1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import '../widgets/semantics_tester.dart';
void main() {
testWidgets('Traversal order handles touching elements', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
MaterialApp(
home: Column(
children: List<Widget>.generate(3, (int column) {
return Row(
children: List<Widget>.generate(3, (int row) {
return Semantics(
child: SizedBox(
width: 50.0,
height: 50.0,
child: Text('$column - $row'),
),
);
}),
);
}),
),
),
);
final TestSemantics expected = TestSemantics.root(
children: <TestSemantics>[
TestSemantics(
id: 1,
textDirection: TextDirection.ltr,
children: <TestSemantics>[
TestSemantics(
id: 2,
children: <TestSemantics>[
TestSemantics(
id: 3,
flags: <SemanticsFlag>[SemanticsFlag.scopesRoute],
children: <TestSemantics>[
TestSemantics(
id: 4,
label: '0 - 0',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 5,
label: '0 - 1',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 6,
label: '0 - 2',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 7,
label: '1 - 0',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 8,
label: '1 - 1',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 9,
label: '1 - 2',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 10,
label: '2 - 0',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 11,
label: '2 - 1',
textDirection: TextDirection.ltr,
),
TestSemantics(
id: 12,
label: '2 - 2',
textDirection: TextDirection.ltr,
),
],
),
],
),
],
),
],
);
expect(semantics, hasSemantics(expected, ignoreRect: true, ignoreTransform: true));
semantics.dispose();
});
}