Re-enable SemanticsAction.focus
matchers (#150990)
## Description This re-enables the `SemanticsAction.focus` matchers so that they actually do something now instead of ignoring the action. This was so that we could land the focus action changes without causing breakages in customer tests, and now that customer tests have been updated, we can land this PR turning it on again. ## Related Issues - Fixes https://github.com/flutter/flutter/issues/149842 ## Related PRs - https://github.com/flutter/flutter/pull/149840 ## Tests - Updates semantics tests to actually look for the focus action.
This commit is contained in:
parent
f2be1260df
commit
c082abe629
@ -296,7 +296,7 @@ void main() {
|
|||||||
TestSemantics.root(
|
TestSemantics.root(
|
||||||
children: <TestSemantics>[
|
children: <TestSemantics>[
|
||||||
TestSemantics.rootChild(
|
TestSemantics.rootChild(
|
||||||
actions: SemanticsAction.tap.index,
|
actions: SemanticsAction.tap.index | SemanticsAction.focus.index,
|
||||||
label: 'ABC',
|
label: 'ABC',
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isButton,
|
SemanticsFlag.isButton,
|
||||||
|
@ -251,7 +251,7 @@ void main() {
|
|||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
SemanticsFlag.isCheckStateMixed,
|
SemanticsFlag.isCheckStateMixed,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[SemanticsAction.focus, SemanticsAction.tap],
|
||||||
), hasLength(1));
|
), hasLength(1));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
|
@ -148,7 +148,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
SemanticsAction.focus,
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -534,8 +534,11 @@ void main() {
|
|||||||
SemanticsFlag.hasEnabledState,
|
SemanticsFlag.hasEnabledState,
|
||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap,
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.didGainAccessibilityFocus,],
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
SemanticsAction.didGainAccessibilityFocus,
|
||||||
|
],
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -7971,6 +7974,7 @@ void main() {
|
|||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
hasEnabledState: true,
|
hasEnabledState: true,
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
|
hasFocusAction: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -10313,6 +10317,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
if (defaultTargetPlatform == TargetPlatform.windows || defaultTargetPlatform == TargetPlatform.macOS)
|
if (defaultTargetPlatform == TargetPlatform.windows || defaultTargetPlatform == TargetPlatform.macOS)
|
||||||
SemanticsAction.didGainAccessibilityFocus,
|
SemanticsAction.didGainAccessibilityFocus,
|
||||||
// TODO(gspencergoog): also test for the presence of SemanticsAction.focus when
|
// TODO(gspencergoog): also test for the presence of SemanticsAction.focus when
|
||||||
|
@ -215,7 +215,7 @@ void main() {
|
|||||||
hasEnabledState: true,
|
hasEnabledState: true,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
hasFocusAction: true,
|
hasFocusAction: defaultTargetPlatform != TargetPlatform.iOS,
|
||||||
isFocusable: true,
|
isFocusable: true,
|
||||||
));
|
));
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
@ -259,7 +259,7 @@ void main() {
|
|||||||
hasEnabledState: true,
|
hasEnabledState: true,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
hasFocusAction: true,
|
hasFocusAction: defaultTargetPlatform != TargetPlatform.iOS,
|
||||||
isFocusable: true,
|
isFocusable: true,
|
||||||
));
|
));
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
|
@ -322,7 +322,10 @@ void main() {
|
|||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
SemanticsFlag.isCheckStateMixed,
|
SemanticsFlag.isCheckStateMixed,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
), hasLength(1));
|
), hasLength(1));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -346,7 +349,10 @@ void main() {
|
|||||||
SemanticsFlag.isChecked,
|
SemanticsFlag.isChecked,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
), hasLength(1));
|
), hasLength(1));
|
||||||
|
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -369,7 +375,10 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
), hasLength(1));
|
), hasLength(1));
|
||||||
|
|
||||||
semantics.dispose();
|
semantics.dispose();
|
||||||
|
@ -1621,6 +1621,7 @@ void main() {
|
|||||||
isFocused: true,
|
isFocused: true,
|
||||||
value: '01/15/2016',
|
value: '01/15/2016',
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
|
hasFocusAction: true,
|
||||||
hasSetTextAction: true,
|
hasSetTextAction: true,
|
||||||
hasSetSelectionAction: true,
|
hasSetSelectionAction: true,
|
||||||
hasCopyAction: true,
|
hasCopyAction: true,
|
||||||
|
@ -182,7 +182,7 @@ void main() {
|
|||||||
hasEnabledState: true,
|
hasEnabledState: true,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
hasFocusAction: true,
|
hasFocusAction: defaultTargetPlatform != TargetPlatform.iOS,
|
||||||
isFocusable: true,
|
isFocusable: true,
|
||||||
));
|
));
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
@ -240,7 +240,7 @@ void main() {
|
|||||||
hasEnabledState: true,
|
hasEnabledState: true,
|
||||||
isEnabled: true,
|
isEnabled: true,
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
hasFocusAction: true,
|
hasFocusAction: defaultTargetPlatform != TargetPlatform.iOS,
|
||||||
isFocusable: true,
|
isFocusable: true,
|
||||||
));
|
));
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
|
@ -284,6 +284,7 @@ void main() {
|
|||||||
isFocused: true,
|
isFocused: true,
|
||||||
value: '01/15/2016',
|
value: '01/15/2016',
|
||||||
hasTapAction: true,
|
hasTapAction: true,
|
||||||
|
hasFocusAction: true,
|
||||||
hasSetTextAction: true,
|
hasSetTextAction: true,
|
||||||
hasSetSelectionAction: true,
|
hasSetSelectionAction: true,
|
||||||
hasCopyAction: true,
|
hasCopyAction: true,
|
||||||
|
@ -205,7 +205,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
final bool isApple = defaultTargetPlatform == TargetPlatform.iOS ||
|
final bool isCupertino = defaultTargetPlatform == TargetPlatform.iOS ||
|
||||||
defaultTargetPlatform == TargetPlatform.macOS;
|
defaultTargetPlatform == TargetPlatform.macOS;
|
||||||
expect(
|
expect(
|
||||||
semantics,
|
semantics,
|
||||||
@ -217,11 +217,11 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
SemanticsFlag.isChecked,
|
SemanticsFlag.isChecked,
|
||||||
if (isApple) SemanticsFlag.isSelected,
|
if (isCupertino) SemanticsFlag.isSelected,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
SemanticsAction.focus,
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -630,6 +630,8 @@ void main() {
|
|||||||
final bool isDesktop = debugDefaultTargetPlatformOverride == TargetPlatform.macOS ||
|
final bool isDesktop = debugDefaultTargetPlatformOverride == TargetPlatform.macOS ||
|
||||||
debugDefaultTargetPlatformOverride == TargetPlatform.windows ||
|
debugDefaultTargetPlatformOverride == TargetPlatform.windows ||
|
||||||
debugDefaultTargetPlatformOverride == TargetPlatform.linux;
|
debugDefaultTargetPlatformOverride == TargetPlatform.linux;
|
||||||
|
final bool isCupertino = debugDefaultTargetPlatformOverride == TargetPlatform.iOS ||
|
||||||
|
debugDefaultTargetPlatformOverride == TargetPlatform.macOS;
|
||||||
return TestSemantics.root(
|
return TestSemantics.root(
|
||||||
children: <TestSemantics>[
|
children: <TestSemantics>[
|
||||||
TestSemantics(
|
TestSemantics(
|
||||||
@ -662,7 +664,10 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
|
],
|
||||||
tooltip: 'Back',
|
tooltip: 'Back',
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -674,8 +679,7 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocused,
|
SemanticsFlag.isFocused,
|
||||||
SemanticsFlag.isHeader,
|
SemanticsFlag.isHeader,
|
||||||
if (debugDefaultTargetPlatformOverride != TargetPlatform.iOS &&
|
if (!isCupertino) SemanticsFlag.namesRoute,
|
||||||
debugDefaultTargetPlatformOverride != TargetPlatform.macOS) SemanticsFlag.namesRoute,
|
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
@ -683,6 +687,7 @@ void main() {
|
|||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
SemanticsAction.didLoseAccessibilityFocus,
|
SemanticsAction.didLoseAccessibilityFocus,
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
SemanticsAction.setText,
|
SemanticsAction.setText,
|
||||||
SemanticsAction.paste,
|
SemanticsAction.paste,
|
||||||
@ -718,7 +723,10 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
|
],
|
||||||
label: 'Suggestions',
|
label: 'Suggestions',
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -783,6 +791,8 @@ void main() {
|
|||||||
final bool isDesktop = debugDefaultTargetPlatformOverride == TargetPlatform.macOS ||
|
final bool isDesktop = debugDefaultTargetPlatformOverride == TargetPlatform.macOS ||
|
||||||
debugDefaultTargetPlatformOverride == TargetPlatform.windows ||
|
debugDefaultTargetPlatformOverride == TargetPlatform.windows ||
|
||||||
debugDefaultTargetPlatformOverride == TargetPlatform.linux;
|
debugDefaultTargetPlatformOverride == TargetPlatform.linux;
|
||||||
|
final bool isCupertino = debugDefaultTargetPlatformOverride == TargetPlatform.iOS ||
|
||||||
|
debugDefaultTargetPlatformOverride == TargetPlatform.macOS;
|
||||||
return TestSemantics.root(
|
return TestSemantics.root(
|
||||||
children: <TestSemantics>[
|
children: <TestSemantics>[
|
||||||
TestSemantics(
|
TestSemantics(
|
||||||
@ -812,7 +822,10 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
|
],
|
||||||
tooltip: 'Back',
|
tooltip: 'Back',
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -824,8 +837,7 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocused,
|
SemanticsFlag.isFocused,
|
||||||
SemanticsFlag.isHeader,
|
SemanticsFlag.isHeader,
|
||||||
if (debugDefaultTargetPlatformOverride != TargetPlatform.iOS &&
|
if (!isCupertino) SemanticsFlag.namesRoute,
|
||||||
debugDefaultTargetPlatformOverride != TargetPlatform.macOS) SemanticsFlag.namesRoute,
|
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
@ -833,6 +845,7 @@ void main() {
|
|||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
SemanticsAction.didLoseAccessibilityFocus,
|
SemanticsAction.didLoseAccessibilityFocus,
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
SemanticsAction.setText,
|
SemanticsAction.setText,
|
||||||
SemanticsAction.paste,
|
SemanticsAction.paste,
|
||||||
@ -856,7 +869,10 @@ void main() {
|
|||||||
SemanticsFlag.isEnabled,
|
SemanticsFlag.isEnabled,
|
||||||
SemanticsFlag.isFocusable,
|
SemanticsFlag.isFocusable,
|
||||||
],
|
],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
|
],
|
||||||
label: 'Suggestions',
|
label: 'Suggestions',
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
|
@ -1454,7 +1454,10 @@ void main() {
|
|||||||
TestSemantics(
|
TestSemantics(
|
||||||
id: 4,
|
id: 4,
|
||||||
flags: <SemanticsFlag>[SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled, SemanticsFlag.isFocusable, SemanticsFlag.isSlider],
|
flags: <SemanticsFlag>[SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled, SemanticsFlag.isFocusable, SemanticsFlag.isSlider],
|
||||||
actions: <SemanticsAction>[SemanticsAction.focus, SemanticsAction.increase, SemanticsAction.decrease],
|
actions: <SemanticsAction>[
|
||||||
|
if (defaultTargetPlatform != TargetPlatform.iOS) SemanticsAction.focus,
|
||||||
|
SemanticsAction.increase, SemanticsAction.decrease,
|
||||||
|
],
|
||||||
value: '50%',
|
value: '50%',
|
||||||
increasedValue: '60%',
|
increasedValue: '60%',
|
||||||
decreasedValue: '40%',
|
decreasedValue: '40%',
|
||||||
|
@ -749,6 +749,7 @@ void main() {
|
|||||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.didGainAccessibilityFocus,
|
SemanticsAction.didGainAccessibilityFocus,
|
||||||
SemanticsAction.didLoseAccessibilityFocus,
|
SemanticsAction.didLoseAccessibilityFocus,
|
||||||
],
|
],
|
||||||
@ -2042,6 +2043,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
SemanticsAction.paste,
|
SemanticsAction.paste,
|
||||||
@ -5576,6 +5578,7 @@ void main() {
|
|||||||
value: 'some text',
|
value: 'some text',
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8410,6 +8413,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8431,6 +8435,7 @@ void main() {
|
|||||||
value: 'Guten Tag',
|
value: 'Guten Tag',
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8453,6 +8458,7 @@ void main() {
|
|||||||
textSelection: const TextSelection.collapsed(offset: 9),
|
textSelection: const TextSelection.collapsed(offset: 9),
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8481,6 +8487,7 @@ void main() {
|
|||||||
value: 'Guten Tag',
|
value: 'Guten Tag',
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorForwardByCharacter,
|
SemanticsAction.moveCursorForwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
@ -8512,6 +8519,7 @@ void main() {
|
|||||||
value: 'Schönen Feierabend',
|
value: 'Schönen Feierabend',
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorForwardByCharacter,
|
SemanticsAction.moveCursorForwardByCharacter,
|
||||||
SemanticsAction.moveCursorForwardByWord,
|
SemanticsAction.moveCursorForwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8543,7 +8551,10 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
semantics,
|
semantics,
|
||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8560,7 +8571,10 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
semantics,
|
semantics,
|
||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8577,7 +8591,10 @@ void main() {
|
|||||||
expect(
|
expect(
|
||||||
semantics,
|
semantics,
|
||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8616,6 +8633,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.setText,
|
SemanticsAction.setText,
|
||||||
// Absent the following because enableInteractiveSelection: false
|
// Absent the following because enableInteractiveSelection: false
|
||||||
// SemanticsAction.moveCursorBackwardByCharacter,
|
// SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
@ -8659,6 +8677,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -8682,6 +8701,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8710,6 +8730,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorForwardByCharacter,
|
SemanticsAction.moveCursorForwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
@ -8765,6 +8786,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8813,6 +8835,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8862,7 +8885,7 @@ void main() {
|
|||||||
TestSemantics(
|
TestSemantics(
|
||||||
id: inputFieldId,
|
id: inputFieldId,
|
||||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||||
value: textInTextField,
|
value: textInTextField,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -8887,6 +8910,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -8937,7 +8961,7 @@ void main() {
|
|||||||
TestSemantics(
|
TestSemantics(
|
||||||
id: inputFieldId,
|
id: inputFieldId,
|
||||||
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.hasEnabledState, SemanticsFlag.isEnabled],
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||||
value: textInTextField,
|
value: textInTextField,
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
),
|
),
|
||||||
@ -8962,6 +8986,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.moveCursorBackwardByCharacter,
|
SemanticsAction.moveCursorBackwardByCharacter,
|
||||||
SemanticsAction.moveCursorBackwardByWord,
|
SemanticsAction.moveCursorBackwardByWord,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
@ -9135,6 +9160,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -9169,6 +9195,7 @@ void main() {
|
|||||||
textSelection: const TextSelection(baseOffset: 0, extentOffset: 0),
|
textSelection: const TextSelection(baseOffset: 0, extentOffset: 0),
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
SemanticsAction.setSelection,
|
SemanticsAction.setSelection,
|
||||||
SemanticsAction.setText,
|
SemanticsAction.setText,
|
||||||
SemanticsAction.paste,
|
SemanticsAction.paste,
|
||||||
@ -9231,6 +9258,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -9280,6 +9308,7 @@ void main() {
|
|||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
actions: <SemanticsAction>[
|
actions: <SemanticsAction>[
|
||||||
SemanticsAction.tap,
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
],
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
@ -18392,8 +18421,7 @@ void main() {
|
|||||||
SemanticsAction.didGainAccessibilityFocus,
|
SemanticsAction.didGainAccessibilityFocus,
|
||||||
if (defaultTargetPlatform == TargetPlatform.windows || defaultTargetPlatform == TargetPlatform.macOS || defaultTargetPlatform == TargetPlatform.linux)
|
if (defaultTargetPlatform == TargetPlatform.windows || defaultTargetPlatform == TargetPlatform.macOS || defaultTargetPlatform == TargetPlatform.linux)
|
||||||
SemanticsAction.didLoseAccessibilityFocus,
|
SemanticsAction.didLoseAccessibilityFocus,
|
||||||
// TODO(gspencergoog): also test for the presence of SemanticsAction.focus when
|
SemanticsAction.focus
|
||||||
// this iOS issue is addressed: https://github.com/flutter/flutter/issues/150030
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -1250,7 +1250,10 @@ void main() {
|
|||||||
semantics,
|
semantics,
|
||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
label: amString,
|
label: amString,
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isButton,
|
SemanticsFlag.isButton,
|
||||||
SemanticsFlag.isChecked,
|
SemanticsFlag.isChecked,
|
||||||
@ -1264,7 +1267,10 @@ void main() {
|
|||||||
semantics,
|
semantics,
|
||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
label: pmString,
|
label: pmString,
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isButton,
|
SemanticsFlag.isButton,
|
||||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||||
@ -1342,7 +1348,10 @@ void main() {
|
|||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
label: 'Hour',
|
label: 'Hour',
|
||||||
value: '07',
|
value: '07',
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
SemanticsFlag.hasEnabledState,
|
SemanticsFlag.hasEnabledState,
|
||||||
@ -1356,7 +1365,10 @@ void main() {
|
|||||||
includesNodeWith(
|
includesNodeWith(
|
||||||
label: 'Minute',
|
label: 'Minute',
|
||||||
value: '00',
|
value: '00',
|
||||||
actions: <SemanticsAction>[SemanticsAction.tap],
|
actions: <SemanticsAction>[
|
||||||
|
SemanticsAction.tap,
|
||||||
|
SemanticsAction.focus,
|
||||||
|
],
|
||||||
flags: <SemanticsFlag>[
|
flags: <SemanticsFlag>[
|
||||||
SemanticsFlag.isTextField,
|
SemanticsFlag.isTextField,
|
||||||
SemanticsFlag.hasEnabledState,
|
SemanticsFlag.hasEnabledState,
|
||||||
|
@ -269,10 +269,7 @@ class TestSemantics {
|
|||||||
final int actionsBitmask = actions is int
|
final int actionsBitmask = actions is int
|
||||||
? actions as int
|
? actions as int
|
||||||
: (actions as List<SemanticsAction>).fold<int>(0, (int bitmask, SemanticsAction action) => bitmask | action.index);
|
: (actions as List<SemanticsAction>).fold<int>(0, (int bitmask, SemanticsAction action) => bitmask | action.index);
|
||||||
// TODO(gspencergoog): Remove focus filter once customer tests have been
|
if (actionsBitmask != nodeData.actions) {
|
||||||
// updated with the proper actions information for focus.
|
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
if ((actionsBitmask & ~SemanticsAction.focus.index) != (nodeData.actions & ~SemanticsAction.focus.index)) {
|
|
||||||
return fail('expected node id $id to have actions $actions but found actions ${nodeData.actions}.');
|
return fail('expected node id $id to have actions $actions but found actions ${nodeData.actions}.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,14 +525,8 @@ class SemanticsTester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (actions != null) {
|
if (actions != null) {
|
||||||
// TODO(gspencergoog): Remove focus filter once customer tests have been
|
final int expectedActions = actions.fold<int>(0, (int value, SemanticsAction action) => value | action.index);
|
||||||
// updated with the proper actions information for focus.
|
final int actualActions = node.getSemanticsData().actions;
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
final List<SemanticsAction> nonFocusActions = actions.where(
|
|
||||||
(SemanticsAction action) => action != SemanticsAction.focus
|
|
||||||
).toList();
|
|
||||||
final int expectedActions = nonFocusActions.fold<int>(0, (int value, SemanticsAction action) => value | action.index);
|
|
||||||
final int actualActions = node.getSemanticsData().actions & ~SemanticsAction.focus.index;
|
|
||||||
if (expectedActions != actualActions) {
|
if (expectedActions != actualActions) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -657,14 +648,11 @@ class SemanticsTester {
|
|||||||
|
|
||||||
static String _actionsToSemanticsActionExpression(dynamic actions) {
|
static String _actionsToSemanticsActionExpression(dynamic actions) {
|
||||||
Iterable<SemanticsAction> list;
|
Iterable<SemanticsAction> list;
|
||||||
// TODO(gspencergoog): Remove focus filter once customer tests have been
|
|
||||||
// updated with the proper actions information for focus.
|
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
if (actions is int) {
|
if (actions is int) {
|
||||||
list = SemanticsAction.values
|
list = SemanticsAction.values
|
||||||
.where((SemanticsAction action) => action != SemanticsAction.focus && (action.index & actions) != 0);
|
.where((SemanticsAction action) => (action.index & actions) != 0);
|
||||||
} else {
|
} else {
|
||||||
list = (actions as List<SemanticsAction>).where((SemanticsAction action) => action != SemanticsAction.focus);
|
list = actions as List<SemanticsAction>;
|
||||||
}
|
}
|
||||||
return '<SemanticsAction>[${list.join(', ')}]';
|
return '<SemanticsAction>[${list.join(', ')}]';
|
||||||
}
|
}
|
||||||
@ -887,10 +875,7 @@ class _IncludesNodeWith extends Matcher {
|
|||||||
if (value != null) 'value "$value"',
|
if (value != null) 'value "$value"',
|
||||||
if (hint != null) 'hint "$hint"',
|
if (hint != null) 'hint "$hint"',
|
||||||
if (textDirection != null) ' (${textDirection!.name})',
|
if (textDirection != null) ' (${textDirection!.name})',
|
||||||
// TODO(gspencergoog): Remove focus filter once customer tests have been
|
if (actions != null) 'actions "${actions!.join(', ')}"',
|
||||||
// updated with the proper actions information for focus.
|
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
if (actions != null) 'actions "${actions!.where((SemanticsAction action) => action != SemanticsAction.focus).join(', ')}"',
|
|
||||||
if (flags != null) 'flags "${flags!.join(', ')}"',
|
if (flags != null) 'flags "${flags!.join(', ')}"',
|
||||||
if (tags != null) 'tags "${tags!.join(', ')}"',
|
if (tags != null) 'tags "${tags!.join(', ')}"',
|
||||||
if (scrollPosition != null) 'scrollPosition "$scrollPosition"',
|
if (scrollPosition != null) 'scrollPosition "$scrollPosition"',
|
||||||
|
@ -2266,10 +2266,6 @@ class _MatchesSemanticsData extends Matcher {
|
|||||||
required bool? isExpanded,
|
required bool? isExpanded,
|
||||||
// Actions
|
// Actions
|
||||||
required bool? hasTapAction,
|
required bool? hasTapAction,
|
||||||
// TODO(gspencergoog): Once this has landed, and customer tests have been
|
|
||||||
// updated, remove the ignore below.
|
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
// ignore: avoid_unused_constructor_parameters
|
|
||||||
required bool? hasFocusAction,
|
required bool? hasFocusAction,
|
||||||
required bool? hasLongPressAction,
|
required bool? hasLongPressAction,
|
||||||
required bool? hasScrollLeftAction,
|
required bool? hasScrollLeftAction,
|
||||||
@ -2329,9 +2325,7 @@ class _MatchesSemanticsData extends Matcher {
|
|||||||
},
|
},
|
||||||
actions = <SemanticsAction, bool>{
|
actions = <SemanticsAction, bool>{
|
||||||
if (hasTapAction != null) SemanticsAction.tap: hasTapAction,
|
if (hasTapAction != null) SemanticsAction.tap: hasTapAction,
|
||||||
// TODO(gspencergoog): Once this has landed, and customer tests have
|
if (hasFocusAction != null) SemanticsAction.focus: hasFocusAction,
|
||||||
// been updated, add a line here that adds handling for
|
|
||||||
// hasFocusAction. https://github.com/flutter/flutter/issues/149842
|
|
||||||
if (hasLongPressAction != null) SemanticsAction.longPress: hasLongPressAction,
|
if (hasLongPressAction != null) SemanticsAction.longPress: hasLongPressAction,
|
||||||
if (hasScrollLeftAction != null) SemanticsAction.scrollLeft: hasScrollLeftAction,
|
if (hasScrollLeftAction != null) SemanticsAction.scrollLeft: hasScrollLeftAction,
|
||||||
if (hasScrollRightAction != null) SemanticsAction.scrollRight: hasScrollRightAction,
|
if (hasScrollRightAction != null) SemanticsAction.scrollRight: hasScrollRightAction,
|
||||||
@ -2429,19 +2423,12 @@ class _MatchesSemanticsData extends Matcher {
|
|||||||
if (tooltip != null) {
|
if (tooltip != null) {
|
||||||
description.add(' with tooltip: $tooltip');
|
description.add(' with tooltip: $tooltip');
|
||||||
}
|
}
|
||||||
// TODO(gspencergoog): Remove filter once customer tests have been updated
|
if (actions.isNotEmpty) {
|
||||||
// with the proper actions information for focus.
|
final List<SemanticsAction> expectedActions = actions.entries
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
final Map<ui.SemanticsAction, bool> nonFocusActions =
|
|
||||||
Map<ui.SemanticsAction, bool>.fromEntries(actions.entries.where(
|
|
||||||
(MapEntry<ui.SemanticsAction, bool> e) => e.key != SemanticsAction.focus
|
|
||||||
));
|
|
||||||
if (nonFocusActions.isNotEmpty) {
|
|
||||||
final List<SemanticsAction> expectedActions = nonFocusActions.entries
|
|
||||||
.where((MapEntry<ui.SemanticsAction, bool> e) => e.value)
|
.where((MapEntry<ui.SemanticsAction, bool> e) => e.value)
|
||||||
.map((MapEntry<ui.SemanticsAction, bool> e) => e.key)
|
.map((MapEntry<ui.SemanticsAction, bool> e) => e.key)
|
||||||
.toList();
|
.toList();
|
||||||
final List<SemanticsAction> notExpectedActions = nonFocusActions.entries
|
final List<SemanticsAction> notExpectedActions = actions.entries
|
||||||
.where((MapEntry<ui.SemanticsAction, bool> e) => !e.value)
|
.where((MapEntry<ui.SemanticsAction, bool> e) => !e.value)
|
||||||
.map((MapEntry<ui.SemanticsAction, bool> e) => e.key)
|
.map((MapEntry<ui.SemanticsAction, bool> e) => e.key)
|
||||||
.toList();
|
.toList();
|
||||||
@ -2620,17 +2607,10 @@ class _MatchesSemanticsData extends Matcher {
|
|||||||
if (maxValueLength != null && maxValueLength != data.maxValueLength) {
|
if (maxValueLength != null && maxValueLength != data.maxValueLength) {
|
||||||
return failWithDescription(matchState, 'maxValueLength was: ${data.maxValueLength}');
|
return failWithDescription(matchState, 'maxValueLength was: ${data.maxValueLength}');
|
||||||
}
|
}
|
||||||
// TODO(gspencergoog): Remove filter once customer tests have been updated
|
if (actions.isNotEmpty) {
|
||||||
// with the proper actions information for focus.
|
|
||||||
// https://github.com/flutter/flutter/issues/149842
|
|
||||||
final Map<ui.SemanticsAction, bool> nonFocusActions =
|
|
||||||
Map<ui.SemanticsAction, bool>.fromEntries(actions.entries.where(
|
|
||||||
(MapEntry<ui.SemanticsAction, bool> e) => e.key != SemanticsAction.focus
|
|
||||||
));
|
|
||||||
if (nonFocusActions.isNotEmpty) {
|
|
||||||
final List<SemanticsAction> unexpectedActions = <SemanticsAction>[];
|
final List<SemanticsAction> unexpectedActions = <SemanticsAction>[];
|
||||||
final List<SemanticsAction> missingActions = <SemanticsAction>[];
|
final List<SemanticsAction> missingActions = <SemanticsAction>[];
|
||||||
for (final MapEntry<ui.SemanticsAction, bool> actionEntry in nonFocusActions.entries) {
|
for (final MapEntry<ui.SemanticsAction, bool> actionEntry in actions.entries) {
|
||||||
final ui.SemanticsAction action = actionEntry.key;
|
final ui.SemanticsAction action = actionEntry.key;
|
||||||
final bool actionExpected = actionEntry.value;
|
final bool actionExpected = actionEntry.value;
|
||||||
final bool actionPresent = (action.index & data.actions) == action.index;
|
final bool actionPresent = (action.index & data.actions) == action.index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user