Skip to content

Commit ff68b62

Browse files
authored
Fix a couple of CupertinoTextField tests to avoid leak-tracking test failures. (#135851)
1 parent 0eb2cb5 commit ff68b62

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

packages/flutter/test/cupertino/text_field_test.dart

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,13 +2485,11 @@ void main() {
24852485
await gesture.up();
24862486
await tester.pump();
24872487
expect(find.byType(CupertinoButton), isContextMenuProvidedByPlatform ? findsNothing : findsNWidgets(4));
2488+
2489+
// Skip the magnifier hide animation, so it can release resources.
2490+
await tester.pump(const Duration(milliseconds: 150));
24882491
},
2489-
// TODO(derdilla): remove after fixing and leak track other failing tests in
2490-
// this file. https://github.com/flutter/flutter/issues/135803
2491-
leakTrackingTestConfig: const LeakTrackingTestConfig(notDisposedAllowList:
2492-
<String, int?>{'ValueNotifier<_OverlayEntryWidgetState?>': 1})
24932492
);
2494-
//
24952493

24962494
testWidgetsWithLeakTracking('Readonly text field does not have tap action', (WidgetTester tester) async {
24972495
final SemanticsTester semantics = SemanticsTester(tester);
@@ -5816,7 +5814,7 @@ void main() {
58165814
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }),
58175815
);
58185816

5819-
testWidgets('Can move cursor when dragging, when tap is on collapsed selection (iOS)', (WidgetTester tester) async {
5817+
testWidgetsWithLeakTracking('Can move cursor when dragging, when tap is on collapsed selection (iOS)', (WidgetTester tester) async {
58205818
final TextEditingController controller = TextEditingController();
58215819
addTearDown(controller.dispose);
58225820

@@ -5860,11 +5858,17 @@ void main() {
58605858

58615859
expect(controller.selection.isCollapsed, true);
58625860
expect(controller.selection.baseOffset, testValue.indexOf('i'));
5861+
5862+
// End gesture and skip the magnifier hide animation, so it can release
5863+
// resources.
5864+
await gesture.up();
5865+
await tester.pump();
5866+
await tester.pump(const Duration(milliseconds: 150));
58635867
},
58645868
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }),
58655869
);
58665870

5867-
testWidgets('Can move cursor when dragging, when tap is on collapsed selection (iOS) - multiline', (WidgetTester tester) async {
5871+
testWidgetsWithLeakTracking('Can move cursor when dragging, when tap is on collapsed selection (iOS) - multiline', (WidgetTester tester) async {
58685872
final TextEditingController controller = TextEditingController();
58695873
addTearDown(controller.dispose);
58705874

@@ -5909,6 +5913,12 @@ void main() {
59095913

59105914
expect(controller.selection.isCollapsed, true);
59115915
expect(controller.selection.baseOffset, testValue.indexOf('i'));
5916+
5917+
// End gesture and skip the magnifier hide animation, so it can release
5918+
// resources.
5919+
await gesture.up();
5920+
await tester.pump();
5921+
await tester.pump(const Duration(milliseconds: 150));
59125922
},
59135923
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }),
59145924
);
@@ -5990,7 +6000,7 @@ void main() {
59906000
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }),
59916001
);
59926002

5993-
testWidgets('Can move cursor when dragging (Android)', (WidgetTester tester) async {
6003+
testWidgetsWithLeakTracking('Can move cursor when dragging (Android)', (WidgetTester tester) async {
59946004
final TextEditingController controller = TextEditingController();
59956005
addTearDown(controller.dispose);
59966006

@@ -6031,6 +6041,12 @@ void main() {
60316041

60326042
expect(controller.selection.isCollapsed, true);
60336043
expect(controller.selection.baseOffset, testValue.indexOf('g'));
6044+
6045+
// End gesture and skip the magnifier hide animation, so it can release
6046+
// resources.
6047+
await gesture.up();
6048+
await tester.pump();
6049+
await tester.pump(const Duration(milliseconds: 150));
60346050
},
60356051
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia }),
60366052
);

0 commit comments

Comments
 (0)