Removes deprecated APIs from v2.6 in binding.dart and widget_tester.dart (#129663)
Removes deprecated APIs from v2.6 in `binding.dart` and `widget_tester.dart` Resolves #129654
This commit is contained in:
@@ -124,7 +124,7 @@ class MatchesGoldenFile extends AsyncMatcher {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
}, additionalTime: const Duration(minutes: 1));
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<T?> runAsync<T>(
|
||||
Future<T> 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<T?> runAsync<T>(Future<T> Function() callback);
|
||||
|
||||
/// Artificially calls dispatchLocalesChanged on the Widget binding,
|
||||
/// then flushes microtasks.
|
||||
@@ -779,11 +756,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
||||
Future<void> 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<T?> runAsync<T>(
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
}) {
|
||||
Future<T?> runAsync<T>(Future<T> Function() callback) {
|
||||
assert(() {
|
||||
if (_pendingAsyncTasks == null) {
|
||||
return true;
|
||||
@@ -1297,8 +1265,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
),
|
||||
);
|
||||
|
||||
addTime(additionalTime);
|
||||
|
||||
return realAsyncZone.run<Future<T?>>(() {
|
||||
final Completer<T?> result = Completer<T?>();
|
||||
_pendingAsyncTasks = Completer<void>();
|
||||
@@ -1452,11 +1418,6 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
Future<void> 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<T?> runAsync<T>(
|
||||
Future<T> Function() callback, {
|
||||
Duration additionalTime = const Duration(milliseconds: 1000),
|
||||
}) async {
|
||||
Future<T?> runAsync<T>(Future<T> Function() callback) async {
|
||||
assert(() {
|
||||
if (!_runningAsyncTasks) {
|
||||
return true;
|
||||
@@ -1998,11 +1956,6 @@ class LiveTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
Future<void> 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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -93,9 +93,7 @@ E? _lastWhereOrNull<E>(Iterable<E> 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<E>(Iterable<E> 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<Object?> 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<T?> runAsync<T>(
|
||||
Future<T> 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<T?>(callback, additionalTime: additionalTime);
|
||||
}) => binding.runAsync<T?>(callback);
|
||||
|
||||
/// Whether there are any transient callbacks scheduled.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user