Include tags in SemanticsNode debug properties (#35491)
diff --git a/packages/flutter/lib/src/semantics/semantics.dart b/packages/flutter/lib/src/semantics/semantics.dart index 8a2f40d..4eb2d98 100644 --- a/packages/flutter/lib/src/semantics/semantics.dart +++ b/packages/flutter/lib/src/semantics/semantics.dart
@@ -2082,6 +2082,7 @@ } 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)
diff --git a/packages/flutter/test/semantics/semantics_test.dart b/packages/flutter/test/semantics/semantics_test.dart index 9444226..cd24659 100644 --- a/packages/flutter/test/semantics/semantics_test.dart +++ b/packages/flutter/test/semantics/semantics_test.dart
@@ -435,6 +435,7 @@ ' 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 @@ ' 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 @@ ' 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', () {