From 7d38697f711f81973df729ba66eac5979cddf94d Mon Sep 17 00:00:00 2001 From: Kameron Date: Thu, 29 Oct 2026 15:52:37 -0700 Subject: [PATCH] Test: Command released in the same frame as the arrow press still jumps Covers the case the fix exists for: an automation keystroke presses and releases within one frame, so the frame-wide modifier state is already empty and only the press event carries Command. With the modifiers read from `i.modifiers` this assertion fails (B3 instead of B1). Co-Authored-By: Claude Fable 5.1 --- crates/ui-egui/tests/it/interaction.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/ui-egui/tests/it/interaction.rs b/crates/ui-egui/tests/it/interaction.rs index 39754591e..e876d736f 100644 --- a/crates/ui-egui/tests/it/interaction.rs +++ b/crates/ui-egui/tests/it/interaction.rs @@ -356,6 +356,16 @@ fn ctrl_arrows_in_point_mode_jump_to_the_edge_of_the_data() { h.input_mut().events.push(Event::ModifiersChanged(Modifiers::NONE)); key(&mut h, Key::ArrowUp, Modifiers::NONE); assert_eq!(edited(&h).as_deref(), Some("=COUNTIF(B4"), "a plain arrow still moves one cell"); + // An automation tool (osascript `key code`) presses and releases within one frame, so by the + // time the frame runs `i.modifiers` is already empty: the modifiers that count are the ones on + // the press event. + h.input_mut().events.extend([ + Event::Key { key: Key::ArrowUp, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::COMMAND }, + Event::ModifiersChanged(Modifiers::NONE), + Event::Key { key: Key::ArrowUp, physical_key: None, pressed: false, repeat: false, modifiers: Modifiers::NONE }, + ]); + h.run_steps(2); + assert_eq!(edited(&h).as_deref(), Some("=COUNTIF(B1"), "Command released in the same frame as the press still jumps"); } #[test]