Skip to content

Commit b20a9e0

Browse files
authored
imporve gesture recognizer semantics test cases (#117257)
1 parent 7b850ef commit b20a9e0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/flutter/test/rendering/paragraph_test.dart

+13-2
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ void main() {
734734
});
735735
});
736736

737-
test('Supports gesture recognizer semantics', () {
737+
test('Supports gesture recognizer semantics', () {
738738
final RenderParagraph paragraph = RenderParagraph(
739739
TextSpan(text: _kText, children: <InlineSpan>[
740740
TextSpan(text: 'one', recognizer: TapGestureRecognizer()..onTap = () {}),
@@ -745,7 +745,18 @@ void main() {
745745
);
746746
layout(paragraph);
747747

748-
paragraph.assembleSemanticsNode(SemanticsNode(), SemanticsConfiguration(), <SemanticsNode>[]);
748+
final SemanticsNode node = SemanticsNode();
749+
paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), <SemanticsNode>[]);
750+
final List<SemanticsNode> children = <SemanticsNode>[];
751+
node.visitChildren((SemanticsNode child) {
752+
children.add(child);
753+
return true;
754+
});
755+
expect(children.length, 4);
756+
expect(children[0].getSemanticsData().actions, 0);
757+
expect(children[1].getSemanticsData().hasAction(SemanticsAction.tap), true);
758+
expect(children[2].getSemanticsData().hasAction(SemanticsAction.longPress), true);
759+
expect(children[3].getSemanticsData().hasAction(SemanticsAction.tap), true);
749760
});
750761

751762
test('Supports empty text span with spell out', () {

0 commit comments

Comments
 (0)