mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-17 00:04:18 +00:00
M5: test Ctrl+M as Windows and Linux send it (#3741)
Real Ctrl events carry both ctrl and command, so a Cmd+Ctrl+M binding, which the registry tries first, would also match them. The test now sends that shape on Windows instead of the command modifier alone.
This commit is contained in:
1 file changed
+5
-3
@@ -285,16 +285,18 @@ fn shortcuts_run_registered_commands() {
|
||||
#[test]
|
||||
fn ctrl_m_opens_the_comments_panel_and_keeps_it_open() {
|
||||
let mut h = harness();
|
||||
// Press it as Windows and Linux send it: Ctrl sets both `ctrl` and `command`, so a
|
||||
// Cmd+Ctrl+M binding would also match and must not take it.
|
||||
h.ctx.set_os(OperatingSystem::Windows);
|
||||
h.state_mut().right = None;
|
||||
h.run_steps(2);
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::M);
|
||||
h.key_press_modifiers(Modifiers::CTRL | Modifiers::COMMAND, Key::M);
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().right, Some(pdfcraft_ui_egui::RightPanel::Comments));
|
||||
// Pressed again it opens, not toggles (#3741).
|
||||
h.key_press_modifiers(Modifiers::COMMAND, Key::M);
|
||||
h.key_press_modifiers(Modifiers::CTRL | Modifiers::COMMAND, Key::M);
|
||||
h.run_steps(2);
|
||||
assert_eq!(h.state().right, Some(pdfcraft_ui_egui::RightPanel::Comments));
|
||||
h.ctx.set_os(OperatingSystem::Nix);
|
||||
h.state_mut().execute("help.shortcuts");
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Ctrl+M");
|
||||
|
||||
Reference in new issue
Block a user