Unverified Commit 24e3f705 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Rename SemanticsFlags to SemanticsFlag (#13994)

to align with `SemanticsAction` and other enum-like types.
parent 4d37e03e
6a724f0d3e22d41246baf3447d7ba2c9ff886765 16e365e7224f3d295f065e85df11060f011a74c5
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'dart:ui' show Offset, Rect, SemanticsAction, SemanticsFlags, import 'dart:ui' show Offset, Rect, SemanticsAction, SemanticsFlag,
TextDirection; TextDirection;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -106,7 +106,7 @@ class SemanticsData extends Diagnosticable { ...@@ -106,7 +106,7 @@ class SemanticsData extends Diagnosticable {
assert(increasedValue == '' || textDirection != null, 'A SemanticsData object with increasedValue "$increasedValue" had a null textDirection.'), assert(increasedValue == '' || textDirection != null, 'A SemanticsData object with increasedValue "$increasedValue" had a null textDirection.'),
assert(rect != null); assert(rect != null);
/// A bit field of [SemanticsFlags] that apply to this node. /// A bit field of [SemanticsFlag]s that apply to this node.
final int flags; final int flags;
/// A bit field of [SemanticsAction]s that apply to this node. /// A bit field of [SemanticsAction]s that apply to this node.
...@@ -157,7 +157,7 @@ class SemanticsData extends Diagnosticable { ...@@ -157,7 +157,7 @@ class SemanticsData extends Diagnosticable {
final Matrix4 transform; final Matrix4 transform;
/// Whether [flags] contains the given flag. /// Whether [flags] contains the given flag.
bool hasFlag(SemanticsFlags flag) => (flags & flag.index) != 0; bool hasFlag(SemanticsFlag flag) => (flags & flag.index) != 0;
/// Whether [actions] contains the given action. /// Whether [actions] contains the given action.
bool hasAction(SemanticsAction action) => (actions & action.index) != 0; bool hasAction(SemanticsAction action) => (actions & action.index) != 0;
...@@ -178,7 +178,7 @@ class SemanticsData extends Diagnosticable { ...@@ -178,7 +178,7 @@ class SemanticsData extends Diagnosticable {
properties.add(new IterableProperty<String>('actions', actionSummary, ifEmpty: null)); properties.add(new IterableProperty<String>('actions', actionSummary, ifEmpty: null));
final List<String> flagSummary = <String>[]; final List<String> flagSummary = <String>[];
for (SemanticsFlags flag in SemanticsFlags.values.values) { for (SemanticsFlag flag in SemanticsFlag.values.values) {
if ((flags & flag.index) != 0) if ((flags & flag.index) != 0)
flagSummary.add(describeEnum(flag)); flagSummary.add(describeEnum(flag));
} }
...@@ -856,7 +856,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -856,7 +856,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
int _flags = _kEmptyConfig._flags; int _flags = _kEmptyConfig._flags;
bool _hasFlag(SemanticsFlags flag) => _flags & flag.index != 0; bool _hasFlag(SemanticsFlag flag) => _flags & flag.index != 0;
/// A textual description of this node. /// A textual description of this node.
/// ///
...@@ -1089,14 +1089,14 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { ...@@ -1089,14 +1089,14 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
} }
final List<String> actions = _actions.keys.map((SemanticsAction action) => describeEnum(action)).toList()..sort(); final List<String> actions = _actions.keys.map((SemanticsAction action) => describeEnum(action)).toList()..sort();
properties.add(new IterableProperty<String>('actions', actions, ifEmpty: null)); properties.add(new IterableProperty<String>('actions', actions, ifEmpty: null));
if (_hasFlag(SemanticsFlags.hasEnabledState)) if (_hasFlag(SemanticsFlag.hasEnabledState))
properties.add(new FlagProperty('isEnabled', value: _hasFlag(SemanticsFlags.isEnabled), ifFalse: 'disabled')); properties.add(new FlagProperty('isEnabled', value: _hasFlag(SemanticsFlag.isEnabled), ifFalse: 'disabled'));
if (_hasFlag(SemanticsFlags.hasCheckedState)) if (_hasFlag(SemanticsFlag.hasCheckedState))
properties.add(new FlagProperty('isChecked', value: _hasFlag(SemanticsFlags.isChecked), ifTrue: 'checked', ifFalse: 'unchecked')); properties.add(new FlagProperty('isChecked', value: _hasFlag(SemanticsFlag.isChecked), ifTrue: 'checked', ifFalse: 'unchecked'));
properties.add(new FlagProperty('isSelected', value: _hasFlag(SemanticsFlags.isSelected), ifTrue: 'selected')); properties.add(new FlagProperty('isSelected', value: _hasFlag(SemanticsFlag.isSelected), ifTrue: 'selected'));
properties.add(new FlagProperty('isFocused', value: _hasFlag(SemanticsFlags.isFocused), ifTrue: 'focused')); properties.add(new FlagProperty('isFocused', value: _hasFlag(SemanticsFlag.isFocused), ifTrue: 'focused'));
properties.add(new FlagProperty('isButton', value: _hasFlag(SemanticsFlags.isButton), ifTrue: 'button')); properties.add(new FlagProperty('isButton', value: _hasFlag(SemanticsFlag.isButton), ifTrue: 'button'));
properties.add(new FlagProperty('isTextField', value: _hasFlag(SemanticsFlags.isTextField), ifTrue: 'textField')); properties.add(new FlagProperty('isTextField', value: _hasFlag(SemanticsFlag.isTextField), ifTrue: 'textField'));
properties.add(new StringProperty('label', _label, defaultValue: '')); properties.add(new StringProperty('label', _label, defaultValue: ''));
properties.add(new StringProperty('value', _value, defaultValue: '')); properties.add(new StringProperty('value', _value, defaultValue: ''));
properties.add(new StringProperty('increasedValue', _increasedValue, defaultValue: '')); properties.add(new StringProperty('increasedValue', _increasedValue, defaultValue: ''));
...@@ -1747,9 +1747,9 @@ class SemanticsConfiguration { ...@@ -1747,9 +1747,9 @@ class SemanticsConfiguration {
} }
/// Whether the owning [RenderObject] is selected (true) or not (false). /// Whether the owning [RenderObject] is selected (true) or not (false).
bool get isSelected => _hasFlag(SemanticsFlags.isSelected); bool get isSelected => _hasFlag(SemanticsFlag.isSelected);
set isSelected(bool value) { set isSelected(bool value) {
_setFlag(SemanticsFlags.isSelected, value); _setFlag(SemanticsFlag.isSelected, value);
} }
/// Whether the owning [RenderObject] is currently enabled. /// Whether the owning [RenderObject] is currently enabled.
...@@ -1763,10 +1763,10 @@ class SemanticsConfiguration { ...@@ -1763,10 +1763,10 @@ class SemanticsConfiguration {
/// ///
/// The getter will return null if the owning [RenderObject] doesn't support /// The getter will return null if the owning [RenderObject] doesn't support
/// the concept of being enabled/disabled. /// the concept of being enabled/disabled.
bool get isEnabled => _hasFlag(SemanticsFlags.hasEnabledState) ? _hasFlag(SemanticsFlags.isEnabled) : null; bool get isEnabled => _hasFlag(SemanticsFlag.hasEnabledState) ? _hasFlag(SemanticsFlag.isEnabled) : null;
set isEnabled(bool value) { set isEnabled(bool value) {
_setFlag(SemanticsFlags.hasEnabledState, true); _setFlag(SemanticsFlag.hasEnabledState, true);
_setFlag(SemanticsFlags.isEnabled, value); _setFlag(SemanticsFlag.isEnabled, value);
} }
/// If this node has Boolean state that can be controlled by the user, whether /// If this node has Boolean state that can be controlled by the user, whether
...@@ -1777,28 +1777,28 @@ class SemanticsConfiguration { ...@@ -1777,28 +1777,28 @@ class SemanticsConfiguration {
/// ///
/// The getter returns null if the owning [RenderObject] does not have /// The getter returns null if the owning [RenderObject] does not have
/// checked/unchecked state. /// checked/unchecked state.
bool get isChecked => _hasFlag(SemanticsFlags.hasCheckedState) ? _hasFlag(SemanticsFlags.isChecked) : null; bool get isChecked => _hasFlag(SemanticsFlag.hasCheckedState) ? _hasFlag(SemanticsFlag.isChecked) : null;
set isChecked(bool value) { set isChecked(bool value) {
_setFlag(SemanticsFlags.hasCheckedState, true); _setFlag(SemanticsFlag.hasCheckedState, true);
_setFlag(SemanticsFlags.isChecked, value); _setFlag(SemanticsFlag.isChecked, value);
} }
/// Whether the owning [RenderObject] currently holds the user's focus. /// Whether the owning [RenderObject] currently holds the user's focus.
bool get isFocused => _hasFlag(SemanticsFlags.isFocused); bool get isFocused => _hasFlag(SemanticsFlag.isFocused);
set isFocused(bool value) { set isFocused(bool value) {
_setFlag(SemanticsFlags.isFocused, value); _setFlag(SemanticsFlag.isFocused, value);
} }
/// Whether the owning [RenderObject] is a button (true) or not (false). /// Whether the owning [RenderObject] is a button (true) or not (false).
bool get isButton => _hasFlag(SemanticsFlags.isButton); bool get isButton => _hasFlag(SemanticsFlag.isButton);
set isButton(bool value) { set isButton(bool value) {
_setFlag(SemanticsFlags.isButton, value); _setFlag(SemanticsFlag.isButton, value);
} }
/// Whether the owning [RenderObject] is a text field. /// Whether the owning [RenderObject] is a text field.
bool get isTextField => _hasFlag(SemanticsFlags.isTextField); bool get isTextField => _hasFlag(SemanticsFlag.isTextField);
set isTextField(bool value) { set isTextField(bool value) {
_setFlag(SemanticsFlags.isTextField, value); _setFlag(SemanticsFlag.isTextField, value);
} }
// TAGS // TAGS
...@@ -1836,7 +1836,7 @@ class SemanticsConfiguration { ...@@ -1836,7 +1836,7 @@ class SemanticsConfiguration {
// INTERNAL FLAG MANAGEMENT // INTERNAL FLAG MANAGEMENT
int _flags = 0; int _flags = 0;
void _setFlag(SemanticsFlags flag, bool value) { void _setFlag(SemanticsFlag flag, bool value) {
if (value) { if (value) {
_flags |= flag.index; _flags |= flag.index;
} else { } else {
...@@ -1845,7 +1845,7 @@ class SemanticsConfiguration { ...@@ -1845,7 +1845,7 @@ class SemanticsConfiguration {
_hasBeenAnnotated = true; _hasBeenAnnotated = true;
} }
bool _hasFlag(SemanticsFlags flag) => (_flags & flag.index) != 0; bool _hasFlag(SemanticsFlag flag) => (_flags & flag.index) != 0;
// CONFIGURATION COMBINATION LOGIC // CONFIGURATION COMBINATION LOGIC
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'dart:ui' as ui show window; import 'dart:ui' as ui show window;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -200,8 +200,8 @@ String _getMessage(SemanticsNode node) { ...@@ -200,8 +200,8 @@ String _getMessage(SemanticsNode node) {
final List<String> annotations = <String>[]; final List<String> annotations = <String>[];
bool wantsTap = false; bool wantsTap = false;
if (data.hasFlag(SemanticsFlags.hasCheckedState)) { if (data.hasFlag(SemanticsFlag.hasCheckedState)) {
annotations.add(data.hasFlag(SemanticsFlags.isChecked) ? 'checked' : 'unchecked'); annotations.add(data.hasFlag(SemanticsFlag.isChecked) ? 'checked' : 'unchecked');
wantsTap = true; wantsTap = true;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
...@@ -189,7 +189,7 @@ void main() { ...@@ -189,7 +189,7 @@ void main() {
new TestSemantics.rootChild( new TestSemantics.rootChild(
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
label: 'ABC', label: 'ABC',
flags: SemanticsFlags.isButton.index, flags: SemanticsFlag.isButton.index,
) )
], ],
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
label: 'ABC', label: 'ABC',
rect: new Rect.fromLTRB(0.0, 0.0, 88.0, 36.0), rect: new Rect.fromLTRB(0.0, 0.0, 88.0, 36.0),
transform: new Matrix4.translationValues(356.0, 282.0, 0.0), transform: new Matrix4.translationValues(356.0, 282.0, 0.0),
flags: SemanticsFlags.isButton.index, flags: SemanticsFlag.isButton.index,
) )
], ],
), ),
...@@ -71,7 +71,7 @@ void main() { ...@@ -71,7 +71,7 @@ void main() {
label: 'ABC', label: 'ABC',
rect: new Rect.fromLTRB(0.0, 0.0, 88.0, 36.0), rect: new Rect.fromLTRB(0.0, 0.0, 88.0, 36.0),
transform: new Matrix4.translationValues(356.0, 282.0, 0.0), transform: new Matrix4.translationValues(356.0, 282.0, 0.0),
flags: SemanticsFlags.isButton.index, flags: SemanticsFlag.isButton.index,
) )
] ]
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -49,7 +49,7 @@ void main() { ...@@ -49,7 +49,7 @@ void main() {
label: 'Button', label: 'Button',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
flags: SemanticsFlags.isButton.index, flags: SemanticsFlag.isButton.index,
), ),
], ],
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -101,11 +101,11 @@ void main() { ...@@ -101,11 +101,11 @@ void main() {
id: 1, id: 1,
rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0), rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: null, transform: null,
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.hasCheckedState, SemanticsFlag.hasCheckedState,
SemanticsFlags.isChecked, SemanticsFlag.isChecked,
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
SemanticsFlags.isEnabled SemanticsFlag.isEnabled
], ],
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
label: 'aaa\nAAA', label: 'aaa\nAAA',
...@@ -114,11 +114,11 @@ void main() { ...@@ -114,11 +114,11 @@ void main() {
id: 4, id: 4,
rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0), rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: new Matrix4.translationValues(0.0, 56.0, 0.0), transform: new Matrix4.translationValues(0.0, 56.0, 0.0),
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.hasCheckedState, SemanticsFlag.hasCheckedState,
SemanticsFlags.isChecked, SemanticsFlag.isChecked,
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
SemanticsFlags.isEnabled SemanticsFlag.isEnabled
], ],
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
label: 'bbb\nBBB', label: 'bbb\nBBB',
...@@ -127,10 +127,10 @@ void main() { ...@@ -127,10 +127,10 @@ void main() {
id: 7, id: 7,
rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0), rect: new Rect.fromLTWH(0.0, 0.0, 800.0, 56.0),
transform: new Matrix4.translationValues(0.0, 112.0, 0.0), transform: new Matrix4.translationValues(0.0, 112.0, 0.0),
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.hasCheckedState, SemanticsFlag.hasCheckedState,
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
SemanticsFlags.isEnabled SemanticsFlag.isEnabled
], ],
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
label: 'CCC\nccc', label: 'CCC\nccc',
......
...@@ -394,7 +394,7 @@ void _tests() { ...@@ -394,7 +394,7 @@ void _tests() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isSelected], flags: <SemanticsFlag>[SemanticsFlag.isSelected],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'Fri, Jan 15', label: r'Fri, Jan 15',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
...@@ -479,7 +479,7 @@ void _tests() { ...@@ -479,7 +479,7 @@ void _tests() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isSelected], flags: <SemanticsFlag>[SemanticsFlag.isSelected],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'15, Friday, January 15, 2016', label: r'15, Friday, January 15, 2016',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
...@@ -573,25 +573,25 @@ void _tests() { ...@@ -573,25 +573,25 @@ void _tests() {
], ],
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'Previous month December 2015', label: r'Previous month December 2015',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'Next month February 2016', label: r'Next month February 2016',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'CANCEL', label: r'CANCEL',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'OK', label: r'OK',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -292,7 +292,7 @@ void main() { ...@@ -292,7 +292,7 @@ void main() {
new TestSemantics.rootChild( new TestSemantics.rootChild(
rect: new Rect.fromLTRB(0.0, 0.0, 48.0, 48.0), rect: new Rect.fromLTRB(0.0, 0.0, 48.0, 48.0),
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
label: 'link', label: 'link',
) )
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -361,23 +361,23 @@ void main() { ...@@ -361,23 +361,23 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
label: 'one', label: 'one',
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
SemanticsFlags.isEnabled, SemanticsFlag.isEnabled,
], ],
), ),
new TestSemantics.rootChild( new TestSemantics.rootChild(
label: 'two', label: 'two',
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.isSelected, SemanticsFlag.isSelected,
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
SemanticsFlags.isEnabled, SemanticsFlag.isEnabled,
], ],
), ),
new TestSemantics.rootChild( new TestSemantics.rootChild(
label: 'three', label: 'three',
flags: <SemanticsFlags>[ flags: <SemanticsFlag>[
SemanticsFlags.hasEnabledState, SemanticsFlag.hasEnabledState,
], ],
), ),
] ]
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags, SemanticsAction; import 'dart:ui' show SemanticsFlag, SemanticsAction;
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -1214,7 +1214,7 @@ void main() { ...@@ -1214,7 +1214,7 @@ void main() {
new TestSemantics( new TestSemantics(
id: 2, id: 2,
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
label: 'TAB #0\nTab 1 of 2', label: 'TAB #0\nTab 1 of 2',
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight), rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
transform: new Matrix4.translationValues(0.0, 276.0, 0.0), transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
...@@ -1464,7 +1464,7 @@ void main() { ...@@ -1464,7 +1464,7 @@ void main() {
new TestSemantics( new TestSemantics(
id: 24, id: 24,
actions: SemanticsAction.tap.index, actions: SemanticsAction.tap.index,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
label: 'Semantics override 0\nTab 1 of 2', label: 'Semantics override 0\nTab 1 of 2',
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight), rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
transform: new Matrix4.translationValues(0.0, 276.0, 0.0), transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -1666,7 +1666,7 @@ void main() { ...@@ -1666,7 +1666,7 @@ void main() {
), ),
); );
expect(semantics, includesNodeWith(flags: <SemanticsFlags>[SemanticsFlags.isTextField])); expect(semantics, includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField]));
}); });
testWidgets('Caret works when maxLines is null', (WidgetTester tester) async { testWidgets('Caret works when maxLines is null', (WidgetTester tester) async {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -69,7 +69,7 @@ Future<Null> pumpTestWidget(WidgetTester tester, { ...@@ -69,7 +69,7 @@ Future<Null> pumpTestWidget(WidgetTester tester, {
void main() { void main() {
testWidgets('UserAccountsDrawerHeader test', (WidgetTester tester) async { testWidgets('UserAccountsDrawerHeader test', (WidgetTester tester) async {
await pumpTestWidget(tester); await pumpTestWidget(tester);
expect(find.text('A'), findsOneWidget); expect(find.text('A'), findsOneWidget);
expect(find.text('B'), findsOneWidget); expect(find.text('B'), findsOneWidget);
expect(find.text('C'), findsOneWidget); expect(find.text('C'), findsOneWidget);
...@@ -351,7 +351,7 @@ void main() { ...@@ -351,7 +351,7 @@ void main() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.isButton], flags: <SemanticsFlag>[SemanticsFlag.isButton],
actions: <SemanticsAction>[SemanticsAction.tap], actions: <SemanticsAction>[SemanticsAction.tap],
label: r'Show accounts', label: r'Show accounts',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -277,13 +277,13 @@ void main() { ...@@ -277,13 +277,13 @@ void main() {
), ),
); );
expect(semantics, includesNodeWith(flags: <SemanticsFlags>[SemanticsFlags.isTextField])); expect(semantics, includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField]));
await tester.tap(find.byType(EditableText)); await tester.tap(find.byType(EditableText));
await tester.idle(); await tester.idle();
await tester.pump(); await tester.pump();
expect(semantics, includesNodeWith(flags: <SemanticsFlags>[SemanticsFlags.isTextField, SemanticsFlags.isFocused])); expect(semantics, includesNodeWith(flags: <SemanticsFlag>[SemanticsFlag.isTextField, SemanticsFlag.isFocused]));
}); });
testWidgets('EditableText includes text as value in semantics', (WidgetTester tester) async { testWidgets('EditableText includes text as value in semantics', (WidgetTester tester) async {
...@@ -309,7 +309,7 @@ void main() { ...@@ -309,7 +309,7 @@ void main() {
); );
expect(semantics, includesNodeWith( expect(semantics, includesNodeWith(
flags: <SemanticsFlags>[SemanticsFlags.isTextField], flags: <SemanticsFlag>[SemanticsFlag.isTextField],
value: value1, value: value1,
)); ));
...@@ -319,7 +319,7 @@ void main() { ...@@ -319,7 +319,7 @@ void main() {
await tester.pump(); await tester.pump();
expect(semantics, includesNodeWith( expect(semantics, includesNodeWith(
flags: <SemanticsFlags>[SemanticsFlags.isTextField], flags: <SemanticsFlag>[SemanticsFlag.isTextField],
value: value2, value: value2,
)); ));
}); });
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -233,17 +233,17 @@ void main() { ...@@ -233,17 +233,17 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics( new TestSemantics(
id: 6, id: 6,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
label: 'node 1', label: 'node 1',
), ),
new TestSemantics( new TestSemantics(
id: 7, id: 7,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
label: 'node 2', label: 'node 2',
), ),
new TestSemantics( new TestSemantics(
id: 8, id: 8,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
label: 'node 3', label: 'node 3',
), ),
], ],
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -36,7 +36,7 @@ void main() { ...@@ -36,7 +36,7 @@ void main() {
id: 1, id: 1,
label: 'test1', label: 'test1',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
) )
] ]
))); )));
...@@ -78,7 +78,7 @@ void main() { ...@@ -78,7 +78,7 @@ void main() {
id: 1, id: 1,
label: 'child1', label: 'child1',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
) )
], ],
))); )));
...@@ -124,13 +124,13 @@ void main() { ...@@ -124,13 +124,13 @@ void main() {
id: 2, id: 2,
label: 'child1', label: 'child1',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
new TestSemantics( new TestSemantics(
id: 3, id: 3,
label: 'child2', label: 'child2',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
], ],
), ),
...@@ -174,7 +174,7 @@ void main() { ...@@ -174,7 +174,7 @@ void main() {
id: 1, id: 1,
label: 'child1', label: 'child1',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
) )
], ],
))); )));
...@@ -220,13 +220,13 @@ void main() { ...@@ -220,13 +220,13 @@ void main() {
id: 4, id: 4,
label: 'child1', label: 'child1',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
new TestSemantics( new TestSemantics(
id: 3, id: 3,
label: 'child2', label: 'child2',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
], ],
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -60,13 +60,13 @@ void main() { ...@@ -60,13 +60,13 @@ void main() {
id: 2, id: 2,
label: 'child1', label: 'child1',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
new TestSemantics( new TestSemantics(
id: 3, id: 3,
label: 'child2', label: 'child2',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
], ],
), ),
...@@ -110,7 +110,7 @@ void main() { ...@@ -110,7 +110,7 @@ void main() {
id: 1, id: 1,
label: 'child1', label: 'child1',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
) )
], ],
))); )));
...@@ -156,13 +156,13 @@ void main() { ...@@ -156,13 +156,13 @@ void main() {
id: 4, id: 4,
label: 'child1', label: 'child1',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
new TestSemantics( new TestSemantics(
id: 3, id: 3,
label: 'child2', label: 'child2',
rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0), rect: new Rect.fromLTRB(0.0, 0.0, 800.0, 10.0),
flags: SemanticsFlags.isSelected.index, flags: SemanticsFlag.isSelected.index,
), ),
], ],
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -37,7 +37,7 @@ void main() { ...@@ -37,7 +37,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: 'test', label: 'test',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
) )
...@@ -62,7 +62,7 @@ void main() { ...@@ -62,7 +62,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
] ]
...@@ -116,7 +116,7 @@ void main() { ...@@ -116,7 +116,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: 'test', label: 'test',
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
) )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -64,12 +64,12 @@ void main() { ...@@ -64,12 +64,12 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics( new TestSemantics(
id: 3, id: 3,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
new TestSemantics( new TestSemantics(
id: 4, id: 4,
flags: SemanticsFlags.hasCheckedState.index, flags: SemanticsFlag.hasCheckedState.index,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
] ]
...@@ -120,7 +120,7 @@ void main() { ...@@ -120,7 +120,7 @@ void main() {
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 2, id: 2,
label: 'L2', label: 'L2',
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
], ],
...@@ -160,7 +160,7 @@ void main() { ...@@ -160,7 +160,7 @@ void main() {
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 2, id: 2,
label: 'L2', label: 'L2',
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
], ],
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -56,14 +56,14 @@ void main() { ...@@ -56,14 +56,14 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: label, label: label,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
// IDs 2 and 3 are used up by the nodes that get merged in // IDs 2 and 3 are used up by the nodes that get merged in
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 4, id: 4,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: label, label: label,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
...@@ -112,14 +112,14 @@ void main() { ...@@ -112,14 +112,14 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: label, label: label,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
// IDs 2 and 3 are used up by the nodes that get merged in // IDs 2 and 3 are used up by the nodes that get merged in
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 4, id: 4,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: label, label: label,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -42,7 +42,7 @@ void main() { ...@@ -42,7 +42,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: 'label', label: 'label',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
...@@ -80,7 +80,7 @@ void main() { ...@@ -80,7 +80,7 @@ void main() {
children: <TestSemantics>[ children: <TestSemantics>[
new TestSemantics.rootChild( new TestSemantics.rootChild(
id: 1, id: 1,
flags: SemanticsFlags.hasCheckedState.index | SemanticsFlags.isChecked.index, flags: SemanticsFlag.hasCheckedState.index | SemanticsFlag.isChecked.index,
label: 'label', label: 'label',
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
rect: TestSemantics.fullScreen, rect: TestSemantics.fullScreen,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -46,7 +46,7 @@ class TestSemantics { ...@@ -46,7 +46,7 @@ class TestSemantics {
this.transform, this.transform,
this.children: const <TestSemantics>[], this.children: const <TestSemantics>[],
Iterable<SemanticsTag> tags, Iterable<SemanticsTag> tags,
}) : assert(flags is int || flags is List<SemanticsFlags>), }) : assert(flags is int || flags is List<SemanticsFlag>),
assert(actions is int || actions is List<SemanticsAction>), assert(actions is int || actions is List<SemanticsAction>),
assert(label != null), assert(label != null),
assert(value != null), assert(value != null),
...@@ -71,7 +71,7 @@ class TestSemantics { ...@@ -71,7 +71,7 @@ class TestSemantics {
this.children: const <TestSemantics>[], this.children: const <TestSemantics>[],
Iterable<SemanticsTag> tags, Iterable<SemanticsTag> tags,
}) : id = 0, }) : id = 0,
assert(flags is int || flags is List<SemanticsFlags>), assert(flags is int || flags is List<SemanticsFlag>),
assert(actions is int || actions is List<SemanticsAction>), assert(actions is int || actions is List<SemanticsAction>),
assert(label != null), assert(label != null),
assert(increasedValue != null), assert(increasedValue != null),
...@@ -105,7 +105,7 @@ class TestSemantics { ...@@ -105,7 +105,7 @@ class TestSemantics {
Matrix4 transform, Matrix4 transform,
this.children: const <TestSemantics>[], this.children: const <TestSemantics>[],
Iterable<SemanticsTag> tags, Iterable<SemanticsTag> tags,
}) : assert(flags is int || flags is List<SemanticsFlags>), }) : assert(flags is int || flags is List<SemanticsFlag>),
assert(actions is int || actions is List<SemanticsAction>), assert(actions is int || actions is List<SemanticsAction>),
assert(label != null), assert(label != null),
assert(value != null), assert(value != null),
...@@ -122,12 +122,12 @@ class TestSemantics { ...@@ -122,12 +122,12 @@ class TestSemantics {
/// they are created. /// they are created.
final int id; final int id;
/// The [SemanticsFlags] set on this node. /// The [SemanticsFlag]s set on this node.
/// ///
/// There are two ways to specify this property: as an `int` that encodes the /// There are two ways to specify this property: as an `int` that encodes the
/// flags as a bit field, or as a `List<SemanticsFlags>` that are _on_. /// flags as a bit field, or as a `List<SemanticsFlag>` that are _on_.
/// ///
/// Using `List<SemanticsFlags>` is recommended due to better readability. /// Using `List<SemanticsFlag>` is recommended due to better readability.
final dynamic flags; final dynamic flags;
/// The [SemanticsAction]s set on this node. /// The [SemanticsAction]s set on this node.
...@@ -223,7 +223,7 @@ class TestSemantics { ...@@ -223,7 +223,7 @@ class TestSemantics {
final int flagsBitmask = flags is int final int flagsBitmask = flags is int
? flags ? flags
: flags.fold<int>(0, (int bitmask, SemanticsFlags flag) => bitmask | flag.index); : flags.fold<int>(0, (int bitmask, SemanticsFlag flag) => bitmask | flag.index);
if (flagsBitmask != nodeData.flags) if (flagsBitmask != nodeData.flags)
return fail('expected node id $id to have flags $flags but found flags ${nodeData.flags}.'); return fail('expected node id $id to have flags $flags but found flags ${nodeData.flags}.');
...@@ -277,8 +277,8 @@ class TestSemantics { ...@@ -277,8 +277,8 @@ class TestSemantics {
buf.writeln('${indent}new $runtimeType('); buf.writeln('${indent}new $runtimeType(');
if (id != null) if (id != null)
buf.writeln('$indent id: $id,'); buf.writeln('$indent id: $id,');
if (flags is int && flags != 0 || flags is List<SemanticsFlags> && flags.isNotEmpty) if (flags is int && flags != 0 || flags is List<SemanticsFlag> && flags.isNotEmpty)
buf.writeln('$indent flags: ${SemanticsTester._flagsToSemanticsFlagsExpression(flags)},'); buf.writeln('$indent flags: ${SemanticsTester._flagsToSemanticsFlagExpression(flags)},');
if (actions is int && actions != 0 || actions is List<SemanticsAction> && actions.isNotEmpty) if (actions is int && actions != 0 || actions is List<SemanticsAction> && actions.isNotEmpty)
buf.writeln('$indent actions: ${SemanticsTester._actionsToSemanticsActionExpression(actions)},'); buf.writeln('$indent actions: ${SemanticsTester._actionsToSemanticsActionExpression(actions)},');
if (label != null && label != '') if (label != null && label != '')
...@@ -347,7 +347,7 @@ class SemanticsTester { ...@@ -347,7 +347,7 @@ class SemanticsTester {
String value, String value,
TextDirection textDirection, TextDirection textDirection,
List<SemanticsAction> actions, List<SemanticsAction> actions,
List<SemanticsFlags> flags, List<SemanticsFlag> flags,
SemanticsNode ancestor, SemanticsNode ancestor,
}) { }) {
bool checkNode(SemanticsNode node) { bool checkNode(SemanticsNode node) {
...@@ -364,7 +364,7 @@ class SemanticsTester { ...@@ -364,7 +364,7 @@ class SemanticsTester {
return false; return false;
} }
if (flags != null) { if (flags != null) {
final int expectedFlags = flags.fold(0, (int value, SemanticsFlags flag) => value | flag.index); final int expectedFlags = flags.fold(0, (int value, SemanticsFlag flag) => value | flag.index);
final int actualFlags = node.getSemanticsData().flags; final int actualFlags = node.getSemanticsData().flags;
if (expectedFlags != actualFlags) if (expectedFlags != actualFlags)
return false; return false;
...@@ -440,15 +440,15 @@ class SemanticsTester { ...@@ -440,15 +440,15 @@ class SemanticsTester {
return _generateSemanticsTestForNode(node, 0); return _generateSemanticsTestForNode(node, 0);
} }
static String _flagsToSemanticsFlagsExpression(dynamic flags) { static String _flagsToSemanticsFlagExpression(dynamic flags) {
Iterable<SemanticsFlags> list; Iterable<SemanticsFlag> list;
if (flags is int) { if (flags is int) {
list = SemanticsFlags.values.values list = SemanticsFlag.values.values
.where((SemanticsFlags flag) => (flag.index & flags) != 0); .where((SemanticsFlag flag) => (flag.index & flags) != 0);
} else { } else {
list = flags; list = flags;
} }
return '<SemanticsFlags>[${list.join(', ')}]'; return '<SemanticsFlag>[${list.join(', ')}]';
} }
static String _actionsToSemanticsActionExpression(dynamic actions) { static String _actionsToSemanticsActionExpression(dynamic actions) {
...@@ -470,7 +470,7 @@ class SemanticsTester { ...@@ -470,7 +470,7 @@ class SemanticsTester {
final SemanticsData nodeData = node.getSemanticsData(); final SemanticsData nodeData = node.getSemanticsData();
buf.writeln('new TestSemantics('); buf.writeln('new TestSemantics(');
if (nodeData.flags != 0) if (nodeData.flags != 0)
buf.writeln(' flags: ${_flagsToSemanticsFlagsExpression(nodeData.flags)},'); buf.writeln(' flags: ${_flagsToSemanticsFlagExpression(nodeData.flags)},');
if (nodeData.actions != 0) if (nodeData.actions != 0)
buf.writeln(' actions: ${_actionsToSemanticsActionExpression(nodeData.actions)},'); buf.writeln(' actions: ${_actionsToSemanticsActionExpression(nodeData.actions)},');
if (node.label != null && node.label.isNotEmpty) if (node.label != null && node.label.isNotEmpty)
...@@ -555,7 +555,7 @@ class _IncludesNodeWith extends Matcher { ...@@ -555,7 +555,7 @@ class _IncludesNodeWith extends Matcher {
final String value; final String value;
final TextDirection textDirection; final TextDirection textDirection;
final List<SemanticsAction> actions; final List<SemanticsAction> actions;
final List<SemanticsFlags> flags; final List<SemanticsFlag> flags;
@override @override
bool matches(covariant SemanticsTester item, Map<dynamic, dynamic> matchState) { bool matches(covariant SemanticsTester item, Map<dynamic, dynamic> matchState) {
...@@ -603,7 +603,7 @@ Matcher includesNodeWith({ ...@@ -603,7 +603,7 @@ Matcher includesNodeWith({
String value, String value,
TextDirection textDirection, TextDirection textDirection,
List<SemanticsAction> actions, List<SemanticsAction> actions,
List<SemanticsFlags> flags, List<SemanticsFlag> flags,
}) { }) {
return new _IncludesNodeWith( return new _IncludesNodeWith(
label: label, label: label,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'dart:ui' show SemanticsFlags; import 'dart:ui' show SemanticsFlag;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart'; import 'package:flutter/semantics.dart';
...@@ -113,7 +113,7 @@ void _tests() { ...@@ -113,7 +113,7 @@ void _tests() {
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
), ),
new TestSemantics( new TestSemantics(
flags: <SemanticsFlags>[SemanticsFlags.hasCheckedState, SemanticsFlags.isChecked, SemanticsFlags.isSelected], flags: <SemanticsFlag>[SemanticsFlag.hasCheckedState, SemanticsFlag.isChecked, SemanticsFlag.isSelected],
actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease], actions: <SemanticsAction>[SemanticsAction.tap, SemanticsAction.decrease],
label: r'‪Interactive text‬', label: r'‪Interactive text‬',
value: r'test-value', value: r'test-value',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment