Updates flutter/test/cupertino to no longer use TestWindow (#122325)
Updates `flutter/test/cupertino` to no longer use `TestWindow`
This commit is contained in:
@@ -251,7 +251,7 @@ void main() {
|
||||
|
||||
const double inset = 3;
|
||||
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();
|
||||
await tester.pumpWidget(
|
||||
|
||||
@@ -2,15 +2,10 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// 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:
|
||||
// This file is run as part of a reduced test set in CI on Mac and Windows
|
||||
// machines.
|
||||
@Tags(<String>['reduced-test-set', 'no-shuffle'])
|
||||
@Tags(<String>['reduced-test-set'])
|
||||
library;
|
||||
|
||||
import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle, Color;
|
||||
@@ -5003,9 +4998,11 @@ void main() {
|
||||
|
||||
group('Text selection toolbar', () {
|
||||
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;
|
||||
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
|
||||
tester.binding.window.devicePixelRatioTestValue = 1;
|
||||
TextEditingController controller;
|
||||
EditableTextState state;
|
||||
Offset bottomLeftSelectionPosition;
|
||||
@@ -5183,15 +5180,14 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
tester.binding.window.clearPhysicalSizeTestValue();
|
||||
tester.binding.window.clearDevicePixelRatioTestValue();
|
||||
});
|
||||
|
||||
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;
|
||||
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
|
||||
tester.binding.window.devicePixelRatioTestValue = 1;
|
||||
final TextEditingController controller;
|
||||
final EditableTextState state;
|
||||
|
||||
@@ -5253,15 +5249,14 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
tester.binding.window.clearPhysicalSizeTestValue();
|
||||
tester.binding.window.clearDevicePixelRatioTestValue();
|
||||
});
|
||||
|
||||
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;
|
||||
tester.binding.window.physicalSizeTestValue = const Size(400, 400);
|
||||
tester.binding.window.devicePixelRatioTestValue = 1;
|
||||
final TextEditingController controller;
|
||||
final EditableTextState state;
|
||||
|
||||
@@ -5327,9 +5322,6 @@ void main() {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
tester.binding.window.clearPhysicalSizeTestValue();
|
||||
tester.binding.window.clearDevicePixelRatioTestValue();
|
||||
});
|
||||
|
||||
// This is a regression test for
|
||||
|
||||
@@ -246,8 +246,8 @@ void main() {
|
||||
|
||||
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.
|
||||
tester.binding.window.physicalSizeTestValue = const Size(800, 800);
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
tester.view.physicalSize = const Size(800, 800);
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
|
||||
await tester.pumpWidget(CupertinoApp(
|
||||
@@ -318,8 +318,8 @@ void main() {
|
||||
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
|
||||
// the same page.
|
||||
tester.binding.window.physicalSizeTestValue = const Size(640, 800);
|
||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
||||
tester.view.physicalSize = const Size(640, 800);
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final TextEditingController controller = TextEditingController(text: 'abc def ghi');
|
||||
await tester.pumpWidget(CupertinoApp(
|
||||
|
||||
@@ -188,8 +188,8 @@ void main() {
|
||||
|
||||
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 double spacerWidth = 1.0 / tester.binding.window.devicePixelRatio;
|
||||
final double dividerWidth = 1.0 / tester.binding.window.devicePixelRatio;
|
||||
final double spacerWidth = 1.0 / tester.view.devicePixelRatio;
|
||||
final double dividerWidth = 1.0 / tester.view.devicePixelRatio;
|
||||
const double borderRadius = 8.0; // Should match _kToolbarBorderRadius
|
||||
final double width = 7 * TestBox.itemWidth + 6 * (dividerWidth + 2 * spacerWidth) + 2 * borderRadius;
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in New Issue
Block a user