Unverified Commit 67e17e45 authored by pdblasi-google's avatar pdblasi-google Committed by GitHub

Updates `flutter/test/cupertino` to no longer use `TestWindow` (#122325)

Updates `flutter/test/cupertino` to no longer use `TestWindow`
parent 57171a3f
...@@ -251,7 +251,7 @@ void main() { ...@@ -251,7 +251,7 @@ void main() {
const double inset = 3; const double inset = 3;
const double scaleFactor = 2; const double scaleFactor = 2;
final Size screenSize = tester.binding.window.physicalSize / tester.binding.window.devicePixelRatio; final Size screenSize = tester.view.physicalSize / tester.view.devicePixelRatio;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
await tester.pumpWidget( await tester.pumpWidget(
......
...@@ -2,15 +2,10 @@ ...@@ -2,15 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// no-shuffle:
// //TODO(gspencergoog): Remove this tag once this test's state leaks/test
// dependencies have been fixed.
// https://github.com/flutter/flutter/issues/85160
// Fails with "flutter test --test-randomize-ordering-seed=456"
// reduced-test-set: // reduced-test-set:
// This file is run as part of a reduced test set in CI on Mac and Windows // This file is run as part of a reduced test set in CI on Mac and Windows
// machines. // machines.
@Tags(<String>['reduced-test-set', 'no-shuffle']) @Tags(<String>['reduced-test-set'])
library; library;
import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle, Color; import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle, Color;
...@@ -5003,9 +4998,11 @@ void main() { ...@@ -5003,9 +4998,11 @@ void main() {
group('Text selection toolbar', () { group('Text selection toolbar', () {
testWidgets('Collapsed selection works', (WidgetTester tester) async { testWidgets('Collapsed selection works', (WidgetTester tester) async {
tester.view.physicalSize = const Size(400, 400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
EditableText.debugDeterministicCursor = true; EditableText.debugDeterministicCursor = true;
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
tester.binding.window.devicePixelRatioTestValue = 1;
TextEditingController controller; TextEditingController controller;
EditableTextState state; EditableTextState state;
Offset bottomLeftSelectionPosition; Offset bottomLeftSelectionPosition;
...@@ -5183,15 +5180,14 @@ void main() { ...@@ -5183,15 +5180,14 @@ void main() {
), ),
), ),
); );
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}); });
testWidgets('selecting multiple words works', (WidgetTester tester) async { testWidgets('selecting multiple words works', (WidgetTester tester) async {
tester.view.physicalSize = const Size(400, 400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
EditableText.debugDeterministicCursor = true; EditableText.debugDeterministicCursor = true;
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
tester.binding.window.devicePixelRatioTestValue = 1;
final TextEditingController controller; final TextEditingController controller;
final EditableTextState state; final EditableTextState state;
...@@ -5253,15 +5249,14 @@ void main() { ...@@ -5253,15 +5249,14 @@ void main() {
), ),
), ),
); );
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}); });
testWidgets('selecting multiline works', (WidgetTester tester) async { testWidgets('selecting multiline works', (WidgetTester tester) async {
tester.view.physicalSize = const Size(400, 400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
EditableText.debugDeterministicCursor = true; EditableText.debugDeterministicCursor = true;
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
tester.binding.window.devicePixelRatioTestValue = 1;
final TextEditingController controller; final TextEditingController controller;
final EditableTextState state; final EditableTextState state;
...@@ -5327,9 +5322,6 @@ void main() { ...@@ -5327,9 +5322,6 @@ void main() {
), ),
), ),
); );
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}); });
// This is a regression test for // This is a regression test for
......
...@@ -246,8 +246,8 @@ void main() { ...@@ -246,8 +246,8 @@ void main() {
testWidgets("When a menu item doesn't fit, a second page is used.", (WidgetTester tester) async { testWidgets("When a menu item doesn't fit, a second page is used.", (WidgetTester tester) async {
// Set the screen size to more narrow, so that Paste can't fit. // Set the screen size to more narrow, so that Paste can't fit.
tester.binding.window.physicalSizeTestValue = const Size(800, 800); tester.view.physicalSize = const Size(800, 800);
addTearDown(tester.binding.window.clearPhysicalSizeTestValue); addTearDown(tester.view.reset);
final TextEditingController controller = TextEditingController(text: 'abc def ghi'); final TextEditingController controller = TextEditingController(text: 'abc def ghi');
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(CupertinoApp(
...@@ -318,8 +318,8 @@ void main() { ...@@ -318,8 +318,8 @@ void main() {
testWidgets('A smaller menu puts each button on its own page.', (WidgetTester tester) async { testWidgets('A smaller menu puts each button on its own page.', (WidgetTester tester) async {
// Set the screen size to more narrow, so that two buttons can't fit on // Set the screen size to more narrow, so that two buttons can't fit on
// the same page. // the same page.
tester.binding.window.physicalSizeTestValue = const Size(640, 800); tester.view.physicalSize = const Size(640, 800);
addTearDown(tester.binding.window.clearPhysicalSizeTestValue); addTearDown(tester.view.reset);
final TextEditingController controller = TextEditingController(text: 'abc def ghi'); final TextEditingController controller = TextEditingController(text: 'abc def ghi');
await tester.pumpWidget(CupertinoApp( await tester.pumpWidget(CupertinoApp(
......
...@@ -188,8 +188,8 @@ void main() { ...@@ -188,8 +188,8 @@ void main() {
testWidgets('does not paginate if children fit with zero margin', (WidgetTester tester) async { testWidgets('does not paginate if children fit with zero margin', (WidgetTester tester) async {
final List<Widget> children = List<Widget>.generate(7, (int i) => const TestBox()); final List<Widget> children = List<Widget>.generate(7, (int i) => const TestBox());
final double spacerWidth = 1.0 / tester.binding.window.devicePixelRatio; final double spacerWidth = 1.0 / tester.view.devicePixelRatio;
final double dividerWidth = 1.0 / tester.binding.window.devicePixelRatio; final double dividerWidth = 1.0 / tester.view.devicePixelRatio;
const double borderRadius = 8.0; // Should match _kToolbarBorderRadius const double borderRadius = 8.0; // Should match _kToolbarBorderRadius
final double width = 7 * TestBox.itemWidth + 6 * (dividerWidth + 2 * spacerWidth) + 2 * borderRadius; final double width = 7 * TestBox.itemWidth + 6 * (dividerWidth + 2 * spacerWidth) + 2 * borderRadius;
await tester.pumpWidget( await tester.pumpWidget(
......
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