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
76946829
Unverified
Commit
76946829
authored
Jun 26, 2020
by
Michael Goderbauer
Committed by
GitHub
Jun 26, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not return partial semantics from tester.getSemantics (#60367)
parent
aa0382e9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
1 deletion
+34
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+6
-1
widget_tester_test.dart
packages/flutter_test/test/widget_tester_test.dart
+28
-0
No files found.
packages/flutter_test/lib/src/widget_tester.dart
View file @
76946829
...
...
@@ -997,6 +997,11 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
/// The ancestor's semantic data will include the child's as well as
/// other nodes that have been merged together.
///
/// If the [SemanticsNode] of the object identified by the finder is
/// force-merged into an ancestor (e.g. via the [MergeSemantics] widget)
/// the node into which it is merged is returned. That node will include
/// all the semantics information of the nodes merged into it.
///
/// Will throw a [StateError] if the finder returns more than one element or
/// if no semantics are found or are not enabled.
SemanticsNode
getSemantics
(
Finder
finder
)
{
...
...
@@ -1012,7 +1017,7 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
final
Element
element
=
candidates
.
single
;
RenderObject
renderObject
=
element
.
findRenderObject
();
SemanticsNode
result
=
renderObject
.
debugSemantics
;
while
(
renderObject
!=
null
&&
result
==
null
)
{
while
(
renderObject
!=
null
&&
(
result
==
null
||
result
.
isMergedIntoParent
)
)
{
renderObject
=
renderObject
?.
parent
as
RenderObject
;
result
=
renderObject
?.
debugSemantics
;
}
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
76946829
...
...
@@ -127,6 +127,34 @@ void main() {
expect
(
semantics
.
label
,
'A
\n
B
\n
C'
);
semanticsHandle
.
dispose
();
});
testWidgets
(
'Does not return partial semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsHandle
semanticsHandle
=
tester
.
ensureSemantics
();
final
Key
key
=
UniqueKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
MergeSemantics
(
child:
Semantics
(
container:
true
,
label:
'A'
,
child:
Semantics
(
container:
true
,
key:
key
,
label:
'B'
,
child:
Container
(),
),
),
),
),
),
);
final
SemanticsNode
node
=
tester
.
getSemantics
(
find
.
byKey
(
key
));
final
SemanticsData
semantics
=
node
.
getSemanticsData
();
expect
(
semantics
.
label
,
'A
\n
B'
);
semanticsHandle
.
dispose
();
});
});
group
(
'ensureVisible'
,
()
{
...
...
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