mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +08:00
[various] Removed references to deprecated TestWindow
APIs (#4558)
Removed references to deprecated `TestWindow` APIs. Closes [flutter #122912](https://github.com/flutter/flutter/issues/122912)
This commit is contained in:
@ -9,13 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
testWidgets('StaggeredExample lays out children correctly',
|
testWidgets('StaggeredExample lays out children correctly',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(400, 200);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(400, 200);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const MaterialApp(
|
const MaterialApp(
|
||||||
|
@ -11,13 +11,9 @@ void main() {
|
|||||||
testWidgets(
|
testWidgets(
|
||||||
'DynamicGridView works when using DynamicSliverGridDelegateWithFixedCrossAxisCount',
|
'DynamicGridView works when using DynamicSliverGridDelegateWithFixedCrossAxisCount',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(400, 100);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(400, 100);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -59,13 +55,9 @@ void main() {
|
|||||||
testWidgets(
|
testWidgets(
|
||||||
'DynamicGridView works when using DynamicSliverGridDelegateWithMaxCrossAxisExtent',
|
'DynamicGridView works when using DynamicSliverGridDelegateWithMaxCrossAxisExtent',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(440, 100);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(440, 100);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -106,13 +98,9 @@ void main() {
|
|||||||
group('DynamicGridView.staggered', () {
|
group('DynamicGridView.staggered', () {
|
||||||
testWidgets('DynamicGridView.staggered works with simple layout',
|
testWidgets('DynamicGridView.staggered works with simple layout',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(400, 100);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(400, 100);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -158,13 +146,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
testWidgets('DynamicGridView.staggered works with a horizontal grid',
|
testWidgets('DynamicGridView.staggered works with a horizontal grid',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(100, 500);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(100, 500);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -216,13 +200,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
testWidgets('DynamicGridView.staggered works with a reversed grid',
|
testWidgets('DynamicGridView.staggered works with a reversed grid',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(600, 200);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(600, 200);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -290,13 +270,10 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('DynamicGridView.staggered deletes children appropriately',
|
testWidgets('DynamicGridView.staggered deletes children appropriately',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(600, 1000);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(600, 1000);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
final List<Widget> children = List<Widget>.generate(
|
final List<Widget> children = List<Widget>.generate(
|
||||||
50,
|
50,
|
||||||
(int index) => SizedBox(
|
(int index) => SizedBox(
|
||||||
@ -375,13 +352,9 @@ void main() {
|
|||||||
group('DynamicGridView.builder', () {
|
group('DynamicGridView.builder', () {
|
||||||
testWidgets('DynamicGridView.builder works with a staggered layout',
|
testWidgets('DynamicGridView.builder works with a staggered layout',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(400, 100);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(400, 100);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
@ -430,13 +403,9 @@ void main() {
|
|||||||
testWidgets(
|
testWidgets(
|
||||||
'DynamicGridView.builder works with an infinite grid using a staggered layout',
|
'DynamicGridView.builder works with an infinite grid using a staggered layout',
|
||||||
(WidgetTester tester) async {
|
(WidgetTester tester) async {
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(400, 100);
|
||||||
// ignore: deprecated_member_use
|
tester.view.devicePixelRatio = 1.0;
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(400, 100);
|
addTearDown(tester.view.reset);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatioTestValue = 1.0;
|
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
MaterialApp(
|
MaterialApp(
|
||||||
|
@ -508,9 +508,7 @@ void main() {
|
|||||||
expect(find.text('Item 4'), findsNothing);
|
expect(find.text('Item 4'), findsNothing);
|
||||||
await tester.binding.setSurfaceSize(const Size(280, 100));
|
await tester.binding.setSurfaceSize(const Size(280, 100));
|
||||||
// resets the screen to its original size after the test end
|
// resets the screen to its original size after the test end
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
// ignore: deprecated_member_use
|
|
||||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('Item 0'), findsOneWidget);
|
expect(find.text('Item 0'), findsOneWidget);
|
||||||
expect(find.text('Item 1'), findsOneWidget);
|
expect(find.text('Item 1'), findsOneWidget);
|
||||||
@ -572,9 +570,7 @@ void main() {
|
|||||||
|
|
||||||
await tester.binding.setSurfaceSize(const Size(560, 100));
|
await tester.binding.setSurfaceSize(const Size(560, 100));
|
||||||
// resets the screen to its original size after the test end
|
// resets the screen to its original size after the test end
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
// ignore: deprecated_member_use
|
|
||||||
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Item 0'), findsOneWidget);
|
expect(find.text('Item 0'), findsOneWidget);
|
||||||
|
@ -58,17 +58,11 @@ void runTests() {
|
|||||||
} else {
|
} else {
|
||||||
expect(
|
expect(
|
||||||
coordinate.x,
|
coordinate.x,
|
||||||
((rect.center.dx - rect.topLeft.dx) *
|
((rect.center.dx - rect.topLeft.dx) * tester.view.devicePixelRatio)
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatio)
|
|
||||||
.round());
|
.round());
|
||||||
expect(
|
expect(
|
||||||
coordinate.y,
|
coordinate.y,
|
||||||
((rect.center.dy - rect.topLeft.dy) *
|
((rect.center.dy - rect.topLeft.dy) * tester.view.devicePixelRatio)
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatio)
|
|
||||||
.round());
|
.round());
|
||||||
}
|
}
|
||||||
await tester.binding.setSurfaceSize(null);
|
await tester.binding.setSurfaceSize(null);
|
||||||
|
@ -470,17 +470,11 @@ void googleMapsTests() {
|
|||||||
final Rect rect = tester.getRect(find.byKey(key));
|
final Rect rect = tester.getRect(find.byKey(key));
|
||||||
expect(
|
expect(
|
||||||
coordinate.x,
|
coordinate.x,
|
||||||
((rect.center.dx - rect.topLeft.dx) *
|
((rect.center.dx - rect.topLeft.dx) * tester.view.devicePixelRatio)
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatio)
|
|
||||||
.round());
|
.round());
|
||||||
expect(
|
expect(
|
||||||
coordinate.y,
|
coordinate.y,
|
||||||
((rect.center.dy - rect.topLeft.dy) *
|
((rect.center.dy - rect.topLeft.dy) * tester.view.devicePixelRatio)
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
|
||||||
// ignore: deprecated_member_use
|
|
||||||
tester.binding.window.devicePixelRatio)
|
|
||||||
.round());
|
.round());
|
||||||
await tester.binding.setSurfaceSize(null);
|
await tester.binding.setSurfaceSize(null);
|
||||||
});
|
});
|
||||||
|
@ -101,9 +101,8 @@ void main() {
|
|||||||
photoUrl: 'photoUrl',
|
photoUrl: 'photoUrl',
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO(pdblasi-google): Update `window` usages to new API after 3.9.0 is in stable. https://github.com/flutter/flutter/issues/122912
|
tester.view.physicalSize = const Size(100, 100);
|
||||||
// ignore: deprecated_member_use
|
addTearDown(tester.view.reset);
|
||||||
tester.binding.window.physicalSizeTestValue = const Size(100, 100);
|
|
||||||
|
|
||||||
await HttpOverrides.runZoned(
|
await HttpOverrides.runZoned(
|
||||||
() async {
|
() async {
|
||||||
|
Reference in New Issue
Block a user