Files
OrcaSlicer/tools/mcp/tests/rows.json
T
SoftFever d64e10f4dd Regroup the slicer's MCP commands and let each run from its arguments
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.
2026-11-18 16:50:32 +08:00

97 lines
7.5 KiB
JSON

// Rows of lists, trees and tables as targets, and popups as snapshot roots: object list rows (plates,
// an object, its parts and the Printable column), the object's and a part's menus run from their rows,
// Compare presets' rows, the object settings table, the print button's popup and a drop-down list. 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/rows.json --out /tmp/rows
// Refusals (a bad column, a row without a checkbox, two rows a locator names) and checklist rows (the
// Add Settings checklist is on no FFF menu) are unit tests in tests/slic3rutils/test_mcp_results.cpp.
{
"orca_replay_version": "0.2.0",
"name": "rows and popups",
"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"}},
// ---- The object list shows while the sidebar's switch is on Objects ----
{"tool": "widget_set_value", "args": {"target": {"class": "SwitchButton", "label": "Process"}, "value": true}},
{"tool": "widget_list", "args": {"target": "main", "query": "row"}, "expect": {"/nodes": {"ge": 2}}},
// ---- Plate rows pick the plate ----
{"tool": "widget_click", "args": {"target": {"gltoolbar": "addplate"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 2"}}, "expect": {"/selected": {"eq": ["Plate 2"]}}},
{"tool": "app_state", "expect": {"/plates/current": {"eq": 1}}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 1"}}},
{"tool": "app_state", "expect": {"/plates/current": {"eq": 0}}},
// ---- An object row: selected as a click selects it, its menu listed and run ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "widget_click", "args": {"target": {"row": "Cube"}}, "expect": {"/selected": {"eq": ["Plate 1>Cube"]}}},
{"tool": "widget_click", "args": {"target": {"row": "Cube"}, "button": "right"},
"expect": {"/popup_menu/items": {"contains": "Add Modifier>Cylinder"}}},
{"tool": "widget_click", "args": {"target": {"row": "Cube"}, "button": "right", "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"}}},
// ---- Part rows: a click, Ctrl adds another; a right click keeps a selection it is in, so the part
// is clicked alone before its menu changes its type ----
{"tool": "widget_click", "args": {"target": {"row": "Cube>Generic-Cylinder"}}, "expect": {"/selected": {"eq": ["Plate 1>Cube>Generic-Cylinder"]}}},
{"tool": "widget_click", "args": {"target": {"row": "Cube>Cube"}, "modifiers": ["ctrl"]},
"expect": {"/selected": {"eq": ["Plate 1>Cube>Cube", "Plate 1>Cube>Generic-Cylinder"]}}},
{"tool": "widget_click", "args": {"target": {"row": "Cube>Generic-Cylinder"}}},
{"tool": "widget_click", "args": {"target": {"row": "Cube>Generic-Cylinder"}, "button": "right", "popup_item": "Change Type>Negative Part"},
"expect": {"/ran": {"eq": "Change Type>Negative Part"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/parts/1/type": {"eq": "negative"}}},
// ---- The Printable column acts as a click on its icon; a double click frames the object ----
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cube", "column": "Printable"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/instances/0/printable": {"eq": false}}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cube", "column": "Printable"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/0/instances/0/printable": {"eq": true}}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cube"}, "double": true}, "expect": {"/selected": {"eq": ["Plate 1>Cube"]}}},
{"tool": "object_list", "expect": {"/total": {"eq": 1}, "/plates/0/objects/0/instances/0/printable": {"eq": true}}},
// ---- Compare presets: a data view's rows, with both presets' values ----
{"tool": "widget_click", "args": {"target": {"label": "Compare presets"}}},
{"tool": "widget_set_value", "args": {"target": {"class": "PresetComboBox", "within": "Compare presets", "index": 5}, "value": "0.12mm Fine @BBL X1C"}},
{"tool": "widget_click", "args": {"target": {"row": "Quality>Layer height>Layer height", "within": "Compare presets"}},
"expect": {"/clicked": {"contains": "Quality>Layer height>Layer height"}}},
{"tool": "keyboard_press", "args": {"target": {"class": "DiffPresetDialog"}, "keys": "Escape"}},
// ---- The object settings table: rows named by their Name cell, read-only ----
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cube"}, "button": "right", "popup_item": "Edit in Parameter Table"},
"await": false, "save_as": "table"},
{"tool": "app_wait", "args": {"for": "dialog", "timeout_s": 10}, "expect": {"/satisfied": {"eq": true}}},
{"tool": "widget_list", "args": {"target": "dialog", "query": "Generic-Cylinder"}, "expect": {"/nodes": {"eq": 1}}},
{"tool": "widget_click", "args": {"target": {"row": "Generic-Cylinder", "within": "Object/Part Settings", "column": "Wall loops"}},
"expect": {"/column": {"eq": "Wall loops"}}},
{"tool": "dialog_answer", "args": {"dialog": {"title": "Object/Part Settings"}, "button": "close"}},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.table}"}},
// ---- The print button's popup: listed on its own, one of its buttons picked ----
{"tool": "widget_click", "args": {"target": {"class": "SideButton", "index": 3}}},
{"tool": "widget_list", "args": {"target": "popup", "query": "Export plate sliced file"}, "expect": {"/nodes": {"eq": 1}}},
{"tool": "widget_click", "args": {"target": {"class": "SideButton", "label": "Export plate sliced file"}}},
{"tool": "widget_list", "args": {"target": "popup"}, "expect": {"/nodes": {"eq": 0}}},
{"tool": "widget_list", "args": {"target": "main", "query": "Export plate sliced file", "include_menus": false}, "expect": {"/nodes": {"eq": 1}}},
// ---- A drop-down list's rows: the plate type, picked, then put back through the combo itself (a
// press within 20 ms of its list closing, which a replay can make, does not reopen it) ----
{"tool": "widget_click", "args": {"target": {"class": "ComboBox", "label": "Smooth Cool Plate"}}},
{"tool": "widget_list", "args": {"target": "popup", "query": "row"}, "expect": {"/nodes": {"ge": 2}}},
{"tool": "widget_click", "args": {"target": {"row": "Textured PEI Plate"}}, "expect": {"/clicked": {"eq": "Textured PEI Plate"}}},
{"tool": "widget_list", "args": {"target": "main", "query": "Textured PEI Plate"}, "expect": {"/nodes": {"eq": 1}}},
{"tool": "widget_set_value", "args": {"target": {"class": "ComboBox", "label": "Textured PEI Plate"}, "value": "Smooth Cool Plate"}},
{"tool": "widget_list", "args": {"target": "main", "query": "Smooth Cool Plate"}, "expect": {"/nodes": {"eq": 1}}},
{"tool": "app_state", "expect": {"/dialogs": {"empty": true}, "/closed_menus": {"empty": true}}}
]
}