From d41eeeb50d9e5ceaf64df3180f47f5d3a41ae4a3 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Wed, 3 Jul 2019 09:13:37 -0700 Subject: [PATCH] Include tags in SemanticsNode debug properties (#35491) --- packages/flutter/lib/src/semantics/semantics.dart | 1 + packages/flutter/test/semantics/semantics_test.dart | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart index 8a2f40d43a7..4eb2d984227 100644 --- a/packages/flutter/lib/src/semantics/semantics.dart +++ b/packages/flutter/lib/src/semantics/semantics.dart @@ -2082,6 +2082,7 @@ class SemanticsNode extends AbstractNode with DiagnosticableTreeMixin { } properties.add(DiagnosticsProperty('rect', rect, description: description, showName: false)); } + properties.add(IterableProperty('tags', tags?.map((SemanticsTag tag) => tag.name), defaultValue: null)); final List actions = _actions.keys.map((SemanticsAction action) => describeEnum(action)).toList()..sort(); final List customSemanticsActions = _customSemanticsActions.keys .map((CustomSemanticsAction action) => action.label) diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart index 9444226e0ef..cd24659cccb 100644 --- a/packages/flutter/test/semantics/semantics_test.dart +++ b/packages/flutter/test/semantics/semantics_test.dart @@ -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' @@ -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' @@ -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 = {RenderViewport.useTwoPaneSemantics}; + + expect( + actionNode.toStringDeep(), + contains('\n tags: RenderViewport.twoPane\n'), + ); }); test('SemanticsConfiguration getter/setter', () {