Skip to content

Commit

Permalink
imporve gesture recognizer semantics test cases (#117257)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 committed Dec 17, 2022
1 parent 7b850ef commit b20a9e0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/flutter/test/rendering/paragraph_test.dart
Expand Up @@ -734,7 +734,7 @@ void main() {
});
});

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

paragraph.assembleSemanticsNode(SemanticsNode(), SemanticsConfiguration(), <SemanticsNode>[]);
final SemanticsNode node = SemanticsNode();
paragraph.assembleSemanticsNode(node, SemanticsConfiguration(), <SemanticsNode>[]);
final List<SemanticsNode> children = <SemanticsNode>[];
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', () {
Expand Down

0 comments on commit b20a9e0

Please sign in to comment.