diff --git a/packages/flutter_test/lib/src/_matchers_io.dart b/packages/flutter_test/lib/src/_matchers_io.dart index fb479a6991..74a3d49760 100644 --- a/packages/flutter_test/lib/src/_matchers_io.dart +++ b/packages/flutter_test/lib/src/_matchers_io.dart @@ -124,7 +124,7 @@ class MatchesGoldenFile extends AsyncMatcher { image.dispose(); } } - }, additionalTime: const Duration(minutes: 1)); + }); } @override diff --git a/packages/flutter_test/lib/src/_matchers_web.dart b/packages/flutter_test/lib/src/_matchers_web.dart index c671390346..749b57164e 100644 --- a/packages/flutter_test/lib/src/_matchers_web.dart +++ b/packages/flutter_test/lib/src/_matchers_web.dart @@ -77,7 +77,7 @@ class MatchesGoldenFile extends AsyncMatcher { } on TestFailure catch (ex) { return ex.message; } - }, additionalTime: const Duration(seconds: 22)); + }); _renderElement(view, _findRepaintBoundary(e)); return result; } diff --git a/packages/flutter_test/lib/src/binding.dart b/packages/flutter_test/lib/src/binding.dart index 8075382793..23caf1f33b 100644 --- a/packages/flutter_test/lib/src/binding.dart +++ b/packages/flutter_test/lib/src/binding.dart @@ -310,19 +310,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase @protected bool get registerTestTextInput => true; - /// This method has no effect. - /// - /// This method was previously used to change the timeout of the test. However, - /// in practice having short timeouts was found to be nothing but trouble, - /// primarily being a cause flakes rather than helping debug tests. - /// - /// For this reason, this method has been deprecated. - @Deprecated( - 'This method has no effect. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - void addTime(Duration duration) { } - /// Delay for `duration` of time. /// /// In the automated test environment ([AutomatedTestWidgetsFlutterBinding], @@ -465,17 +452,7 @@ abstract class TestWidgetsFlutterBinding extends BindingBase /// are required to wait for the returned future to complete before calling /// this method again. Attempts to do otherwise will result in a /// [TestFailure] error being thrown. - /// - /// The `additionalTime` argument was previously used with - /// [AutomatedTestWidgetsFlutterBinding.addTime] but now has no effect. - Future runAsync( - Future Function() callback, { - @Deprecated( - 'This parameter has no effect. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - Duration additionalTime = const Duration(milliseconds: 1000), - }); + Future runAsync(Future Function() callback); /// Artificially calls dispatchLocalesChanged on the Widget binding, /// then flushes microtasks. @@ -779,11 +756,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase Future Function() testBody, VoidCallback invariantTester, { String description = '', - @Deprecated( - 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - Duration? timeout, }); /// This is called during test execution before and after the body has been @@ -1253,7 +1225,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { } _phase = newPhase; if (hasScheduledFrame) { - addTime(const Duration(milliseconds: 500)); _currentFakeAsync!.flushMicrotasks(); handleBeginFrame(Duration( milliseconds: _clock!.now().millisecondsSinceEpoch, @@ -1267,10 +1238,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { } @override - Future runAsync( - Future Function() callback, { - Duration additionalTime = const Duration(milliseconds: 1000), - }) { + Future runAsync(Future Function() callback) { assert(() { if (_pendingAsyncTasks == null) { return true; @@ -1297,8 +1265,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ), ); - addTime(additionalTime); - return realAsyncZone.run>(() { final Completer result = Completer(); _pendingAsyncTasks = Completer(); @@ -1452,11 +1418,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { Future Function() testBody, VoidCallback invariantTester, { String description = '', - @Deprecated( - 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - Duration? timeout, }) { assert(!inTest); assert(_currentFakeAsync == null); @@ -1961,10 +1922,7 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { } @override - Future runAsync( - Future Function() callback, { - Duration additionalTime = const Duration(milliseconds: 1000), - }) async { + Future runAsync(Future Function() callback) async { assert(() { if (!_runningAsyncTasks) { return true; @@ -1998,11 +1956,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { Future Function() testBody, VoidCallback invariantTester, { String description = '', - @Deprecated( - 'This parameter has no effect. Use the `timeout` parameter on `testWidgets` instead. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - Duration? timeout, }) { assert(!inTest); _inTest = true; diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index 0c287d1a35..3cc1bb6ce2 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -2054,7 +2054,7 @@ class _MatchesReferenceImage extends AsyncMatcher { Uint8List.view(referenceBytes.buffer), ); return countDifferentPixels == 0 ? null : 'does not match on $countDifferentPixels pixels'; - }, additionalTime: const Duration(minutes: 1)); + }); } @override diff --git a/packages/flutter_test/lib/src/widget_tester.dart b/packages/flutter_test/lib/src/widget_tester.dart index 0a26dfc9bd..8cd6d50cb0 100644 --- a/packages/flutter_test/lib/src/widget_tester.dart +++ b/packages/flutter_test/lib/src/widget_tester.dart @@ -93,9 +93,7 @@ E? _lastWhereOrNull(Iterable list, bool Function(E) test) { /// `test` package. If set, it should be relatively large (minutes). It defaults /// to ten minutes for tests run by `flutter test`, and is unlimited for tests /// run by `flutter run`; specifically, it defaults to -/// [TestWidgetsFlutterBinding.defaultTestTimeout]. (The `initialTimeout` -/// parameter has no effect. It was previously used with -/// [TestWidgetsFlutterBinding.addTime] but that feature was removed.) +/// [TestWidgetsFlutterBinding.defaultTestTimeout]. /// /// If the `semanticsEnabled` parameter is set to `true`, /// [WidgetTester.ensureSemantics] will have been called before the tester is @@ -115,11 +113,6 @@ E? _lastWhereOrNull(Iterable list, bool Function(E) test) { /// If the [tags] are passed, they declare user-defined tags that are implemented by /// the `test` package. /// -/// See also: -/// -/// * [AutomatedTestWidgetsFlutterBinding.addTime] to learn more about -/// timeout and how to manually increase timeouts. -/// /// ## Sample code /// /// ```dart @@ -135,11 +128,6 @@ void testWidgets( WidgetTesterCallback callback, { bool? skip, test_package.Timeout? timeout, - @Deprecated( - 'This parameter has no effect. Use `timeout` instead. ' - 'This feature was deprecated after v2.6.0-1.0.pre.' - ) - Duration? initialTimeout, bool semanticsEnabled = true, TestVariant variant = const DefaultTestVariant(), dynamic tags, @@ -182,7 +170,6 @@ void testWidgets( }, tester._endOfTestVerifications, description: combinedDescription, - timeout: initialTimeout, ); }, skip: skip, @@ -826,8 +813,12 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker /// your widget tree, then await that future inside [callback]. Future runAsync( Future Function() callback, { + @Deprecated( + 'This is no longer supported and has no effect. ' + 'This feature was deprecated after v3.12.0-1.1.pre.' + ) Duration additionalTime = const Duration(milliseconds: 1000), - }) => binding.runAsync(callback, additionalTime: additionalTime); + }) => binding.runAsync(callback); /// Whether there are any transient callbacks scheduled. ///