Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3ce26910
Unverified
Commit
3ce26910
authored
Jun 26, 2020
by
MH Johnson
Committed by
GitHub
Jun 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Semantics] Update bottom nav semantics tests to use matches semantics (#60329)
parent
fb6c2532
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
137 deletions
+90
-137
bottom_navigation_bar_test.dart
...ges/flutter/test/material/bottom_navigation_bar_test.dart
+90
-137
No files found.
packages/flutter/test/material/bottom_navigation_bar_test.dart
View file @
3ce26910
...
...
@@ -12,7 +12,6 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:vector_math/vector_math_64.dart'
show
Vector3
;
import
'../rendering/mock_canvas.dart'
;
import
'../widgets/semantics_tester.dart'
;
void
main
(
)
{
testWidgets
(
'BottomNavigationBar callback test'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -1183,8 +1182,6 @@ void main() {
});
testWidgets
(
'BottomNavigationBar.fixed semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
boilerplate
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1207,47 +1204,37 @@ void main() {
),
);
final
TestSemantics
expected
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSelected
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'AC
\n
Tab 1 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Alarm
\n
Tab 2 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Hot Tub
\n
Tab 3 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
expect
(
tester
.
getSemantics
(
find
.
text
(
'AC'
)),
matchesSemantics
(
label:
'AC
\n
Tab 1 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
isSelected:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Alarm'
)),
matchesSemantics
(
label:
'Alarm
\n
Tab 2 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Hot Tub'
)),
matchesSemantics
(
label:
'Hot Tub
\n
Tab 3 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
semantics
,
hasSemantics
(
expected
,
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'BottomNavigationBar.shifting semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
boilerplate
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1271,42 +1258,34 @@ void main() {
),
);
final
TestSemantics
expected
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSelected
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'AC
\n
Tab 1 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Alarm
\n
Tab 2 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Hot Tub
\n
Tab 3 of 3'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
expect
(
tester
.
getSemantics
(
find
.
text
(
'AC'
)),
matchesSemantics
(
label:
'AC
\n
Tab 1 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
isSelected:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Alarm'
)),
matchesSemantics
(
label:
'Alarm
\n
Tab 2 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Hot Tub'
)),
matchesSemantics
(
label:
'Hot Tub
\n
Tab 3 of 3'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
semantics
,
hasSemantics
(
expected
,
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'BottomNavigationBar handles items.length changes'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -1553,8 +1532,6 @@ void main() {
});
testWidgets
(
'BottomNavigationBar.fixed [showSelectedLabels]=false and [showUnselectedLabels]=false semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
boilerplate
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1575,41 +1552,28 @@ void main() {
),
);
final
TestSemantics
expected
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
,
SemanticsFlag
.
isSelected
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Red
\n
Tab 1 of 2'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Green
\n
Tab 2 of 2'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
expect
(
tester
.
getSemantics
(
find
.
text
(
'Red'
)),
matchesSemantics
(
label:
'Red
\n
Tab 1 of 2'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
isSelected:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Green'
)),
matchesSemantics
(
label:
'Green
\n
Tab 2 of 2'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
semantics
,
hasSemantics
(
expected
,
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'BottomNavigationBar.shifting [showSelectedLabels]=false and [showUnselectedLabels]=false semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
boilerplate
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -1631,36 +1595,25 @@ void main() {
),
);
final
TestSemantics
expected
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isSelected
,
SemanticsFlag
.
isFocusable
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Red
\n
Tab 1 of 2'
,
textDirection:
TextDirection
.
ltr
,
),
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isFocusable
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Green
\n
Tab 2 of 2'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
expect
(
tester
.
getSemantics
(
find
.
text
(
'Red'
)),
matchesSemantics
(
label:
'Red
\n
Tab 1 of 2'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
isSelected:
true
,
hasTapAction:
true
,
),
);
expect
(
tester
.
getSemantics
(
find
.
text
(
'Green'
)),
matchesSemantics
(
label:
'Green
\n
Tab 2 of 2'
,
textDirection:
TextDirection
.
ltr
,
isFocusable:
true
,
hasTapAction:
true
,
),
);
expect
(
semantics
,
hasSemantics
(
expected
,
ignoreId:
true
,
ignoreTransform:
true
,
ignoreRect:
true
));
semantics
.
dispose
();
});
testWidgets
(
'BottomNavigationBar changes mouse cursor when the tile is hovered over'
,
(
WidgetTester
tester
)
async
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment