Space right-click tests: assert results and menus for ⌘Space and ⌥Space

The agent test checks each ui.pointer call succeeds and that neither
⌘Space nor ⌥Space opens a canvas menu; ⌘ keeps the ⌘+right-click layer
list (#307), ⌥ opens nothing. A canvas-path test covers the same for
the Move and Brush tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Cristi RaduandClaude Opus 5.5 committed 2026-11-08 09:35:17 +02:00
1 parent dbaeae1723
commit 6083077d3d
2 files changed
+32 -4

No files matched your search

+6 -4
View File
@@ -675,15 +675,17 @@ fn agent_space_right_click_opens_the_hand_view_menu() {
app.ui.canvas_tool_menu = None;
app.ui.layer_menu = None;
app.ui.brush_picker = None;
call(&mut app, &ctx, "ui.pointer", click(true, true));
assert!(app.ui.canvas_tool_menu.as_ref().is_none_or(|m| m.anchor.is_none()), "{tool:?}: ⌘Space holds the Zoom, which has no menu");
assert_eq!(call(&mut app, &ctx, "ui.pointer", click(true, true))["ok"], true, "{tool:?}");
assert!(app.ui.canvas_tool_menu.is_none(), "{tool:?}: ⌘Space holds the Zoom, which has no menu");
// ⌘ still makes it a ⌘/Ctrl+right-click, which lists the layers under the pointer (#307).
assert!(app.ui.layer_menu.is_some(), "{tool:?}: ⌘+right-click lists the layers");
app.ui.canvas_tool_menu = None;
app.ui.layer_menu = None;
app.ui.brush_picker = None;
// ⌥Space holds the Zoom too: no view menu, and not the Move tool's layer list.
let alt = json!({"space": true, "alt": true, "button": "secondary", "events": [{"kind":"down","x":8,"y":8},{"kind":"up","x":8,"y":8}]});
call(&mut app, &ctx, "ui.pointer", alt);
assert!(app.ui.canvas_tool_menu.as_ref().is_none_or(|m| m.anchor.is_none()), "{tool:?}: ⌥Space opens no view menu");
assert_eq!(call(&mut app, &ctx, "ui.pointer", alt)["ok"], true, "{tool:?}");
assert!(app.ui.canvas_tool_menu.is_none(), "{tool:?}: ⌥Space opens no menu");
assert!(app.ui.layer_menu.is_none(), "{tool:?}: ⌥Space doesn't open the layer list");
}
}
@@ -1104,3 +1104,29 @@ fn space_right_click_opens_the_hand_view_menu() {
assert!(h.state().ui.canvas_tool_menu.is_none(), "{tool:?}: choosing closes the menu");
}
}
/// ⌘Space and ⌥Space hold the Zoom, not the Hand: a right-click opens no view menu (#11271).
/// With ⌥ it opens nothing, not even the held-over Move tool's layer list; with ⌘ it is still a
/// ⌘/Ctrl+right-click, which lists the layers under the pointer for any tool (#307).
#[test]
fn command_or_alt_space_right_click_opens_no_view_menu() {
for mods in [Modifiers::COMMAND, Modifiers::ALT] {
for tool in [Tool::Move, Tool::Brush] {
let mut h = harness(tool);
let p = screen(&h, 200.0, 150.0);
h.event(Event::PointerMoved(p));
h.run_steps(1);
key(&mut h, Key::Space, true, mods);
h.event(Event::PointerButton { pos: p, button: PointerButton::Secondary, pressed: true, modifiers: mods });
h.run_steps(1);
h.event(Event::PointerButton { pos: p, button: PointerButton::Secondary, pressed: false, modifiers: mods });
h.run_steps(1);
key(&mut h, Key::Space, false, mods);
h.run_steps(2);
let view = h.state().ui.canvas_tool_menu.as_ref().is_some_and(|m| crate::canvas_tool_menu::rows(m) == crate::canvas_tool_menu::VIEW_MENU);
assert!(!view, "{mods:?} {tool:?}: no view menu");
assert_eq!(h.state().ui.layer_menu.is_some(), mods.command, "{mods:?} {tool:?}: the layer list only for ⌘+right-click");
assert_eq!(h.state().ui.tool, tool, "{mods:?} {tool:?}: the tool is kept");
}
}
}