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 <noreply@anthropic.com>
This commit is contained in:
Kameron
2026-10-29 15:52:37 -07:00
co-authored by Claude Fable 5.1
parent 57e40d2d14
commit 7d38697f71
+10
View File
@@ -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]