|
11 | 11 | // https://github.com/flutter/flutter/issues/122950 |
12 | 12 | // Fails with "flutter test --test-randomize-ordering-seed=20230318" |
13 | 13 | @Tags(<String>['reduced-test-set', 'no-shuffle']) |
14 | | -// TODO(188666): Fix web test failures and re-enable. See also: |
15 | | -// https://github.com/flutter/flutter/issues/71604. |
16 | | -@TestOn('!chrome') |
17 | 14 | library; |
18 | 15 |
|
19 | 16 | import 'dart:async'; |
@@ -2134,6 +2131,8 @@ void main() { |
2134 | 2131 | TargetPlatform.linux, |
2135 | 2132 | TargetPlatform.windows, |
2136 | 2133 | }), |
| 2134 | + skip: |
| 2135 | + isContextMenuProvidedByPlatform, // [intended] only applies to platforms where we supply the context menu. |
2137 | 2136 | ); |
2138 | 2137 |
|
2139 | 2138 | testWidgets('Swapping controllers should update selection', (WidgetTester tester) async { |
@@ -3401,75 +3400,78 @@ void main() { |
3401 | 3400 | ), |
3402 | 3401 | ); |
3403 | 3402 |
|
3404 | | - testWidgets('assertion error is not thrown when attempting to drag both selection handles', ( |
3405 | | - WidgetTester tester, |
3406 | | - ) async { |
3407 | | - // Regression test for https://github.com/flutter/flutter/issues/168578. |
3408 | | - final controller = TextEditingController(text: 'abc def ghi'); |
3409 | | - addTearDown(controller.dispose); |
| 3403 | + testWidgets( |
| 3404 | + 'assertion error is not thrown when attempting to drag both selection handles', |
| 3405 | + (WidgetTester tester) async { |
| 3406 | + // Regression test for https://github.com/flutter/flutter/issues/168578. |
| 3407 | + final controller = TextEditingController(text: 'abc def ghi'); |
| 3408 | + addTearDown(controller.dispose); |
3410 | 3409 |
|
3411 | | - await tester.pumpWidget( |
3412 | | - overlay( |
3413 | | - child: Center( |
3414 | | - child: TextField( |
3415 | | - dragStartBehavior: DragStartBehavior.down, |
3416 | | - controller: controller, |
3417 | | - style: const TextStyle(fontSize: 10.0), |
| 3410 | + await tester.pumpWidget( |
| 3411 | + overlay( |
| 3412 | + child: Center( |
| 3413 | + child: TextField( |
| 3414 | + dragStartBehavior: DragStartBehavior.down, |
| 3415 | + controller: controller, |
| 3416 | + style: const TextStyle(fontSize: 10.0), |
| 3417 | + ), |
3418 | 3418 | ), |
3419 | 3419 | ), |
3420 | | - ), |
3421 | | - ); |
| 3420 | + ); |
3422 | 3421 |
|
3423 | | - // Double tap on 'e' to select 'def'. |
3424 | | - final Offset ePos = textOffsetToPosition(tester, 5); |
3425 | | - await tester.tapAt(ePos, pointer: 7); |
3426 | | - await tester.pump(const Duration(milliseconds: 50)); |
3427 | | - expect(controller.selection.isCollapsed, isTrue); |
3428 | | - expect(controller.selection.baseOffset, 5); |
3429 | | - await tester.tapAt(ePos, pointer: 7); |
3430 | | - await tester.pumpAndSettle(); |
3431 | | - expect(controller.selection.baseOffset, 4); |
3432 | | - expect(controller.selection.extentOffset, 7); |
| 3422 | + // Double tap on 'e' to select 'def'. |
| 3423 | + final Offset ePos = textOffsetToPosition(tester, 5); |
| 3424 | + await tester.tapAt(ePos, pointer: 7); |
| 3425 | + await tester.pump(const Duration(milliseconds: 50)); |
| 3426 | + expect(controller.selection.isCollapsed, isTrue); |
| 3427 | + expect(controller.selection.baseOffset, 5); |
| 3428 | + await tester.tapAt(ePos, pointer: 7); |
| 3429 | + await tester.pumpAndSettle(); |
| 3430 | + expect(controller.selection.baseOffset, 4); |
| 3431 | + expect(controller.selection.extentOffset, 7); |
3433 | 3432 |
|
3434 | | - final RenderEditable renderEditable = findRenderEditable(tester); |
3435 | | - final List<TextSelectionPoint> endpoints = globalize( |
3436 | | - renderEditable.getEndpointsForSelection(controller.selection), |
3437 | | - renderEditable, |
3438 | | - ); |
3439 | | - expect(endpoints.length, 2); |
| 3433 | + final RenderEditable renderEditable = findRenderEditable(tester); |
| 3434 | + final List<TextSelectionPoint> endpoints = globalize( |
| 3435 | + renderEditable.getEndpointsForSelection(controller.selection), |
| 3436 | + renderEditable, |
| 3437 | + ); |
| 3438 | + expect(endpoints.length, 2); |
3440 | 3439 |
|
3441 | | - // Drag the end handle to 'g'. |
3442 | | - final Offset endHandlePos = endpoints[1].point + const Offset(1.0, 1.0); |
3443 | | - Offset newHandlePos = textOffsetToPosition(tester, 9); // Position of 'g'. |
3444 | | - final TestGesture endHandleGesture = await tester.startGesture(endHandlePos, pointer: 7); |
3445 | | - await tester.pump(); |
3446 | | - await endHandleGesture.moveTo(newHandlePos); |
3447 | | - await tester.pump(); |
3448 | | - expect(controller.selection.baseOffset, 4); |
3449 | | - expect(controller.selection.extentOffset, 9); |
| 3440 | + // Drag the end handle to 'g'. |
| 3441 | + final Offset endHandlePos = endpoints[1].point + const Offset(1.0, 1.0); |
| 3442 | + Offset newHandlePos = textOffsetToPosition(tester, 9); // Position of 'g'. |
| 3443 | + final TestGesture endHandleGesture = await tester.startGesture(endHandlePos, pointer: 7); |
| 3444 | + await tester.pump(); |
| 3445 | + await endHandleGesture.moveTo(newHandlePos); |
| 3446 | + await tester.pump(); |
| 3447 | + expect(controller.selection.baseOffset, 4); |
| 3448 | + expect(controller.selection.extentOffset, 9); |
3450 | 3449 |
|
3451 | | - // Attempt to drag the start handle to the start of the text. |
3452 | | - final Offset startHandlePos = endpoints[0].point + const Offset(1.0, 1.0); |
3453 | | - newHandlePos = textOffsetToPosition(tester, 0); |
3454 | | - final TestGesture startHandleGesture = await tester.startGesture(startHandlePos, pointer: 8); |
3455 | | - await tester.pump(); |
3456 | | - await startHandleGesture.moveTo(newHandlePos); |
3457 | | - await tester.pump(); |
3458 | | - await startHandleGesture.up(); |
3459 | | - await tester.pump(); |
| 3450 | + // Attempt to drag the start handle to the start of the text. |
| 3451 | + final Offset startHandlePos = endpoints[0].point + const Offset(1.0, 1.0); |
| 3452 | + newHandlePos = textOffsetToPosition(tester, 0); |
| 3453 | + final TestGesture startHandleGesture = await tester.startGesture(startHandlePos, pointer: 8); |
| 3454 | + await tester.pump(); |
| 3455 | + await startHandleGesture.moveTo(newHandlePos); |
| 3456 | + await tester.pump(); |
| 3457 | + await startHandleGesture.up(); |
| 3458 | + await tester.pump(); |
3460 | 3459 |
|
3461 | | - // Drag the end handle to the end of the text after releasing the start handle. |
3462 | | - newHandlePos = textOffsetToPosition(tester, 11); // Position of 'i'. |
3463 | | - await tester.pump(); |
3464 | | - await endHandleGesture.moveTo(newHandlePos); |
3465 | | - await tester.pump(); |
3466 | | - await endHandleGesture.up(); |
3467 | | - await tester.pump(); |
| 3460 | + // Drag the end handle to the end of the text after releasing the start handle. |
| 3461 | + newHandlePos = textOffsetToPosition(tester, 11); // Position of 'i'. |
| 3462 | + await tester.pump(); |
| 3463 | + await endHandleGesture.moveTo(newHandlePos); |
| 3464 | + await tester.pump(); |
| 3465 | + await endHandleGesture.up(); |
| 3466 | + await tester.pump(); |
3468 | 3467 |
|
3469 | | - expect(tester.takeException(), isNull); |
3470 | | - expect(controller.selection.baseOffset, 0); |
3471 | | - expect(controller.selection.extentOffset, 11); |
3472 | | - }, variant: TargetPlatformVariant.only(TargetPlatform.android)); |
| 3468 | + expect(tester.takeException(), isNull); |
| 3469 | + expect(controller.selection.baseOffset, 0); |
| 3470 | + expect(controller.selection.extentOffset, 11); |
| 3471 | + }, |
| 3472 | + variant: TargetPlatformVariant.only(TargetPlatform.android), |
| 3473 | + skip: kIsWeb, // [intended] on web only one selection handle can be dragged at a time. |
| 3474 | + ); |
3473 | 3475 |
|
3474 | 3476 | testWidgets('Can only drag one selection handle at a time on iOS', (WidgetTester tester) async { |
3475 | 3477 | final controller = TextEditingController(text: 'abc def ghi'); |
@@ -12738,6 +12740,8 @@ void main() { |
12738 | 12740 | variant: TargetPlatformVariant.all( |
12739 | 12741 | excluding: <TargetPlatform>{TargetPlatform.iOS, TargetPlatform.macOS}, |
12740 | 12742 | ), |
| 12743 | + skip: |
| 12744 | + isContextMenuProvidedByPlatform, // [intended] only applies to platforms where we supply the context menu. |
12741 | 12745 | ); |
12742 | 12746 |
|
12743 | 12747 | testWidgets( |
|
0 commit comments