mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
all selectable widgets set the hasSelectedState flag (#157191)
Set the `hasSelectedState` flag in all selectable widgets. This happens automatically because only selectable widgets have `Semantics.selected` set to a non-null value. When the value is propagated to `SemanticsConfiguration.isSelected`, it sets both `hasSelectedState` to true and `isSelected` as appropriate. More progress towards https://github.com/flutter/flutter/issues/66673
This commit is contained in:
parent
9a41f11610
commit
cd0aa2b537
@ -4672,6 +4672,7 @@ class SemanticsConfiguration {
|
||||
/// in which case it will not be flagged as selected.
|
||||
bool get isSelected => _hasFlag(SemanticsFlag.isSelected);
|
||||
set isSelected(bool value) {
|
||||
_setFlag(SemanticsFlag.hasSelectedState, true);
|
||||
_setFlag(SemanticsFlag.isSelected, value);
|
||||
}
|
||||
|
||||
|
||||
@ -513,7 +513,7 @@ Future<void> main() async {
|
||||
expect(semantics, includesNodeWith(
|
||||
label: 'Tab 1',
|
||||
hint: 'Tab 1 of 2',
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isSelected],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
textDirection: TextDirection.ltr,
|
||||
));
|
||||
|
||||
|
||||
@ -150,6 +150,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.isChecked,
|
||||
if (isApple) SemanticsFlag.hasSelectedState,
|
||||
if (isApple) SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
|
||||
@ -829,6 +829,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
@ -840,6 +841,8 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
// Declares that it is selectable, but not currently selected.
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
@ -866,6 +869,8 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
// Declares that it is selectable, but not currently selected.
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
@ -876,6 +881,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
|
||||
@ -960,6 +960,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
@ -971,6 +972,8 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
// Declares that it is selectable, but not currently selected.
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
@ -997,6 +1000,8 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
// Declares that it is selectable, but not currently selected.
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
SemanticsAction.tap,
|
||||
@ -1007,6 +1012,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
|
||||
@ -2765,8 +2765,9 @@ void main() {
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'A\nTab 1 of 2',
|
||||
@ -2776,6 +2777,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'B\nTab 2 of 2',
|
||||
|
||||
@ -2839,6 +2839,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
],
|
||||
@ -2888,6 +2889,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
],
|
||||
@ -2948,6 +2950,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
@ -3006,6 +3009,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
@ -3062,6 +3066,7 @@ void main() {
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
@ -3113,6 +3118,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
],
|
||||
@ -3163,7 +3169,10 @@ void main() {
|
||||
TestSemantics(
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[], // Must not be a button when tapping is disabled.
|
||||
// Must not be a button when tapping is disabled.
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState
|
||||
],
|
||||
actions: <SemanticsAction>[],
|
||||
),
|
||||
],
|
||||
@ -3213,6 +3222,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
@ -3265,6 +3275,7 @@ void main() {
|
||||
label: 'test',
|
||||
textDirection: TextDirection.ltr,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isButton,
|
||||
],
|
||||
|
||||
@ -703,6 +703,7 @@ void main() {
|
||||
SemanticsFlag.isButton,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
label: 'link',
|
||||
|
||||
@ -299,6 +299,7 @@ void main() {
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
label: 'one',
|
||||
),
|
||||
@ -308,21 +309,24 @@ void main() {
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'two',
|
||||
),
|
||||
TestSemantics.rootChild(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
label: 'three',
|
||||
),
|
||||
TestSemantics.rootChild(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
label: 'four',
|
||||
),
|
||||
|
||||
@ -5999,6 +5999,7 @@ TestSemantics _expectedSemantics() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
@ -6007,19 +6008,19 @@ TestSemantics _expectedSemantics() {
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable, SemanticsFlag.hasSelectedState],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Def\nTab 2 of 4',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable, SemanticsFlag.hasSelectedState],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Ghi\nTab 3 of 4',
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
TestSemantics(
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable, SemanticsFlag.hasSelectedState],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Jkl\nTab 4 of 4',
|
||||
textDirection: TextDirection.ltr,
|
||||
|
||||
@ -412,6 +412,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Title',
|
||||
@ -451,6 +452,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Title',
|
||||
@ -487,6 +489,7 @@ void main() {
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.focus],
|
||||
label: 'Title',
|
||||
@ -524,6 +527,7 @@ void main() {
|
||||
SemanticsFlag.isChecked,
|
||||
SemanticsFlag.hasEnabledState,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
label: 'Title',
|
||||
textDirection: TextDirection.ltr,
|
||||
|
||||
@ -217,6 +217,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.isChecked,
|
||||
if (isCupertino) SemanticsFlag.hasSelectedState,
|
||||
if (isCupertino) SemanticsFlag.isSelected,
|
||||
],
|
||||
actions: <SemanticsAction>[
|
||||
|
||||
@ -81,6 +81,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.isToggled,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: SemanticsAction.tap.index | SemanticsAction.focus.index,
|
||||
label: 'aaa\nAAA',
|
||||
@ -96,6 +97,7 @@ void main() {
|
||||
SemanticsFlag.isChecked,
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: SemanticsAction.tap.index | SemanticsAction.focus.index,
|
||||
label: 'bbb\nBBB',
|
||||
@ -111,6 +113,7 @@ void main() {
|
||||
SemanticsFlag.isEnabled,
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.isInMutuallyExclusiveGroup,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
actions: SemanticsAction.tap.index | SemanticsAction.focus.index,
|
||||
label: 'CCC\nccc',
|
||||
|
||||
@ -3615,6 +3615,7 @@ void main() {
|
||||
id: 4,
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
@ -3624,7 +3625,10 @@ void main() {
|
||||
),
|
||||
TestSemantics(
|
||||
id: 5,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'TAB #1\nTab 2 of 2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||
@ -3672,7 +3676,7 @@ void main() {
|
||||
const String tab0title = 'This is a very wide tab #0\nTab 1 of 20';
|
||||
const String tab10title = 'This is a very wide tab #10\nTab 11 of 20';
|
||||
|
||||
const List<SemanticsFlag> hiddenFlags = <SemanticsFlag>[SemanticsFlag.isHidden, SemanticsFlag.isFocusable];
|
||||
const List<SemanticsFlag> hiddenFlags = <SemanticsFlag>[SemanticsFlag.isHidden, SemanticsFlag.isFocusable, SemanticsFlag.hasSelectedState];
|
||||
expect(semantics, includesNodeWith(actions: <SemanticsAction>[SemanticsAction.scrollLeft]));
|
||||
expect(semantics, includesNodeWith(label: tab0title));
|
||||
expect(semantics, includesNodeWith(label: tab10title, flags: hiddenFlags));
|
||||
@ -3881,6 +3885,7 @@ void main() {
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
@ -3891,7 +3896,10 @@ void main() {
|
||||
),
|
||||
TestSemantics(
|
||||
id: 5,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isFocusable,
|
||||
],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
label: 'Semantics override 1\nTab 2 of 2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||
@ -5670,14 +5678,21 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
label: 'TAB1\nTab 1 of 2',
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable, SemanticsFlag.isSelected],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
id: 2,
|
||||
rect: TestSemantics.fullScreen,
|
||||
actions: 1 | SemanticsAction.focus.index,
|
||||
),
|
||||
TestSemantics(
|
||||
label: 'TAB2\nTab 2 of 2',
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isFocusable],
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.isFocusable,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
],
|
||||
id: 3,
|
||||
rect: TestSemantics.fullScreen,
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.focus],
|
||||
|
||||
@ -730,7 +730,7 @@ void main() {
|
||||
' merge boundary ⛔️\n'
|
||||
' Rect.fromLTRB(60.0, 20.0, 80.0, 50.0)\n'
|
||||
' actions: longPress, scrollUp, showOnScreen\n'
|
||||
' flags: hasCheckedState, isSelected, isButton\n'
|
||||
' flags: hasCheckedState, hasSelectedState, isSelected, isButton\n'
|
||||
' label: "Use all the properties"\n'
|
||||
' textDirection: rtl\n'
|
||||
' sortKey: OrdinalSortKey#19df5(order: 1.0)\n',
|
||||
@ -738,7 +738,12 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
allProperties.getSemanticsData().toString(),
|
||||
'SemanticsData(Rect.fromLTRB(50.0, 10.0, 70.0, 40.0), [1.0,0.0,0.0,10.0; 0.0,1.0,0.0,10.0; 0.0,0.0,1.0,0.0; 0.0,0.0,0.0,1.0], actions: [longPress, scrollUp, showOnScreen], flags: [hasCheckedState, isSelected, isButton], label: "Use all the properties", textDirection: rtl)',
|
||||
'SemanticsData('
|
||||
'Rect.fromLTRB(50.0, 10.0, 70.0, 40.0), '
|
||||
'[1.0,0.0,0.0,10.0; 0.0,1.0,0.0,10.0; 0.0,0.0,1.0,0.0; 0.0,0.0,0.0,1.0], '
|
||||
'actions: [longPress, scrollUp, showOnScreen], '
|
||||
'flags: [hasCheckedState, hasSelectedState, isSelected, isButton], '
|
||||
'label: "Use all the properties", textDirection: rtl)',
|
||||
);
|
||||
|
||||
final SemanticsNode scaled = SemanticsNode()
|
||||
|
||||
@ -200,7 +200,7 @@ void _defineTests() {
|
||||
TestSemantics(
|
||||
rect: const Rect.fromLTRB(1.0, 2.0, 3.0, 4.0),
|
||||
id: 2,
|
||||
flags: 1,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.hasSelectedState],
|
||||
label: 'label-before',
|
||||
value: 'value-before',
|
||||
increasedValue: 'increase-before',
|
||||
@ -253,7 +253,13 @@ void _defineTests() {
|
||||
rect: const Rect.fromLTRB(5.0, 6.0, 7.0, 8.0),
|
||||
actions: 255,
|
||||
id: 2,
|
||||
flags: 15,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasCheckedState,
|
||||
SemanticsFlag.isChecked,
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
SemanticsFlag.isButton,
|
||||
],
|
||||
label: 'label-after',
|
||||
value: 'value-after',
|
||||
increasedValue: 'increase-after',
|
||||
@ -524,11 +530,7 @@ void _defineTests() {
|
||||
);
|
||||
expect(semantics, hasSemantics(expectedSemantics, ignoreRect: true, ignoreTransform: true));
|
||||
semantics.dispose();
|
||||
}, skip: true); // TODO(yjbanov): https://github.com/flutter/flutter/issues/66673
|
||||
// Skipped temporarily to allow https://github.com/flutter/engine/pull/55780
|
||||
// to roll into the framework, which introduces a new flag. Because this
|
||||
// test enumerates all flags, the new flag breaks it. This test will need
|
||||
// to be updated after the roll.
|
||||
});
|
||||
|
||||
group('diffing', () {
|
||||
testWidgets('complains about duplicate keys', (WidgetTester tester) async {
|
||||
|
||||
@ -227,17 +227,17 @@ void main() {
|
||||
children: <TestSemantics>[
|
||||
TestSemantics(
|
||||
id: 2,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
label: 'node 1',
|
||||
),
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
label: 'node 2',
|
||||
),
|
||||
TestSemantics(
|
||||
id: 4,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
label: 'node 3',
|
||||
),
|
||||
],
|
||||
|
||||
@ -31,7 +31,7 @@ void main() {
|
||||
id: 1,
|
||||
label: 'test1',
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
)));
|
||||
@ -72,7 +72,7 @@ void main() {
|
||||
id: 1,
|
||||
label: 'child1',
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
)));
|
||||
@ -118,13 +118,13 @@ void main() {
|
||||
id: 2,
|
||||
label: 'child1',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
label: 'child2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -167,7 +167,7 @@ void main() {
|
||||
id: 1,
|
||||
label: 'child1',
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
)));
|
||||
@ -213,13 +213,13 @@ void main() {
|
||||
id: 4,
|
||||
label: 'child1',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
label: 'child2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -57,13 +57,13 @@ void main() {
|
||||
id: 2,
|
||||
label: 'child1',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
label: 'child2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -106,7 +106,7 @@ void main() {
|
||||
id: 1,
|
||||
label: 'child1',
|
||||
rect: TestSemantics.fullScreen,
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
)));
|
||||
@ -152,13 +152,13 @@ void main() {
|
||||
id: 4,
|
||||
label: 'child1',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
TestSemantics(
|
||||
id: 3,
|
||||
label: 'child2',
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
|
||||
flags: SemanticsFlag.isSelected.index,
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -152,6 +152,7 @@ void main() {
|
||||
TestSemantics.rootChild(
|
||||
id: 1,
|
||||
flags: <SemanticsFlag>[
|
||||
SemanticsFlag.hasSelectedState,
|
||||
SemanticsFlag.isSelected,
|
||||
],
|
||||
label: 'test1\ntest2',
|
||||
|
||||
@ -710,11 +710,7 @@ void main() {
|
||||
],
|
||||
);
|
||||
expect(semantics, hasSemantics(expectedSemantics, ignoreId: true));
|
||||
}, skip: true); // TODO(yjbanov): https://github.com/flutter/flutter/issues/66673
|
||||
// Skipped temporarily to allow https://github.com/flutter/engine/pull/55780
|
||||
// to roll into the framework, which introduces a new flag. Because this
|
||||
// test enumerates all flags, the new flag breaks it. This test will need
|
||||
// to be updated after the roll.
|
||||
});
|
||||
|
||||
testWidgets('Actions can be replaced without triggering semantics update', (WidgetTester tester) async {
|
||||
final SemanticsTester semantics = SemanticsTester(tester);
|
||||
|
||||
@ -132,7 +132,7 @@ void _tests() {
|
||||
TestSemantics(
|
||||
id: 6,
|
||||
tags: <SemanticsTag>[const SemanticsTag('RenderViewport.twoPane')],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.isSelected],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease],
|
||||
label: '\u202aInteractive text\u202c',
|
||||
value: 'test-value',
|
||||
|
||||
@ -24,7 +24,7 @@ void main() {
|
||||
TestSemantics(
|
||||
id: 1,
|
||||
rect: const Rect.fromLTRB(0.0, 0.0, 800.0, 600.0),
|
||||
flags: <SemanticsFlag>[SemanticsFlag.isSelected],
|
||||
flags: <SemanticsFlag>[SemanticsFlag.hasSelectedState, SemanticsFlag.isSelected],
|
||||
),
|
||||
],
|
||||
), ignoreTransform: true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user