Skip to content

Commit 67e17e4

Browse files
Updates flutter/test/cupertino to no longer use TestWindow (flutter#122325)
Updates `flutter/test/cupertino` to no longer use `TestWindow`
1 parent 57171a3 commit 67e17e4

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

packages/flutter/test/cupertino/scrollbar_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ void main() {
251251

252252
const double inset = 3;
253253
const double scaleFactor = 2;
254-
final Size screenSize = tester.binding.window.physicalSize / tester.binding.window.devicePixelRatio;
254+
final Size screenSize = tester.view.physicalSize / tester.view.devicePixelRatio;
255255

256256
final ScrollController scrollController = ScrollController();
257257
await tester.pumpWidget(

packages/flutter/test/cupertino/text_field_test.dart

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// no-shuffle:
6-
// //TODO(gspencergoog): Remove this tag once this test's state leaks/test
7-
// dependencies have been fixed.
8-
// https://github.com/flutter/flutter/issues/85160
9-
// Fails with "flutter test --test-randomize-ordering-seed=456"
105
// reduced-test-set:
116
// This file is run as part of a reduced test set in CI on Mac and Windows
127
// machines.
13-
@Tags(<String>['reduced-test-set', 'no-shuffle'])
8+
@Tags(<String>['reduced-test-set'])
149
library;
1510

1611
import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle, Color;
@@ -5003,9 +4998,11 @@ void main() {
50034998

50044999
group('Text selection toolbar', () {
50055000
testWidgets('Collapsed selection works', (WidgetTester tester) async {
5001+
tester.view.physicalSize = const Size(400, 400);
5002+
tester.view.devicePixelRatio = 1;
5003+
addTearDown(tester.view.reset);
5004+
50065005
EditableText.debugDeterministicCursor = true;
5007-
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
5008-
tester.binding.window.devicePixelRatioTestValue = 1;
50095006
TextEditingController controller;
50105007
EditableTextState state;
50115008
Offset bottomLeftSelectionPosition;
@@ -5183,15 +5180,14 @@ void main() {
51835180
),
51845181
),
51855182
);
5186-
5187-
tester.binding.window.clearPhysicalSizeTestValue();
5188-
tester.binding.window.clearDevicePixelRatioTestValue();
51895183
});
51905184

51915185
testWidgets('selecting multiple words works', (WidgetTester tester) async {
5186+
tester.view.physicalSize = const Size(400, 400);
5187+
tester.view.devicePixelRatio = 1;
5188+
addTearDown(tester.view.reset);
5189+
51925190
EditableText.debugDeterministicCursor = true;
5193-
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
5194-
tester.binding.window.devicePixelRatioTestValue = 1;
51955191
final TextEditingController controller;
51965192
final EditableTextState state;
51975193

@@ -5253,15 +5249,14 @@ void main() {
52535249
),
52545250
),
52555251
);
5256-
5257-
tester.binding.window.clearPhysicalSizeTestValue();
5258-
tester.binding.window.clearDevicePixelRatioTestValue();
52595252
});
52605253

52615254
testWidgets('selecting multiline works', (WidgetTester tester) async {
5255+
tester.view.physicalSize = const Size(400, 400);
5256+
tester.view.devicePixelRatio = 1;
5257+
addTearDown(tester.view.reset);
5258+
52625259
EditableText.debugDeterministicCursor = true;
5263-
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
5264-
tester.binding.window.devicePixelRatioTestValue = 1;
52655260
final TextEditingController controller;
52665261
final EditableTextState state;
52675262

@@ -5327,9 +5322,6 @@ void main() {
53275322
),
53285323
),
53295324
);
5330-
5331-
tester.binding.window.clearPhysicalSizeTestValue();
5332-
tester.binding.window.clearDevicePixelRatioTestValue();
53335325
});
53345326

53355327
// This is a regression test for

packages/flutter/test/cupertino/text_selection_test.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ void main() {
246246

247247
testWidgets("When a menu item doesn't fit, a second page is used.", (WidgetTester tester) async {
248248
// Set the screen size to more narrow, so that Paste can't fit.
249-
tester.binding.window.physicalSizeTestValue = const Size(800, 800);
250-
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
249+
tester.view.physicalSize = const Size(800, 800);
250+
addTearDown(tester.view.reset);
251251

252252
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
253253
await tester.pumpWidget(CupertinoApp(
@@ -318,8 +318,8 @@ void main() {
318318
testWidgets('A smaller menu puts each button on its own page.', (WidgetTester tester) async {
319319
// Set the screen size to more narrow, so that two buttons can't fit on
320320
// the same page.
321-
tester.binding.window.physicalSizeTestValue = const Size(640, 800);
322-
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
321+
tester.view.physicalSize = const Size(640, 800);
322+
addTearDown(tester.view.reset);
323323

324324
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
325325
await tester.pumpWidget(CupertinoApp(

packages/flutter/test/cupertino/text_selection_toolbar_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ void main() {
188188

189189
testWidgets('does not paginate if children fit with zero margin', (WidgetTester tester) async {
190190
final List<Widget> children = List<Widget>.generate(7, (int i) => const TestBox());
191-
final double spacerWidth = 1.0 / tester.binding.window.devicePixelRatio;
192-
final double dividerWidth = 1.0 / tester.binding.window.devicePixelRatio;
191+
final double spacerWidth = 1.0 / tester.view.devicePixelRatio;
192+
final double dividerWidth = 1.0 / tester.view.devicePixelRatio;
193193
const double borderRadius = 8.0; // Should match _kToolbarBorderRadius
194194
final double width = 7 * TestBox.itemWidth + 6 * (dividerWidth + 2 * spacerWidth) + 2 * borderRadius;
195195
await tester.pumpWidget(

0 commit comments

Comments
 (0)