From b20a9e0a37dfcbf64212d9176a0f40dcd7329535 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Sun, 18 Dec 2022 04:00:46 +0800 Subject: [PATCH] imporve gesture recognizer semantics test cases (#117257) --- .../flutter/test/rendering/paragraph_test.dart | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/flutter/test/rendering/paragraph_test.dart b/packages/flutter/test/rendering/paragraph_test.dart index 977954b3c347..6ed3da39448d 100644 --- a/packages/flutter/test/rendering/paragraph_test.dart +++ b/packages/flutter/test/rendering/paragraph_test.dart @@ -734,7 +734,7 @@ void main() { }); }); - test('Supports gesture recognizer semantics', () { + test('Supports gesture recognizer semantics', () { final RenderParagraph paragraph = RenderParagraph( TextSpan(text: _kText, children: [ TextSpan(text: 'one', recognizer: TapGestureRecognizer()..onTap = () {}), @@ -745,7 +745,18 @@ void main() { ); layout(paragraph); - paragraph.assembleSemanticsNode(SemanticsNode(), SemanticsConfiguration(), []); + final SemanticsNode node = SemanticsNode(); + paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), []); + final List children = []; + node.visitChildren((SemanticsNode child) { + children.add(child); + return true; + }); + expect(children.length, 4); + expect(children[0].getSemanticsData().actions, 0); + expect(children[1].getSemanticsData().hasAction(SemanticsAction.tap), true); + expect(children[2].getSemanticsData().hasAction(SemanticsAction.longPress), true); + expect(children[3].getSemanticsData().hasAction(SemanticsAction.tap), true); }); test('Supports empty text span with spell out', () {