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
142922de
Commit
142922de
authored
Mar 20, 2017
by
Adam Barth
Committed by
GitHub
Mar 20, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add WidgetTester.hasRunningAnimation (#8886)
Fixes #4017
parent
9c876336
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-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
+16
-0
No files found.
packages/flutter_test/lib/src/widget_tester.dart
View file @
142922de
...
...
@@ -222,10 +222,15 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
do
{
await
binding
.
pump
(
duration
,
phase
);
count
+=
1
;
}
while
(
binding
.
transientCallbackCount
>
0
);
}
while
(
hasRunningAnimations
);
}).
then
<
int
>((
Null
_
)
=>
count
);
}
/// Whether ther are any any transient callbacks scheduled.
///
/// This essentially checks whether all animations have completed.
bool
get
hasRunningAnimations
=>
binding
.
transientCallbackCount
>
0
;
@override
HitTestResult
hitTestOnBinding
(
Point
location
)
{
location
=
binding
.
localToGlobal
(
location
);
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
142922de
...
...
@@ -185,4 +185,20 @@ void main() {
);
});
});
testWidgets
(
'hasRunningAnimations control test'
,
(
WidgetTester
tester
)
async
{
final
AnimationController
controller
=
new
AnimationController
(
duration:
const
Duration
(
seconds:
1
),
vsync:
const
TestVSync
()
);
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
controller
.
forward
();
expect
(
tester
.
hasRunningAnimations
,
isTrue
);
controller
.
stop
();
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
controller
.
forward
();
expect
(
tester
.
hasRunningAnimations
,
isTrue
);
await
tester
.
pumpAndSettle
();
expect
(
tester
.
hasRunningAnimations
,
isFalse
);
});
}
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