@@ -14354,6 +14354,50 @@ testWidgets('Floating cursor ending with selection', (WidgetTester tester) async
14354
14354
);
14355
14355
});
14356
14356
});
14357
+
14358
+ // Regression test for: https://github.com/flutter/flutter/issues/117418.
14359
+ testWidgets ('can handle the partial selection of a multi-code-unit glyph' , (WidgetTester tester) async {
14360
+ await tester.pumpWidget (
14361
+ MaterialApp (
14362
+ home: EditableText (
14363
+ controller: controller,
14364
+ showSelectionHandles: true ,
14365
+ autofocus: true ,
14366
+ focusNode: FocusNode (),
14367
+ style: Typography .material2018 ().black.titleMedium! ,
14368
+ cursorColor: Colors .blue,
14369
+ backgroundCursorColor: Colors .grey,
14370
+ selectionControls: materialTextSelectionControls,
14371
+ keyboardType: TextInputType .text,
14372
+ textAlign: TextAlign .right,
14373
+ minLines: 2 ,
14374
+ maxLines: 2 ,
14375
+ ),
14376
+ ),
14377
+ );
14378
+
14379
+ await tester.enterText (find.byType (EditableText ), '12345' );
14380
+ await tester.pumpAndSettle ();
14381
+
14382
+ final EditableTextState state =
14383
+ tester.state <EditableTextState >(find.byType (EditableText ));
14384
+ state.userUpdateTextEditingValue (
14385
+ const TextEditingValue (
14386
+ // This is an extended grapheme cluster made up of several code units,
14387
+ // which has length 8. A selection from 0-1 does not fully select it.
14388
+ text: '👨👩👦' ,
14389
+ selection: TextSelection (
14390
+ baseOffset: 0 ,
14391
+ extentOffset: 1 ,
14392
+ ),
14393
+ ),
14394
+ SelectionChangedCause .keyboard,
14395
+ );
14396
+
14397
+ await tester.pumpAndSettle ();
14398
+
14399
+ expect (tester.takeException (), null );
14400
+ });
14357
14401
}
14358
14402
14359
14403
class UnsettableController extends TextEditingController {
0 commit comments