Support Alt+E center stage shortcut
Recognize Option+E by physical key position so macOS dead-key delivery works, including from focused composers, while preserving existing platform aliases and shell behavior. Update labels, notes, and focused coverage.
This commit is contained in:
@@ -385,6 +385,44 @@ void main() {
|
||||
);
|
||||
}
|
||||
|
||||
test('Alt+E toggles by physical key position, including Option dead keys', () {
|
||||
const event = KeyDownEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
character: '´',
|
||||
timeStamp: Duration.zero,
|
||||
);
|
||||
expect(chatCenterStageShortcut(event, _AltHeld()), isTrue);
|
||||
expect(
|
||||
chatCenterStageShortcut(
|
||||
const KeyUpEvent(
|
||||
physicalKey: PhysicalKeyboardKey.keyE,
|
||||
logicalKey: LogicalKeyboardKey(0x00B4),
|
||||
timeStamp: Duration.zero,
|
||||
),
|
||||
_AltHeld(),
|
||||
),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('Alt+E toggles from a focused composer without typing', (
|
||||
tester,
|
||||
) async {
|
||||
wide(tester);
|
||||
final workspace = threePanes();
|
||||
final stage = ChatCenterStageController(store: _MemoryStore());
|
||||
addTearDown(workspace.dispose);
|
||||
addTearDown(stage.dispose);
|
||||
await tester.pumpWidget(host(workspace, stage));
|
||||
await tester.tap(find.byKey(const ValueKey('input-three')));
|
||||
await tester.sendKeyDownEvent(LogicalKeyboardKey.altLeft);
|
||||
await tester.sendKeyEvent(LogicalKeyboardKey.keyE);
|
||||
await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
|
||||
expect(stage.value, isTrue);
|
||||
expect(find.text('e'), findsNothing);
|
||||
});
|
||||
|
||||
test('the choice is remembered', () async {
|
||||
final store = _MemoryStore();
|
||||
final first = ChatCenterStageController(store: store)..toggle();
|
||||
@@ -398,7 +436,18 @@ void main() {
|
||||
});
|
||||
|
||||
test('labels name the platform chord', () {
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.macOS), 'Cmd+E');
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.windows), 'Ctrl+E');
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.macOS), 'Option+E');
|
||||
expect(chatCenterStageShortcutLabel(TargetPlatform.windows), 'Alt+E');
|
||||
});
|
||||
}
|
||||
|
||||
class _AltHeld extends HardwareKeyboard {
|
||||
@override
|
||||
bool get isAltPressed => true;
|
||||
@override
|
||||
bool get isControlPressed => false;
|
||||
@override
|
||||
bool get isMetaPressed => false;
|
||||
@override
|
||||
bool get isShiftPressed => false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user