From 2ace80452253cfa067a0d6bd95fd7a07477c3b15 Mon Sep 17 00:00:00 2001 From: Adrian Date: Wed, 28 Oct 2026 14:01:36 -0400 Subject: [PATCH] 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. --- crates/ui-egui/tests/it/commands.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/tests/it/commands.rs b/crates/ui-egui/tests/it/commands.rs index 2b2603ca37..d52cf040f9 100644 --- a/crates/ui-egui/tests/it/commands.rs +++ b/crates/ui-egui/tests/it/commands.rs @@ -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");