From c4a7cf202ae8f4fd27ff24611e607c7994cf2c94 Mon Sep 17 00:00:00 2001 From: Polina Cherkasova Date: Mon, 15 Apr 2024 11:46:32 -0700 Subject: [PATCH] Update leak related TODOs. (#146743) https://github.com/flutter/flutter/issues/146742 --- .../flutter/test/animation/live_binding_test.dart | 2 +- .../flutter/test/cupertino/tab_scaffold_test.dart | 7 +------ packages/flutter/test/widgets/draggable_test.dart | 13 ++++--------- packages/flutter/test/widgets/image_test.dart | 2 +- ..._expression_for_current_semantics_tree_test.dart | 6 +----- .../flutter/test/widgets/shape_decoration_test.dart | 2 +- packages/flutter/test/widgets/view_test.dart | 3 +-- 7 files changed, 10 insertions(+), 25 deletions(-) diff --git a/packages/flutter/test/animation/live_binding_test.dart b/packages/flutter/test/animation/live_binding_test.dart index 33692e66eed8..8a7e2f1a30b9 100644 --- a/packages/flutter/test/animation/live_binding_test.dart +++ b/packages/flutter/test/animation/live_binding_test.dart @@ -79,7 +79,7 @@ void main() { }, skip: true); // Typically skip: isBrowser https://github.com/flutter/flutter/issues/42767 testWidgets('Should show event indicator for pointer events with setSurfaceSize', - // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] + // TODO(polina-c): root layer is leaking, https://github.com/flutter/flutter/issues/146742 [leaks-to-clean] experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), (WidgetTester tester) async { final AnimationSheetBuilder animationSheet = AnimationSheetBuilder(frameSize: const Size(200, 200), allLayers: true); diff --git a/packages/flutter/test/cupertino/tab_scaffold_test.dart b/packages/flutter/test/cupertino/tab_scaffold_test.dart index 4e2ac52ca174..df81155716f9 100644 --- a/packages/flutter/test/cupertino/tab_scaffold_test.dart +++ b/packages/flutter/test/cupertino/tab_scaffold_test.dart @@ -831,8 +831,6 @@ void main() { testWidgets('A controller can control more than one CupertinoTabScaffold, ' 'removal of listeners does not break the controller', - // TODO(polina-c): dispose TabController, https://github.com/flutter/flutter/issues/144910 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), (WidgetTester tester) async { final List tabsPainted0 = []; final List tabsPainted1 = []; @@ -1277,10 +1275,7 @@ void main() { .setMockMethodCallHandler(SystemChannels.platform, null); }); - testWidgets('System back navigation inside of tabs', - // TODO(polina-c): dispose TabController, https://github.com/flutter/flutter/issues/144910 - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), - (WidgetTester tester) async { + testWidgets('System back navigation inside of tabs', (WidgetTester tester) async { await tester.pumpWidget( CupertinoApp( home: MediaQuery( diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart index 90b2622f301c..d7d43a332037 100644 --- a/packages/flutter/test/widgets/draggable_test.dart +++ b/packages/flutter/test/widgets/draggable_test.dart @@ -14,7 +14,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/rendering.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 'semantics_tester.dart'; @@ -2541,10 +2540,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/6128. - testWidgets('Draggable plays nice with onTap', - // TODO(polina-c): fix the leaking ImmediateMultiDragGestureRecognizer https://github.com/flutter/flutter/pull/144396 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), - (WidgetTester tester) async { + testWidgets('Draggable plays nice with onTap', (WidgetTester tester) async { late final OverlayEntry entry; addTearDown(() => entry..remove()..dispose()); @@ -2578,6 +2574,7 @@ void main() { await firstGesture.moveBy(const Offset(100.0, 0.0)); await secondGesture.up(); + await firstGesture.up(); }); testWidgets('DragTarget does not set state when remove from the tree', (WidgetTester tester) async { @@ -3434,10 +3431,7 @@ void main() { }); // Regression test for https://github.com/flutter/flutter/issues/92083 - testWidgets('feedback respect the MouseRegion cursor configure', - // TODO(polina-c): fix the leaking ImmediateMultiDragGestureRecognizer https://github.com/flutter/flutter/pull/144396 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), - (WidgetTester tester) async { + testWidgets('feedback respect the MouseRegion cursor configure', (WidgetTester tester) async { await tester.pumpWidget( const MaterialApp( home: Column( @@ -3463,6 +3457,7 @@ void main() { await tester.pump(); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.grabbing); + gesture.up(); }); testWidgets('configurable feedback ignore pointer behavior', (WidgetTester tester) async { diff --git a/packages/flutter/test/widgets/image_test.dart b/packages/flutter/test/widgets/image_test.dart index af15f5c9ad2d..033d60351bdc 100644 --- a/packages/flutter/test/widgets/image_test.dart +++ b/packages/flutter/test/widgets/image_test.dart @@ -824,7 +824,7 @@ void main() { }); testWidgets('Precache removes original listener immediately after future completes, does not crash on successive calls #25143', - // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] + // TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean] experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), (WidgetTester tester) async { final _TestImageStreamCompleter imageStreamCompleter = _TestImageStreamCompleter(); diff --git a/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart b/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart index 1f3267983bff..1f7aec466cf9 100644 --- a/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart +++ b/packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart @@ -10,7 +10,6 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/semantics.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'; import 'semantics_tester.dart'; @@ -53,10 +52,7 @@ void _tests() { // also update this code to reflect the new output. // // This test is flexible w.r.t. leading and trailing whitespace. - testWidgets('generates code', - // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), - (WidgetTester tester) async { + testWidgets('generates code', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); await pumpTestWidget(tester); final String code = semantics diff --git a/packages/flutter/test/widgets/shape_decoration_test.dart b/packages/flutter/test/widgets/shape_decoration_test.dart index 605ae1f74b7c..b0e7c67bd541 100644 --- a/packages/flutter/test/widgets/shape_decoration_test.dart +++ b/packages/flutter/test/widgets/shape_decoration_test.dart @@ -19,7 +19,7 @@ Future main() async { final ImageProvider image = TestImageProvider(0, 0, image: rawImage); testWidgets('ShapeDecoration.image', - // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] + // TODO(polina-c): dispose ImageStreamCompleterHandle, https://github.com/flutter/flutter/issues/145599 [leaks-to-clean] experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), (WidgetTester tester) async { await tester.pumpWidget( diff --git a/packages/flutter/test/widgets/view_test.dart b/packages/flutter/test/widgets/view_test.dart index 587045422a53..64221196bb6f 100644 --- a/packages/flutter/test/widgets/view_test.dart +++ b/packages/flutter/test/widgets/view_test.dart @@ -346,8 +346,7 @@ void main() { }); testWidgets('correctly switches between view configurations', - // TODO(polina-c): clean up leaks, https://github.com/flutter/flutter/issues/134787 [leaks-to-clean] - experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), + experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(), // Leaking by design as contains deprecated items. (WidgetTester tester) async { await tester.pumpWidget( wrapWithView: false,