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
14b832aa
Unverified
Commit
14b832aa
authored
Sep 20, 2023
by
derdilla
Committed by
GitHub
Sep 20, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cover more tests with leak tracking (#134837)
parent
52ef9d88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
ticker_test.dart
packages/flutter/test/scheduler/ticker_test.dart
+7
-6
No files found.
packages/flutter/test/scheduler/ticker_test.dart
View file @
14b832aa
...
...
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
void
main
(
)
{
Future
<
void
>
setAppLifeCycleState
(
AppLifecycleState
state
)
async
{
...
...
@@ -15,7 +16,7 @@ void main() {
.
handlePlatformMessage
(
'flutter/lifecycle'
,
message
,
(
_
)
{});
}
testWidgets
(
'Ticker mute control test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker mute control test'
,
(
WidgetTester
tester
)
async
{
int
tickCount
=
0
;
void
handleTick
(
Duration
duration
)
{
tickCount
+=
1
;
...
...
@@ -97,7 +98,7 @@ void main() {
expect
(
ticker
.
isActive
,
isFalse
);
});
testWidgets
(
'Ticker control test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker control test'
,
(
WidgetTester
tester
)
async
{
late
Ticker
ticker
;
void
testFunction
()
{
...
...
@@ -110,7 +111,7 @@ void main() {
expect
(
ticker
.
toString
(
debugIncludeStack:
true
),
contains
(
'testFunction'
));
});
testWidgets
(
'Ticker can be sped up with time dilation'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker can be sped up with time dilation'
,
(
WidgetTester
tester
)
async
{
timeDilation
=
0.5
;
// Move twice as fast.
late
Duration
lastDuration
;
void
handleTick
(
Duration
duration
)
{
...
...
@@ -128,7 +129,7 @@ void main() {
timeDilation
=
1.0
;
// restore time dilation, or it will affect other tests
});
testWidgets
(
'Ticker can be slowed down with time dilation'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker can be slowed down with time dilation'
,
(
WidgetTester
tester
)
async
{
timeDilation
=
2.0
;
// Move half as fast.
late
Duration
lastDuration
;
void
handleTick
(
Duration
duration
)
{
...
...
@@ -146,7 +147,7 @@ void main() {
timeDilation
=
1.0
;
// restore time dilation, or it will affect other tests
});
testWidgets
(
'Ticker stops ticking when application is paused'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker stops ticking when application is paused'
,
(
WidgetTester
tester
)
async
{
int
tickCount
=
0
;
void
handleTick
(
Duration
duration
)
{
tickCount
+=
1
;
...
...
@@ -169,7 +170,7 @@ void main() {
setAppLifeCycleState
(
AppLifecycleState
.
resumed
);
});
testWidgets
(
'Ticker can be created before application unpauses'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Ticker can be created before application unpauses'
,
(
WidgetTester
tester
)
async
{
setAppLifeCycleState
(
AppLifecycleState
.
paused
);
int
tickCount
=
0
;
...
...
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