Unverified Commit 45c94ec3 authored by pdblasi-google's avatar pdblasi-google Committed by GitHub

Updates `flutter_localizations/test` to stop using `TestWindow` (#122564)

Reland: Updates `flutter_localizations/test` to stop using `TestWindow`
parent baaa43c6
...@@ -227,10 +227,9 @@ void main() { ...@@ -227,10 +227,9 @@ void main() {
const Size kCommonScreenSizeLandscape = Size(1770, 1070); const Size kCommonScreenSizeLandscape = Size(1770, 1070);
Future<void> showPicker(WidgetTester tester, Locale locale, Size size) async { Future<void> showPicker(WidgetTester tester, Locale locale, Size size) async {
tester.binding.window.physicalSizeTestValue = size; tester.view.physicalSize = size;
addTearDown(tester.binding.window.clearPhysicalSizeTestValue); tester.view.devicePixelRatio = 1.0;
tester.binding.window.devicePixelRatioTestValue = 1.0; addTearDown(tester.view.reset);
addTearDown(tester.binding.window.clearDevicePixelRatioTestValue);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
home: Builder( home: Builder(
......
...@@ -9,8 +9,9 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -9,8 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
testWidgets('can localize the header in all known formats - portrait', (WidgetTester tester) async { testWidgets('can localize the header in all known formats - portrait', (WidgetTester tester) async {
// Ensure picker is displayed in portrait mode. // Ensure picker is displayed in portrait mode.
tester.binding.window.physicalSizeTestValue = const Size(400, 800); tester.view.physicalSize = const Size(400, 800);
tester.binding.window.devicePixelRatioTestValue = 1; tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final Finder stringFragmentTextFinder = find.descendant( final Finder stringFragmentTextFinder = find.descendant(
of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_StringFragment'), of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_StringFragment'),
...@@ -74,15 +75,13 @@ void main() { ...@@ -74,15 +75,13 @@ void main() {
await tester.tapAt(Offset(center.dx, center.dy - 50.0)); await tester.tapAt(Offset(center.dx, center.dy - 50.0));
await finishPicker(tester); await finishPicker(tester);
} }
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}); });
testWidgets('can localize the header in all known formats - landscape', (WidgetTester tester) async { testWidgets('can localize the header in all known formats - landscape', (WidgetTester tester) async {
// Ensure picker is displayed in landscape mode. // Ensure picker is displayed in landscape mode.
tester.binding.window.physicalSizeTestValue = const Size(800, 400); tester.view.physicalSize = const Size(800, 400);
tester.binding.window.devicePixelRatioTestValue = 1; tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
final Finder stringFragmentTextFinder = find.descendant( final Finder stringFragmentTextFinder = find.descendant(
of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_StringFragment'), of: find.byWidgetPredicate((Widget w) => '${w.runtimeType}' == '_StringFragment'),
...@@ -151,9 +150,6 @@ void main() { ...@@ -151,9 +150,6 @@ void main() {
await tester.tapAt(Offset(center.dx, center.dy - 50.0)); await tester.tapAt(Offset(center.dx, center.dy - 50.0));
await finishPicker(tester); await finishPicker(tester);
} }
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}); });
testWidgets('can localize input mode in all known formats', (WidgetTester tester) async { testWidgets('can localize input mode in all known formats', (WidgetTester tester) async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment