@@ -550,8 +550,8 @@ void main() {
550550 // Test 0 screen width and height.
551551 // Verify no errors are thrown.
552552 testWidgets ('Screen Size 0' , (WidgetTester tester) async {
553- // Screen Width 0.
554- setScreenSize (tester, Size (0 , 1200 ));
553+ // Screen width and height 0.
554+ setScreenSize (tester, Size (0 , 0 ));
555555 Key key = UniqueKey ();
556556 String defaultName = 'defaultName' ;
557557 Widget widget = MaterialApp (
@@ -574,7 +574,7 @@ void main() {
574574 expect (
575575 state.activeBreakpointSegment.responsiveBreakpoint.name, defaultName);
576576 MediaQuery mediaQuery = tester.widget (find.byType (MediaQuery ).first);
577- expect (mediaQuery.data.size, Size (0 , 1200 ));
577+ expect (mediaQuery.data.size, Size (0 , 0 ));
578578
579579 resetScreenSize (tester);
580580 setScreenSize (tester, Size (450 , 0 ));
@@ -594,6 +594,58 @@ void main() {
594594 expect (mediaQuery.data.size, Size (0 , 0 ));
595595 });
596596
597+ testWidgets ('Screen Width 0 Initialization' , (WidgetTester tester) async {
598+ // Screen width and height 0.
599+ setScreenSize (tester, Size (0 , 1200 ));
600+ Key key = UniqueKey ();
601+ String defaultName = 'defaultName' ;
602+ Widget widget = MaterialApp (
603+ home: ResponsiveWrapper (
604+ key: key,
605+ defaultName: defaultName,
606+ defaultScale: true ,
607+ breakpoints: [
608+ ResponsiveBreakpoint .resize (450 , name: MOBILE ),
609+ ResponsiveBreakpoint .resize (600 , name: TABLET ),
610+ ResponsiveBreakpoint .resize (800 , name: DESKTOP ),
611+ ],
612+ child: Container (),
613+ shrinkWrap: false ,
614+ ),
615+ );
616+ await tester.pumpWidget (widget);
617+ await tester.pump ();
618+ dynamic state = tester.state (find.byKey (key));
619+ MediaQuery mediaQuery = tester.widget (find.byType (MediaQuery ).first);
620+ expect (mediaQuery.data.size, Size (0 , 1200 ));
621+ });
622+
623+ testWidgets ('Screen Height 0 Initialization' , (WidgetTester tester) async {
624+ // Screen width and height 0.
625+ setScreenSize (tester, Size (1200 , 0 ));
626+ Key key = UniqueKey ();
627+ String defaultName = 'defaultName' ;
628+ Widget widget = MaterialApp (
629+ home: ResponsiveWrapper (
630+ key: key,
631+ defaultName: defaultName,
632+ defaultScale: true ,
633+ breakpoints: [
634+ ResponsiveBreakpoint .resize (450 , name: MOBILE ),
635+ ResponsiveBreakpoint .resize (600 , name: TABLET ),
636+ ResponsiveBreakpoint .resize (800 , name: DESKTOP ),
637+ ],
638+ child: Container (),
639+ shrinkWrap: false ,
640+ ),
641+ );
642+ await tester.pumpWidget (widget);
643+ await tester.pump ();
644+ dynamic state = tester.state (find.byKey (key));
645+ MediaQuery mediaQuery = tester.widget (find.byType (MediaQuery ).first);
646+ expect (mediaQuery.data.size, Size (1200 , 0 ));
647+ });
648+
597649 // Test infinite screen width and height.
598650 // Infinite screen width or height is not allowed.
599651
0 commit comments