Always test semantics (#35110)
Default `semanticsEnabled` to true for `testWidgets` and fix associated bugs
This commit is contained in:
@@ -123,7 +123,7 @@ void main() {
|
||||
final Evaluation result = await textContrastGuideline.evaluate(tester);
|
||||
expect(result.passed, false);
|
||||
expect(result.reason,
|
||||
'SemanticsNode#21(Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), label: "this is a test",'
|
||||
'SemanticsNode#3(Rect.fromLTRB(300.0, 200.0, 500.0, 400.0), label: "this is a test",'
|
||||
' textDirection: ltr):\nExpected contrast ratio of at least '
|
||||
'4.5 but found 1.17 for a font size of 14.0. The '
|
||||
'computed light color was: Color(0xfffafafa), The computed dark color was:'
|
||||
@@ -256,7 +256,7 @@ void main() {
|
||||
final Evaluation result = await androidTapTargetGuideline.evaluate(tester);
|
||||
expect(result.passed, false);
|
||||
expect(result.reason,
|
||||
'SemanticsNode#41(Rect.fromLTRB(376.0, 276.5, 424.0, 323.5), actions: [tap]): expected tap '
|
||||
'SemanticsNode#3(Rect.fromLTRB(376.0, 276.5, 424.0, 323.5), actions: [tap]): expected tap '
|
||||
'target size of at least Size(48.0, 48.0), but found Size(48.0, 47.0)\n'
|
||||
'See also: https://support.google.com/accessibility/android/answer/7101858?hl=en');
|
||||
handle.dispose();
|
||||
|
||||
@@ -33,7 +33,7 @@ void main() {
|
||||
group('semantics', () {
|
||||
testWidgets('Throws StateError if semantics are not enabled', (WidgetTester tester) async {
|
||||
expect(() => find.bySemanticsLabel('Add'), throwsStateError);
|
||||
});
|
||||
}, semanticsEnabled: false);
|
||||
|
||||
testWidgets('finds Semantically labeled widgets', (WidgetTester tester) async {
|
||||
final SemanticsHandle semanticsHandle = tester.ensureSemantics();
|
||||
|
||||
@@ -542,7 +542,7 @@ void main() {
|
||||
|
||||
expect(() => tester.getSemantics(find.text('hello')),
|
||||
throwsA(isInstanceOf<StateError>()));
|
||||
});
|
||||
}, semanticsEnabled: false);
|
||||
|
||||
testWidgets('throws when there are multiple results from the finder', (WidgetTester tester) async {
|
||||
final SemanticsHandle semanticsHandle = tester.ensureSemantics();
|
||||
|
||||
Reference in New Issue
Block a user