Skip to content

Commit

Permalink
Include tags in SemanticsNode debug properties (flutter#35491)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored and darrenaustin committed Jul 3, 2019
1 parent faf34fe commit 461956a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/flutter/lib/src/semantics/semantics.dart
Expand Up @@ -2082,6 +2082,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin {
}
properties.add(DiagnosticsProperty<Rect>('rect', rect, description: description, showName: false));
}
properties.add(IterableProperty<String>('tags', tags?.map((SemanticsTag tag) => tag.name), defaultValue: null));
final List<String> actions = _actions.keys.map<String>((SemanticsAction action) => describeEnum(action)).toList()..sort();
final List<String> customSemanticsActions = _customSemanticsActions.keys
.map<String>((CustomSemanticsAction action) => action.label)
Expand Down
11 changes: 11 additions & 0 deletions packages/flutter/test/semantics/semantics_test.dart
Expand Up @@ -435,6 +435,7 @@ void main() {
' isMergedIntoParent: false\n'
' mergeAllDescendantsIntoThisNode: false\n'
' Rect.fromLTRB(0.0, 0.0, 0.0, 0.0)\n'
' tags: null\n'
' actions: []\n'
' customActions: []\n'
' flags: []\n'
Expand Down Expand Up @@ -530,6 +531,7 @@ void main() {
' isMergedIntoParent: false\n'
' mergeAllDescendantsIntoThisNode: false\n'
' Rect.fromLTRB(0.0, 0.0, 0.0, 0.0)\n'
' tags: null\n'
' actions: customAction\n'
' customActions: action1, action2, action3\n'
' flags: []\n'
Expand All @@ -551,7 +553,16 @@ void main() {
' elevation: 0.0\n'
' thickness: 0.0\n',
);
});

test('Tags show up in debug properties', () {
final SemanticsNode actionNode = SemanticsNode()
..tags = <SemanticsTag>{RenderViewport.useTwoPaneSemantics};

expect(
actionNode.toStringDeep(),
contains('\n tags: RenderViewport.twoPane\n'),
);
});

test('SemanticsConfiguration getter/setter', () {
Expand Down

0 comments on commit 461956a

Please sign in to comment.