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
fdf05c90
Unverified
Commit
fdf05c90
authored
Feb 01, 2024
by
Polina Cherkasova
Committed by
GitHub
Feb 01, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix leaks in tests. (#142677)
parent
e91f530b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
27 deletions
+14
-27
scroll_aware_image_provider_test.dart
...lutter/test/widgets/scroll_aware_image_provider_test.dart
+14
-27
No files found.
packages/flutter/test/widgets/scroll_aware_image_provider_test.dart
View file @
fdf05c90
...
...
@@ -14,6 +14,12 @@ void main() {
late
ui
.
Image
testImage
;
ui
.
Image
cloneImage
()
{
final
ui
.
Image
clone
=
testImage
.
clone
();
addTearDown
(
clone
.
dispose
);
return
clone
;
}
setUpAll
(()
async
{
testImage
=
await
createTestImage
(
width:
10
,
height:
10
);
});
...
...
@@ -34,10 +40,7 @@ void main() {
return
Scrollable
.
of
(
find
.
byType
(
TestWidget
).
evaluate
().
first
).
position
;
}
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
await
tester
.
pumpWidget
(
TestWidget
(
key
));
...
...
@@ -65,10 +68,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
});
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is not scrolling'
,
// TODO(polina-c): make sure images are disposed, https://github.com/flutter/flutter/issues/141388 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is not scrolling'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
...
...
@@ -105,10 +105,7 @@ void main() {
expect
(
findPhysics
<
RecordingPhysics
>(
tester
).
velocities
,
<
double
>[
0
]);
});
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is scrolling slowly'
,
// TODO(polina-c): make sure images are disposed, https://github.com/flutter/flutter/issues/141388 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is scrolling slowly'
,
(
WidgetTester
tester
)
async
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
...
...
@@ -167,10 +164,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
});
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast'
,
// TODO(polina-c): make sure images are disposed, https://github.com/flutter/flutter/issues/141388 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast'
,
(
WidgetTester
tester
)
async
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
...
...
@@ -239,10 +233,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
});
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast and fizzles if disposed'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast and fizzles if disposed'
,
(
WidgetTester
tester
)
async
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
...
...
@@ -261,7 +252,7 @@ void main() {
final
DisposableBuildContext
context
=
DisposableBuildContext
(
keys
.
last
.
currentState
!);
addTearDown
(
context
.
dispose
);
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
testImage
.
clon
e
());
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
cloneImag
e
());
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
context:
context
,
imageProvider:
testImageProvider
,
...
...
@@ -313,10 +304,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
0
);
});
testWidgets
(
'ScrollAwareImageProvider resolves from ImageCache and does not set completer twice'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider resolves from ImageCache and does not set completer twice'
,
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
...
...
@@ -331,7 +319,7 @@ void main() {
final
DisposableBuildContext
context
=
DisposableBuildContext
(
key
.
currentState
!);
addTearDown
(
context
.
dispose
);
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
testImage
.
clon
e
());
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
cloneImag
e
());
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
context:
context
,
imageProvider:
testImageProvider
,
...
...
@@ -367,7 +355,6 @@ void main() {
});
testWidgets
(
'ScrollAwareImageProvider does not block LRU updates to image cache'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
int
oldSize
=
imageCache
.
maximumSize
;
...
...
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