Enables setting of semantics focused and focusable attributes within Focus widgets. (#41814)
This adds a Semantics node to the Focus and FocusScope widgets, setting the focused and focusable attributes so that the accessibility subsystem can be told when a control has the input focus. Includes an engine roll to flutter/engine@77252d2, and the following 8 engine changes: flutter/engine@77252d2 Greg Spencer Add missing focusable testing info (flutter/engine#13013) flutter/engine@0e42a29 skia-flutter-.. Roll src/third_party/skia 54548626a977..e27a503a0a21 (1 commits) (flutter/engine#13024) flutter/engine@6b56ed7 gaaclarke Refactor: FlutterDartProject (flutter/engine#13006) flutter/engine@393480c skia-flutter-.. Roll src/third_party/skia 77dde599c98a..54548626a977 (1 commits) (flutter/engine#13023) flutter/engine@080b89d skia-flutter-.. Roll src/third_party/skia 2b1a25a4d324..77dde599c98a (1 commits) (flutter/engine#13021) flutter/engine@90b0f30 Ben Konyi Roll src/third_party/dart f4a72bfc64..bb04f145b2 (18 commits) (flutter/engine#13020) flutter/engine@049fb89 skia-flutter-.. Roll fuchsia/sdk/core/linux-amd64 from q_uYX... to cknsi... (flutter/engine#13019) flutter/engine@6925b2a skia-flutter-.. Roll fuchsia/sdk/core/mac-amd64 from wuAtw... to u0JpE... (flutter/engine#13018) Related Issues Addresses #40101 Landing on red in order to fix the build: it's red because of the needed engine roll.
This commit is contained in:
@@ -69,50 +69,61 @@ void main() {
|
||||
matching: find.byType('Semantics'),
|
||||
firstMatchOnly: true,
|
||||
);
|
||||
expect(await getSemantics(normalTextField), hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isEditable: true,
|
||||
isFocusable: true,
|
||||
isFocused: false,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(normalTextField),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isEditable: true,
|
||||
isFocusable: true,
|
||||
isFocused: false,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(normalTextField);
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
expect(await getSemantics(normalTextField), hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
AndroidSemanticsAction.copy,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(normalTextField),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.copy,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.enterText('hello world');
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
|
||||
expect(await getSemantics(normalTextField), hasAndroidSemantics(
|
||||
text: 'hello world',
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
AndroidSemanticsAction.copy,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(normalTextField),
|
||||
hasAndroidSemantics(
|
||||
text: 'hello world',
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: false,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.copy,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('password TextField has correct Android semantics', () async {
|
||||
@@ -121,50 +132,59 @@ void main() {
|
||||
matching: find.byType('Semantics'),
|
||||
firstMatchOnly: true,
|
||||
);
|
||||
expect(await getSemantics(passwordTextField), hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isEditable: true,
|
||||
isFocusable: true,
|
||||
isFocused: false,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(passwordTextField),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isEditable: true,
|
||||
isFocusable: true,
|
||||
isFocused: false,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(passwordTextField);
|
||||
|
||||
expect(await getSemantics(passwordTextField), hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
AndroidSemanticsAction.copy,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(passwordTextField),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.copy,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.enterText('hello world');
|
||||
|
||||
expect(await getSemantics(passwordTextField), hasAndroidSemantics(
|
||||
text: '\u{2022}' * ('hello world'.length),
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
AndroidSemanticsAction.copy,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(passwordTextField),
|
||||
hasAndroidSemantics(
|
||||
text: '\u{2022}' * ('hello world'.length),
|
||||
className: AndroidClassName.editText,
|
||||
isFocusable: true,
|
||||
isFocused: true,
|
||||
isEditable: true,
|
||||
isPassword: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.copy,
|
||||
AndroidSemanticsAction.setSelection,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
@@ -178,114 +198,404 @@ void main() {
|
||||
});
|
||||
|
||||
test('Checkbox has correct Android semantics', () async {
|
||||
expect(await getSemantics(find.byValueKey(checkboxKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(checkboxKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(checkboxKeyValue));
|
||||
|
||||
expect(await getSemantics(find.byValueKey(checkboxKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(await getSemantics(find.byValueKey(disabledCheckboxKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isCheckable: true,
|
||||
isEnabled: false,
|
||||
actions: const <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(checkboxKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(disabledCheckboxKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.checkBox,
|
||||
isCheckable: true,
|
||||
isEnabled: false,
|
||||
actions: const <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
test('Radio has correct Android semantics', () async {
|
||||
expect(await getSemantics(find.byValueKey(radio2KeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.radio,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(radio2KeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.radio,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(radio2KeyValue));
|
||||
|
||||
expect(await getSemantics(find.byValueKey(radio2KeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.radio,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(radio2KeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.radio,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
test('Switch has correct Android semantics', () async {
|
||||
expect(await getSemantics(find.byValueKey(switchKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(switchKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(switchKeyValue));
|
||||
|
||||
expect(await getSemantics(find.byValueKey(switchKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(switchKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: true,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/20820.
|
||||
test('Switch can be labeled', () async {
|
||||
expect(await getSemantics(find.byValueKey(labeledSwitchKeyValue)), hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
contentDescription: switchLabel,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.click,
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
));
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(labeledSwitchKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.toggleSwitch,
|
||||
isChecked: false,
|
||||
isCheckable: true,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
contentDescription: switchLabel,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await driver.tap(find.byValueKey('back'));
|
||||
});
|
||||
});
|
||||
|
||||
group('Popup Controls', () {
|
||||
setUpAll(() async {
|
||||
await driver.tap(find.text(popupControlsRoute));
|
||||
});
|
||||
|
||||
test('Popup Menu has correct Android semantics', () async {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(popupButtonKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(popupButtonKeyValue));
|
||||
try {
|
||||
// We have to wait wall time here because we're waiting for TalkBack to
|
||||
// catch up.
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
for (String item in popupItems) {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
if (item == popupItems.first) AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
if (item != popupItems.first) AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Popup $item doesn't have the right semantics");
|
||||
}
|
||||
await driver.tap(find.byValueKey('$popupKeyValue.${popupItems.first}'));
|
||||
|
||||
// Pop up the menu again, to verify that TalkBack gets the right answer
|
||||
// more than just the first time.
|
||||
await driver.tap(find.byValueKey(popupButtonKeyValue));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
for (String item in popupItems) {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$popupKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
// TODO(gspencergoog): This should really be identical to the first time,
|
||||
// but TalkBack doesn't find it the second time for some reason.
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Popup $item doesn't have the right semantics the second time");
|
||||
}
|
||||
} finally {
|
||||
await driver.tap(find.byValueKey('$popupKeyValue.${popupItems.first}'));
|
||||
}
|
||||
});
|
||||
|
||||
test('Dropdown Menu has correct Android semantics', () async {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(dropdownButtonKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(dropdownButtonKeyValue));
|
||||
try {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
for (String item in popupItems) {
|
||||
// There are two copies of each item, so we want to find the version
|
||||
// that is in the overlay, not the one in the dropdown.
|
||||
expect(
|
||||
await getSemantics(find.descendant(
|
||||
of: find.byType('Scrollable'),
|
||||
matching: find.byValueKey('$dropdownKeyValue.$item'),
|
||||
)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
// TODO(gspencergoog): This should really be different for the first item:
|
||||
// It should have clearAccessibilityFocus instead, but for some reason
|
||||
// TalkBack doesn't ask to focus it.
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Dropdown $item doesn't have the right semantics");
|
||||
}
|
||||
await driver.tap(
|
||||
find.descendant(
|
||||
of: find.byType('Scrollable'),
|
||||
matching: find.byValueKey('$dropdownKeyValue.${popupItems.first}'),
|
||||
),
|
||||
);
|
||||
|
||||
// Pop up the dropdown again, to verify that TalkBack gets the right answer
|
||||
// more than just the first time.
|
||||
await driver.tap(find.byValueKey(dropdownButtonKeyValue));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
for (String item in popupItems) {
|
||||
// There are two copies of each item, so we want to find the version
|
||||
// that is in the overlay, not the one in the dropdown.
|
||||
expect(
|
||||
await getSemantics(find.descendant(
|
||||
of: find.byType('Scrollable'),
|
||||
matching: find.byValueKey('$dropdownKeyValue.$item'),
|
||||
)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
// TODO(gspencergoog): This should really be different for the first item:
|
||||
// It should have clearAccessibilityFocus instead, but for some reason
|
||||
// TalkBack doesn't ask to focus it.
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Dropdown $item doesn't have the right semantics the second time.");
|
||||
}
|
||||
} finally {
|
||||
await driver.tap(
|
||||
find.descendant(
|
||||
of: find.byType('Scrollable'),
|
||||
matching: find.byValueKey('$dropdownKeyValue.${popupItems.first}'),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('Modal alert dialog has correct Android semantics', () async {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey(alertButtonKeyValue)),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
await driver.tap(find.byValueKey(alertButtonKeyValue));
|
||||
try {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$alertKeyValue.OK')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Alert OK button doesn't have the right semantics");
|
||||
|
||||
for (String item in <String>['Title', 'Body1', 'Body2']) {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$alertKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
if (item == 'Body1') AndroidSemanticsAction.clearAccessibilityFocus,
|
||||
if (item != 'Body1') AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
),
|
||||
reason: "Alert $item button doesn't have the right semantics");
|
||||
}
|
||||
|
||||
await driver.tap(find.byValueKey('$alertKeyValue.OK'));
|
||||
|
||||
// Pop up the alert again, to verify that TalkBack gets the right answer
|
||||
// more than just the first time.
|
||||
await driver.tap(find.byValueKey(alertButtonKeyValue));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 1500));
|
||||
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$alertKeyValue.OK')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.button,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
AndroidSemanticsAction.click,
|
||||
],
|
||||
),
|
||||
reason: "Alert OK button doesn't have the right semantics");
|
||||
|
||||
for (String item in <String>['Title', 'Body1', 'Body2']) {
|
||||
expect(
|
||||
await getSemantics(find.byValueKey('$alertKeyValue.$item')),
|
||||
hasAndroidSemantics(
|
||||
className: AndroidClassName.view,
|
||||
isChecked: false,
|
||||
isCheckable: false,
|
||||
isEnabled: true,
|
||||
isFocusable: true,
|
||||
actions: <AndroidSemanticsAction>[
|
||||
// TODO(gspencergoog): This should really be identical to the first time,
|
||||
// but TalkBack doesn't find it the second time for some reason.
|
||||
AndroidSemanticsAction.accessibilityFocus,
|
||||
],
|
||||
),
|
||||
reason: "Alert $item button doesn't have the right semantics");
|
||||
}
|
||||
} finally {
|
||||
await driver.tap(find.byValueKey('$alertKeyValue.OK'));
|
||||
}
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
await driver.tap(find.byValueKey('back'));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user