forked from firka/flutter
Export characters (#59620)
This commit is contained in:
committed by
GitHub
parent
2e63b7d4f8
commit
766e0fa9ef
@@ -15,6 +15,7 @@
|
||||
library widgets;
|
||||
|
||||
export 'package:vector_math/vector_math_64.dart' show Matrix4;
|
||||
export 'package:characters/characters.dart';
|
||||
|
||||
export 'src/widgets/actions.dart';
|
||||
export 'src/widgets/animated_cross_fade.dart';
|
||||
|
||||
@@ -5022,6 +5022,32 @@ void main() {
|
||||
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text);
|
||||
});
|
||||
|
||||
testWidgets('Can access characters on editing string', (WidgetTester tester) async {
|
||||
int charactersLength;
|
||||
final Widget widget = MaterialApp(
|
||||
home: EditableText(
|
||||
backgroundCursorColor: Colors.grey,
|
||||
controller: TextEditingController(),
|
||||
focusNode: FocusNode(),
|
||||
style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1,
|
||||
cursorColor: Colors.blue,
|
||||
selectionControls: materialTextSelectionControls,
|
||||
keyboardType: TextInputType.text,
|
||||
onChanged: (String value) {
|
||||
charactersLength = value.characters.length;
|
||||
},
|
||||
),
|
||||
);
|
||||
await tester.pumpWidget(widget);
|
||||
|
||||
// Enter an extended grapheme cluster whose string length is different than
|
||||
// its characters length.
|
||||
await tester.enterText(find.byType(EditableText), '👨👩👦');
|
||||
await tester.pump();
|
||||
|
||||
expect(charactersLength, 1);
|
||||
});
|
||||
|
||||
testWidgets('EditableText can set and update clipBehavior', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(MediaQuery(
|
||||
data: const MediaQueryData(devicePixelRatio: 1.0),
|
||||
|
||||
Reference in New Issue
Block a user