[a11y] Make sure RenderFractionalTranslation updates its semantics after the translation field is set (#48985)
This commit is contained in:
committed by
Flutter GitHub Bot
parent
fcf341e4f3
commit
b67d5ec6e9
@@ -162,7 +162,7 @@ const Matcher hasAGoodToStringDeep = _HasGoodToStringDeep();
|
||||
|
||||
/// A matcher for functions that throw [FlutterError].
|
||||
///
|
||||
/// This is equivalent to `throwsA(isA<FlutterError>())`.
|
||||
/// This is equivalent to `throwsA(isInstanceOf<FlutterError>())`.
|
||||
///
|
||||
/// If you are trying to test whether a call to [WidgetTester.pumpWidget]
|
||||
/// results in a [FlutterError], see [TestWidgetsFlutterBinding.takeException].
|
||||
@@ -176,7 +176,7 @@ final Matcher throwsFlutterError = throwsA(isFlutterError);
|
||||
|
||||
/// A matcher for functions that throw [AssertionError].
|
||||
///
|
||||
/// This is equivalent to `throwsA(isA<AssertionError>())`.
|
||||
/// This is equivalent to `throwsA(isInstanceOf<AssertionError>())`.
|
||||
///
|
||||
/// If you are trying to test whether a call to [WidgetTester.pumpWidget]
|
||||
/// results in an [AssertionError], see
|
||||
@@ -197,7 +197,7 @@ final Matcher throwsAssertionError = throwsA(isAssertionError);
|
||||
///
|
||||
/// * [throwsFlutterError], to test if a function throws a [FlutterError].
|
||||
/// * [isAssertionError], to test if any object is any kind of [AssertionError].
|
||||
final test_package.TypeMatcher<FlutterError> isFlutterError = isA<FlutterError>();
|
||||
final Matcher isFlutterError = isInstanceOf<FlutterError>();
|
||||
|
||||
/// A matcher for [AssertionError].
|
||||
///
|
||||
@@ -207,11 +207,11 @@ final test_package.TypeMatcher<FlutterError> isFlutterError = isA<FlutterError>(
|
||||
///
|
||||
/// * [throwsAssertionError], to test if a function throws any [AssertionError].
|
||||
/// * [isFlutterError], to test if any object is a [FlutterError].
|
||||
final test_package.TypeMatcher<AssertionError> isAssertionError = isA<AssertionError>();
|
||||
final Matcher isAssertionError = isInstanceOf<AssertionError>();
|
||||
|
||||
/// A matcher that compares the type of the actual value to the type argument T.
|
||||
// TODO(ianh): Remove this once https://github.com/dart-lang/matcher/issues/98 is fixed
|
||||
test_package.TypeMatcher<T> isInstanceOf<T>() => isA<T>();
|
||||
Matcher isInstanceOf<T>() => test_package.TypeMatcher<T>();
|
||||
|
||||
/// Asserts that two [double]s are equal, within some tolerated error.
|
||||
///
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
test('$WidgetsBinding initializes with $LiveTestWidgetsFlutterBinding when FLUTTER_TEST = "false"', () {
|
||||
TestWidgetsFlutterBinding.ensureInitialized(<String, String>{'FLUTTER_TEST': 'false'});
|
||||
expect(WidgetsBinding.instance, isA<LiveTestWidgetsFlutterBinding>());
|
||||
expect(WidgetsBinding.instance, isInstanceOf<LiveTestWidgetsFlutterBinding>());
|
||||
}, onPlatform: const <String, dynamic>{
|
||||
'browser': <Skip>[Skip('Browser will not use the live binding')]
|
||||
});
|
||||
|
||||
@@ -9,6 +9,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
test('$WidgetsBinding initializes with $AutomatedTestWidgetsFlutterBinding when FLUTTER_TEST has a value that is not "true" or "false"', () {
|
||||
TestWidgetsFlutterBinding.ensureInitialized(<String, String>{'FLUTTER_TEST': 'value that is neither "true" nor "false"'});
|
||||
expect(WidgetsBinding.instance, isA<AutomatedTestWidgetsFlutterBinding>());
|
||||
expect(WidgetsBinding.instance, isInstanceOf<AutomatedTestWidgetsFlutterBinding>());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
test('$WidgetsBinding initializes with $AutomatedTestWidgetsFlutterBinding when FLUTTER_TEST is defined but null', () {
|
||||
TestWidgetsFlutterBinding.ensureInitialized(<String, String>{'FLUTTER_TEST': null});
|
||||
expect(WidgetsBinding.instance, isA<AutomatedTestWidgetsFlutterBinding>());
|
||||
expect(WidgetsBinding.instance, isInstanceOf<AutomatedTestWidgetsFlutterBinding>());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
test('$WidgetsBinding initializes with $AutomatedTestWidgetsFlutterBinding when FLUTTER_TEST = "true"', () {
|
||||
TestWidgetsFlutterBinding.ensureInitialized(<String, String>{'FLUTTER_TEST': 'true'});
|
||||
expect(WidgetsBinding.instance, isA<AutomatedTestWidgetsFlutterBinding>());
|
||||
expect(WidgetsBinding.instance, isInstanceOf<AutomatedTestWidgetsFlutterBinding>());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
void main() {
|
||||
test('$WidgetsBinding initializes with $LiveTestWidgetsFlutterBinding when the environment does not contain FLUTTER_TEST', () {
|
||||
TestWidgetsFlutterBinding.ensureInitialized(<String, String>{});
|
||||
expect(WidgetsBinding.instance, isA<LiveTestWidgetsFlutterBinding>());
|
||||
expect(WidgetsBinding.instance, isInstanceOf<LiveTestWidgetsFlutterBinding>());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
Future<void> main(FutureOr<void> testMain()) async {
|
||||
reportTestException = (FlutterErrorDetails details, String testDescription) {
|
||||
expect(details.exception, isA<StateError>());
|
||||
expect(details.exception, isInstanceOf<StateError>());
|
||||
expect(details.exception.message, 'foo');
|
||||
expect(testDescription, 'custom exception reporter');
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ void main() {
|
||||
group('goldenFileComparator', () {
|
||||
test('is initialized by test framework', () {
|
||||
expect(goldenFileComparator, isNotNull);
|
||||
expect(goldenFileComparator, isA<LocalFileComparator>());
|
||||
expect(goldenFileComparator, isInstanceOf<LocalFileComparator>());
|
||||
final LocalFileComparator comparator = goldenFileComparator as LocalFileComparator;
|
||||
expect(comparator.basedir.path, contains('flutter_test'));
|
||||
});
|
||||
|
||||
@@ -153,15 +153,15 @@ void main() {
|
||||
real_test.expect(information[3].level, DiagnosticLevel.info);
|
||||
real_test.expect(information[4].level, DiagnosticLevel.info);
|
||||
real_test.expect(information[5].level, DiagnosticLevel.info);
|
||||
real_test.expect(information[0], isA<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[1], isA<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[2], isA<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[3], isA<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[4], isA<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[5], isA<DiagnosticsStackTrace>());
|
||||
real_test.expect(information[0], isInstanceOf<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[1], isInstanceOf<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[2], isInstanceOf<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[3], isInstanceOf<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[4], isInstanceOf<DiagnosticsProperty<void>>());
|
||||
real_test.expect(information[5], isInstanceOf<DiagnosticsStackTrace>());
|
||||
final DiagnosticsStackTrace stackTraceProperty = information[5] as DiagnosticsStackTrace;
|
||||
real_test.expect(stackTraceProperty.name, '\nWhen the first method was called, this was the stack');
|
||||
real_test.expect(stackTraceProperty.value, isA<StackTrace>());
|
||||
real_test.expect(stackTraceProperty.value, isInstanceOf<StackTrace>());
|
||||
}
|
||||
await f1;
|
||||
await f2;
|
||||
|
||||
@@ -29,7 +29,7 @@ void main() {
|
||||
await tester.testTextInput.receiveAction(TextInputAction.done);
|
||||
fail('Expected a PlatformException, but it was not thrown.');
|
||||
} catch (e) {
|
||||
expect(e, isA<PlatformException>());
|
||||
expect(e, isInstanceOf<PlatformException>());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,7 +33,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(() => tester.getSemantics(find.text('hello')), throwsStateError);
|
||||
expect(() => tester.getSemantics(find.text('hello')),
|
||||
throwsA(isInstanceOf<StateError>()));
|
||||
}, semanticsEnabled: false);
|
||||
|
||||
testWidgets('throws when there are multiple results from the finder', (WidgetTester tester) async {
|
||||
@@ -52,7 +53,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
|
||||
expect(() => tester.getSemantics(find.text('hello')), throwsStateError);
|
||||
expect(() => tester.getSemantics(find.text('hello')),
|
||||
throwsA(isInstanceOf<StateError>()));
|
||||
semanticsHandle.dispose();
|
||||
});
|
||||
|
||||
@@ -470,7 +472,7 @@ void main() {
|
||||
|
||||
expect(
|
||||
expectAsync0(tester.pageBack),
|
||||
throwsA(isA<TestFailure>()),
|
||||
throwsA(isInstanceOf<TestFailure>()),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -627,7 +629,7 @@ void main() {
|
||||
testWidgets('disallows re-entry', (WidgetTester tester) async {
|
||||
final Completer<void> completer = Completer<void>();
|
||||
tester.runAsync<void>(() => completer.future);
|
||||
expect(() => tester.runAsync(() async { }), throwsA(isA<TestFailure>()));
|
||||
expect(() => tester.runAsync(() async { }), throwsA(isInstanceOf<TestFailure>()));
|
||||
completer.complete();
|
||||
});
|
||||
|
||||
@@ -683,7 +685,7 @@ void main() {
|
||||
'calling dispose() on the AnimationController itself. Otherwise,\n'
|
||||
'the ticker will leak.\n',
|
||||
);
|
||||
expect(error.diagnostics.last, isA<DiagnosticsProperty<Ticker>>());
|
||||
expect(error.diagnostics.last, isInstanceOf<DiagnosticsProperty<Ticker>>());
|
||||
expect(error.diagnostics.last.value, ticker);
|
||||
expect(error.toStringDeep(), startsWith(
|
||||
'FlutterError\n'
|
||||
@@ -744,6 +746,7 @@ void main() {
|
||||
}
|
||||
}, variant: TargetPlatformVariant.all());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
class FakeMatcher extends AsyncMatcher {
|
||||
|
||||
Reference in New Issue
Block a user