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
80814553
Unverified
Commit
80814553
authored
Aug 05, 2020
by
Ming Lyu (CareF)
Committed by
GitHub
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revert widgettester breaking change (#62914)
parent
73208301
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+6
-0
widget_tester_test.dart
packages/flutter_test/test/widget_tester_test.dart
+11
-1
No files found.
packages/flutter_test/lib/src/widget_tester.dart
View file @
80814553
...
...
@@ -608,9 +608,12 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
Future
<
int
>
pumpAndSettle
([
Duration
duration
=
const
Duration
(
milliseconds:
100
),
EnginePhase
phase
=
EnginePhase
.
sendSemanticsUpdate
,
Duration
timeout
=
const
Duration
(
minutes:
10
),
])
{
assert
(
duration
!=
null
);
assert
(
duration
>
Duration
.
zero
);
assert
(
timeout
!=
null
);
assert
(
timeout
>
Duration
.
zero
);
assert
(()
{
final
WidgetsBinding
binding
=
this
.
binding
;
if
(
binding
is
LiveTestWidgetsFlutterBinding
&&
...
...
@@ -623,8 +626,11 @@ class WidgetTester extends WidgetController implements HitTestDispatcher, Ticker
return
true
;
}());
return
TestAsyncUtils
.
guard
<
int
>(()
async
{
final
DateTime
endTime
=
binding
.
clock
.
fromNowBy
(
timeout
);
int
count
=
0
;
do
{
if
(
binding
.
clock
.
now
().
isAfter
(
endTime
))
throw
FlutterError
(
'pumpAndSettle timed out'
);
await
binding
.
pump
(
duration
,
phase
);
count
+=
1
;
}
while
(
binding
.
hasScheduledFrame
);
...
...
packages/flutter_test/test/widget_tester_test.dart
View file @
80814553
...
...
@@ -465,11 +465,21 @@ void main() {
testWidgets
(
'pumpAndSettle control test'
,
(
WidgetTester
tester
)
async
{
final
AnimationController
controller
=
AnimationController
(
duration:
const
Duration
(
seconds:
1
),
duration:
const
Duration
(
minutes:
525600
),
vsync:
const
TestVSync
(),
);
expect
(
await
tester
.
pumpAndSettle
(),
1
);
controller
.
forward
();
try
{
await
tester
.
pumpAndSettle
();
expect
(
true
,
isFalse
);
}
catch
(
e
)
{
expect
(
e
,
isFlutterError
);
}
controller
.
stop
();
expect
(
await
tester
.
pumpAndSettle
(),
1
);
controller
.
duration
=
const
Duration
(
seconds:
1
);
controller
.
forward
();
expect
(
await
tester
.
pumpAndSettle
(
const
Duration
(
milliseconds:
300
)),
5
);
// 0, 300, 600, 900, 1200ms
});
...
...
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