mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-01 01:12:59 -05:00
Outside the Design tab an agent had 175 commands, 50 of them in the tool list. There are now 118, named by what they act on (`object_`, `plate_`, `preset_`, `filament_`, `plugin_` and so on), and 115 are listed. Each takes its target and values in the call, acts on the selection when it names no target and says what it acted on; an old name is refused. Printers and system filaments install and uninstall, preferences read and write, plugins enable, reload, uninstall and refresh, and objects reorder, with no dialog to drive. The Speed Dial keeps its 129 tiles under the same ids. Eight defects in the rows these commands share with the menus are fixed. For a person: an object row that cannot run says why instead of "Select an object first.", rows that failed no longer claim success, Duplicate Plate can be undone, and Refresh Plugins picked while a refresh runs now runs after it instead of beside it.
75 lines
5.2 KiB
JSON
75 lines
5.2 KiB
JSON
// Context and button menus are listed or run by path, never shown, so the run must finish with nobody
|
|
// pressing Escape (on macOS a native menu would hold every later step). Run it on a fresh datadir set
|
|
// up with the default printer (Bambu Lab X1 Carbon 0.4):
|
|
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/context_menus.json --out /tmp/menus
|
|
// Refusals (no such item, a submenu, a disabled item, a click that opened no menu) are unit tests in
|
|
// tests/slic3rutils/test_mcp_results.cpp, since a replay step cannot expect an error.
|
|
{
|
|
"orca_replay_version": "0.2.0",
|
|
"name": "context menus",
|
|
"steps": [
|
|
{"tool": "app_wait", "args": {"for": "ready"}},
|
|
{"tool": "dialog_auto_answer", "args": {"rules": [
|
|
{"match": "Uniform scale", "button": "ok"},
|
|
{"match": "per-object setting mode", "button": "ok"}]}},
|
|
{"tool": "project_new", "args": {"discard_changes": true}},
|
|
{"tool": "window_set", "args": {"size": [1600, 900]}},
|
|
{"tool": "view_set", "args": {"tab": "prepare"}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:add_primitive_cube:orca"}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "view_set", "args": {"camera": "iso"}},
|
|
// Every click on the cube goes to a point on its top, in the cube's own coordinates, away from the
|
|
// diagonal its two triangles share. The middle of the top is on that edge, and from the iso view the
|
|
// ray to it runs along the edge, where rounding can let the surface check's ray slip between them.
|
|
|
|
// ---- A right click on the cube lists the object menu; nothing is shown ----
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "point": [6, -6, 12.8]}},
|
|
"expect": {"/popup_menu/items": {"contains": "Add Modifier>Cylinder"}, "/popup_menu/checked": {"contains": "Printable"}}},
|
|
{"tool": "app_state", "expect": {"/dialogs": {"empty": true}}},
|
|
|
|
// ---- The same click runs an item: a modifier through the GUI's own command, one undo step ----
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "point": [6, -6, 12.8]}, "popup_item": "add modifier>cylinder"},
|
|
"expect": {"/ran": {"eq": "Add Modifier>Cylinder"}}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
|
|
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1": {"exists": false}}},
|
|
{"tool": "action_run", "args": {"id": "orca_command:redo:orca"}},
|
|
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}},
|
|
|
|
// ---- The Edit menu's Undo and Redo, named by their labels alone on every platform, though macOS shows
|
|
// their keys as text after them ----
|
|
{"tool": "widget_click", "args": {"target": {"menu": "Edit>Undo"}}, "expect": {"/clicked": {"eq": "Edit>Undo"}}},
|
|
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1": {"exists": false}}},
|
|
{"tool": "widget_click", "args": {"target": {"menu": "Edit>Redo"}}, "expect": {"/clicked": {"eq": "Edit>Redo"}}},
|
|
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "modifier"}}},
|
|
|
|
// ---- Empty space with nothing selected: the default menu ----
|
|
{"tool": "object_select", "args": {"none": true}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "x": 1000, "y": 150},
|
|
"expect": {"/popup_menu/items": {"contains": "Add Primitive>Cube"}}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "x": 1000, "y": 150, "popup_item": "Add Primitive>Cylinder"},
|
|
"expect": {"/ran": {"eq": "Add Primitive>Cylinder"}}},
|
|
{"tool": "app_wait", "args": {"for": "idle"}},
|
|
{"tool": "app_state", "expect": {"/objects": {"eq": 2}}},
|
|
|
|
// ---- A button's menu: the first edit button, the printer's (zero-sized on macOS, which froze the
|
|
// app before), or on Linux, where that one is hidden, filament 1's, which has a menu with two
|
|
// filaments ----
|
|
{"tool": "widget_click", "args": {"target": {"label": "Add one filament"}}},
|
|
{"tool": "widget_click", "args": {"target": {"label": "Click to edit preset", "index": 0}},
|
|
"expect": {"/popup_menu/items": {"empty": false}}},
|
|
{"tool": "app_state", "expect": {"/dialogs": {"empty": true}, "/tab": {"eq": "prepare"}}},
|
|
|
|
// ---- Two objects selected: the multi-selection menu, built for each click and freed after it ----
|
|
{"tool": "object_select", "args": {"all": true}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "point": [6, -6, 12.8]}},
|
|
"expect": {"/popup_menu/items": {"contains": "Align/Distribute>Align left (-X)"}}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "point": [6, -6, 12.8]}},
|
|
"expect": {"/popup_menu/items": {"contains": "Delete"}}},
|
|
{"tool": "mouse_gesture", "args": {"action": "click", "button": "right", "at": {"object": 0, "point": [6, -6, 12.8]}, "popup_item": "Delete"},
|
|
"expect": {"/ran": {"eq": "Delete"}}},
|
|
{"tool": "app_state", "expect": {"/objects": {"eq": 0}, "/closed_menus": {"empty": true}}}
|
|
]
|
|
}
|