Ignore or fix leaks. (#141468)
This commit is contained in:
committed by
GitHub
parent
3d112429cc
commit
a8e699249b
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -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(() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 }) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user