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:
Adrian committed 2026-11-16 04:27:47 -05:00
1 parent fdf9350045
commit 2ace804522
1 file changed
+5 -3
+5 -3
View File
@@ -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");