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
12eeb94c
Unverified
Commit
12eeb94c
authored
Jun 05, 2018
by
Michael Goderbauer
Committed by
GitHub
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compare SemanticsHandler# at end of test to value at beginning of test (#18183)
parent
57187b00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
7 deletions
+22
-7
object.dart
packages/flutter/lib/src/rendering/object.dart
+10
-5
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+12
-2
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
12eeb94c
...
...
@@ -822,7 +822,12 @@ class PipelineOwner {
SemanticsOwner
get
semanticsOwner
=>
_semanticsOwner
;
SemanticsOwner
_semanticsOwner
;
int
_outstandingSemanticsHandle
=
0
;
/// The number of clients registered to listen for semantics.
///
/// The number is increased whenever [ensureSemantics] is called and decreased
/// when [SemanticsHandle.dispose] is called.
int
get
debugOutstandingSemanticsHandles
=>
_outstandingSemanticsHandles
;
int
_outstandingSemanticsHandles
=
0
;
/// Opens a [SemanticsHandle] and calls [listener] whenever the semantics tree
/// updates.
...
...
@@ -837,8 +842,8 @@ class PipelineOwner {
/// objects for a given [PipelineOwner] are closed, the [PipelineOwner] stops
/// maintaining the semantics tree.
SemanticsHandle
ensureSemantics
({
VoidCallback
listener
})
{
_outstandingSemanticsHandle
+=
1
;
if
(
_outstandingSemanticsHandle
==
1
)
{
_outstandingSemanticsHandle
s
+=
1
;
if
(
_outstandingSemanticsHandle
s
==
1
)
{
assert
(
_semanticsOwner
==
null
);
_semanticsOwner
=
new
SemanticsOwner
();
if
(
onSemanticsOwnerCreated
!=
null
)
...
...
@@ -849,8 +854,8 @@ class PipelineOwner {
void
_didDisposeSemanticsHandle
()
{
assert
(
_semanticsOwner
!=
null
);
_outstandingSemanticsHandle
-=
1
;
if
(
_outstandingSemanticsHandle
==
0
)
{
_outstandingSemanticsHandle
s
-=
1
;
if
(
_outstandingSemanticsHandle
s
==
0
)
{
_semanticsOwner
.
dispose
();
_semanticsOwner
=
null
;
if
(
onSemanticsOwnerDisposed
!=
null
)
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
12eeb94c
...
...
@@ -57,9 +57,10 @@ void testWidgets(String description, WidgetTesterCallback callback, {
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
final
WidgetTester
tester
=
new
WidgetTester
.
_
(
binding
);
timeout
??=
binding
.
defaultTestTimeout
;
test_package
.
test
(
test_package
.
test
(
description
,
()
{
tester
.
_recordNumberOfSemanticsHandles
();
test_package
.
addTearDown
(
binding
.
postTest
);
return
binding
.
runTest
(
()
=>
callback
(
tester
),
...
...
@@ -125,6 +126,7 @@ Future<Null> benchmarkWidgets(WidgetTesterCallback callback) {
final
TestWidgetsFlutterBinding
binding
=
TestWidgetsFlutterBinding
.
ensureInitialized
();
assert
(
binding
is
!
AutomatedTestWidgetsFlutterBinding
);
final
WidgetTester
tester
=
new
WidgetTester
.
_
(
binding
);
tester
.
_recordNumberOfSemanticsHandles
();
return
binding
.
runTest
(
()
=>
callback
(
tester
),
tester
.
_endOfTestVerifications
,
...
...
@@ -523,7 +525,8 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
}
void
_verifySemanticsHandlesWereDisposed
()
{
if
(
binding
.
pipelineOwner
.
semanticsOwner
!=
null
)
{
assert
(
_lastRecordedSemanticsHandles
!=
null
);
if
(
binding
.
pipelineOwner
.
debugOutstandingSemanticsHandles
>
_lastRecordedSemanticsHandles
)
{
throw
new
FlutterError
(
'A SemanticsHandle was active at the end of the test.
\n
'
'All SemanticsHandle instances must be disposed by calling dispose() on '
...
...
@@ -532,6 +535,13 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
'existing handle will leak into another test and alter its behavior.'
);
}
_lastRecordedSemanticsHandles
=
null
;
}
int
_lastRecordedSemanticsHandles
;
void
_recordNumberOfSemanticsHandles
()
{
_lastRecordedSemanticsHandles
=
binding
.
pipelineOwner
.
debugOutstandingSemanticsHandles
;
}
/// Returns the TestTextInput singleton.
...
...
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