Unverified Commit f9b91734 authored by Angelo Silvestre's avatar Angelo Silvestre Committed by GitHub

Add deleteBackwardByDecomposingPreviousCharacter mapping for tests (#132919)

In  `MacOSTestTextInputKeyHandler`, there are some mappings from shortcuts to generate macOS selectors. However, `ctrl + backspace` isn't mapped to `deleteBackwardByDecomposingPreviousCharacter:`.

This PR adds the mapping for `deleteBackwardByDecomposingPreviousCharacter:`.

Fixes: https://github.com/flutter/flutter/issues/132917
parent 254f235c
...@@ -50,6 +50,8 @@ class MacOSTestTextInputKeyHandler extends TestTextInputKeyHandler { ...@@ -50,6 +50,8 @@ class MacOSTestTextInputKeyHandler extends TestTextInputKeyHandler {
alt: true, shift: pressShift): <String>['deleteWordBackward:'], alt: true, shift: pressShift): <String>['deleteWordBackward:'],
SingleActivator(LogicalKeyboardKey.backspace, SingleActivator(LogicalKeyboardKey.backspace,
meta: true, shift: pressShift): <String>['deleteToBeginningOfLine:'], meta: true, shift: pressShift): <String>['deleteToBeginningOfLine:'],
SingleActivator(LogicalKeyboardKey.backspace, control: true, shift: pressShift):
<String>['deleteBackwardByDecomposingPreviousCharacter:'],
SingleActivator(LogicalKeyboardKey.delete, shift: pressShift): <String>[ SingleActivator(LogicalKeyboardKey.delete, shift: pressShift): <String>[
'deleteForward:' 'deleteForward:'
], ],
......
...@@ -76,4 +76,26 @@ void main() { ...@@ -76,4 +76,26 @@ void main() {
expect(selectorNames, isNull); expect(selectorNames, isNull);
} }
}, variant: TargetPlatformVariant.all()); }, variant: TargetPlatformVariant.all());
testWidgets('selector is called for ctrl + backspace on macOS', (WidgetTester tester) async {
List<dynamic>? selectorNames;
await SystemChannels.textInput.invokeMethod('TextInput.setClient', <dynamic>[1, <String, dynamic>{}]);
await SystemChannels.textInput.invokeMethod('TextInput.show');
SystemChannels.textInput.setMethodCallHandler((MethodCall call) async {
if (call.method == 'TextInputClient.performSelectors') {
selectorNames = (call.arguments as List<dynamic>)[1] as List<dynamic>;
}
});
await tester.sendKeyDownEvent(LogicalKeyboardKey.control);
await tester.sendKeyDownEvent(LogicalKeyboardKey.backspace);
await tester.sendKeyUpEvent(LogicalKeyboardKey.backspace);
await tester.sendKeyUpEvent(LogicalKeyboardKey.control);
await SystemChannels.textInput.invokeMethod('TextInput.clearClient');
if (defaultTargetPlatform == TargetPlatform.macOS) {
expect(selectorNames, <dynamic>['deleteBackwardByDecomposingPreviousCharacter:']);
} else {
expect(selectorNames, isNull);
}
}, variant: TargetPlatformVariant.all());
} }
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