diff --git a/packages/flutter/test/cupertino/text_field_test.dart b/packages/flutter/test/cupertino/text_field_test.dart index 5750c548c9..147dcc3554 100644 --- a/packages/flutter/test/cupertino/text_field_test.dart +++ b/packages/flutter/test/cupertino/text_field_test.dart @@ -2485,13 +2485,11 @@ void main() { await gesture.up(); await tester.pump(); expect(find.byType(CupertinoButton), isContextMenuProvidedByPlatform ? findsNothing : findsNWidgets(4)); + + // Skip the magnifier hide animation, so it can release resources. + await tester.pump(const Duration(milliseconds: 150)); }, - // TODO(derdilla): remove after fixing and leak track other failing tests in - // this file. https://github.com/flutter/flutter/issues/135803 - leakTrackingTestConfig: const LeakTrackingTestConfig(notDisposedAllowList: - {'ValueNotifier<_OverlayEntryWidgetState?>': 1}) ); - // testWidgetsWithLeakTracking('Readonly text field does not have tap action', (WidgetTester tester) async { final SemanticsTester semantics = SemanticsTester(tester); @@ -5816,7 +5814,7 @@ void main() { variant: const TargetPlatformVariant({ TargetPlatform.iOS }), ); - testWidgets('Can move cursor when dragging, when tap is on collapsed selection (iOS)', (WidgetTester tester) async { + testWidgetsWithLeakTracking('Can move cursor when dragging, when tap is on collapsed selection (iOS)', (WidgetTester tester) async { final TextEditingController controller = TextEditingController(); addTearDown(controller.dispose); @@ -5860,11 +5858,17 @@ void main() { expect(controller.selection.isCollapsed, true); expect(controller.selection.baseOffset, testValue.indexOf('i')); + + // End gesture and skip the magnifier hide animation, so it can release + // resources. + await gesture.up(); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 150)); }, variant: const TargetPlatformVariant({ TargetPlatform.iOS }), ); - testWidgets('Can move cursor when dragging, when tap is on collapsed selection (iOS) - multiline', (WidgetTester tester) async { + testWidgetsWithLeakTracking('Can move cursor when dragging, when tap is on collapsed selection (iOS) - multiline', (WidgetTester tester) async { final TextEditingController controller = TextEditingController(); addTearDown(controller.dispose); @@ -5909,6 +5913,12 @@ void main() { expect(controller.selection.isCollapsed, true); expect(controller.selection.baseOffset, testValue.indexOf('i')); + + // End gesture and skip the magnifier hide animation, so it can release + // resources. + await gesture.up(); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 150)); }, variant: const TargetPlatformVariant({ TargetPlatform.iOS }), ); @@ -5990,7 +6000,7 @@ void main() { variant: const TargetPlatformVariant({ TargetPlatform.iOS }), ); - testWidgets('Can move cursor when dragging (Android)', (WidgetTester tester) async { + testWidgetsWithLeakTracking('Can move cursor when dragging (Android)', (WidgetTester tester) async { final TextEditingController controller = TextEditingController(); addTearDown(controller.dispose); @@ -6031,6 +6041,12 @@ void main() { expect(controller.selection.isCollapsed, true); expect(controller.selection.baseOffset, testValue.indexOf('g')); + + // End gesture and skip the magnifier hide animation, so it can release + // resources. + await gesture.up(); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 150)); }, variant: const TargetPlatformVariant({ TargetPlatform.android, TargetPlatform.fuchsia }), );