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
Hide 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() {
...
@@ -14,6 +14,12 @@ void main() {
late
ui
.
Image
testImage
;
late
ui
.
Image
testImage
;
ui
.
Image
cloneImage
()
{
final
ui
.
Image
clone
=
testImage
.
clone
();
addTearDown
(
clone
.
dispose
);
return
clone
;
}
setUpAll
(()
async
{
setUpAll
(()
async
{
testImage
=
await
createTestImage
(
width:
10
,
height:
10
);
testImage
=
await
createTestImage
(
width:
10
,
height:
10
);
});
});
...
@@ -34,10 +40,7 @@ void main() {
...
@@ -34,10 +40,7 @@ void main() {
return
Scrollable
.
of
(
find
.
byType
(
TestWidget
).
evaluate
().
first
).
position
;
return
Scrollable
.
of
(
find
.
byType
(
TestWidget
).
evaluate
().
first
).
position
;
}
}
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
(
WidgetTester
tester
)
async
{
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
await
tester
.
pumpWidget
(
TestWidget
(
key
));
await
tester
.
pumpWidget
(
TestWidget
(
key
));
...
@@ -65,10 +68,7 @@ void main() {
...
@@ -65,10 +68,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
expect
(
imageCache
.
currentSize
,
1
);
});
});
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is not scrolling'
,
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is not scrolling'
,
(
WidgetTester
tester
)
async
{
// 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
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
await
tester
.
pumpWidget
(
Directionality
(
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
...
@@ -105,10 +105,7 @@ void main() {
...
@@ -105,10 +105,7 @@ void main() {
expect
(
findPhysics
<
RecordingPhysics
>(
tester
).
velocities
,
<
double
>[
0
]);
expect
(
findPhysics
<
RecordingPhysics
>(
tester
).
velocities
,
<
double
>[
0
]);
});
});
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is scrolling slowly'
,
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is scrolling slowly'
,
(
WidgetTester
tester
)
async
{
// 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
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
addTearDown
(
scrollController
.
dispose
);
...
@@ -167,10 +164,7 @@ void main() {
...
@@ -167,10 +164,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
expect
(
imageCache
.
currentSize
,
1
);
});
});
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast'
,
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast'
,
(
WidgetTester
tester
)
async
{
// 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
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
addTearDown
(
scrollController
.
dispose
);
...
@@ -239,10 +233,7 @@ void main() {
...
@@ -239,10 +233,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
1
);
expect
(
imageCache
.
currentSize
,
1
);
});
});
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast and fizzles if disposed'
,
testWidgets
(
'ScrollAwareImageProvider delays if in scrollable that is scrolling fast and fizzles if disposed'
,
(
WidgetTester
tester
)
async
{
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
addTearDown
(
scrollController
.
dispose
);
...
@@ -261,7 +252,7 @@ void main() {
...
@@ -261,7 +252,7 @@ void main() {
final
DisposableBuildContext
context
=
DisposableBuildContext
(
keys
.
last
.
currentState
!);
final
DisposableBuildContext
context
=
DisposableBuildContext
(
keys
.
last
.
currentState
!);
addTearDown
(
context
.
dispose
);
addTearDown
(
context
.
dispose
);
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
testImage
.
clon
e
());
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
cloneImag
e
());
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
context:
context
,
context:
context
,
imageProvider:
testImageProvider
,
imageProvider:
testImageProvider
,
...
@@ -313,10 +304,7 @@ void main() {
...
@@ -313,10 +304,7 @@ void main() {
expect
(
imageCache
.
currentSize
,
0
);
expect
(
imageCache
.
currentSize
,
0
);
});
});
testWidgets
(
'ScrollAwareImageProvider resolves from ImageCache and does not set completer twice'
,
testWidgets
(
'ScrollAwareImageProvider resolves from ImageCache and does not set completer twice'
,
(
WidgetTester
tester
)
async
{
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean]
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
final
ScrollController
scrollController
=
ScrollController
();
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
addTearDown
(
scrollController
.
dispose
);
...
@@ -331,7 +319,7 @@ void main() {
...
@@ -331,7 +319,7 @@ void main() {
final
DisposableBuildContext
context
=
DisposableBuildContext
(
key
.
currentState
!);
final
DisposableBuildContext
context
=
DisposableBuildContext
(
key
.
currentState
!);
addTearDown
(
context
.
dispose
);
addTearDown
(
context
.
dispose
);
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
testImage
.
clon
e
());
final
TestImageProvider
testImageProvider
=
TestImageProvider
(
cloneImag
e
());
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
final
ScrollAwareImageProvider
<
TestImageProvider
>
imageProvider
=
ScrollAwareImageProvider
<
TestImageProvider
>(
context:
context
,
context:
context
,
imageProvider:
testImageProvider
,
imageProvider:
testImageProvider
,
...
@@ -367,7 +355,6 @@ void main() {
...
@@ -367,7 +355,6 @@ void main() {
});
});
testWidgets
(
'ScrollAwareImageProvider does not block LRU updates to image cache'
,
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
(),
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
(
WidgetTester
tester
)
async
{
final
int
oldSize
=
imageCache
.
maximumSize
;
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