Skip to content

[various] Removed references to deprecated TestWindow APIs #4558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('StaggeredExample lays out children correctly',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(400, 200);

// 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;
tester.view.physicalSize = const Size(400, 200);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
const MaterialApp(
Expand Down
79 changes: 24 additions & 55 deletions packages/dynamic_layouts/test/staggered_layout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ void main() {
testWidgets(
'DynamicGridView works when using DynamicSliverGridDelegateWithFixedCrossAxisCount',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(400, 100);

// 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;
tester.view.physicalSize = const Size(400, 100);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -59,13 +55,9 @@ void main() {
testWidgets(
'DynamicGridView works when using DynamicSliverGridDelegateWithMaxCrossAxisExtent',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(440, 100);

// 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;
tester.view.physicalSize = const Size(440, 100);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -106,13 +98,9 @@ void main() {
group('DynamicGridView.staggered', () {
testWidgets('DynamicGridView.staggered works with simple layout',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(400, 100);

// 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;
tester.view.physicalSize = const Size(400, 100);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -158,13 +146,9 @@ void main() {
});
testWidgets('DynamicGridView.staggered works with a horizontal grid',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(100, 500);

// 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;
tester.view.physicalSize = const Size(100, 500);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -216,13 +200,9 @@ void main() {
});
testWidgets('DynamicGridView.staggered works with a reversed grid',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(600, 200);

// 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;
tester.view.physicalSize = const Size(600, 200);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -290,13 +270,10 @@ void main() {

testWidgets('DynamicGridView.staggered deletes children appropriately',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(600, 1000);
tester.view.physicalSize = const Size(600, 1000);
tester.view.devicePixelRatio = 1.0;
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(
50,
(int index) => SizedBox(
Expand Down Expand Up @@ -375,13 +352,9 @@ void main() {
group('DynamicGridView.builder', () {
testWidgets('DynamicGridView.builder works with a staggered layout',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(400, 100);

// 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;
tester.view.physicalSize = const Size(400, 100);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down Expand Up @@ -430,13 +403,9 @@ void main() {
testWidgets(
'DynamicGridView.builder works with an infinite grid using a staggered layout',
(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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(400, 100);

// 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;
tester.view.physicalSize = const Size(400, 100);
tester.view.devicePixelRatio = 1.0;
addTearDown(tester.view.reset);

await tester.pumpWidget(
MaterialApp(
Expand Down
8 changes: 2 additions & 6 deletions packages/dynamic_layouts/test/wrap_layout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,7 @@ void main() {
expect(find.text('Item 4'), findsNothing);
await tester.binding.setSurfaceSize(const Size(280, 100));
// 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
// ignore: deprecated_member_use
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
addTearDown(tester.view.resetPhysicalSize);
await tester.pumpAndSettle();
expect(find.text('Item 0'), findsOneWidget);
expect(find.text('Item 1'), findsOneWidget);
Expand Down Expand Up @@ -572,9 +570,7 @@ void main() {

await tester.binding.setSurfaceSize(const Size(560, 100));
// 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
// ignore: deprecated_member_use
addTearDown(tester.binding.window.clearPhysicalSizeTestValue);
addTearDown(tester.view.resetPhysicalSize);
await tester.pumpAndSettle();

expect(find.text('Item 0'), findsOneWidget);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,11 @@ void runTests() {
} else {
expect(
coordinate.x,
((rect.center.dx - rect.topLeft.dx) *
// 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)
((rect.center.dx - rect.topLeft.dx) * tester.view.devicePixelRatio)
.round());
expect(
coordinate.y,
((rect.center.dy - rect.topLeft.dy) *
// 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)
((rect.center.dy - rect.topLeft.dy) * tester.view.devicePixelRatio)
.round());
}
await tester.binding.setSurfaceSize(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,11 @@ void googleMapsTests() {
final Rect rect = tester.getRect(find.byKey(key));
expect(
coordinate.x,
((rect.center.dx - rect.topLeft.dx) *
// 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)
((rect.center.dx - rect.topLeft.dx) * tester.view.devicePixelRatio)
.round());
expect(
coordinate.y,
((rect.center.dy - rect.topLeft.dy) *
// 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)
((rect.center.dy - rect.topLeft.dy) * tester.view.devicePixelRatio)
.round());
await tester.binding.setSurfaceSize(null);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ void main() {
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
// ignore: deprecated_member_use
tester.binding.window.physicalSizeTestValue = const Size(100, 100);
tester.view.physicalSize = const Size(100, 100);
addTearDown(tester.view.reset);

await HttpOverrides.runZoned(
() async {
Expand Down