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
a8e69924
Unverified
Commit
a8e69924
authored
Jan 16, 2024
by
Polina Cherkasova
Committed by
GitHub
Jan 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore or fix leaks. (#141468)
parent
3d112429
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
62 additions
and
19 deletions
+62
-19
live_binding_test.dart
packages/flutter/test/animation/live_binding_test.dart
+1
-1
flutter_test_config.dart
packages/flutter/test/flutter_test_config.dart
+2
-2
search_anchor_test.dart
packages/flutter/test/material/search_anchor_test.dart
+4
-1
memory_allocations_test.dart
packages/flutter/test/rendering/memory_allocations_test.dart
+5
-0
context_menu_controller_test.dart
...es/flutter/test/widgets/context_menu_controller_test.dart
+9
-2
image_test.dart
packages/flutter/test/widgets/image_test.dart
+4
-1
memory_allocations_test.dart
packages/flutter/test/widgets/memory_allocations_test.dart
+7
-2
nested_scroll_view_test.dart
packages/flutter/test/widgets/nested_scroll_view_test.dart
+1
-2
page_view_test.dart
packages/flutter/test/widgets/page_view_test.dart
+8
-2
scroll_aware_image_provider_test.dart
...lutter/test/widgets/scroll_aware_image_provider_test.dart
+8
-2
scrollable_restoration_test.dart
...ges/flutter/test/widgets/scrollable_restoration_test.dart
+8
-2
tracking_scroll_controller_test.dart
...flutter/test/widgets/tracking_scroll_controller_test.dart
+4
-1
widget_tester.dart
packages/flutter_test/lib/src/widget_tester.dart
+1
-1
No files found.
packages/flutter/test/animation/live_binding_test.dart
View file @
a8e69924
...
...
@@ -80,7 +80,7 @@ void main() {
testWidgets
(
'Should show event indicator for pointer events with setSurfaceSize'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
AnimationSheetBuilder
animationSheet
=
AnimationSheetBuilder
(
frameSize:
const
Size
(
200
,
200
),
allLayers:
true
);
addTearDown
(
animationSheet
.
dispose
);
...
...
packages/flutter/test/flutter_test_config.dart
View file @
a8e69924
...
...
@@ -20,7 +20,7 @@ import '_goldens_io.dart' if (dart.library.html) '_goldens_web.dart'
/// `--dart-define LEAK_TRACKING=true` or invoke `export LEAK_TRACKING=true`.
///
/// See documentation for [testWidgets] on how to except individual tests.
bool
isLeakTrackingEnabled
(
)
{
bool
_
isLeakTrackingEnabled
(
)
{
if
(
kIsWeb
)
{
return
false
;
}
...
...
@@ -41,7 +41,7 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) {
// receive the event.
WidgetController
.
hitTestWarningShouldBeFatal
=
true
;
if
(
isLeakTrackingEnabled
())
{
if
(
_
isLeakTrackingEnabled
())
{
LeakTesting
.
enable
();
LeakTracking
.
warnForUnsupportedPlatforms
=
false
;
...
...
packages/flutter/test/material/search_anchor_test.dart
View file @
a8e69924
...
...
@@ -2951,6 +2951,7 @@ void main() {
testWidgets
(
'Block entering text on disabled widget'
,
(
WidgetTester
tester
)
async
{
const
String
initValue
=
'init'
;
final
TextEditingController
controller
=
TextEditingController
(
text:
initValue
);
addTearDown
(
controller
.
dispose
);
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
@@ -2972,13 +2973,15 @@ void main() {
testWidgets
(
'Disabled SearchBar semantics node still contains value'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
TextEditingController
controller
=
TextEditingController
(
text:
'text'
);
addTearDown
(
controller
.
dispose
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Center
(
child:
SearchBar
(
controller:
TextEditingController
(
text:
'text'
)
,
controller:
controller
,
enabled:
false
,
),
),
...
...
packages/flutter/test/rendering/memory_allocations_test.dart
View file @
a8e69924
...
...
@@ -7,8 +7,13 @@ import 'dart:ui' as ui;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
void
main
(
)
{
// LeakTesting is turned off because it adds subscriptions to
// [FlutterMemoryAllocations], that may interfere with the tests.
LeakTesting
.
settings
=
LeakTesting
.
settings
.
withIgnoredAll
();
final
FlutterMemoryAllocations
ma
=
FlutterMemoryAllocations
.
instance
;
setUp
(()
{
...
...
packages/flutter/test/widgets/context_menu_controller_test.dart
View file @
a8e69924
...
...
@@ -5,6 +5,7 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
import
'clipboard_utils.dart'
;
import
'editable_text_utils.dart'
;
...
...
@@ -90,7 +91,10 @@ void main() {
expect
(
find
.
byKey
(
key2
),
findsNothing
);
});
testWidgets
(
'A menu can be hidden and then reshown'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'A menu can be hidden and then reshown'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
GlobalKey
key1
=
GlobalKey
();
late
final
BuildContext
context
;
...
...
@@ -178,7 +182,10 @@ void main() {
controller
.
remove
();
});
testWidgets
(
'Calling show when a built-in widget is already showing its context menu hides the built-in menu'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Calling show when a built-in widget is already showing its context menu hides the built-in menu'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
GlobalKey
builtInKey
=
GlobalKey
();
final
GlobalKey
directKey
=
GlobalKey
();
late
final
BuildContext
context
;
...
...
packages/flutter/test/widgets/image_test.dart
View file @
a8e69924
...
...
@@ -1853,7 +1853,10 @@ void main() {
skip:
kIsWeb
,
// https://github.com/flutter/flutter/issues/87933.
);
testWidgets
(
'Reports image size when painted'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Reports image size when painted'
,
// TODO(polina-c): make sure images are disposed, https://github.com/flutter/flutter/issues/141388
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
late
ImageSizeInfo
imageSizeInfo
;
int
count
=
0
;
debugOnPaintImage
=
(
ImageSizeInfo
info
)
{
...
...
packages/flutter/test/widgets/memory_allocations_test.dart
View file @
a8e69924
...
...
@@ -5,11 +5,16 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
int
_creations
=
0
;
int
_disposals
=
0
;
int
_creations
=
0
;
int
_disposals
=
0
;
void
main
(
)
{
// LeakTesting is turned off because it adds subscriptions to
// [FlutterMemoryAllocations], that may interfere with the tests.
LeakTesting
.
settings
=
LeakTesting
.
settings
.
withIgnoredAll
();
final
FlutterMemoryAllocations
ma
=
FlutterMemoryAllocations
.
instance
;
test
(
'Publishers dispatch events in debug mode'
,
()
async
{
...
...
packages/flutter/test/widgets/nested_scroll_view_test.dart
View file @
a8e69924
...
...
@@ -535,9 +535,8 @@ void main() {
});
testWidgets
(
'Three NestedScrollViews with one ScrollController'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
TrackingScrollController
controller
=
TrackingScrollController
();
addTearDown
(
controller
.
dispose
);
...
...
packages/flutter/test/widgets/page_view_test.dart
View file @
a8e69924
...
...
@@ -419,7 +419,10 @@ void main() {
expect
(
previousPageCompleted
,
true
);
});
testWidgets
(
'PageView in zero-size container'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'PageView in zero-size container'
,
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Center
(
...
...
@@ -599,7 +602,10 @@ void main() {
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Idaho'
)),
const
Offset
(
790.0
,
0.0
));
});
testWidgets
(
'Page snapping disable and reenable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Page snapping disable and reenable'
,
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
List
<
int
>
log
=
<
int
>[];
Widget
build
({
required
bool
pageSnapping
})
{
...
...
packages/flutter/test/widgets/scroll_aware_image_provider_test.dart
View file @
a8e69924
...
...
@@ -34,7 +34,10 @@ void main() {
return
Scrollable
.
of
(
find
.
byType
(
TestWidget
).
evaluate
().
first
).
position
;
}
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'ScrollAwareImageProvider does not delay if widget is not in scrollable'
,
// TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
GlobalKey
<
TestWidgetState
>
key
=
GlobalKey
<
TestWidgetState
>();
await
tester
.
pumpWidget
(
TestWidget
(
key
));
...
...
@@ -99,7 +102,10 @@ void main() {
expect
(
findPhysics
<
RecordingPhysics
>(
tester
).
velocities
,
<
double
>[
0
]);
});
testWidgets
(
'ScrollAwareImageProvider does not delay if in scrollable that is scrolling slowly'
,
(
WidgetTester
tester
)
async
{
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
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
final
List
<
GlobalKey
<
TestWidgetState
>>
keys
=
<
GlobalKey
<
TestWidgetState
>>[];
final
ScrollController
scrollController
=
ScrollController
();
addTearDown
(
scrollController
.
dispose
);
...
...
packages/flutter/test/widgets/scrollable_restoration_test.dart
View file @
a8e69924
...
...
@@ -282,7 +282,10 @@ void main() {
await
pageViewScrollAndRestore
(
tester
);
});
testWidgets
(
'PageView.builder restoration'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'PageView.builder restoration'
,
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
TestHarness
(
child:
PageView
.
builder
(
...
...
@@ -298,7 +301,10 @@ void main() {
await
pageViewScrollAndRestore
(
tester
);
});
testWidgets
(
'PageView.custom restoration'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'PageView.custom restoration'
,
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
TestHarness
(
child:
PageView
.
custom
(
...
...
packages/flutter/test/widgets/tracking_scroll_controller_test.dart
View file @
a8e69924
...
...
@@ -64,7 +64,10 @@ void main() {
expect
(
controller
.
initialScrollOffset
,
0.0
);
});
testWidgets
(
'TrackingScrollController saves offset'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'TrackingScrollController saves offset'
,
// TODO(polina-c): Remove when PageView is fixed, https://github.com/flutter/flutter/issues/141119
experimentalLeakTesting:
LeakTesting
.
settings
.
withIgnoredAll
(),
(
WidgetTester
tester
)
async
{
int
attach
=
0
;
int
detach
=
0
;
final
TrackingScrollController
controller
=
TrackingScrollController
(
...
...
packages/flutter_test/lib/src/widget_tester.dart
View file @
a8e69924
...
...
@@ -123,7 +123,7 @@ E? _lastWhereOrNull<E>(Iterable<E> list, bool Function(E) test) {
/// during test execution.
/// Otherwise [LeakTesting.settings] is used.
/// Adjust [LeakTesting.settings] in flutter_test_config.dart
/// (see https://
github.com/flutter/flutter/blob/master/packages/flutter_test/lib/flutter_test.dart
)
/// (see https://
api.flutter.dev/flutter/flutter_test/flutter_test-library.html
)
/// for the entire package or folder, or in the test's main for a test file
/// (don't use [setUp] or [setUpAll]).
/// To turn off leak tracking just for one test, set [experimentalLeakTesting] to
...
...
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