diff --git a/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart b/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart index 8cf962b8ae5..b80dddfe9de 100644 --- a/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart +++ b/examples/api/test/material/dropdown_menu/dropdown_menu.0_test.dart @@ -105,7 +105,7 @@ void main() { // Resize the screen to small screen and make sure no overflowed error appears. tester.view.physicalSize = const Size(200, 160); tester.view.devicePixelRatio = 1.0; - addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.reset); await tester.pump(); expect(tester.takeException(), isNull); diff --git a/packages/flutter/test/cupertino/nav_bar_test.dart b/packages/flutter/test/cupertino/nav_bar_test.dart index a38457b921a..11311e7930d 100644 --- a/packages/flutter/test/cupertino/nav_bar_test.dart +++ b/packages/flutter/test/cupertino/nav_bar_test.dart @@ -3236,6 +3236,8 @@ void main() { tester.view.devicePixelRatio = 1; tester.binding.platformDispatcher.textScaleFactorTestValue = 1; + addTearDown(tester.view.reset); + addTearDown(tester.binding.platformDispatcher.clearTextScaleFactorTestValue); setWindowToPortrait(tester, size: const Size(402, 874)); var count = 0; diff --git a/packages/flutter/test/material/bottom_navigation_bar_test.dart b/packages/flutter/test/material/bottom_navigation_bar_test.dart index 353294546fd..35009b59c4c 100644 --- a/packages/flutter/test/material/bottom_navigation_bar_test.dart +++ b/packages/flutter/test/material/bottom_navigation_bar_test.dart @@ -3004,9 +3004,10 @@ void main() { testWidgets('BottomNavigationBar linear landscape layout label RenderFlex overflow', ( WidgetTester tester, ) async { - //Regression test for https://github.com/flutter/flutter/issues/112163 + // Regression test for https://github.com/flutter/flutter/issues/112163 tester.view.physicalSize = const Size(540, 340); + addTearDown(tester.view.resetPhysicalSize); await tester.pumpWidget( MaterialApp( @@ -3053,8 +3054,6 @@ void main() { find.byType(MaterialApp), matchesGoldenFile('bottom_navigation_bar.label_overflow.png'), ); - - addTearDown(tester.view.resetPhysicalSize); }); testWidgets('BottomNavigationBar keys passed through', (WidgetTester tester) async { diff --git a/packages/flutter/test/material/navigation_drawer_test.dart b/packages/flutter/test/material/navigation_drawer_test.dart index 199bda7e2dd..a35af5fa5bc 100644 --- a/packages/flutter/test/material/navigation_drawer_test.dart +++ b/packages/flutter/test/material/navigation_drawer_test.dart @@ -592,4 +592,5 @@ void widgetSetup(WidgetTester tester, double viewWidth, {double viewHeight = 100 tester.view.devicePixelRatio = 2; final double dpi = tester.view.devicePixelRatio; tester.view.physicalSize = Size(viewWidth * dpi, viewHeight * dpi); + addTearDown(tester.view.reset); } diff --git a/packages/flutter/test/material/navigation_rail_test.dart b/packages/flutter/test/material/navigation_rail_test.dart index 9c5a15d2638..7e54bac0f02 100644 --- a/packages/flutter/test/material/navigation_rail_test.dart +++ b/packages/flutter/test/material/navigation_rail_test.dart @@ -4037,6 +4037,7 @@ void main() { const trailingKey = Key('trailing'); tester.view.physicalSize = const Size(800, 600); tester.view.devicePixelRatio = 1.0; + addTearDown(tester.view.reset); await tester.pumpWidget( MaterialApp( home: Builder( @@ -4091,6 +4092,7 @@ void main() { const trailingKey = Key('trailing'); tester.view.physicalSize = const Size(800, 600); tester.view.devicePixelRatio = 1.0; + addTearDown(tester.view.reset); await tester.pumpWidget( MaterialApp( home: Builder( diff --git a/packages/flutter/test/material/snack_bar_test.dart b/packages/flutter/test/material/snack_bar_test.dart index 36614171fe6..8bc0ef48bfb 100644 --- a/packages/flutter/test/material/snack_bar_test.dart +++ b/packages/flutter/test/material/snack_bar_test.dart @@ -3987,8 +3987,7 @@ void main() { testWidgets('Tap on button behind snack bar defined by width', (WidgetTester tester) async { tester.view.physicalSize = const Size.square(200); tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); + addTearDown(tester.view.reset); const buttonText = 'Show snackbar'; const snackbarContent = 'Snackbar'; @@ -4045,8 +4044,7 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/78537. tester.view.physicalSize = const Size.square(200); tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); + addTearDown(tester.view.reset); const buttonText = 'Show snackbar'; const snackbarContent = 'Snackbar'; @@ -4105,8 +4103,7 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/78537. tester.view.physicalSize = const Size.square(200); tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); + addTearDown(tester.view.reset); const buttonText = 'Show snackbar'; const snackbarContent = 'Snackbar'; @@ -4203,8 +4200,7 @@ void main() { // Regression test for https://github.com/flutter/flutter/issues/148566. tester.view.physicalSize = const Size.square(200); tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); + addTearDown(tester.view.reset); const buttonText = 'Show snackbar'; const snackbarContent = 'Snackbar'; diff --git a/packages/flutter/test/widgets/media_query_test.dart b/packages/flutter/test/widgets/media_query_test.dart index d5060f0b521..ca627c5a50c 100644 --- a/packages/flutter/test/widgets/media_query_test.dart +++ b/packages/flutter/test/widgets/media_query_test.dart @@ -1559,7 +1559,7 @@ void main() { physicalDoubleTapSlop: 100, physicalTouchSlop: 100, ); - addTearDown(() => tester.view.resetGestureSettings()); + addTearDown(tester.view.resetGestureSettings); expect( MediaQueryData.fromView(tester.view).gestureSettings.touchSlop, diff --git a/packages/flutter/test/widgets/two_dimensional_viewport_test.dart b/packages/flutter/test/widgets/two_dimensional_viewport_test.dart index 040aa8c7863..e5f73e2140a 100644 --- a/packages/flutter/test/widgets/two_dimensional_viewport_test.dart +++ b/packages/flutter/test/widgets/two_dimensional_viewport_test.dart @@ -2110,12 +2110,11 @@ void main() { expect(viewport.viewportDimension, const Size(800.0, 600.0)); tester.view.physicalSize = const Size(300.0, 300.0); tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); await tester.pumpWidget(simpleBuilderTest(delegate: delegate)); await tester.pumpAndSettle(); viewport = getViewport(tester, childKey); expect(viewport.viewportDimension, const Size(300.0, 300.0)); - tester.view.resetPhysicalSize(); - tester.view.resetDevicePixelRatio(); }, variant: TargetPlatformVariant.all()); testWidgets('Rebuilds when delegate changes', (WidgetTester tester) async {