@@ -612,6 +612,27 @@ void _tests() {
612612 tester.binding.window.clearDevicePixelRatioTestValue ();
613613 });
614614
615+ testWidgets ('when change orientation, should reflect in render objects' , (WidgetTester tester) async {
616+ // portrait
617+ tester.binding.window.physicalSizeTestValue = const Size (800 , 800.5 );
618+ tester.binding.window.devicePixelRatioTestValue = 1 ;
619+ await mediaQueryBoilerplate (tester, false );
620+
621+ RenderObject render = tester.renderObject (find.byWidgetPredicate ((Widget w) => '${w .runtimeType }' == '_DayPeriodInputPadding' ));
622+ expect ((render as dynamic ).orientation, Orientation .portrait); // ignore: avoid_dynamic_calls
623+
624+ // landscape
625+ tester.binding.window.physicalSizeTestValue = const Size (800.5 , 800 );
626+ tester.binding.window.devicePixelRatioTestValue = 1 ;
627+ await mediaQueryBoilerplate (tester, false , tapButton: false );
628+
629+ render = tester.renderObject (find.byWidgetPredicate ((Widget w) => '${w .runtimeType }' == '_DayPeriodInputPadding' ));
630+ expect ((render as dynamic ).orientation, Orientation .landscape); // ignore: avoid_dynamic_calls
631+
632+ tester.binding.window.clearPhysicalSizeTestValue ();
633+ tester.binding.window.clearDevicePixelRatioTestValue ();
634+ });
635+
615636 testWidgets ('builder parameter' , (WidgetTester tester) async {
616637 Widget buildFrame (TextDirection textDirection) {
617638 return MaterialApp (
@@ -1342,6 +1363,7 @@ Future<void> mediaQueryBoilerplate(
13421363 String ? errorInvalidText,
13431364 bool accessibleNavigation = false ,
13441365 EntryModeChangeCallback ? onEntryModeChange,
1366+ bool tapButton = true ,
13451367}) async {
13461368 await tester.pumpWidget (
13471369 Localizations (
@@ -1355,6 +1377,7 @@ Future<void> mediaQueryBoilerplate(
13551377 alwaysUse24HourFormat: alwaysUse24HourFormat,
13561378 textScaleFactor: textScaleFactor,
13571379 accessibleNavigation: accessibleNavigation,
1380+ size: tester.binding.window.physicalSize / tester.binding.window.devicePixelRatio,
13581381 ),
13591382 child: Material (
13601383 child: Directionality (
@@ -1385,6 +1408,8 @@ Future<void> mediaQueryBoilerplate(
13851408 ),
13861409 ),
13871410 );
1388- await tester.tap (find.text ('X' ));
1411+ if (tapButton) {
1412+ await tester.tap (find.text ('X' ));
1413+ }
13891414 await tester.pumpAndSettle ();
13901415}
0 commit comments