Unverified Commit ff68b625 authored by Kostia Sokolovskyi's avatar Kostia Sokolovskyi Committed by GitHub

Fix a couple of CupertinoTextField tests to avoid leak-tracking test failures. (#135851)

parent 0eb2cb50
...@@ -2485,13 +2485,11 @@ void main() { ...@@ -2485,13 +2485,11 @@ void main() {
await gesture.up(); await gesture.up();
await tester.pump(); await tester.pump();
expect(find.byType(CupertinoButton), isContextMenuProvidedByPlatform ? findsNothing : findsNWidgets(4)); 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:
<String, int?>{'ValueNotifier<_OverlayEntryWidgetState?>': 1})
); );
//
testWidgetsWithLeakTracking('Readonly text field does not have tap action', (WidgetTester tester) async { testWidgetsWithLeakTracking('Readonly text field does not have tap action', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
...@@ -5816,7 +5814,7 @@ void main() { ...@@ -5816,7 +5814,7 @@ void main() {
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }), variant: const TargetPlatformVariant(<TargetPlatform>{ 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(); final TextEditingController controller = TextEditingController();
addTearDown(controller.dispose); addTearDown(controller.dispose);
...@@ -5860,11 +5858,17 @@ void main() { ...@@ -5860,11 +5858,17 @@ void main() {
expect(controller.selection.isCollapsed, true); expect(controller.selection.isCollapsed, true);
expect(controller.selection.baseOffset, testValue.indexOf('i')); 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>{ TargetPlatform.iOS }), variant: const TargetPlatformVariant(<TargetPlatform>{ 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(); final TextEditingController controller = TextEditingController();
addTearDown(controller.dispose); addTearDown(controller.dispose);
...@@ -5909,6 +5913,12 @@ void main() { ...@@ -5909,6 +5913,12 @@ void main() {
expect(controller.selection.isCollapsed, true); expect(controller.selection.isCollapsed, true);
expect(controller.selection.baseOffset, testValue.indexOf('i')); 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>{ TargetPlatform.iOS }), variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }),
); );
...@@ -5990,7 +6000,7 @@ void main() { ...@@ -5990,7 +6000,7 @@ void main() {
variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS }), variant: const TargetPlatformVariant(<TargetPlatform>{ 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(); final TextEditingController controller = TextEditingController();
addTearDown(controller.dispose); addTearDown(controller.dispose);
...@@ -6031,6 +6041,12 @@ void main() { ...@@ -6031,6 +6041,12 @@ void main() {
expect(controller.selection.isCollapsed, true); expect(controller.selection.isCollapsed, true);
expect(controller.selection.baseOffset, testValue.indexOf('g')); 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>{ TargetPlatform.android, TargetPlatform.fuchsia }), variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia }),
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment