diff --git a/dev/bots/test.dart b/dev/bots/test.dart index 68dae76a2d..1e0a453953 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -927,7 +927,7 @@ Future _runFrameworkTests() async { } } - Future runFixTests() async { + Future runFixTests(String package) async { final List args = [ 'fix', '--compare-to-golden', @@ -935,7 +935,7 @@ Future _runFrameworkTests() async { await runCommand( dart, args, - workingDirectory: path.join(flutterRoot, 'packages', 'flutter', 'test_fixes'), + workingDirectory: path.join(flutterRoot, 'packages', package, 'test_fixes'), ); } @@ -965,7 +965,8 @@ Future _runFrameworkTests() async { Future runSlow() async { printProgress('${green}Running slow package tests$reset for directories other than packages/flutter'); await runTracingTests(); - await runFixTests(); + await runFixTests('flutter'); + await runFixTests('flutter_test'); await runPrivateTests(); } diff --git a/packages/flutter/lib/fix_data/README.md b/packages/flutter/lib/fix_data/README.md index dc75878009..9e98e276db 100644 --- a/packages/flutter/lib/fix_data/README.md +++ b/packages/flutter/lib/fix_data/README.md @@ -5,7 +5,7 @@ define the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings used by the Flutter framework. The number of fix rules defined in a file should not exceed 50 for better -maintainability. Searching for `title:` is a given `.yaml` file will account +maintainability. Searching for `title:` in a given `.yaml` file will account for the number of fixes. Splitting out fix rules should be done by class. When adding a new `.yaml` file, make a copy of `fix_template.yaml`. If the new diff --git a/packages/flutter_test/analysis_options.yaml b/packages/flutter_test/analysis_options.yaml new file mode 100644 index 0000000000..e61f982d45 --- /dev/null +++ b/packages/flutter_test/analysis_options.yaml @@ -0,0 +1,5 @@ +include: ../analysis_options.yaml + +analyzer: + exclude: + - "test_fixes/**" diff --git a/packages/flutter_test/lib/fix_data/README.md b/packages/flutter_test/lib/fix_data/README.md new file mode 100644 index 0000000000..14950061d9 --- /dev/null +++ b/packages/flutter_test/lib/fix_data/README.md @@ -0,0 +1,45 @@ +## Directory contents + +The `.yaml` files in these directories are used to +define the [`dart fix` framework](https://dart.dev/tools/dart-fix) refactorings +used by `flutter_test`. + +The number of fix rules defined in a file should not exceed 50 for better +maintainability. Searching for `title:` in a given `.yaml` file will account +for the number of fixes. Splitting out fix rules should be done by class. + +When adding a new `.yaml` file, make a copy of `template.yaml`. Each file should +be for a single class and named `fix_.yaml`. To make sure each file is +grouped with related classes, a `fix_` folder will contain all of the +fix files for the individual classes. + +See the flutter/packages/flutter_test/test_fixes directory for the tests that +validate these fix rules. + +To run these tests locally, execute this command in the +flutter/packages/flutter_test/test_fixes directory. +```sh +dart fix --compare-to-golden +``` + +For more documentation about Data Driven Fixes, see +https://dart.dev/go/data-driven-fixes#test-folder. + +To learn more about how fixes are authored in package:flutter_test, see +https://github.com/flutter/flutter/wiki/Data-driven-Fixes + +## When making structural changes to this directory + +The tests in this directory are also invoked from external +repositories. Specifically, the CI system for the dart-lang/sdk repo +runs these tests in order to ensure that changes to the dart fix file +format do not break Flutter. + +See [tools/bots/flutter/analyze_flutter_flutter.sh](https://github.com/dart-lang/sdk/blob/main/tools/bots/flutter/analyze_flutter_flutter.sh) +for where the flutter fix tests are invoked for the dart repo. + +See [dev/bots/test.dart](https://github.com/flutter/flutter/blob/master/dev/bots/test.dart) +for where the flutter fix tests are invoked for the flutter/flutter repo. + +When possible, please coordinate changes to this directory that might affect the +`analyze_flutter_flutter.sh` script. diff --git a/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_animation_sheet_builder.yaml b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_animation_sheet_builder.yaml new file mode 100644 index 0000000000..475378d3ea --- /dev/null +++ b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_animation_sheet_builder.yaml @@ -0,0 +1,42 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/test_fixes/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are for AnimationSheetBuilder from the flutter_test/animation_sheet.dart file. * + +version: 1 +transforms: + # Changes made in https://github.com/flutter/flutter/pull/83337 + # The related deprecation for `sheetSize` doesn't have a fix because there + # isn't an alternative API, it's being removed completely. + - title: 'Migrate to collate' + date: 2023-03-29 + element: + uris: [ 'flutter_test.dart' ] + method: 'display' + inClass: 'AnimationSheetBuilder' + changes: + - kind: 'rename' + newName: 'collate' + - kind: 'removeParameter' + name: 'key' + - kind: 'addParameter' + index: 0 + name: 'cellsPerRow' + style: 'required_positional' + argumentValue: + expression: '1' diff --git a/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_automated_test_widgets_flutter_binding.yaml b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_automated_test_widgets_flutter_binding.yaml new file mode 100644 index 0000000000..60a203d83b --- /dev/null +++ b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_automated_test_widgets_flutter_binding.yaml @@ -0,0 +1,32 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/test_fixes/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are for AutomatedTestWidgetsFlutterBinding from the flutter_test/binding.dart file. * + +version: 1 +transforms: + # Changes made in https://github.com/flutter/flutter/pull/89952 + - title: "Remove timeout" + date: 2023-03-30 + element: + uris: [ 'flutter_test.dart' ] + method: 'runTest' + inClass: 'AutomatedTestWidgetsFlutterBinding' + changes: + - kind: 'removeParameter' + name: 'timeout' diff --git a/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_live_test_widgets_flutter_binding.yaml b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_live_test_widgets_flutter_binding.yaml new file mode 100644 index 0000000000..17aa3715d2 --- /dev/null +++ b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_live_test_widgets_flutter_binding.yaml @@ -0,0 +1,32 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/test_fixes/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are for LiveTestWidgetsFlutterBinding from the flutter_test/binding.dart file. * + +version: 1 +transforms: + # Changes made in https://github.com/flutter/flutter/pull/89952 + - title: "Remove timeout" + date: 2023-03-30 + element: + uris: [ 'flutter_test.dart' ] + method: 'runTest' + inClass: 'LiveTestWidgetsFlutterBinding' + changes: + - kind: 'removeParameter' + name: 'timeout' diff --git a/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_test_widgets_flutter_binding.yaml b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_test_widgets_flutter_binding.yaml new file mode 100644 index 0000000000..92fbfb9784 --- /dev/null +++ b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_binding/fix_test_widgets_flutter_binding.yaml @@ -0,0 +1,45 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/test_fixes/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are for TestWidgetsFlutterBinding from the flutter_test/binding.dart file. * + +version: 1 +transforms: + # Changes made in https://github.com/flutter/flutter/pull/89952 + - title: "Remove timeout" + date: 2023-03-30 + element: + uris: [ 'flutter_test.dart' ] + method: 'runTest' + inClass: 'TestWidgetsFlutterBinding' + changes: + - kind: 'removeParameter' + name: 'timeout' + + # Changes made in https://github.com/flutter/flutter/pull/89952 + # The related deprecation for `addTime` doesn't have a fix as the method is + # being removed completely. + - title: "Remove additionalTime" + date: 2023-03-30 + element: + uris: [ 'flutter_test.dart' ] + method: 'runAsync' + inClass: 'TestWidgetsFlutterBinding' + changes: + - kind: 'removeParameter' + name: 'additionalTime' diff --git a/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_widget_tester.yaml b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_widget_tester.yaml new file mode 100644 index 0000000000..53f17e82bf --- /dev/null +++ b/packages/flutter_test/lib/fix_data/fix_flutter_test/fix_widget_tester.yaml @@ -0,0 +1,51 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/test_fixes/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are for the flutter_test/widget_tester.dart file. * + +version: 1 +transforms: + # Changes made in https://github.com/flutter/flutter/pull/89952 + - title: "Migrate to timeout" + date: 2023-03-30 + element: + uris: [ 'flutter_test.dart' ] + function: 'testWidgets' + oneOf: + - if: "initialTimeout != '' && timeout == ''" + changes: + - kind: 'addParameter' + index: 3 + name: 'timeout' + style: optional_named + argumentValue: + expression: 'Timeout({% initialTimeout %})' + requiredIf: "initialTimeout != '' && timeout == ''" + - kind: 'removeParameter' + name: 'initialTimeout' + - if: "initialTimeout != '' && timeout != ''" + changes: + - kind: 'removeParameter' + name: 'initialTimeout' + variables: + initialTimeout: + kind: 'fragment' + value: 'arguments[initialTimeout]' + timeout: + kind: 'fragment' + value: 'arguments[timeout]' diff --git a/packages/flutter_test/lib/fix_data/template.yaml b/packages/flutter_test/lib/fix_data/template.yaml new file mode 100644 index 0000000000..25c8a12859 --- /dev/null +++ b/packages/flutter_test/lib/fix_data/template.yaml @@ -0,0 +1,25 @@ +# Copyright 2014 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# For details regarding the *Flutter Fix* feature, see +# https://flutter.dev/docs/development/tools/flutter-fix + +# Please add new fixes to the top of the file, separated by one blank line +# from other fixes. In a comment, include a link to the PR where the change +# requiring the fix was made. + +# Every fix must be tested. See the +# flutter/packages/flutter_test/lib/fix_data/README.md file for instructions +# on testing these data driven fixes. + +# For documentation about this file format, see +# https://dart.dev/go/data-driven-fixes. + +# * Fixes in this file are [for CLASS] from the library. * + +# Uncomment version & transforms, and follow with fixes. +# version: 1 +# transforms: + +# Before adding a new fix: read instructions at the top of this file. diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index d6b7fbdd1b..04f836acbc 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -759,6 +759,8 @@ abstract class TestWidgetsFlutterBinding extends BindingBase 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' 'This feature was deprecated after v2.6.0-1.0.pre.' ) + // TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346 + // is complete, as this removal will cascade into `integration_test` Duration? timeout, }); @@ -1430,6 +1432,8 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' 'This feature was deprecated after v2.6.0-1.0.pre.' ) + // TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346 + // is complete, as this removal will cascade into `integration_test` Duration? timeout, }) { assert(!inTest); @@ -1927,6 +1931,8 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' 'This feature was deprecated after v2.6.0-1.0.pre.' ) + // TODO(pdblasi-google): Do not remove until https://github.com/flutter/flutter/issues/124346 + // is complete, as this removal will cascade into `integration_test` Duration? timeout, }) { assert(!inTest); diff --git a/packages/flutter_test/test_fixes/.dartignore b/packages/flutter_test/test_fixes/.dartignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/flutter_test/test_fixes/analysis_options.yaml b/packages/flutter_test/test_fixes/analysis_options.yaml new file mode 100644 index 0000000000..7cca7b1d5c --- /dev/null +++ b/packages/flutter_test/test_fixes/analysis_options.yaml @@ -0,0 +1 @@ +# This ensures that parent analysis options do not accidentally break the fix tests. diff --git a/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart b/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart new file mode 100644 index 0000000000..b83227862d --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart @@ -0,0 +1,23 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('test', (WidgetTester tester) async { + final AnimationSheetBuilder animationSheet = + AnimationSheetBuilder(frameSize: const Size(48, 24)); + + // This line will remain unchanged as there is no replacement for the + // `sheetSize` API. + tester.binding.setSurfaceSize(animationSheet.sheetSize()); + + // These lines will replace the calls to `display` with a call to `collate` + // but will still have a build error. + // Changes made in https://github.com/flutter/flutter/pull/83337 + final Widget display = await animationSheet.display(); + final Widget display2 = await animationSheet.display(key: UniqueKey()); + }); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart.expect b/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart.expect new file mode 100644 index 0000000000..4a2b4cc4cb --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/animation_sheet_builder.dart.expect @@ -0,0 +1,23 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('test', (WidgetTester tester) async { + final AnimationSheetBuilder animationSheet = + AnimationSheetBuilder(frameSize: const Size(48, 24)); + + // This line will remain unchanged as there is no replacement for the + // `sheetSize` API. + tester.binding.setSurfaceSize(animationSheet.sheetSize()); + + // These lines will replace the calls to `display` with a call to `collate` + // but will still have a build error. + // Changes made in https://github.com/flutter/flutter/pull/83337 + final Widget display = await animationSheet.collate(1); + final Widget display2 = await animationSheet.collate(1); + }); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart b/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart new file mode 100644 index 0000000000..f5c93338f3 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart @@ -0,0 +1,15 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + final binding = AutomatedTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { }, + () { }, + // Changes made in https://github.com/flutter/flutter/pull/89952 + timeout: Duration(minutes: 30), + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart.expect b/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart.expect new file mode 100644 index 0000000000..cf67007b96 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/automated_test_widgets_flutter_binding.dart.expect @@ -0,0 +1,13 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + final binding = AutomatedTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { }, + () { }, + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart b/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart new file mode 100644 index 0000000000..616a069eb5 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart @@ -0,0 +1,15 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + final binding = LiveTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { }, + () { }, + // Changes made in https://github.com/flutter/flutter/pull/89952 + timeout: Duration(minutes: 30), + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart.expect b/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart.expect new file mode 100644 index 0000000000..119f57706c --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/live_test_widgets_flutter_binding.dart.expect @@ -0,0 +1,13 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + final binding = LiveTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { }, + () { }, + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart b/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart new file mode 100644 index 0000000000..ae14e85142 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart @@ -0,0 +1,28 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; + +import 'package:clock/src/clock.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() async { + TestWidgetsFlutterBinding binding = AutomatedTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { + // This will be unchanged as there is no equivalent API. + binding.addTime(Duration(seconds: 30)); + + await binding.runAsync( + () async {}, + // Changes made in https://github.com/flutter/flutter/pull/89952 + additionalTime: Duration(seconds: 25), + ); + }, + () { }, + // This timeout will be removed and not replaced since there is no + // equivalent API at this layer. + timeout: Duration(minutes: 30), + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart.expect b/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart.expect new file mode 100644 index 0000000000..32482e7f2c --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/binding/test_widgets_flutter_binding.dart.expect @@ -0,0 +1,20 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() async { + TestWidgetsFlutterBinding binding = AutomatedTestWidgetsFlutterBinding.ensureInitialized(); + binding.runTest( + () async { + // This will be unchanged as there is no equivalent API. + binding.addTime(Duration(seconds: 30)); + + await binding.runAsync( + () async {}, + ); + }, + () { }, + ); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart b/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart new file mode 100644 index 0000000000..0f4616a887 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('test', (WidgetTester tester) async { + // This call will be unchanged + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, timeout: Timeout(Duration(hours: 1))); + + testWidgets('test', (WidgetTester tester) async { + // The `timeout` will remain unchanged, but `initialTimeout` will be removed + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, + timeout: Timeout(Duration(minutes: 45)), + initialTimeout: Duration(minutes: 30)); + + testWidgets('test', (WidgetTester tester) async { + // initialTimeout will be wrapped in a Timeout and changed to `timeout` + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, initialTimeout: Duration(seconds: 30)); +} diff --git a/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart.expect b/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart.expect new file mode 100644 index 0000000000..246cc7f272 --- /dev/null +++ b/packages/flutter_test/test_fixes/flutter_test/widget_tester.dart.expect @@ -0,0 +1,23 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('test', (WidgetTester tester) async { + // This call will be unchanged + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, timeout: Timeout(Duration(hours: 1))); + + testWidgets('test', (WidgetTester tester) async { + // The `timeout` will remain unchanged, but `initialTimeout` will be removed + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, + timeout: Timeout(Duration(minutes: 45))); + + testWidgets('test', (WidgetTester tester) async { + // initialTimeout will be wrapped in a Timeout and changed to `timeout` + // Changes made in https://github.com/flutter/flutter/pull/89952 + }, timeout: Timeout(Duration(seconds: 30))); +}