Catalog the MCP sweep tests and design their Python replacements

Every sweep test now has an entry, by area under tools/mcp/test-entries/, saying what it checks, how it decides pass
or fail and what it leaves unchecked, and TESTS.md holds the rules a new test is designed by before it is written.
The entries also design the Python tests that take the place of the replays, which leave the sweep as those land;
the fifteen operation replays that could not fail are removed now.
This commit is contained in:
SoftFever 2026-11-19 05:40:47 +08:00
parent 1d63e52dec
commit 5a351f9cb1
31 changed files with 5948 additions and 1353 deletions

View file

@ -29,6 +29,8 @@ ctest --test-dir ./tests/fff_print -C Release
To run the app and see or drive it (reproduce an issue, capture before/after screenshots, script GUI steps), use its MCP server: [tools/mcp/README.md](tools/mcp/README.md) launches it and drives it from a shell, Python or a replayable script, and the design is in [docs/HLSD/mcp-server.md](docs/HLSD/mcp-server.md).
The MCP sweep's tests (`tools/mcp/run_sweep.py`) are designed top down: [tools/mcp/TESTS.md](tools/mcp/TESTS.md) holds the rules and the index, and each area's entries are in `tools/mcp/test-entries/`. Before writing or changing a test, add or update its entry (what it tests, the checks that decide it, what it leaves out) and have the entry reviewed. Keep the entry in step with the test.
## Documentation
- Docs live in `docs/`; the high-level design of a subsystem goes in `docs/HLSD/<subsystem>.md`.

View file

@ -340,24 +340,19 @@ refusals that leave the project as it was (modified presets without `preset_chan
does not take), `preset_changes: "keep"` keeping an edit, and `project_new` dropping the test's settings. It
starts from the harness's default printer and reruns on the same datadir.
`tests/ops_*.json` drive each operation of the operations layer (`docs/HLSD/mcp-server.md`, "The
operations layer") through the routes that reach it: the command, a Speed Dial action run with `action_run`
`tests/ops_open_project.json`, `ops_select_preset.json`, `ops_assign_filament_preset_one_slot.json` and
`ops_assign_filament_preset_multi_slot.json` drive an operation of the operations layer (`docs/HLSD/mcp-server.md`,
"The operations layer") through the routes that reach it: the command, a Speed Dial action run with `action_run`
where one runs it from a call, and, for presets, a pick in the sidebar and the plugin API called from a
`script_run` step. One replay per operation, named after it: G-code, sliced 3MF, model 3MF and STL exports, a model
import, a project opened, started anew and saved, a plate selected and locked, arrange, slice, the
Preview's layer range, a printer or process preset selected (`ops_select_preset`), a filament assigned
to a slot on a printer with one slot and with several (`ops_assign_filament_preset_one_slot`,
`_multi_slot`), presets imported, an object's instance count, and the refusals of `printer_send`'s action,
whose id is `send_gcode`, which never sets a print host, so nothing is sent. Each records what a call leaves: its reply or its
refusal's text, the state read back after it, and the undo snapshots it took, which
`tests/fixtures/ops_undo.py` reads from the app's log since no tool lists the undo history. Their
`expect`s are on the setup and on what is read back. A replay cannot assert a refusal's text, so a
call that a route refuses is `optional`, and `result.json` is the record of those texts, to compare
between two builds.
`script_run` step. They open a project, select a printer or process preset, and assign a filament to a slot on a
printer with one slot and with several. Each records what a call leaves: its reply or its refusal's text, the
state read back after it, and the undo snapshots it took, which `tests/fixtures/ops_undo.py` reads from the app's
log since no tool lists the undo history. Their `expect`s are on the setup and on what is read back. A replay
cannot assert a refusal's text, so a call that a route refuses is `optional`, and `result.json` is the record of
those texts.
The preset replays share `tests/fixtures/ops_presets.py`, which sets the slots, colours and flushing
volumes to known values before each case, and each needs a freshly launched app, since a hidden
preset that `preset_select` shows stays shown until a restart. The replays whose calls write files
need a fresh `--out`, since some of those calls write without `overwrite`. Launch the app from a folder that
preset that `preset_select` shows stays shown until a restart. Launch the app from a folder that
holds no `.py` files, since the app's working directory is on Python's module path and a file there can
shadow a standard module that `script_run` needs.
@ -688,3 +683,7 @@ An entry's keys:
- `timeout_s`: how long the test may run (900 by default).
`test_run_sweep.py` checks the runner without the app, and that `sweep.json` lists every test there is.
`TESTS.md` holds the rules the sweep's tests follow and the index of all of them, and `test-entries/` an entry for
each test, by area: what it tests, how it decides pass or fail, and what it leaves unchecked. A new test starts as
an entry there, reviewed before the test is written.

252
tools/mcp/TESTS.md Normal file
View file

@ -0,0 +1,252 @@
# MCP sweep tests
The design of the tests `run_sweep.py` runs. This file holds the rules every test follows, the grades, and the index
of all tests. Each test's entry is in its area's file under `test-entries/`: what the test checks, how it decides
pass or fail, what it leaves unchecked, and how far its verdict can be trusted. Change an entry first, before its
test is written or changed.
## Adding or changing a test
A test is a Python script, `test_<area>.py`, designed here first:
1. Write or change the test's entry in its area's file: what it tests, its scenarios with the state expected after
each step, and what it leaves out on purpose and why. A test that fits no area starts a file of its own and a row
in the table of areas.
2. Have the entry reviewed and agreed before any test code is written.
3. Write the test to match the entry and add it to `sweep.json`. When the test changes later, change its entry in
the same commit.
Replays are not tests. `smoke_test.json` is kept as the example of the replay format, and `test_action_replay_hidden`
runs it as its input. The `tests/*.json` replays still in the sweep each leave it, with their entries, in the commit
that adds the Python test covering what they cover. No replay is added to the sweep.
### The read-back rule
A test decides by comparing the app's state with values its entry writes down before the test runs:
- **Check the start.** Read and check the state a scenario starts from, so that each step is measured from a known
state: after `project_new`, `plate_list` lists one plate, current, with the name `""`.
- **Read each step back through another tool.** After a call, read the state it should leave with a tool other
than the one that acted: `plate_list` after `plate_rename`. The call's own reply may be checked as well, never
instead.
- **Check every value the scenario fixes.** After renaming one plate, check the number of plates and every plate's
name, not only the renamed one, so that a change to the wrong plate fails. Leave out the fields the scenario does
not fix, so that a field added to a reply breaks nothing.
- **Write expected values out.** An expected value comes from the entry, never from an earlier read in the same
run: a "same as before" check passes when both reads are wrong.
- **A refusal is a result.** Assert that the call was refused with its code, or with its words where it has no
code, then read the state and check it is the state before the call, written out again.
- **A wait that runs out of time fails.**
- **Exact unless the app computes it.** A position a call gives is checked exactly. A value the app works out,
such as an arrangement or a layer count, gets a stated tolerance or a property to hold: no two objects overlap,
every object is on its plate.
- **Check what a person keeps once through the file.** The reading tools share the app's model with the tools that
change it, so they cannot see a value that is stored but lost on saving. For a property that belongs in the
project or the print, add one check through the file: save and reopen the project, or read the G-code.
An entry is ready for review when every step has its expected state, and every value a step leaves that nothing
checks appears under **Not checked** with the reason. An entry is written before its test exists; the table of all
tests lists the ones the sweep runs.
### The shared check module
`checks.py` holds what the tests use to apply the rule, so that it is applied in one place:
- `Checks` collects named checks, prints `ok <name>` or `FAIL <name>: <detail>` for each, and gives the test's exit
code. A failed check lets the test go on. `Checks.scenario(name, fn)` runs one scenario: an exception fails that
scenario under its name, and the next scenario still runs.
- `refused(call, code=None, words=None)` passes only when the call is refused with exactly that code, or, for a
refusal without one, with text that holds those words; it returns the refusal's text.
- `wait(client, condition, timeout_s)` fails when the wait runs out of time.
- Readers give the state a scenario checks in a fixed shape, such as `plates()`: a list of `{name, current, locked,
objects}`, one per plate.
## How the sweep decides
**The runner.** `run_sweep.py` runs each entry of `sweep.json` in a folder of its own on a freshly launched
app, and a test passes when its process exits 0. A failed setup or launch, a run past its time limit (900 s
unless the entry sets `timeout_s`), or an error running the test fails it, and so does a test left without a
result. On macOS a new OrcaSlicer crash report fails the run. When a test ends, the runner's `stop` kills the app
it launched (`TerminateProcess` on Windows, `SIGTERM` elsewhere) and ignores how it exited, so a crash while the
app closes fails nothing on Windows or Linux; only the tests that close the app themselves see it. Tests that start
their own app (`"launch": "own"`) start it with their own environment, so on Linux they follow neither the X11
default nor `--headless`. No CI job runs the sweep: it runs when someone runs it.
**Replays.** A `.json` test runs with `orca_mcp.py run-replay`, which exits 0 when the replay passed. A step is ok
when its call returns no error, when a `script_run` step's script finished (so a fixture fails its step by
raising), and when every `expect` matcher holds. The first step that is not ok ends the replay as failed. What a
replay can catch follows from that:
- A step without `expect` checks only that the call returned no error.
- A step marked `optional` checks nothing: it passes whether the call succeeds or is refused, and whether its
`expect` holds or not. A replay has no way to assert that a call is refused, or what a refusal says.
- Every matcher except `exists` fails when its pointer is missing, so a mistyped pointer fails the step. The
exception is `{"exists": false}`, which a mistyped pointer passes.
- `gt`, `ge`, `lt` and `le` compare numbers only; `contains` is a substring of a string, a member of an array or
a key of an object.
- Every run writes `result.json`, but nothing compares it with an earlier run's.
**Python tests.** A `.py` test is a script that makes its calls, prints `ok` or `FAIL` for each named check and
exits 1 when a check failed or an exception escaped. What it checks is whatever the script computes; the entries
name each check by the text it prints. A test written under the read-back rule makes its checks through
`checks.py`; the older tests each have a `check()` of their own.
## Strength
Each entry ends with one of three grades:
| Grade | Meaning |
|---|---|
| Strong | A regression in what the test exercises would fail it; values are checked exactly. |
| Partial | The main outcome is checked, but some of what it exercises is only run, or checked loosely. |
| Smoke | It passes as long as its calls succeed; it checks little of what they return or leave behind. |
## Areas
Each area's tests are designed in a file of their own under `test-entries/`. A test not yet in `sweep.json` has its
entry there before it is written, and the replays an area's tests take the place of keep their entries in that file
until they leave the sweep.
| Area | Python tests | Replays still in the sweep |
|---|---|---|
| [Plates](test-entries/plates.md) | [`test_plates`](test-entries/plates.md#test_plates) | [`plates`](test-entries/plates.md#plates), [`menu_items_plates`](test-entries/plates.md#menu_items_plates), [`plate_icons`](test-entries/plates.md#plate_icons) |
| [Objects](test-entries/objects.md) | [`test_objects`](test-entries/objects.md#test_objects), [`test_object_structure`](test-entries/objects.md#test_object_structure) | [`menu_items_objects`](test-entries/objects.md#menu_items_objects), [`menu_items_placement`](test-entries/objects.md#menu_items_placement), [`menu_items_structure`](test-entries/objects.md#menu_items_structure), [`objects_state`](test-entries/objects.md#objects_state), [`objects_order`](test-entries/objects.md#objects_order), [`objects_files`](test-entries/objects.md#objects_files), [`scene`](test-entries/objects.md#scene) |
| [Presets and calibration](test-entries/presets.md) | [`test_presets`](test-entries/presets.md#test_presets), [`test_calibration`](test-entries/presets.md#test_calibration) | [`presets`](test-entries/presets.md#presets), [`presets_and_plate_map`](test-entries/presets.md#presets_and_plate_map), [`ops_select_preset`](test-entries/presets.md#ops_select_preset), [`calibration`](test-entries/presets.md#calibration) |
| [Filaments and settings](test-entries/filaments_settings.md) | [`test_filaments`](test-entries/filaments_settings.md#test_filaments), [`test_settings`](test-entries/filaments_settings.md#test_settings) | [`ops_assign_filament_preset_one_slot`](test-entries/filaments_settings.md#ops_assign_filament_preset_one_slot), [`ops_assign_filament_preset_multi_slot`](test-entries/filaments_settings.md#ops_assign_filament_preset_multi_slot), [`multicolor`](test-entries/filaments_settings.md#multicolor), [`settings_targets`](test-entries/filaments_settings.md#settings_targets) |
| [Project files, imports and exports](test-entries/files.md) | [`test_files`](test-entries/files.md#test_files) | [`filaments_and_files`](test-entries/files.md#filaments_and_files), [`new_project_keeps_layer_gcode`](test-entries/files.md#new_project_keeps_layer_gcode), [`ops_open_project`](test-entries/files.md#ops_open_project) |
| [Slicing, layers and the Preview](test-entries/slice_preview.md) | [`test_slice_preview`](test-entries/slice_preview.md#test_slice_preview) | [`slice_stats`](test-entries/slice_preview.md#slice_stats), [`preview`](test-entries/slice_preview.md#preview), [`layers`](test-entries/slice_preview.md#layers), [`view_switches`](test-entries/slice_preview.md#view_switches) |
| [Gizmos and canvas input](test-entries/gizmos.md) | [`test_gizmos`](test-entries/gizmos.md#test_gizmos) | [`gizmos`](test-entries/gizmos.md#gizmos), [`dialogs_canvas_input`](test-entries/gizmos.md#dialogs_canvas_input) |
| [GUI automation tools](test-entries/gui_tools.md) | [`test_gui_tools`](test-entries/gui_tools.md#test_gui_tools), [`test_recording`](test-entries/gui_tools.md#test_recording), [`test_call_forms`](test-entries/gui_tools.md#test_call_forms) | [`context_menus`](test-entries/gui_tools.md#context_menus), [`rows`](test-entries/gui_tools.md#rows), [`web_dialogs`](test-entries/gui_tools.md#web_dialogs), [`recording`](test-entries/gui_tools.md#recording), [`agent_forms`](test-entries/gui_tools.md#agent_forms), [`actions_ask`](test-entries/gui_tools.md#actions_ask) |
| [Commands, preferences, installs and plugins](test-entries/commands.md) | [`test_every_action`](test-entries/commands.md#test_every_action), [`test_menu_items_refusals`](test-entries/commands.md#test_menu_items_refusals), [`test_additions_refusals`](test-entries/commands.md#test_additions_refusals), [`test_person_forms`](test-entries/commands.md#test_person_forms), [`test_preferences`](test-entries/commands.md#test_preferences), [`test_install_printers`](test-entries/commands.md#test_install_printers), [`test_install_filaments`](test-entries/commands.md#test_install_filaments), [`test_plugin_commands`](test-entries/commands.md#test_plugin_commands), [`test_plugin_tools`](test-entries/commands.md#test_plugin_tools), [`test_operation_routes`](test-entries/commands.md#test_operation_routes) | — |
| [Windows, views, printers and web pages](test-entries/windows_web.md) | [`test_printer_extruders`](test-entries/windows_web.md#test_printer_extruders), [`test_project_open_settings`](test-entries/windows_web.md#test_project_open_settings), [`test_sidebar_floating`](test-entries/windows_web.md#test_sidebar_floating), [`test_set_window`](test-entries/windows_web.md#test_set_window), [`test_set_view_preview`](test-entries/windows_web.md#test_set_view_preview), [`test_set_view_camera`](test-entries/windows_web.md#test_set_view_camera), [`test_speed_dial_open`](test-entries/windows_web.md#test_speed_dial_open), [`test_send_gcode`](test-entries/windows_web.md#test_send_gcode), [`test_web_ui`](test-entries/windows_web.md#test_web_ui), [`test_webview_modal`](test-entries/windows_web.md#test_webview_modal) | — |
| [Runtime, command line and harness](test-entries/runtime.md) | [`test_command_line`](test-entries/runtime.md#test_command_line), [`test_runtime_lifecycle`](test-entries/runtime.md#test_runtime_lifecycle), [`test_stdio_bridge`](test-entries/runtime.md#test_stdio_bridge), [`test_orca_mcp_attach`](test-entries/runtime.md#test_orca_mcp_attach), [`test_run_sweep`](test-entries/runtime.md#test_run_sweep), [`test_recovery_under_load`](test-entries/runtime.md#test_recovery_under_load), [`test_worker_admission`](test-entries/runtime.md#test_worker_admission), [`test_cancel_pending_slice`](test-entries/runtime.md#test_cancel_pending_slice), [`test_export_running_job`](test-entries/runtime.md#test_export_running_job), [`test_action_replay_hidden`](test-entries/runtime.md#test_action_replay_hidden), [`test_list_windows`](test-entries/runtime.md#test_list_windows), [`test_ref_locator_export`](test-entries/runtime.md#test_ref_locator_export) | [`smoke_test`](test-entries/runtime.md#smoke_test) |
| [Design tab](test-entries/design.md) | [`test_cad_replay`](test-entries/design.md#test_cad_replay), [`test_cad_slow_build`](test-entries/design.md#test_cad_slow_build), [`test_cad_failed_job`](test-entries/design.md#test_cad_failed_job), [`test_cad_examples`](test-entries/design.md#test_cad_examples), [`test_cad_click_edit`](test-entries/design.md#test_cad_click_edit), [`test_cad_commands`](test-entries/design.md#test_cad_commands), [`test_cad_sketching`](test-entries/design.md#test_cad_sketching), [`test_cad_context_menu`](test-entries/design.md#test_cad_context_menu) | [`cad_sketch_to_solid`](test-entries/design.md#cad_sketch_to_solid), [`cad_sketch_edit`](test-entries/design.md#cad_sketch_edit), [`cad_topology_targets`](test-entries/design.md#cad_topology_targets), [`cad_features`](test-entries/design.md#cad_features), [`cad_doc`](test-entries/design.md#cad_doc), [`cad_canvas`](test-entries/design.md#cad_canvas) |
## All tests
The 80 tests `sweep.json` lists: 48 Strong, 27 Partial, 5 Smoke.
| Test | Area | Kind | Strength |
|---|---|---|---|
| [`plates`](test-entries/plates.md#plates) | [Plates](test-entries/plates.md) | replay | Strong |
| [`menu_items_plates`](test-entries/plates.md#menu_items_plates) | [Plates](test-entries/plates.md) | replay | Strong |
| [`plate_icons`](test-entries/plates.md#plate_icons) | [Plates](test-entries/plates.md) | replay | Strong |
| [`menu_items_objects`](test-entries/objects.md#menu_items_objects) | [Objects](test-entries/objects.md) | replay | Strong |
| [`menu_items_placement`](test-entries/objects.md#menu_items_placement) | [Objects](test-entries/objects.md) | replay | Strong |
| [`menu_items_structure`](test-entries/objects.md#menu_items_structure) | [Objects](test-entries/objects.md) | replay | Strong |
| [`objects_state`](test-entries/objects.md#objects_state) | [Objects](test-entries/objects.md) | replay | Strong |
| [`objects_order`](test-entries/objects.md#objects_order) | [Objects](test-entries/objects.md) | replay | Strong |
| [`objects_files`](test-entries/objects.md#objects_files) | [Objects](test-entries/objects.md) | replay | Partial |
| [`scene`](test-entries/objects.md#scene) | [Objects](test-entries/objects.md) | replay | Partial |
| [`presets`](test-entries/presets.md#presets) | [Presets and calibration](test-entries/presets.md) | replay | Strong |
| [`presets_and_plate_map`](test-entries/presets.md#presets_and_plate_map) | [Presets and calibration](test-entries/presets.md) | replay | Strong |
| [`ops_select_preset`](test-entries/presets.md#ops_select_preset) | [Presets and calibration](test-entries/presets.md) | replay | Smoke |
| [`calibration`](test-entries/presets.md#calibration) | [Presets and calibration](test-entries/presets.md) | replay | Strong |
| [`ops_assign_filament_preset_one_slot`](test-entries/filaments_settings.md#ops_assign_filament_preset_one_slot) | [Filaments and settings](test-entries/filaments_settings.md) | replay | Smoke |
| [`ops_assign_filament_preset_multi_slot`](test-entries/filaments_settings.md#ops_assign_filament_preset_multi_slot) | [Filaments and settings](test-entries/filaments_settings.md) | replay | Smoke |
| [`multicolor`](test-entries/filaments_settings.md#multicolor) | [Filaments and settings](test-entries/filaments_settings.md) | replay | Partial |
| [`settings_targets`](test-entries/filaments_settings.md#settings_targets) | [Filaments and settings](test-entries/filaments_settings.md) | replay | Strong |
| [`filaments_and_files`](test-entries/files.md#filaments_and_files) | [Project files, imports and exports](test-entries/files.md) | replay | Partial |
| [`new_project_keeps_layer_gcode`](test-entries/files.md#new_project_keeps_layer_gcode) | [Project files, imports and exports](test-entries/files.md) | replay | Partial |
| [`ops_open_project`](test-entries/files.md#ops_open_project) | [Project files, imports and exports](test-entries/files.md) | replay | Partial |
| [`slice_stats`](test-entries/slice_preview.md#slice_stats) | [Slicing, layers and the Preview](test-entries/slice_preview.md) | replay | Strong |
| [`preview`](test-entries/slice_preview.md#preview) | [Slicing, layers and the Preview](test-entries/slice_preview.md) | replay | Strong |
| [`layers`](test-entries/slice_preview.md#layers) | [Slicing, layers and the Preview](test-entries/slice_preview.md) | replay | Strong |
| [`view_switches`](test-entries/slice_preview.md#view_switches) | [Slicing, layers and the Preview](test-entries/slice_preview.md) | replay | Strong |
| [`gizmos`](test-entries/gizmos.md#gizmos) | [Gizmos and canvas input](test-entries/gizmos.md) | replay | Partial |
| [`dialogs_canvas_input`](test-entries/gizmos.md#dialogs_canvas_input) | [Gizmos and canvas input](test-entries/gizmos.md) | replay | Partial |
| [`context_menus`](test-entries/gui_tools.md#context_menus) | [GUI automation tools](test-entries/gui_tools.md) | replay | Strong |
| [`rows`](test-entries/gui_tools.md#rows) | [GUI automation tools](test-entries/gui_tools.md) | replay | Partial |
| [`web_dialogs`](test-entries/gui_tools.md#web_dialogs) | [GUI automation tools](test-entries/gui_tools.md) | replay | Partial |
| [`recording`](test-entries/gui_tools.md#recording) | [GUI automation tools](test-entries/gui_tools.md) | replay | Partial |
| [`agent_forms`](test-entries/gui_tools.md#agent_forms) | [GUI automation tools](test-entries/gui_tools.md) | replay | Partial |
| [`actions_ask`](test-entries/gui_tools.md#actions_ask) | [GUI automation tools](test-entries/gui_tools.md) | replay | Partial |
| [`test_every_action`](test-entries/commands.md#test_every_action) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Partial |
| [`test_menu_items_refusals`](test-entries/commands.md#test_menu_items_refusals) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_additions_refusals`](test-entries/commands.md#test_additions_refusals) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_person_forms`](test-entries/commands.md#test_person_forms) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_preferences`](test-entries/commands.md#test_preferences) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_install_printers`](test-entries/commands.md#test_install_printers) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_install_filaments`](test-entries/commands.md#test_install_filaments) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_plugin_commands`](test-entries/commands.md#test_plugin_commands) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Strong |
| [`test_plugin_tools`](test-entries/commands.md#test_plugin_tools) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Partial |
| [`test_operation_routes`](test-entries/commands.md#test_operation_routes) | [Commands, preferences, installs and plugins](test-entries/commands.md) | Python | Partial |
| [`test_printer_extruders`](test-entries/windows_web.md#test_printer_extruders) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_project_open_settings`](test-entries/windows_web.md#test_project_open_settings) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_sidebar_floating`](test-entries/windows_web.md#test_sidebar_floating) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_set_window`](test-entries/windows_web.md#test_set_window) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Partial |
| [`test_set_view_preview`](test-entries/windows_web.md#test_set_view_preview) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_set_view_camera`](test-entries/windows_web.md#test_set_view_camera) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Partial |
| [`test_speed_dial_open`](test-entries/windows_web.md#test_speed_dial_open) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Partial |
| [`test_send_gcode`](test-entries/windows_web.md#test_send_gcode) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_web_ui`](test-entries/windows_web.md#test_web_ui) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Strong |
| [`test_webview_modal`](test-entries/windows_web.md#test_webview_modal) | [Windows, views, printers and web pages](test-entries/windows_web.md) | Python | Partial |
| [`test_command_line`](test-entries/runtime.md#test_command_line) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_runtime_lifecycle`](test-entries/runtime.md#test_runtime_lifecycle) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_stdio_bridge`](test-entries/runtime.md#test_stdio_bridge) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Partial |
| [`test_orca_mcp_attach`](test-entries/runtime.md#test_orca_mcp_attach) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_run_sweep`](test-entries/runtime.md#test_run_sweep) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_recovery_under_load`](test-entries/runtime.md#test_recovery_under_load) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Partial |
| [`test_worker_admission`](test-entries/runtime.md#test_worker_admission) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_cancel_pending_slice`](test-entries/runtime.md#test_cancel_pending_slice) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_export_running_job`](test-entries/runtime.md#test_export_running_job) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_action_replay_hidden`](test-entries/runtime.md#test_action_replay_hidden) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_list_windows`](test-entries/runtime.md#test_list_windows) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Strong |
| [`test_ref_locator_export`](test-entries/runtime.md#test_ref_locator_export) | [Runtime, command line and harness](test-entries/runtime.md) | Python | Partial |
| [`smoke_test`](test-entries/runtime.md#smoke_test) | [Runtime, command line and harness](test-entries/runtime.md) | replay | Smoke |
| [`test_cad_replay`](test-entries/design.md#test_cad_replay) | [Design tab](test-entries/design.md) | Python | Strong |
| [`test_cad_slow_build`](test-entries/design.md#test_cad_slow_build) | [Design tab](test-entries/design.md) | Python | Partial |
| [`test_cad_failed_job`](test-entries/design.md#test_cad_failed_job) | [Design tab](test-entries/design.md) | Python | Strong |
| [`test_cad_examples`](test-entries/design.md#test_cad_examples) | [Design tab](test-entries/design.md) | Python | Smoke |
| [`test_cad_click_edit`](test-entries/design.md#test_cad_click_edit) | [Design tab](test-entries/design.md) | Python | Strong |
| [`test_cad_commands`](test-entries/design.md#test_cad_commands) | [Design tab](test-entries/design.md) | Python | Partial |
| [`test_cad_sketching`](test-entries/design.md#test_cad_sketching) | [Design tab](test-entries/design.md) | Python | Strong |
| [`test_cad_context_menu`](test-entries/design.md#test_cad_context_menu) | [Design tab](test-entries/design.md) | Python | Strong |
| [`cad_sketch_to_solid`](test-entries/design.md#cad_sketch_to_solid) | [Design tab](test-entries/design.md) | replay | Strong |
| [`cad_sketch_edit`](test-entries/design.md#cad_sketch_edit) | [Design tab](test-entries/design.md) | replay | Strong |
| [`cad_topology_targets`](test-entries/design.md#cad_topology_targets) | [Design tab](test-entries/design.md) | replay | Strong |
| [`cad_features`](test-entries/design.md#cad_features) | [Design tab](test-entries/design.md) | replay | Partial |
| [`cad_doc`](test-entries/design.md#cad_doc) | [Design tab](test-entries/design.md) | replay | Strong |
| [`cad_canvas`](test-entries/design.md#cad_canvas) | [Design tab](test-entries/design.md) | replay | Partial |
## What the sweep does not catch
These patterns run across many tests, and each lets a real regression pass. The entries in the area files name where
each one applies.
**The operations replays record and do not check.** In the four `ops_*` replays, the `expect`s sit on the setup,
and the calls under test are `optional`, the ones that should succeed as well as the ones that should be refused.
Their `result.json` is a record, but nothing compares it with an earlier run's. `test_operation_routes` asserts a
handful of the states they record.
**`optional` accepts both outcomes.** A step that should be refused passes when it is accepted, and one that
should succeed passes when it is refused. A refusal is caught only when a later step happens to read the state it
would have changed, and many refusals have no such step. The Design replays come closest, since a refused call that
went through would usually shift a feature index or a count that the next step checks.
**A wait that runs out of time passes.** `app_wait` replies `satisfied: false`, or `status: "running"` for a job,
as a successful result when its time runs out. Most `app_wait` steps have no `expect`, including the ones meant to
show that a prompt opened, so they pause the replay for up to 30 s and check nothing.
**Fixtures return data and assert nothing.** The `tests/fixtures/*.py` helpers fail their step only when they raise
by accident. `ops_presets.preset_api` catches every exception and returns it as data, so no plugin API call in the
preset replays can fail.
**Replies are trusted instead of read back.** Several checks compare a tool's reply with the arguments it was
given, such as a window's size and position, the legend rows, or a dialog's size. Others pass whenever the call
returns, as `check(name, True)` after the call. Neither reads the state the call should have left.
**Slices are checked by their outcome.** Tests that set per-object, per-range or per-layer settings check that the
slice ended `ok`, and `layers` also checks the layer count. No test reads the G-code, so a setting that never
reaches the print passes.
**Screenshots and recordings are kept, not compared.** Nearly every GUI test saves pictures. Only
`test_set_view_preview` (two captures byte for byte) and `test_cad_commands` ("the screenshots differ") compare any.
**Absence is checked without a control.** Checks such as "no notice", "not in the journal", "the notification gets
no reply", "the broken plugin offers nothing" and a colour's text being absent pass just as well when the thing they
look for was renamed or never produced. No step first shows that it can be seen.
**A few tests wait a fixed time instead of synchronising.** `test_cancel_pending_slice` (0.1 s),
`test_recovery_under_load` (2 s and 1 s) and `test_cad_slow_build` on Windows (2 s) can pass on a slow machine
without reaching the state they claim to test.

View file

@ -21,23 +21,8 @@
"objects_state": {"path": "tests/objects_state.json"},
"ops_assign_filament_preset_multi_slot": {"path": "tests/ops_assign_filament_preset_multi_slot.json"},
"ops_assign_filament_preset_one_slot": {"path": "tests/ops_assign_filament_preset_one_slot.json"},
"ops_export_gcode": {"path": "tests/ops_export_gcode.json"},
"ops_export_model_3mf": {"path": "tests/ops_export_model_3mf.json"},
"ops_export_sliced_3mf": {"path": "tests/ops_export_sliced_3mf.json"},
"ops_export_stl": {"path": "tests/ops_export_stl.json"},
"ops_import_models": {"path": "tests/ops_import_models.json"},
"ops_import_presets": {"path": "tests/ops_import_presets.json"},
"ops_new_project": {"path": "tests/ops_new_project.json"},
"ops_open_project": {"path": "tests/ops_open_project.json"},
"ops_save_project_as": {"path": "tests/ops_save_project_as.json"},
"ops_select_plate": {"path": "tests/ops_select_plate.json"},
"ops_select_preset": {"path": "tests/ops_select_preset.json"},
"ops_send_gcode_to_host": {"path": "tests/ops_send_gcode_to_host.json"},
"ops_set_instance_count": {"path": "tests/ops_set_instance_count.json"},
"ops_set_plate_locked": {"path": "tests/ops_set_plate_locked.json"},
"ops_show_layer_range": {"path": "tests/ops_show_layer_range.json"},
"ops_start_arrange": {"path": "tests/ops_start_arrange.json"},
"ops_start_slice": {"path": "tests/ops_start_slice.json"},
"plate_icons": {"path": "tests/plate_icons.json"},
"plates": {"path": "tests/plates.json"},
"presets": {"path": "tests/presets.json"},

View file

@ -0,0 +1,231 @@
# Commands, preferences, installs and plugins
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_every_action`
`test_every_action.py` · Python, 509 checks
**Tests:** Runs all 129 Speed Dial actions of `tests/data/speed_dial_actions.json` through `action_run`, each from a state rebuilt by calls (empty project, two cubes, sliced plates, an assembled object, a recording, and so on), and answers the action's dialog or file picker as its row says. For each action it reads back the action's effect, then checks that the reply names the action, that the journal keeps an `action_run` step for it with the arguments its command journals, and that `action_search` maps it to the command in `tests/data/speed_dial_action_calls.json`.
**Decides by:** Exits 1 when any printed `FAIL` check fails. A call error, or an uncaught exception from a row's lambda, also fails the test. Every action runs; none is skipped. What "passes" means depends on the row:
- Common to every row that runs (all but the 3 refused): `... its reply names the action it ran` (`ran` == `orca_command:<key>:orca`, skipped for `export_config`, whose dialog is cancelled). `... the journal keeps its action_run with the arguments its command journals` requires an `action_run` step of that id whose inner `args` equal one value exactly:
- `{"test": "<name>"}`, the fixture's arguments, for the nine `calib_*` actions: their command, `calibration_generate_test`, journals its arguments, and the action's own fixed ones stand for them (`ActionContext::set_journal_args`).
- `{"percent": 50}` for `go_to_layer` and `{"tab": "preview"}` for `go_to_tab`, the values given for their input.
- `{}`, no `args`, for every other action: its command journals nothing of its own, or, as for `obj_arrange` and `start_recording`, its action's fixed arguments are empty.
The test's docstring, which says every step carries the fixture's arguments, says this instead: an `action_run` step with the id alone replays the same, since the action supplies its fixed arguments.
`... its action names the fixture's command` compares `action_search`'s `command` with the fixture's.
- Effect read back exactly, objects: `undo` (1 object), `redo` (2), `obj_delete` (only the other cube's id is left), `obj_delete_all` (none), `obj_mirror_x/y/z` (part centres move along that axis only, and instance `mirrored` is true), `obj_split_objects` (2 objects), `obj_split_parts` (1 object of 2 parts), `obj_center` (centre at 128,128 ±1 mm), `obj_drop` (min z 0 ±0.01), `obj_orient` (z size 20 ±0.5 after a 45° tilt), `obj_instances_up`/`obj_instances_down`/`obj_set_instances` (2/1/3 instances), `obj_instances_to_objects` (3 objects, 1 instance each), `obj_assemble` (1 object of 2 parts), the six `obj_type_*` (sorted part types), `obj_rename` (the typed name), the four `obj_order_by_*` (exact order), the ten `add_handy_*` (exact object names), `import_zip_archive` (1 object), `load_project` (2 objects, project path ends `load_me.3mf`), `new_project` (no objects).
- Effect read back exactly, plates and slicing: `slice_and_preview` (plate 0 sliced and tab `preview`), `slice_all` (2 plates, both sliced), `plate_add` (objects per plate `[2, 0]`), `plate_duplicate` (2 plates, the second holding 2 objects), `plate_delete` (1 plate, objects on `[0, None]`), `plate_rename` (the typed name), `plate_toggle_lock` (`locked` true), `plate_goto` (current 0), `go_to_layer` (top shown layer within 2 of half of `layer_count`).
- Effect read back exactly, app state: `mode_simple/advanced/expert` (`mode`), `go_to_tab` (`tab`), `select_all` (`[0, 1]`), `deselect_all` (`empty`), `filament_add`/`filament_delete` (2/1 slots), the eight camera `view_*` (elevation and azimuth ±2°; `view_top`/`view_bottom` check elevation only), `view_toggle_perspective` (`projection` differs), `start_recording` (recording, path in the output folder), `stop_recording` (no recording, and `stopped.mkv` is non-empty), `toggle_developer_mode` (`developer_mode` flipped), `install_local_plugin` (the fixture's name is in `plugin_list`), `refresh_plugins` (the side-loaded fixture's name is not in `plugin_list` before the refresh, which its `before()` reads, and is after).
- Effect read loosely: the nine `calib_*` (project `name` equals the test's name and at least 1 object), the six `add_primitive_<shape>` (1 object whose name contains the shape), `add_primitive_text` (Text gizmo open, 1 object), `obj_fit_volume` (x size > 200 mm), `obj_arrange` (both cubes on some plate), `view_fit_bed` (zoom smaller, `look_at` x within 5 mm of the bed centre), `reset_window_layout` (`sidebar_collapsed` false), `help_benchmark_3d_scene` (more than 1 object, a name containing "Orca", the benchmark window open), `toggle_run_script_panel` (3D view height differs), `help_tip_of_the_day` ("Daily Tips" ImGui window listed).
- File written, existence and size > 0 only: `export_gcode`, `export_stl`, `export_3mf`, `export_drc_single`, `export_toolpaths_obj`, `save_project`, `save_project_as`, `take_screenshot` (the reply's path is in the output folder). File count only: `export_stl_multi`, `export_drc_multi` (2 files each). Archive's G-code entries exactly: `export_sliced_file` (`plate_2` alone), `export_all_sliced_file` (`plate_1`, `plate_2`).
- Window or dialog opened, judged by title substring, then closed: `open_preferences`, `preset_bundle`, `export_config` (cancelled, and the call may error), `help_keyboard_shortcuts`, `help_setup_wizard`, `help_troubleshoot`, `help_network_test`, `help_about`, `help_migrate_filament_presets` (OK pressed), `open_action_replay`, `open_plugins`, `help_check_updates` (any dialog).
- File picker opened once (the auto-answer rule's `uses` == 1) and nothing loaded: `import_file`, `import_configs`, `add_primitive_svg`.
- Refused with an exact code, and no journal step: `send_gcode` (`not_a_print_host_printer`), `sync_ams` (`no_printer`), `sync_presets` (`not_signed_in`).
- Hand-off to another program, only `ran` checked: `help_open_config_folder`, `open_wiki`, `open_youtube`, `install_plugin`.
- Setup: `every action has a row`, `every row is an action`, `every action has a call in the fixture`, `Start Recording's folder is the output folder`.
**Not checked:**
- 22 actions never show their effect: the 12 window rows only show that a dialog with that title opened. `help_migrate_filament_presets` presses OK without reading what was migrated. `help_check_updates` answers whatever dialog is topmost, because an empty title matches every dialog. The 3 picker rows never import anything. The 4 hand-off rows never observe the browser or file manager. The 3 refused rows read the code only.
- Written files are never opened, except the two sliced archives (G-code entry names only). A truncated or wrong STL/3MF/DRC/G-code/OBJ, or a blank screenshot, passes.
- Loose effect checks where exact values are known: `calib_*` (only name and object count, not the generated test's objects), `add_primitive_*` (substring of the name), `obj_fit_volume` (> 200 mm), `obj_arrange` (on a plate; no positions, no overlap check), `view_fit_bed` (y of `look_at` unchecked), `reset_window_layout` (sidebar only), `toggle_run_script_panel` (any height change).
- `its action names the fixture's command` compares two static tables. It says nothing about what the action does.
**Strength:** Partial — about 70 actions have their effect read back exactly and about 23 loosely; 22 more only open a dialog, hand off, get refused or open a cancelled picker; and 12 export rows mostly check that a file exists. The journal step is pinned exactly for every action.
## `test_menu_items_refusals`
`test_menu_items_refusals.py` · Python, 126 checks
**Tests:** What the object and plate commands built from menu items refuse, called directly and picked from the Speed Dial (Space, search, click). Covers Set as Individual Objects, Select All with a gizmo open, target errors, Rename, Delete on the last solid part and on cut objects, Split, Change Type, Assemble on object-list rows, Mirror, Drop, Add Primitive, Auto-Orient on locked or unprintable objects, and the plate commands on a missing plate. For each case it also checks the state left behind.
**Decides by:** Exits 1 when any check fails; all checks print at the end, so an uncaught `McpError` from a setup call exits non-zero with nothing printed.
- Direct refusals: the error text holds a phrase and, where given, the details' `code` is exact (`gizmo_open`, `nothing_selected`, `one_object_only`, `wrong_selection`, `last_solid_part`, `cut_object`, `one_shell`, `auto_drop_question`, `no_such_plate` ×7, `no_objects_to_orient`, `not_printable` ×2, `not_renamed`).
- State after each refusal: `object_list` `total`, names, part ids and types, selection, `mirrored` flags, plate list (`name`, `locked`, `current`) and `rotation_deg`, all compared exactly with the state before.
- Picks: the expected notice text appears in `app_state.notifications`, or an auto-answer rule's `uses` rises by exactly 1 (Rename, last-solid-part message, cut question, Auto-Drop, Edit Plate Name). The state is then read back, for example Assemble on instance rows giving `[("other",1),("Assembly",2)]`.
- Notices two picks share: "Select two or more objects first." (Assemble with one object selected, then Assemble on every part row of an object) and "This acts on one object or part at a time: …" (Split to Objects on two instance rows, then Split to Parts on two part rows). A refused pick's notice is an error notice, which never fades, and the same text pushed again only moves the open one to the end of the list (`NotificationManager::activate_existing`). So before the second pick of each pair, the test closes the earlier notice. `widget_list` lists each notification as an `imgui_window` node for its ImGui window, `!!Ntfctn<id>`, with its text as a `text` node in it; the test finds the window whose text holds the notice's text and clicks its large invisible close button, which closes the notification in either theme. That button, labelled " ", and the close glyph beside it have labels the listing cleans to nothing and no `##` name, so `widget_list` lists neither and gives them no ref. The test reaches the invisible one with the locator `{imgui: "", window: "!!Ntfctn<id>", index: N - 1}`, which matches the window's unlabelled items in the order they are recorded; `render_close_button()` submits it last. N is the count the same locator without `index` is refused with ("N ImGui items match …; add \"index\""); it is at least 2, the glyph and the invisible button. A short refusal notice draws no minimize button (`m_multiline` with more than 3 lines only). "the earlier notice is closed" then waits up to 5 s, failing when the time runs out, for `app_state.notifications` to hold no notice with the text. After the second pick, its own check reads the text there again.
- Results that run: `object_delete {}` on two solid parts (the remaining part ids, and the reply's `parts` and `kept`), `object_split keep_z` (2 objects, upper piece above 20 mm), the Auto-Drop "No" pick (pieces dropped below 1 mm), Duplicate Plate (`ops_undo.taken()` count 1, and undo restores 1 plate and 1 object), rename to the same name (no snapshot).
**Not checked:**
- `a pick of Change Type with an object selected says to select a part`: notice text only; the object's part types are not read afterwards.
- `object_auto_orient names only what it turned, not an object on a locked plate`: reads the reply alone. Neither cube's rotation is read, so a turn of the locked-plate cube goes unseen.
- Refusals checked by text only, with no code: `Set as Individual Objects on an object of one instance ...`, `object_delete of an object the project lacks names its index`, `object_mirror with no axis is refused by its schema` (any error containing "axis").
- `and takes no undo snapshot` reads the info-level log through `ops_undo.py`. It would pass if snapshots stopped being logged; the Duplicate Plate count-1 check in the same run would catch that.
**To settle in review:**
- Reaching the close button through a refusal's count is roundabout. Naming the button in the app (`record_named_item` on the close button in `render_close_button()`) would let the test click it by name; that is a change to the app.
**Strength:** Strong — refusal codes and the state after each refusal are compared exactly, and each pick's notice is its own; only a few picks rest on notice text alone.
## `test_additions_refusals`
`test_additions_refusals.py` · Python, 64 checks
**Tests:** Refusals of the filament, preset, export, import and settings commands. Covers `preset_sync` and `filament_sync_ams` with no account or printer, `view_set` of a layer with no slice, per-object STL and toolpath exports of an empty project (called and picked), a ZIP entry the archive lacks, `layer_height` on a part or a height range, a missing height range, the sidebar while a bare G-code file is open, deleting the only or a mixed filament slot, the 64-slot limit, and an `object_order` that leaves an object out. It also checks that a height range's own settings show on its object-list row.
**Decides by:** Exits 1 when any check fails.
- Refusals: error text holds a phrase and the details' `code` is exact (`not_signed_in`, `no_printer` ×3, `no_layers`, `no_objects` ×2, `no_toolpaths`, `no_such_entry`, `last_filament_slot`, `mixed_uses_slot`, `mixed_filament_slot`, `too_many_filaments`, `order_misses_object`). Some are checked by text only (see below).
- Details: `entries` == `["cube.stl", "parts/block.stl"]`, and `height_ranges` == the two ranges.
- State left: `gcode_window` and `legend_collapsed` unchanged, export folder empty, `object_list.total` 0, part and range overrides unchanged, `sidebar_collapsed` unchanged, slot count 1/3/64.
- Picks: exact notice text in `notifications` ("The project has no objects.", "No more filament slots can be added.", or containing "The Preview shows no toolpaths"), and `dialogs` == `[]`.
- Height-range row: `widget_list` row shows "has settings" after `wall_loops` is set and not after it is nulled; the selected rows are unchanged.
- Object order: two 20 mm cubes added with `object_add_primitive {name: "first"}` and `{name: "second"}`. "two cubes, first and second" reads `object_list` plate 0's names as `["first", "second"]`. `object_order {plate: 0, order: [1]}` is refused as `order_misses_object`, naming object 0, and "and leaves the order as it was" reads the names as `["first", "second"]`. The control, "a full order is taken": `object_order {plate: 0, order: [1, 0]}` gives the names `["second", "first"]`.
**Not checked:**
- `and leaves the part's settings too` and `and the object's ranges stay` follow refused `settings_get` calls, which only read; they would catch a refused read that changed something.
- Refusals checked by text, with no code: `settings_set`/`settings_get` of `layer_height` on a part, a null `layer_height` on a range, a missing height range, filament settings with `target object`, and the sidebar `view_set`.
- `project_export ... as its action` (no path) checks the refusal only; whether a picker or file appeared is checked only for the folder variant and the picks.
**Strength:** Strong — refusal codes, details and the unchanged state are compared exactly, the order by names that tell the objects apart.
## `test_person_forms`
`test_person_forms.py` · Python, 61 checks
**Tests:** That a call with exactly an action's arguments behaves as a person's pick. `project_save {save_as}` and `project_export {format: gcode}` open their pickers, `project_save` with a path does not, and `preset_export` always opens its dialog. Speed Dial picks of View: Top, Deselect All and Go to layer run in place. `object_arrange`/`object_select {all}` and their `action_run` give the command's reply, journal step and replay, including in the assemble view and with Measure open.
**Decides by:** Exits 1 when any check fails.
- Pickers: the save/export auto-answer rule's `uses` rises by exactly 1 per call and not for the path save. The file exists for the path save, and no file has an mtime after the start in the project folder or `last_export_path`.
- `preset_export`: `status` `blocked_by_dialog` with a dialog titled "Export Preset Bundle", an error after cancel, the folder empty, and `silent` refused.
- `view_set` bad tab: the error starts with `No tab has the id "no_such_page".` and the payload contains `no_such_tab`.
- Picks: camera elevation ≥ 85, `tab` stays `preview`, the Prepare selection empty, Go to layer's top layer within 1 of the middle, and for each pick no new job under the command's tool name and no notice containing "Started" or "Finished".
- The control for those absences, last, after every pick that runs in place: a pick of Slice and Preview, opened and searched the same way on the same project, starts its slice as a job. "a pick that runs as a job is listed as one" reads `app_state.jobs` with a job of `tool` `plate_slice` numbered above the newest before the pick; "and shows its Started or Finished notice" reads `app_state.notifications` with a notice containing "Started" or "Finished" (`Started: <title>`, then `Finished: <title>`, from `PersonContext::submit()`).
- Arrange/select: `off_plate` == `[]`, no `ran` for direct calls, `ran` == the action id for `action_run`, no `level`, `outside` empty, `objects` == `[0, 1, 2]`. The journal step's `tool` and `args` are exact for `object_select` and `action_run` (and contain `spacing` for `object_arrange`). The exported replays give `passed` true with the state reproduced. The assemble-view `canvas` values and the `gizmo_open` refusal are exact.
**Not checked:**
- `a cancelled Save Project As is an error` and `a cancelled Export Preset Bundle is an error` accept any error; the message is not read.
- The cancelled `project_export {format: gcode}` reply is not read; the test only requires that it raises nothing.
- `preset_export refuses silent` passes on any error containing "silent", which a schema rejection of the argument would also give.
- `a pick of View: Top turns the camera` checks elevation only.
- `object_arrange {} replies with the settings in force ...` checks that a `settings` key exists, not its values.
- The control's notices fade after 10 s (a regular notice's time); it is read straight after the slice settles.
**Strength:** Strong — the picker counts, journal steps, replays and selections are compared exactly, and the "runs in place" absences have a control in the same run; a few error paths accept any error.
## `test_preferences`
`test_preferences.py` · Python, 65 checks
**Tests:** `preferences_get`/`preferences_set` against the Preferences dialog. The keys on each tab match the dialog's named controls; the MCP switch and port; a three-key write read back from the call, from `preferences_get` and from the reopened dialog; `restart_needed`; whole-call refusals. Also the backup timer following Auto backup, the downloads folder (call, dialog row, Browse while the dialog is open), Hide login side panel's live effect on the Home page, and preset sync / stealth mode with no account.
**Decides by:** Exits 1 when any check fails.
- Dialog parity, per tab: the named controls' set == the keys `preferences_get` lists, and each checkbox's and choice's shown value == `value`.
- Writes: `changed` holds exact before/after values, `preferences_get` and the dialog show the written values, `unchanged` == `["auto_arrange"]`, and `restart_needed` is true for `enable_multi_machine` only.
- Refusals: the text contains `preference_refused`, `no_such_choice`, `out_of_range` (with "240"), `not_a_preference`, `not_a_folder` or "modal dialog is open", and the good key stays unchanged.
- Backup timer: the periods logged by `set_interval` are exactly `[0]`, then `[on]`, then all 0.
- Downloads folder: stored value == folder, the dialog row label shows it, and the Browse pick shows and stores the browsed folder.
- Login panel: the computed `display` of `#LeftBoard` on the Home page, read with `webview_run_javascript`. "the Home page shows its login side panel" waits up to 20 s for `block` (the page shows the panel with jQuery's `show()`, `home.js`), then `none` within 10 s of writing true, then `block` again within 10 s of writing false. A page with no `#LeftBoard` reads `missing`, which fails each of the three.
- Sync/stealth: `changed` names the key, `preferences_get` and the dialog checkbox agree, and the stealth effect's log line appears.
**Not checked:**
- Tab parity compares values for checkboxes and choices only; number and text fields are compared only for `opengl_fps_cap` and `download_path`.
- `and writing <key> <value> starts no preset sync` looks for the absence of "start_sync_service" in the log, so it cannot fail if that log text changes. No control can show the line: a sync starts only for a signed-in account, which the sweep never has. The stealth-mode effect read from the same log lines shows that the log is read.
- After `a number outside its range is refused with the range`, nothing checks that the value stayed unchanged.
**Strength:** Strong — values are checked across three sources (reply, `preferences_get`, dialog), and the login panel by its exact display; only a few negative log reads are weak.
## `test_install_printers`
`test_install_printers.py` · Python, 31 checks
**Tests:** `printer_list_models`, `printer_install` and `printer_uninstall` on a fresh folder seeded with the X1 Carbon 0.4, across a restart. Covers the wizard cache being built, install and refusal (no such model or nozzle), persistence, uninstall of the selected printer and of the last one, `preset_changes: transfer` with unsaved process and printer edits, the Printer Selection dialog's Confirm with the Velo+ ticked in its web page, and the filaments the reload of an install installs or swaps.
**Decides by:** Exits 1 when any check fails; a launch failure is a failed `the app starts` check.
- Models: `installed_nozzles` exact (`["0.4"]` for the X1C and the Velo+ after install, `[]` before), `nozzles` include the expected sizes, and the cache file appears.
- Install/uninstall: `added`/`removed` == the preset name, and `selected` matches `preset_list`'s selected. The printer set is unchanged after refusals (`no_such_model` with `similar`, `no_such_nozzle` with `nozzles`, `last_printer` with its text, `unsaved_preset_changes`).
- The Velo+'s filaments: the reload installs a printer's default filaments where no installed one fits it, and no filament the X1 Carbon's folder holds fits the Velo+. "the reload installs the Velo+'s default filament": `filaments_installed` is not empty, equals the installed filaments `preset_list` lists after the install minus those before (`installed_filaments()`, every filament whatever it fits), and holds `Goofoo ABS @System`, the Velo+ model's `default_materials` (`Goofoo/machine/Goofoo Velo+.json`), which `PresetBundle::load_installed_filaments()` installs; `filaments_uninstalled` is absent. "and offers them for it": each name is in `preset_list {type: filament, printer: <Velo+ preset>}`.
- Transfer: `added` is the X1C's other 3 nozzles, `layer_height` stays 0.12, the printer edit (240) moves to the newly selected preset while that preset's saved value is 250, and `modified` lists both keys.
- Dialog: the tick's `ModelCheckBoxSelected` class must be set before Accept. After Confirm, every Velo+ nozzle is installed, the new presets equal the printer selector's new names, the X1C item is unchanged, and the selected printer is a Velo+ preset.
- Restart: the Velo+ preset is still listed.
- A third vendor, with `Generic ABS @System` installed first: the Voxelab Aquila X2's install. "printer_install's filaments_installed is what preset_list shows installed": `filaments_installed` (absent read as empty) equals the installed filaments after minus those before. "and swaps no filament": `filaments_uninstalled` is absent, nothing installed before is gone from `preset_list`, and `Generic ABS @System` is still installed. A reload swaps a @System filament only for a vendor whose bundle lists default filaments of its own (the vendor's `default_filaments`, which `PresetBundle::apply_vendor_config()` reads). Only an INI bundle fills that list (`VendorProfile` reads it from the INI's `default_filaments` section); the shipped JSON profiles never do, as `printer_install`'s description and `apply_install_set()` say, so none is swapped. A machine profile's `default_filament_profile` is another key, which the swap does not read.
**Not checked:**
- No shipped profile can make the reload swap a @System filament, so the swap that `filaments_uninstalled` reports is never shown; the Voxelab install pins that nothing is swapped. Showing a swap would need an INI vendor bundle as a fixture.
- `printer_list_models lists more than one vendor` only requires > 1 vendor and > 100 models.
- A fixed 2 s sleep after each stop stands in for waiting until the app exits before the relaunch on the same folder.
**To settle in review:**
- That the Velo+'s install installs `Goofoo ABS @System`. The evidence: the Velo+ model's `default_materials` is `Goofoo ABS @System`, which `load_installed_filaments()` installs for a printer that no installed filament fits, and the folder holds only the X1 Carbon's filaments, which the BBL profiles limit to Bambu Lab printers. If a filament the seed installs does fit the Velo+, nothing is installed and the check fails, which would show the test's premise wrong.
**Strength:** Strong — installs, removals, refusals, transfer, the dialog's Confirm and the filaments the reloads install are read back exactly.
## `test_install_filaments`
`test_install_filaments.py` · Python, 23 checks
**Tests:** `filament_install` and `filament_uninstall` on a fresh folder (X1 Carbon, Bambu PLA Basic in slot 1), across a restart. Covers install by the selector's short name, refusal of unknown names, the slot selector offering the new preset, reinstall reporting `installed_already`, re-installing a second printer's default filaments when an uninstall leaves it none, a merely shown printer (A1 mini) getting none of its defaults, and refusal to uninstall the slot's filament.
**Decides by:** Exits 1 when any check fails.
- Install: `installed` contains the candidate preset, `preset_list` offers it, every installed name has that `alias`, `preset_select` puts it in slot 1 with no `shown`, a second install gives `installed` == `[]`, and `no_such_filament` comes with `similar`.
- Shown printer: the printer is not installed and nothing fits it; selecting it adds shown filaments; `filament_install` gives `installed` == `[X1C_ONLY]` with no `filaments_installed`; the installed set == before plus that one; and after the restart none of the shown filaments are installed.
- Defaults given back: `filaments_installed` in the uninstall reply is non-empty and == the Velo+'s fitting filaments minus slot ones. "what the reply calls uninstalled is exactly what stays uninstalled": the reply's `uninstalled` (always present) equals the names asked minus those `filaments_installed` gives back, and none of them is installed afterwards (`filament_uninstall` lists under `uninstalled` only the presets left uninstalled). After the restart the Velo+'s fitting set is unchanged.
- Uninstall: the preset leaves `preset_list` and reads `installed: false`; `filament_in_use` comes with the text "Filament slot 1 uses Bambu PLA Basic @BBL X1C.", and the filament stays installed.
**Not checked:**
- The filament exercised is the first not-installed Bambu Lab preset with an alias that `preset_list` returns, so which filament is tested depends on the shipped profiles.
- `after a restart the filaments offered for the second printer are what the uninstall replied` compares against `preset_list` before the restart, not against the reply.
- A fixed 2 s sleep after each stop.
**Strength:** Strong — installs, re-installs, uninstalls and refusals are read back exactly from the replies and from `preset_list` before and after a restart.
## `test_plugin_commands`
`test_plugin_commands.py` · Python, 37 checks (38 when the first uninstall fails)
**Tests:** The plugin commands on the fixture plugins in a fresh folder: `plugin_list`, `plugin_install_local` (again, and with `overwrite`), `plugin_enable` (plugin and capability, by key and by name), `plugin_reload`, `plugin_uninstall`, and `plugin_refresh` finding side-loaded plugins. Also a person's pick of Refresh Plugins (returns at once, notifies, rescans once), and the Plugins window's rows matching `plugin_list`.
**Decides by:** Exits 1 when any check fails.
- Install: `level` == "success", the row is `installed` with `source` "local", a reinstall gives `plugin_installed` with "is already installed", overwrite asks nothing, and no dialog is open.
- Fields: "plugin_list lists the plugins with their fields" reads the installed fixture's row, which the install check has just found: it has the fields `key`, `name`, `version`, `installed`, `enabled`, `status`, `source`, `capabilities` and `error`. Before the install, every row there is (none, in a fresh folder) is held to the same fields.
- Enable: `enabled` and `status` "Activated", capability lists, `changed` true. Refusal codes are exact: `plugin_not_enabled`, `empty_capability`, `no_such_capability` (with `capabilities`), `no_such_plugin` (with `similar`).
- Reload: `reloaded` == key, `reinstalled` false, stays enabled.
- Uninstall: `uninstalled` == key, `unsubscribed` false, the row and the file are gone, and a second uninstall gives `no_such_plugin`.
- Refresh: the Speed Dial pick replies within 10 s, without a job, then "Plugins refreshed." appears within 60 s, and the log has exactly 1 "Rescanning plugins..." line since the pick. `plugin_refresh` replies without a job and lists the side-loaded plugin, which was absent before.
- Window: `{key: enabled}` read from the page == `plugin_list`'s.
**Not checked:**
- `plugin_uninstall` is retried once, after a 2 s sleep, when the first try fails with "Failed to delete plugin folder", on any platform. A regression that makes that first removal always fail passes if the retry succeeds.
- `call()` presses Yes on any dialog a call blocks on, so an unexpected question during install, enable or reload is accepted silently.
- `and with clear_cache` checks only that the plugin stays enabled; the cache is not observed.
- The window comparison reads only each row's key and switch, not names, status or capabilities.
**Strength:** Strong — each command's reply and the resulting `plugin_list`, files and window rows are compared exactly.
## `test_plugin_tools`
`test_plugin_tools.py` · Python, 36 checks
**Tests:** A plugin's side of the MCP tools, with `mcp_tools_fixture` side-loaded (enabled, 5 capabilities, thread permission) and `mcp_tools_broken`, whose `get_default_config` raises after it registered `measure`. Covers the fixture's `measure` operation through `tool_search`/`tool_call`, its scripts calling tools from the Script worker and a thread, setting an auto-answer rule owned by the plugin, being refused `replay_export`, keeping a progress-dialog handle, and receiving NewProject events. Also covers several `tool_search` queries, unloading via the Plugins dialog (operation and rule withdrawn), and a `--run` launch without MCP where the rule script still runs.
**Decides by:** Exits 1 when any check fails, or 1 at once if a launch fails.
- Operation: `group` "Plugins", `description` starting "Offered by a plugin.", `tool_call` result == `{"twice": 4}`, absent from `tools/list`, and withdrawn within 15 s of the untick.
- Fixture scripts (outcome JSON read from the plugin's storage folder): `call` and `thread` == `{"ok": true, "result": true}`, `rule` == `{"ok": true, "result": "plugin"}` (both with MCP and under `--run`), `export` gives `ok` false with "agent's session", and a separate script's `handle.update(5)` returns true.
- Progress dialog: "the plugin opens a progress dialog and keeps its handle": the `handle` script's outcome has `ok` true, and `window_list` lists a window titled `MCP tools fixture`, the title the script gives `create_progress_dialog`.
- `tool_search`: `listed`/`input_schema`/`summary` per kind of item, the `brim_width` setting, the first Python item `orca.host.TriangleMesh.face_normals`, group "objects" containing `object_arrange`, an unknown group refused naming "Objects", "?" gives `total` 0, and no "cad" section.
- Design commands: "the Design tab is on (launch --cad)" reads `app_state.design_tab` true, and then `tool_search`'s search for "extrude" finds `extrude` in the group `Design`, unlisted, with its schema.
- A menu item's command: with Prepare shown, "tool_call runs a menu item's command" calls `script_toggle_panel` and reads the 3D view's height in `widget_list` (its `canvas "OrcaSceneCanvas"` line) less than before the call, as the Run Script panel docks under it; "and a second call hides it" reads it greater than after the first call.
- Events and journal: `new_projects.txt` gains exactly 1 line per `project_new` and per `new_project` action. Before the `rule` script runs, the agent calls `dialog_auto_answer {rules: []}` itself (it clears only the rules MCP clients set). "a plugin's calls are not in the agent's journal": `replay_export`'s steps hold exactly one `dialog_auto_answer` step, the agent's, with `rules` `[]`; the plugin's call of the same tool is not there.
- The plugin whose load failed: "the plugin whose load failed is listed with its error" reads `plugin_list`'s row for `mcp_tools_broken` with an `error` holding "this fixture's load fails here on purpose" (a row's `error` is the plugin's own, `PluginOps`). "and offers none of its operations": `tool_search {tool: "plugin.mcp_tools_broken.measure"}` is refused with text starting "Unknown tool: plugin.mcp_tools_broken.measure".
- Rule lifetime: the rule's match is in `auto_answer_rules` while the plugin is loaded and gone within 15 s of the untick.
**Not checked:**
- `tool_search describes the plugin's operation` checks only that the text holds `"a"`, the quoted name of the operation's argument. `tool_search's search finds the Speed Dial's other actions` accepts any action title containing "fixture".
- The progress dialog's gauge: `handle.update(5)` returns true, but the gauge is not read.
- The `--run` launch's exit code is ignored, and only the rule script runs there. A fixed 3 s sleep after the stop stands in for waiting on the first app to exit. The fixed port 13692 can collide with another instance.
**Strength:** Partial — the fixture's operation, script outcomes, events, journal, failed load and unload are each checked exactly, with a control for the journal's absence, but two `tool_search` matchers are loose and the `--run` launch's exit code is not read.
## `test_operation_routes`
`test_operation_routes.py` · Python, 22 checks
**Tests:** That the routes into one operation agree: the Go to layer action and `view_set` asked for a layer of a Preview with none; `preset_select` and the plugin API given a mixed-colour filament slot; and the plugin API showing and selecting a hidden printer. It also checks single-route states: `project_save` to a `.gcode.3mf` name, exports of an empty project, and `object_arrange` from the assemble view and with the Move gizmo open.
**Decides by:** Exits 1 if any named check fails or a call outside `answer()` raises. The three conditional checks run only after a guard check that itself fails when they cannot run, so there is no silent skip.
- Empty project: "project_save refuses a .gcode.3mf name" (code `sliced_file_name`), the text contains `sliced_3mf`, and no file. The `.3mf` export is written; `stl` and `sliced_3mf` are refused with `no_objects` and write no file.
- Layers: the action and `view_set {layer: 1}` both refuse with `no_layers`, and "in the same words (layer)" compares the texts exactly.
- Arrange from the assemble view: no refusal and `off_plate` eq `[]`, the offsets changed, and the selection's `canvas` is `3d` afterwards.
- Arrange with the Move gizmo: both cubes are first moved to one spot with `object_transform {object: i, position: [128, 128, 10]}`, and "the cubes are back on one spot" reads both instance offsets from `object_list` as x 128 and y 128. Then the gizmo opens (`active`), `object_arrange` is not refused, and "object_arrange arranges with the Move gizmo open" reads `object_list` again: both cubes are on plate 0 and their 20 mm squares are apart, their offsets differing by at least 20 mm in x or in y. A gizmo is still open afterwards.
- Mixed slot: `filament_is_mixed` holds a 1; `preset_select` refuses with `mixed_filament_slot`; the plugin API raises `ValueError` with a message equal to `preset_select`'s text.
- Hidden printer: a printer listed with `installed: false` exists; after the plugin API's `begin_update(name)`, nothing raised and `app_state.presets.printer` equals it.
**Not checked:**
- "and the arrangement moved a cube" (from the assemble view) passes on any change to the offsets, not that the cubes no longer overlap.
- "and the gizmo stays open" accepts any gizmo, not Move.
- The hidden printer runs the plugin API only; `preset_select` of a hidden printer is not compared. No pair is checked to "accept the same ones" (the README's claim): there is no sliced-Preview case for the action against `view_set`.
- What a refusal leaves, beyond "no file": the tab after a refused layer, the slot's preset after the mixed-slot refusal.
- It is the only test that compares the routes into an operation. The G-code export, a model or preset import, a new or saved project, a plate selected or locked, an instance count, a slice and `printer_send`'s refusals are compared across routes nowhere.
**Strength:** Partial — codes and words are compared exactly where it checks, and both arranges must move what overlaps, but the assemble-view arrange is checked only as "moved", and it compares the routes in only a handful of states.

View file

@ -0,0 +1,533 @@
# Design tab
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_cad_replay`
`test_cad_replay.py` · Python, 15 checks
**Tests:** That a Design-tab session made through `tool_call` and exported with `replay_export` replays to the same part. The session includes:
- failed calls (an empty commit, a missed hole, a fillet the kernel refuses), which the export must leave out;
- a shell that replies `ok` false, which stays in;
- face and edge ids passed with a `generation`, which the export must drop.
The replay runs in a new project in the same instance.
**Decides by:** Exits 1 when any named check prints FAIL. It also exits non-zero when any recording call other than the three expected refusals errors, or when the thread job fails (`await_job`'s `app_wait` raises).
- Live session:
- "a sketch on XY and the plate are centred on modeling_origin": the frame origin equals `modeling_origin` exactly, and the centre of mass x/y is within 1e-6 relative.
- "an empty sketch_finish fails" and "a hole that misses fails as an error": any error.
- "a fillet the kernel refuses fails as an error with the kernel's reason": any error text without "Invalid arguments".
- "a shell thicker than the plate reports the rejected rebuild in its reply (ok false)": `ok is False`.
- "the thread is M5, inferred from the bore".
- Export: "the export leaves out the failed calls" (one `sketch_finish`, no `hole`), "... leaves out the refused fillet and keeps the one that ran" (one `fillet`), "... keeps the shell" (one `shell`), and "the export records no generation".
- Replay:
- "the exported session replays": `passed` true.
- "the same features" (type list) and "the same bodies and undo depth".
- "the same volume and surface area" and "the same centre of mass", within 1e-6 relative of the live session.
**Not checked:**
- The replayed part is compared with the live session, not with known values; the volume is only printed. A modelling regression that changes both alike passes.
- The missed hole's and the refused fillet's error texts. The fillet's edge id comes from the `body_describe` read before the first fillet changed the body, and is passed without a `generation`, so the refusal may concern a different edge than the comment means.
- The exported replay carries no `expect`, so nothing checks that the replayed shell again replies `ok` false; only the end state is compared.
- Feature names and parameters: only feature types are compared.
- "Keeps the sketch open" after the empty commit has no check of its own. It is covered only because the next `sketch_draw` would raise.
**Strength:** Strong — the export's contents are checked exactly, and the replayed part's mass properties are compared exactly against the live session.
## `test_cad_slow_build`
`test_cad_slow_build.py` · Python, 7 checks (5 on Windows)
**Tests:** That the app stays inspectable while a long Design rebuild runs off the UI thread behind the progress dialog. The rebuild is an M8 thread tapped 60 mm deep. While it runs, `app_state` and a main-window screenshot answer, the progress dialog is listed and can be captured, and another Design command is refused as busy. The thread then lands as one feature.
**Decides by:** Exits 1 when a named check prints FAIL, or when an `app_state` or screenshot probe raises.
- Result: "the thread call succeeds" (the awaited result has `ok` true) and "one thread feature and one body".
- During the build, one probe runs. It fires once `widget_list` shows a "Design" dialog whose class contains "Progress"; on Windows it fires 2 s after the call starts.
- "app_state answers during the build".
- "a window screenshot succeeds during the build": width non-zero.
- "another Design command is refused during the build": the `describe_design` error contains "Busy".
- Not on Windows:
- "the progress dialog is listed while it builds".
- "a screenshot of the progress dialog captures it": width non-zero and narrower than the main window.
**Not checked:**
- How long `app_state` or the screenshot takes. "Answers" only means the probe ran and returned. The measured `state_ms` is printed only on failure. The Busy check that follows bounds it loosely, since the build must still be running after both calls.
- On Windows the two dialog checks are dropped without a skip line. The probe fires on a fixed 2 s delay, not on any sign that the build is running; a build that finishes sooner fails the Busy check rather than passing.
- The two screenshots are saved but never compared; "captures it" only compares widths.
- The thread's geometry (designation, volume) is not read.
**Strength:** Partial — the Busy refusal and the single resulting feature are checked, but responsiveness has no time bound and Windows skips the dialog checks.
## `test_cad_failed_job`
`test_cad_failed_job.py` · Python, 9 checks
**Tests:** That a Design call whose job fails after its reply is left out of `replay_export`. A hole that misses a slow-rebuilding coil replies with a running job. An export made while it runs names it in `left_out_running`. The hole then fails, and the export after it keeps a later rename and leaves the hole out. That export replays to the same features and coil. The sweep runs it with a 4 s reply budget (`ORCA_MCP_REPLY_BUDGET_MS=4000`).
**Decides by:** Exits 1 when any check prints FAIL. It also exits non-zero when a set-up call errors, or when the hole fails inside the budget with an error other than "removed no material" (or does so at 40 turns).
- Running job:
- "the missed hole replies with its running job": `status` running.
- "an export while it runs leaves it out and names it": `left_out_running` equals exactly `[{"tool": "hole", "job": <its id>}]`.
- "the hole then fails as an error": the awaited error contains "removed no material".
- Export after: "the export leaves the failed hole out", "and keeps the rename made after it", "and leaves nothing out" (no `left_out_running` key).
- Replay (each step given a 600 s timeout):
- "the exported session replays": `passed` true.
- "the same features, the coil renamed": the type lists are equal and feature 2 is named "Coil".
- "the same coil": volume within 1e-6 relative of the live one.
**Not checked:**
- The coil's volume is compared only with the live session's, not with a known value.
- The rest of the export (helix, sketch and sweep steps) is not inspected. Leaving out the `app_wait` made during the hole has no check of its own; a wrongly exported one would show only as a replay failure.
- Timing drives the set-up: the coil is sized from a timed 12-turn build and grown up to 40 turns. A machine too fast or too loaded fails the "running" checks rather than passing them.
**Strength:** Strong — the running-job bookkeeping, the failure text and the replayed result are each checked exactly.
## `test_cad_examples`
`test_cad_examples.py` · Python, one check per documented example (152 in `scripts/CAD/tool_atlas.json`, 6 of them skipped, plus any `undo`/`redo` examples)
**Tests:** That every example `tool_search {tool}` documents for the Design commands, and for `undo` and `redo`, still runs as written. Each example runs on a fresh empty design, with `from_call` arguments filled from earlier results.
**Decides by:** Exits 1 when any example prints FAIL. An example fails when:
- a call raises: a tool error, a failed job (`call_command` awaits running jobs), or a first reply blocked by a dialog;
- a `from_call` reference cannot be resolved;
- a result dict has `ok` false, a non-empty `error`, or `interactive` set.
The output is one line per example ("ok <command>: <title>" or "FAIL ...") and a closing count.
**Not checked:**
- No result is compared with anything. The Design table's examples carry only `title`, `calls` and `needs`, so an example that builds the wrong geometry passes.
- Examples with `needs` are skipped and count as passes on every platform. There are 6 today: two of `sketch_insert_svg`, `body_compare`, `import_step`, `import_mesh` and `export_step`.
- There is no minimum count. If `tool_search {group: "Design"}` listed no commands, or the commands no examples, the test prints "0 examples" and exits 0.
- A result that is not a dict, or has neither `ok` nor `error`, passes without being examined.
- A failure that leaves a dialog open is charged to the next example, whose `fresh_design` then raises.
**Strength:** Smoke — passes whenever every call succeeds without `ok` false.
## `test_cad_click_edit`
`test_cad_click_edit.py` · Python, 75 checks (6 per typed field over 12 fields, plus 3)
**Tests:** That each value field a Design drawing tool opens on the canvas takes digits typed with no click into it, and that Return commits them. The fields come from:
- the line, rectangle, circle, slot, polygon, ellipse and arc, armed by their keys;
- the rounded rectangle, armed from the right-click offer;
- a rectangle's width label, clicked in Select to open its field again.
All input goes through the UI tools; the Design commands only read back.
**Decides by:** Exits 1 when any `gui.check` prints FAIL. A rung that raises, in the test or in a `cad_gui.py` helper, is recorded as a failed check named after the rung, and the run goes on after `recover()`.
- Per typed field:
- "<rung>: a value field opened by itself".
- "<title> took the keyboard with no click into it": the field is marked focused.
- "took the typed <v>": the field's text equals the digits.
- "the typed <v> is not <title>'s prefill".
- "Return committed <title>: the field closed or the next one opened".
- "<what> is the typed <v>": the matching `sketch_describe` quantity (length, width or height extent, radius, every side or flank) equals the value within 1e-6.
- Two rung checks:
- "rounded_rect: the offer armed the rounded rectangle tool": `tool` is rect_rounded after choosing the menu path built from `scripts/CAD/tool_atlas.json`.
- "label: the click at the label's centre took the label: one driving dimension added": the constraint count goes up by 1.
- From `CadGui.start()`: "the Design tab's first showing lays out its canvas as a later one does", which requires the canvas rects to be equal.
- `cad_gui.py` helpers whose own checks decide the result. Each raise below fails the rung it happens in.
- `start()` exits 2 if the Design tab is off or the UI is not English, and raises if the sketch ribbon has no Cancel.
- `reset_view()` raises if the camera's zoom or target is off by more than 1e-3.
- Opening a sketch raises if no click along the XY diagonal opens one.
- `calibrate()` raises if a probe Point lands more than 0.5 px from its click, if the probes add constraints, or if Ctrl+Z does not remove them exactly (1e-12).
- `cancel()` raises if the sketch stays open.
- `widgets()` raises if `widget_list` cuts its tree.
- The test's own `inside()` raises if a click falls outside the calibrated region.
**Not checked:**
- Only the typed quantity of each shape is read back. The untyped ones, which the closing Escape keeps "as drawn", are not: the ellipse's minor axis, the slot's width, the arc's ends, the shape's position.
- Field titles are read but not checked.
- "the typed <v> is not <title>'s prefill" guards the test's own drawing, not the app. It fails only if a shape was drawn at the typed size.
- If the badge or label layout moves so that the label no longer covers a badge, the label rung raises on its precondition. That is a failure of the test's set-up, not of a field.
**Strength:** Strong — every typed value is read back from the sketch to 1e-6, and focus, text and commit are each checked separately.
## `test_cad_commands`
`test_cad_commands.py` · Python, about 345 checks
**Tests:** What the Design commands' arguments do when the Design panel handles them in the running app:
operation words, suppress and align conflicts; the open sketch's commands; re-editing a committed sketch with
`sketch_edit` (replace, cancel, refusals, a failed replace and its replay); projection, text and SVG art;
`feature_edit` refs and picks made again in an edit card; `view_set`'s Design options; `select_geometry` and the
menu items that act on a selection; `confirm_tool` and `cancel_tool` over cards, sketches, the Text dialog and a
plane pick; `body_place`; the Boolean card; Speed Dial picks and their replay. One rung also checks that each
drawing tool chosen from the right-click menu agrees with `sketch_draw`.
**Decides by:** Exits 1 when any check prints FAIL or a rung raises. `cad_gui.run()` records a raise as a FAIL
named after the rung, runs `recover()` and goes on to the next rung.
- Harness (`cad_gui.py`), part of the verdict: `start()` adds the check "the Design tab's first showing lays out
its canvas as a later one does". Helpers raise, failing the rung, when `new_design` leaves features,
`reset_view` leaves the camera more than 1e-3 off the zoom and target it asked for, `calibrate` probes land
more than 0.5 px off their clicks or add constraints, `cancel`/`confirm` leave a sketch open, `value` finds no
field taking the keyboard, or a menu choice's `ran` is not the path asked for. The test's own `settled` (60 s),
`keep_as_drawn` (8 Esc presses) and `rename_selected` (no row editor) raise the same way.
- words: `operation` in the reply and in `feature_describe` equals the word given (`cut`, `join`); volumes from
`body_mass_properties` are 3500, 5000 and 1000 mm³ to 1e-3; `feature_suppress` and `feature_describe` say
suppressed and the bodies drop to 0; `align_conflicts` holds exactly the second align; `sketch_extend`,
`sketch_pattern`, `sketch_transform` and `sketch_dimension` results are read by coordinate to 1e-6; two refusals
by their text.
- shapes_match_tools (12 shapes, 5 checks each): the menu item arms the tool in `ARMS`, the tool adds exactly
`adds` entities and one Ctrl+Z leaves `left`; a second sketch drawn with `sketch_draw` from the first one's
geometry equals it in entities (1e-6, angles modulo a turn), `closed_loops`, constraint count, sorted
`sketch_list_constraints` types and `dof`, before and after one undo.
- sketch_edit rungs: the reply (`replaced`, `sketch_index`, 4 entities, plane XY); volume 1000 → 4000 → 1000
through the edit and one undo; undo depth +1; `state()` (feature types and names, undo depth, volume) unchanged
after a cancel, a failed replace and an emptied sketch; refusal texts (`out of range`, `is not a sketch`,
`not drawn from entities`, `Project`, `a sketch is already open`); the failed `sketch_finish` reply (`ok` and
`replaced` false, the index, a reason); the next sketch is appended. The failed replace's export holds one
`sketch_edit` and three `sketch_finish` steps, `replay_run` passes and ends with the live run's feature types.
failed_leave, for `sketch_text {}` and K: status line text, no modeless dialog, no sketch, no card, `state()`
unchanged, the sketch still 20 x 10.
- project_model, text, svg_art, text_edit, scale_artwork: Project feature index, type, `scope` and an XY `frame`;
in a sketch, 4 construction lines, `first_index` 5, then 9 entities of which 8 construction; Text
`text_string`, `text_height` and `regions` (4, then 2 after `feature_edit`); SVG art `regions` 1 of area 100
(1e-3), `import_offset` [5, 5], and 4 lines of 20 at scale 2; refusals by text with no feature, undo step or
`describe_design` error added; Scale artwork and Edit: undo depth +1 on Confirm, +0 on Cancel; `nothing_open`
(no modal or modeless dialog, no sketch).
- Edit cards: `feature_edit refs` sets the Fillet's `refs.edges` to the id `body_describe {before}` gave, in one
undo step, refuses stale ids with `-32010`, and undo restores it. The repick rungs click on the canvas through
the calibrated map and require the exact edge or face id (`plane_face`, `plane_face_body`), the Hole's plane
normal and origin to 1e-6 and `hole_x`/`hole_y` 0; clicks on a hidden body leave `selection` `none`.
surface_revolve_flip: the Flip toggle reads `checked` and the one SurfaceRevolve has `flip` true.
- design_view: the `design` block of `view_set`'s reply (section `on`/`z`/`keep` exactly, `z` at the body's
middle to 1e-6, each of four switches true then false); refusal texts; the section stays off after refused
calls; `sketch_normal` looks along the XZ normal (cosine ≥ 0.999).
- select, select_loops: `selection.id` for each kind (`body_solid`, `face_planar`, `edge_str`, `vertex`, `sk_loop`,
`none`); vertex point to 1e-6; renames through the row editor show in `describe_design`; `feature_delete` and
its undo; `busy` texts for `feature_edit {}` and `sketch_constrain_selected`; refusals carrying `-32002` or
`-32010` with the selection kept; `applies` true for `fillet`, `delete_face` and `zoom_to_selection`; after
`zoom_to_selection` the camera's `look_at` is loop 1's centre (1e-3); three canvas screenshots (face, edge,
vertex selected) differ from the nothing-selected one and from each other.
- confirm and cancel: `was` (`card`, `sketch`, `plane_pick`, `text`, `insert`), `ok`, `feature` index, `open`;
refusal texts; feature and body counts; undo and redo depth unchanged after a refused or failed add; the card
still open with its pick and the status line's reason; `object_list` count and `app_state.tab` unchanged by
Commit to Plate.
- place: placement translation to 1e-6 and `moved` flags; Commit to Plate's part offset grows by 10 (1e-3);
rotate keeps the centre and swaps 20 and 30; laying a face on the bed gives lowest z 0 and height 20 (1e-4);
reset gives null; refused in a sketch; a vertex's `placed_point` is the placement applied to its point; a
placement follows its body through renumbering and undo.
- boolean_opens, action_pick: `interactive` and `tool` boolean, the card open, its confirm adds a join or a cut and
leaves one body, the direct cut leaves 3640 mm³ (1e-3); Speed Dial picks arm `array_polar` and `trim`; the
exported `action_run` step carries `orca_command:sk_array_polar:orca` and `{"type": "circular"}`, and its replay
passes and arms the tool again.
**Not checked:**
- shapes_match_tools: the geometry comparison is self-referential. The `sketch_draw` arguments are computed from
the entities the tool drew, so equal geometry only shows that `sketch_draw` reproduces them. Whether the tool
put its shape where it was clicked (a wrong radius, a corner off its click) is never compared. Only the armed
tool, entity counts, undo grouping, inferred constraint kinds and DoF are independent of the tool's output.
- select, "the canvas draws the {face, edge, vertex} selected" and "each drawn apart": the screenshots are
compared only with each other, as "the upper three quarters differ". No baseline, so any repaint difference
passes, and what the highlight looks like is not checked.
- design_view: the switches and the section are read back from the panel's own flags in `view_set`'s reply;
nothing checks that the canvas draws the planes, axes, origin, bed or the cut.
- scale_artwork, and the Insert placement in confirm_refused_add: Scale artwork and Edit are confirmed or
cancelled with no change made, and only the undo depth is read, so scaling the art is never exercised.
- Loose matchers where the value is known: "select: {what} is refused" and "select: a plane is refused while the
planes are hidden …" accept any error; "place: describe_design reads the Commit button's mode" accepts either
`assembly` or `bodies`; "place_select: fit_selection centres inside the placed body" accepts any point in its
box; "text: the text extrudes into a body" needs only one body or more.
- The two replays (sketch_edit_failed_replace, action_pick_replay) are compared by feature types, or the armed
tool, not by names, sketch content or geometry.
- project_model with no sketch open: the projected edges are not read, only the feature, `scope` and `frame`.
- action_pick: the Speed Dial click's own reply, and that the dial closes after the pick, are not checked.
**Strength:** Partial — most rungs check exact ids, volumes, indices and undo depths, but the shapes rung's geometry
oracle is the tools' own output, the selection drawing is checked only as "differs", the Design view switches
only as panel flags, and Scale artwork never scales.
## `test_cad_sketching`
`test_cad_sketching.py` · Python, about 210 checks (about 205 and one `skip` on Linux)
**Tests:** Drawing in an open sketch the way a person does, with clicks on the canvas and exact values typed into
the canvas's value field: each keyed tool's primitive, a profile with two voids, the edit operations (fillet,
chamfer, offset, mirror, mirror of arcs, trim, extend) driven by picks and on-canvas value labels, a dimension,
each constraint button in Constrain mode (and one in the open sketch), selecting and deleting a constraint by its
badge, undo inside a sketch and across its commit, save and open through the File menu, and drawing over a sketch
of 1204 entities loaded while a tool is armed.
**Decides by:** Exits 1 when any check prints FAIL or a rung raises (`cad_gui.run()` records the raise as a FAIL
named after the rung).
- Harness (`cad_gui.py`), part of the verdict: the `start()` check; `calibrate` raises when probes land more than
0.5 px off; `value()` raises when no field takes the keyboard; `cancel`, `confirm` and `reopen` raise when the
sketch does not close or open. The test's own `escape_field`, `keep_as_drawn` and `accept_shown_value` raise
when a field does not open or close or a tool stays armed, and `pick()` adds one check per set of picks ("<rung>:
both picks landed on an entity"), read from the Constrain status line's "N picked".
- Tools: rect sides [80, 80, 120, 120], area 9600 (1e-6), sides axis-aligned; circle radius 25 and area 625π; line
50 long at 30° (1e-9 deg); arc radius 40, sweep 90° (1e-7 deg), chord 40√2; slot end radii 10, flanks 60, area;
polygon sides 30 (1e-9) and a regular polygon's area; ellipse area 1000π (2e-2 mm²); point and circle centre
within 0.6 mm of the click; one spline.
- voids: the eight sides, three closed loops, buildable with no open ends, the outer loop owns exactly the other
two and they own none, areas and net material to 1e-6.
- Edit operations: fillet one arc of r 8, area, its centre r from both legs (1e-9); chamfer five sides, a side of
10√2, legs 70 and 110 (1e-9), area; offset radii 25 and 20 with the inner a hole; mirror six lines, area, every
vertex reflected about the drawn axis (1e-9); mirror_arcs one copy per entity, sources unchanged, copies
reflected (1e-6), no reflex cap; trim and extend lengths and the new end on the crossing (1e-9); dimension a side
of 90, DoF down, solved.
- Constraint rungs: each checks first that the geometry starts away from the relation, then reads the relation
in Constrain mode to 1e-6 or 1e-9 (equal length, 90°, parallel, plumb, equal radius by both buttons, concentric,
tangent, midpoint, symmetric about a line, x = 0 and y = 0, radius 22, diameter 30 giving r 15, fix with a gap of
70 and the anchor unmoved, vertical gap 35, horizontal gap accepted with no move under 5e-3 then typed 40,
coincident, collinear), with guards that nothing collapsed and the other coordinate is untouched. After Confirm
and reopen, "the constraints survived the commit": `solve_ok` and more than 0 constraints (more than 1 for fix).
constrain also needs DoF exactly 3, perpendicular 90° to 1e-9, equal_radius and coincident_points their geometry
after the reopen.
- type_guards: Horizontal on a point moves nothing and stores no constraint; Angle on two circles opens no field
within 1 s and stores none.
- badge: a click selects the side's Horizontal (`selected_constraint`) and deletes nothing; a double-click keeps
only it selected; Delete removes exactly that one.
- undo, feature_undo: 3 → 2 → 1 entities with survivors moved under 1e-8; a feature deleted from its row comes back
with Ctrl+Z as the same 120 x 80 rectangle and goes again with Ctrl+Y.
- roundtrip: the file is written, one feature, every entity identical to 12 decimals, three loops, the holes, outer
area 9600 (1e-9).
- scale: all 1204 entities, 301 loops, the plate's area and 300 holes of side² (1e-9); the drawn line takes its
typed length and angle 0 (1e-9) as the only entity added, and no existing entity moved (exact).
- calibration_cache: the harness's `full_calibrations` counter (map reused, refitted on a resized canvas) and a
line of 40 drawn through the reused map.
**Not checked:**
- "the constraints survived the commit" counts constraints; it does not read the constrained geometry after the
reopen for parallel, live_constrain, vertical, concentric, tangent, midpoint, the three symmetric rungs, radius,
diameter, fix, distance_y, distance_xy and collinear. In parallel and live_constrain the two lines meet at a
snapped endpoint, which the line tool stores as an automatic Coincident (`infer_auto_constraints` in
`DesignSketchTool.cpp`), so the check passes even if Parallel is lost on commit. In distance_xy one of its two
distances could be lost.
- rect, voids and feature_undo compare sorted side lengths, so typing into the Width and Height fields the other
way round passes; ellipse is graded on its area only, not its axes or rotation.
- polygon: the side count is not pinned ("at least 3"); spline: only that one spline exists, not its four control
points or its shape.
- scale: the bulk add and the gesture are timed but the times are only printed; no limit is checked.
- type_guards, "Angle on two circles opened no value field": a field that opens after 1 s passes.
- roundtrip prints `skip` and passes on Linux.
- calibration_cache tests the harness, not the app.
**Strength:** Strong — typed values and constraint results are graded exactly against numbers the test chose;
only the survival of most constraints through the commit is checked by count, and a few tools are loosely pinned.
## `test_cad_context_menu`
`test_cad_context_menu.py` · Python, about 105 checks (about 103 and one `skip` on Linux)
**Tests:** The sketch's right-click offer: its header names what was clicked and it lists exactly the label paths
the Design table gives for five selections, greying exactly the rows with nothing to offer; a right-click with a
line's first point down abandons the point and opens nothing. Every sketch verb with no key is run from the menu
and its result graded: the rectangles, polyline, circles, arcs, arc slot, elliptical arc, polygons, inscribed and
circumscribed, move, rotate, scale, array and polar array through their gizmo labels, Text through the Text
dialog, and an SVG import through the file picker.
**Decides by:** Exits 1 when any check prints FAIL or a rung raises (`cad_gui.run()` records the raise as a FAIL
named after the rung).
- Harness, part of the verdict: the `cad_gui.py` raises listed for `test_cad_sketching`, plus the test's own:
`choose()` raises when the verb's path is not an enabled item of the menu or the reply's `ran` differs, `arm()`
raises when no offer opens and adds a check for each verb in `ARMS` ("<rung>: <verb> armed the <tool> tool"),
`clear_sketch()` raises when entities remain, `ok_text()` when the Text dialog stays open.
- vocabulary: for nothing selected, a line, a circle, a point and two entities, the header equals `HEADER`, the
item set equals the paths computed from `scripts/CAD/tool_atlas.json` (by a re-implementation of
`show_offer_menu`'s layout, for the selection `describe_design` names) with no duplicates, and the greyed set is
exact; the five offered sets all differ and a line adds verbs; two picks give a selection of 2; with an anchor
down the right-click returns no header and no items, and the next one offers again.
- author, no_shortcut: sides [80, 80, 120, 120], one loop of 9600 (1e-9); at least ten keyless verbs, the centre
rectangle among them; the centre rectangle centred on its click within 1.5 px.
- curves: construction properties to 1e-9 (oblique rectangle's opposite sides equal, right corners, not
axis-aligned; rounded rectangle's four equal radii and area W·H − r²(4 − π) to 1e-6; centre arc's ends on its
radius; tangent arc square to the line; elliptical arc's ends on the ellipse and a > b > 0; polygons of 3, 4, 5, 8
and 12 equal sides); click-relative ones within 1.5 px (2-point circle's centre and radius, 3-point circle
through its clicks, polygon vertices on one circle); a typed radius of 30 exactly with DoF 2; circumscribed over
inscribed circumradius 1/cos(π/5) to 1e-6.
- transforms: move +25 in X and 0 in Y (1e-9); rotate 30° keeping the length; scale ×3 keeping the direction;
each array waits for its count; array of 4 at a pitch of exactly 20 with equal lengths; polar array of 6 about
one centre, 60° apart.
- art: OK in the Text dialog adds a feature and the ribbon's Cancel takes it away; the kept text is one feature
with `text_string` "LT", `region_loops` summing to 2 and two regions over 1 mm²; the SVG is offered and imports as
4 lines in 1 loop with proportions 2:1 to 1e-6.
- coverage: the table's keyless sketch verbs minus the test's `DRIVEN` list is empty, `DRIVEN` holds nothing
outside the table, and no sketch verb lacks an action.
**Not checked:**
- coverage reads only `tool_atlas.json` and the test's own `DRIVEN` list; it cannot fail on a change in the app,
only on a table edit that adds a keyless verb with no rung.
- curves: the polyline is graded only as 4 lines and 1 loop, not where its points are; the arc slot only as "at
least 2 arcs" with two sharing a centre, not its 4 arcs, caps or width; the elliptical arc's checks run only `if
"radius" in` the entity, so a renamed field drops them silently; the inscribed and circumscribed verbs are not in
`ARMS`, so what they arm is not checked (the radius ratio still fails a no-op).
- art: the letters' shapes are graded only as two loops of over 1 mm²; the SVG's absolute size is not checked,
only its proportions; the SVG import prints `skip` and passes on Linux.
- "no_shortcut: at least ten verbs offered on an empty sketch have no shortcut" is a floor where the table gives
the exact number; vocabulary's exact menu comparison covers it.
**Strength:** Strong — the menu is compared item for item with the Design table for five selections, and each
keyless verb's result is graded by exact construction properties; only coverage (static) and a few curves are
loose.
## Replays
These replays have no Python test in their place yet, and stay in the sweep until one is designed here.
### `cad_sketch_to_solid`
`tests/cad_sketch_to_solid.json` · replay, 37 steps, 59 expects, 1 optional
**Tests:** Sketch to solid through the Design commands. A sketch on a base plane passes through `modeling_origin`. An empty `sketch_finish` is refused and leaves the sketch open. A fillet is made inside the sketch. Then come extrudes (whole sketch as a new body, one loop alone, and a sketch on a body face joined onto that body) and a revolve about the sketch's only construction line.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Sketch frames: the XZ sketch reports `plane` XZ with normal +Y. The sketch on face 10 has frame origin z 8 ± 1e-3, x axis world −Y and y axis world +X (exact).
- Sketch contents: 6 entities after drawing and 7 after `sketch_fillet`. The fillet is entity 6 with `released_constraints` 1 and `solve_ok`. Committed, it is an `arc` of radius 3 ± 1e-4. Loop areas: 265.93–265.94 and 9600 ± 0.01. The plate is loop 5. Each commit's `sketch_index`/`features` is checked.
- Empty commit: the next `sketch_describe` (no `sketch` argument, so it errors when no sketch is open) must list no entities. The next commit must be `sketch_index` 0.
- Solids: the `extrude` and `revolve` replies (`extrude_index`, `operation` new_body/join, `body`, `bodies`, `loop`, `end` blind, `axis_entity` 4). `body_mass_properties` volumes are within 0.03 mm³ for the jig, lip and single loop, 0.16 for the ring and ±2 for the bracket. `body_describe` gives 11 faces with known kinds, and the bboxes run z 0–30, then 18 after the lip.
**Not checked:**
- The optional empty `sketch_finish`: its refusal text. The refusal and "stays open" are covered only because the next step errors without an open sketch and the next commit must be index 0.
- "Passes through `modeling_origin`": only `frame/origin/0 gt 1.0` and `bbox/min/0 gt 1.0`, not equality with `describe_design`'s `modeling_origin` (left loose because it depends on the bed).
- The holes on 32 mm centres and where the lip sits in its plane: only total volume and z extent.
- `closed_loops/0/entities/6 exists` and `holes/4 exists` only say the arrays are long enough, not what they hold, though the exact values are known.
- The bracket's volume band (±2 mm³) is about 20 times looser than its loop-area check implies.
**Strength:** Strong — every solid's volume is checked tightly, and every sketch reply by exact indices and counts.
### `cad_sketch_edit`
`tests/cad_sketch_edit.json` · replay, 39 steps, 54 expects, 3 optional
**Tests:** The sketch's own tools through the Design commands: polygon, slot, ellipse, spline, trim, extend, chamfer, fillet, linear and circular patterns, rotate and move. It also adds constraints and dimensions from entity picks and from named points (`origin`): a radius that over-constrains is rolled back and a constraint is deleted. Each result is read back from `sketch_describe` and `sketch_list_constraints` and from the extruded solid's volume.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Hex standoff: `sketch_draw`'s shape bookkeeping (`count` 6, `first` 6, 7 entities). The first edge lies at x 4 ± 1e-4. The hexagon loop has area 55.4256–55.4257 and holds the bore as hole 0. Volume 630.0–630.1.
- Trim/extend: `sketch_trim` cuts line 0 to end at x 0 ± 1e-4, with p0 still −10. `sketch_extend` takes line 2 to x 30 ± 1e-4. The sketch is then cancelled, and the next commit being `sketch_index` 0 shows that nothing was committed.
- Plate edits: the rectangle has `dof` 4. The chamfer and fillet create entities 4 and 5, then there are 6 in all. Shape indices for the slot, ellipse, circle and spline, and 13 entities. Linear pattern: `first_index` 13, `added` 4. Rotate pivot (−10, 10) ± 1e-4. Move reports entity 11. Circular pattern: `first_index` 17, `added` 3, `bound` 3. Copy 18 is centred at (22, 0) and the rotated slot's p0 x is −12, both ± 1e-4. Buildable.
- Constraints: 25 before. The distance dimension is added at index 25 with an `origin` ref and `solve_ok`. `equal` is stored as `equal_radius`. After the optional radius there are 27, with item 26 `equal_radius`. Deleting 25 removes a `distance` and leaves 26 in both the live (`scope` live) and the committed (`scope` committed) sketch.
- Final solid: 11106.1–11106.25 mm³.
**Not checked:**
- The optional `sketch_trim` at [100, 100]: nothing reads lines 1 and 3 after it, and the sketch is cancelled two steps later. Neither the refusal nor "refused calls change nothing" is verified for it.
- The optional fillet of radius 100 and the radius dimension are covered only indirectly. The next fillet must still be entity 5, and the constraint count must still be 27. Neither refusal text is checked.
- What the distance and equal constraints do to the geometry. Both match the geometry already there, so they could not move it anyway.
- The spline's `construction` flag.
- Where most edited entities end up (the ellipse, the other two pattern copies, the chamfer and fillet), beyond what the total volume implies.
**Strength:** Strong — every edit's reply is checked by exact index, count or coordinate, and the final volume to 0.15 mm³.
### `cad_topology_targets`
`tests/cad_topology_targets.json` · replay, 33 steps, 69 expects, 1 optional
**Tests:** Reading a body's topology and building on what it finds. It covers `body_describe` filters (convexity, face kinds, direction, extreme, adjacency, paging), a fillet on an inside edge found that way, and M4 countersinks seated on a face on a pilot hole's axis (`at` a cylindrical face). It also covers `measure` between faces and axes, datum planes (midplane, offset) with a sketch on one, and a face push/pull that joins its own body.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Topology reads, all ± 1e-4 or tighter:
- Two concave edges: the first is id 7, a line next to face 2, with 3 faces in total.
- After the fillet: one internal cylindrical face of radius 5.
- Facing −X: 2 faces, with face 0 of area 985.86–985.87.
- Two internal conical faces: half-angle 45°, radii 4.5 and 2.25, axes −X, 6 adjacent edges, the first convex and on face 0.
- The −z extreme is face 10.
- Paging: `faces/4` present, `faces/5` absent, `next_offset` 5.
- Countersinks: `off_plane` 5 ± 1e-4 for both. The first has `y` 0 and frame normal +X.
- Measures, all ± 1e-4:
- Axis to bottom face: 25, at 90°.
- Axis to axis: 25.
- Cone to front face: 0 (≤ 1e-4).
- Cone to back face: 2.75.
- Plate gap and min distance: 5.
- Datums: `plane_index` 7 (normal −X) and 8 (origin z 70). The sketch on datum 8 is at z 70, is `sketch_index` 9, and makes body 1 spanning z 70–74.
- Push/pull: `operation` join on body 0, `sketch_index` −1, face 8, normal +X. Volumes 10352.82–.84 and 12689.20–.22.
**Not checked:**
- The optional tangent plane: its refusal text. "Changes nothing" is verified: the `describe_design` after it must have feature 8 a Plane, no feature 9, `undo_depth` 8 and `redo_depth` 0.
- The two pilot `hole` steps have no expect. Their positions show up only in the later measures; the upper hole's 50 mm height is checked only through the 25 mm spacing.
- The second countersink's `y` and frame.
- `edges/0/faces contains 2`, where the exact face pair is known.
- Face and edge ids are hard-coded ("this build's"). A renumbering fails the test with no change in behaviour (a false fail, not a false pass).
**Strength:** Strong — ids, radii, angles, distances and volumes are checked to 1e-4 or tighter.
### `cad_features`
`tests/cad_features.json` · replay, 45 steps, 59 expects, 6 optional
**Tests:** Threads, sweeps, lofts and plane splits through the Design commands:
- An internal thread on a bore, with its size inferred from the bore, and the same thread placed on the XY plane.
- A helix with round and square wire swept along it.
- A square-to-circle loft up to a datum plane.
- A split by that datum, then a split by XY flipped that keeps one side.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Thread on the bore: `thread_index` 3, `designation` M5, `internal`, `pitch` 0.8 ± 1e-4, `length` 15 ± 1e-4, one body. The body is solid at 600–614 mm³. Feature 3 is a Thread, with `undo_depth` 3.
- Thread on XY: after `undo` there are 3 features. The thread is at x = y = 0 on body 0, as M5, and the volume is again 600–614.
- Helix and sweeps: `helix_index` 0, with start tangent y 0.9968–0.9969 and z 0.0793–0.0794. The round wire is `sweep_index` 2, a new body, solid, 2638–2691 mm³. The square wire is `sweep_index` 4, body 1 of 2, 1492–1524 mm³.
- Loft: datum `plane_index` 0, sketches 1 and 2. `loft_index` 3 is body 0, solid, 11850–11861 mm³.
- Splits: `split_index` 4, upper body 0 and lower body 1, normal +Z, the bboxes meeting at z 20 ± 1e-3. The flipped split keeps body 1 at z 0–10 with 2 bodies, normal −Z, and `undo_depth` 6.
**Not checked:**
- The six optional refusals: a planar face, the unknown `M5x1`, a sweep given as the path, a one-profile loft, the datum plane given as a loft profile, and a split plane above the body.
- Their texts are not checked, including the comment's "names the close ones".
- A wrongful success is caught only because the next real call checks its index (`thread_index` 3, `sweep_index` 4, `loft_index` 3, `split_index` 4) and `undo_depth`.
- A refusal that changed a body without adding a feature would pass. For example, body 0 is not measured again after the refused sweep.
- The thread and sweep solids are checked only within volume bands of about 2 % (600–614, 2638–2691, 1492–1524). A wrong thread profile or wire orientation that stays inside a band passes.
- The XY thread's `length` and `internal` are not read back.
- The side the flipped split discards: only `bodies` 2 and body 1's bbox are checked.
**Strength:** Partial — the loft and splits are checked closely, but the thread and sweep solids only within 2 % volume bands.
### `cad_doc`
`tests/cad_doc.json` · replay, 82 steps, 139 expects, 0 optional
**Tests:**
- Reading and editing a Design feature as its card does: a variable bound to an extrude's `distance` and then removed, and `feature_edit` under its own argument names and the aliases agents use (`index`, `params`, `values`).
- Handing the design to the plate: Commit to Plate; a recommit that replaces the first object and is undone in one Prepare step; and the bodies and assembly modes.
- A STEP export read back into a new design.
- The Design history and tree: undo/redo, suppress, move and delete, body name, visibility and colour, and a save and reopen.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Discovery: `tool_search` lists `feature_describe` as Design read-only and `feature_edit` as Design writable.
- Variables and edits:
- Variable `h` = 12 shows as bound to `distance` in `describe_design` and in `feature_describe` (`params`, `expr`, `refs`, `used_by`, `editable`).
- After unbinding and removing it, `variables` is empty and `bound` is absent.
- `feature_edit` reports `changed` old/new pairs, and the `index`, `params` and `values` aliases each apply.
- Volumes 6000 and 9000 ± 0.01.
- Plate hand-off:
- The commit reply names object 0 "Design Body", 1 part, body 0 sent, on the `prepare` tab.
- `object_list` then shows 1 object of height 15 ± 0.01, then 20 after the recommit (which reports `replaced` 0), and 15 again after one Prepare undo `action_run`.
- The bodies and assembly commits create objects 1, 2 ("Design Body 2") and 3 ("Design Assembly", 2 parts), for a total of 4.
- STEP round trip: the export has `bytes` > 0 and one body. `new_design` clears 3 features and 1 body. The `import_step` body's volume is 12000 ± 1.2.
- History and tree:
- Undo/redo depths, with `distance` going 15 → 10 → 15.
- The rename trims to "Base", is its own undo step (`undo_depth` 4 → 3), and is undone and redone.
- Suppress reports `changed` true, then false, with body counts.
- `feature_move`'s reply and the new feature order, then its undo.
- `body_set` name and visibility show in `describe_design`. A hidden body is left out of `bodies_sent` and listed in `bodies_hidden`.
- `body_delete` and `feature_delete` report their counts, and their undos restore them.
- A colour given as `#3080ff` reads back as `#3080FF`.
- Reopen: after a save, a new project and an open, there are 4 features and body 1 is "Lid" with colour `#3080FF`.
**Not checked:**
- `sketch_repair` only runs.
- What lands on the plate after the hidden-body commit and the second bodies-mode commit: only the commit replies are read, with no `object_list`.
- Most of the reopened design: body 0, the feature names ("Base"), visibility and volumes. `project_save` and `project_open` have no expect.
- The new body's default colour only has to match `^#[0-9A-F]{6}$`.
**Strength:** Strong — nearly every edit is read back by exact value, count or volume, and undo depths are pinned.
### `cad_canvas`
`tests/cad_canvas.json` · replay, 32 steps, 33 expects, 5 optional
**Tests:** The Design view as a canvas target:
- `view_set` on the Design tab, and its refusals of Prepare's and Preview's fields.
- Screenshots of the canvas and of its widget.
- A click that picks the block, and a right click that lists the pick's verbs.
- Keys reaching the Design panel's key hook: Shift+E opens the Extrude card, and Escape with no target closes it.
- The project's modified flag after a change made only in the Design tab, and reopening a design-only project with `discard_changes`.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- View: `view_set` echoes tab `design` with camera `iso`, then `default`, then `fit_selection`. After an extrude, `app_state` reports tab `design`, `gizmo` null and the project dirty.
- Screenshots: the canvas and `wxGLCanvas` targets give source `canvas`, no `approximate` key and width > 0. The main window's width is > 0. `widget_list` finds one `OrcaSceneCanvas`.
- Pick: `widget_click` reports `clicked` canvas. The right-click menu's first item matches "of Extrude". `fit_selection`, refused earlier with nothing picked, now succeeds.
- Keys: `widget_list` "Extrude dist" finds 1 node after Shift+E and 0 after Escape. The next `extrude` returns `ok`.
- Project:
- After the save: not dirty, named `design_only`.
- After `set_variable`: dirty.
- Opening with `discard_changes` reports a project with 0 objects. `app_state` then shows not dirty, the name and path match, and no dialogs are open.
- The variable is gone and a second body exists.
**Not checked:**
- None of the five optional steps is verified:
- Nothing reads the tab, camera or selection after the refused `fit_bed`, the refused `fit_selection` with nothing picked, the refused `layer` 2, or the refused `mouse_gesture` at a model point. "Refuses what belongs to Prepare and Preview" is not tested.
- The refused `project_open` without `discard_changes` is not verified. A silent open would pass; only a dialog left open would be caught, by the final `/dialogs` empty.
- The three PNGs are saved but never compared. Nothing shows that they picture the Design view rather than Prepare's canvas.
- The right-click verbs: only the header item is matched (by regex), not the verbs listed.
- The camera is read only from `view_set`'s own reply.
- The reopened design's geometry: the test checks only that `bodies/1` exists, not that there is no third body.
**Strength:** Partial — the key hook, the modified flag and the reopen are checked, but the refusals and the screenshots are not.

View file

@ -0,0 +1,540 @@
# Filaments and settings
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
Two tests, not one. `test_filaments` is about what a filament slot holds and what the project does with it (the
preset in a slot, the unsaved-changes prompt, the flushing volumes, the filaments of objects and parts, the project's
colours and prime tower); `test_settings` is about where a setting applies (a preset, an object, a part, a height
range) and how the settings commands name those targets. They share no state, and each runs on a fresh app of its own,
so the sweep can run them side by side; `test_filaments` also needs presets that nothing has shown yet, which a fresh
app gives it.
## `test_filaments`
`test_filaments.py` · Python · takes the place of `ops_assign_filament_preset_one_slot.json`,
`ops_assign_filament_preset_multi_slot.json` and `multicolor.json`
**Tests:** Assigning a filament preset to a filament slot through each route a person or a plugin has: a pick in the
slot's selector in the sidebar, the selector's value set (`widget_set_value`), `preset_select`, and the plugin API's
`orca.host.preset.filament`. With one slot, where the assignment switches the filament tab, its unsaved-changes prompt
(offered, answered each way, answered ahead with `preset_changes`, and refused where Transfer is not offered). With
three slots, what the Auto-flush preference (`auto_calculate_flush`: All, Color, None) does to the flushing volumes when
a slot's preset or colour changes, the unsaved changes of the preset the tab edits, the plugin API's other forms, the
refusals and the hidden presets shown by name. Then multicolour printing: the filament of an object and of a part
through `settings_set`, and the project's own settings through `project_set_settings` (slot colours, flushing volumes
and multiplier, plate type, prime tower), with what reaches the print and what the project file keeps. It runs on the
harness's default printer, the Bambu Lab X1 Carbon 0.4, on the sweep's fresh app and data folder.
**Terms:** filament presets `B` (Bambu PLA Basic @BBL X1C), `X` (FilAr PLA Blanco Calido, a PLA whose preset has the
default colour `#FFF8E7`), `M` (Bambu PLA Matte @BBL X1C, a PLA with no default colour), `S` (Bambu Support For PLA @BBL
X1C, a support filament of type PLA), `A` (Bambu Support for ABS @BBL X1C, a support filament of type ABS), `G` (Bambu
PETG Basic @BBL X1C) and `H` (Bambu PETG HF @BBL X1C). Only `X` has a default colour. Their `slow_down_layer_time`, from
the profiles: `B`, `X` and `M` 4, `S` 8, `A` 12, `G` 12, `H` 10. Every route resolves a name against the slot's selector,
which takes the name it shows ("FilAr PLA Blanco Calido", "Bambu Support for ABS") or the internal name; a row that
gives a letter passes the internal name, and a row that quotes a name passes it as quoted. The prompt is the dialog
titled "Transfer or discard changes". Auto-flush is the preference `auto_calculate_flush`: All (`all`), Color (`color
change`), None (`disabled`).
The routes, for slot `n` and preset `P`:
- pick: `widget_click {target: {class: "PlaterPresetComboBox", index: n}}` (index 0 is the printer's selector), then
`widget_click {target: {row: P}}` with the name the selector shows.
- tool: `preset_select {type: "filament", name: P, filament_slot: n}`, with `preset_changes` where the row gives one.
- api: `plugin("orca.host.preset.filament.begin_update(n, P).commit()")`; other forms as the rows give them.
**Reads:**
- `slots()` as in `test_plates`: `filament_is_mixed` from `project_get_settings`, one digit per slot.
- `state()` gives five fields, written `presets | tab | edits | colours | matrix`:
- presets: each slot's preset, from `app_state` `presets.filaments`: `B X B`.
- tab: the filament preset `preset_list {type: "filament", limit: 500}` marks `selected`, with `*` when it is also
`modified`: `B*`.
- edits: each slot's `slow_down_layer_time`, from `settings_get {type: "filament", filament_slot: n, keys:
["slow_down_layer_time"], include_meta: false}`, which reads the tab's unsaved value for a slot whose preset the tab
edits: `9,4,9`.
- colours: `filament_colour` from `project_get_settings`. `c3` is `#111111;#222222;#333333` and `cX` is
`#111111;#FFF8E7;#333333`.
- matrix: `flush_volumes_matrix` from `project_get_settings`, entries counted from 0 in the order it lists them (row
= from, column = to). `S3` is the sentinel `0,777,777,777,0,777,777,777,0`. `R2` is slot 2's row and column worked
out by the app: entries 1, 3, 5 and 7 each above 0 and other than 777, entries 2 and 6 777 and the diagonal 0.
`Sup` is `0,230,777,700,0,700,777,230,0`: a support filament in slot 2, 230 into it (`g_flush_volume_to_support`)
and 700 out of it (`g_min_flush_volume_from_support`, above what the greys' colours need).
After every step of the slot scenarios `state()` is compared with the state its row gives, whole, and
`app_state.dialogs` is empty unless the row says the prompt is open.
- `dialogs()` gives the open dialogs from `app_state.dialogs` as `{title, buttons}`, a button by its label.
- `plugin(code)` runs `code` with `script_run` and gives what it returns: a transaction's `{target_name,
selection_changed, slot_number}`, a commit's `{target_name, selection_changed, slot_assignment_changed, shared_slots,
keys, dirty}`, or, when the plugin API raises, `{raised: {type, message}}`. It asserts what `ops_presets.preset_api`
only reported.
- `filaments()` gives each object as its filament and its parts' filaments from `object_list`, written `cube 1 (1, 2)
· cylinder 2`: the cube on filament 1, its part 0 on 1 and its part 1 on 2, the cylinder on 2.
- `item(target, key)` gives one item of `settings_get {target, object, part, keys: [key], include_meta: false}` as
`{value, effective, source, parts}` and the reply's `note`; a field the reply leaves out is absent.
- `project()` gives the project's own settings, written `colours | multiplier | matrix | plate type | tower`: from
`project_get_settings`, `filament_colour`, `flush_multiplier`, `flush_volumes_matrix`, `curr_bed_type`, and plate 0's
`wipe_tower_x` and `wipe_tower_y`; and `plate_list`'s plate 0 `curr_bed_type` and `wipe_tower`, which must agree with
them.
- `grams()` gives, for each slot, `model_g` and `flush_g`, and the plate's `filament_changes`, from the `summary` of
`plate_slice_stats {plate: 0}` read after the slice.
A call that the prompt holds replies `blocked_by_dialog`. The test then checks `dialogs()`, answers with
`dialog_answer` (a label, or `cancel`, which closes the prompt), waits for the call's job with `app_wait {for: "job"}`
and checks that the wait was met and no dialog is open: the prompt opens once. Every other call is followed by
`app_wait {for: "idle"}`, which must be met. A refusal is matched by its code where the operations layer gives one,
otherwise by its words, and is always followed by the scenario's full read-back.
The test turns on Simple mode once, with the `mode_simple` action, and checks `app_state.mode` is `simple`: the prompt
lists the settings the mode shows, and `slow_down_layer_time` is one of them. Every scenario starts with `project_new
{discard_changes: true, preset_changes: "discard"}` in the Prepare view; sets Auto-flush to All with `preferences_set`
and checks `preferences_get` reads `all`, since a preference outlives the scenario that sets it; sets the number of slots
with `filament_delete` until it is refused and `filament_add`; and checks `slots()`.
Each case of the slot scenarios starts from `arrange(presets, dirty)`, whose result is checked as the row's start: it
drops the tab's unsaved changes (`settings_set {type: "filament", filament_slot, reset_all: true}` on a slot holding the
preset the tab edits), puts `presets` in the slots with `preset_select {preset_changes: "discard"}`, switches the tab to
slot 1's preset with `settings_set {type: "filament", filament_slot: 1, reset_all: true}`, and sets the colours to
`#111111`, `#222222`, `#333333` (as many as there are slots) and the matrix to the sentinels with one
`project_set_settings` call, the colours first and the whole matrix replacing whatever they recalculated. With `dirty`
it then sets `slow_down_layer_time` 9 on slot 1's preset with `settings_set {type: "filament", filament_slot: 1}`.
**Scenario: hidden filaments, shown by name** (runs first)
One slot, from `arrange([B])`: `B | B | 4 | #111111 | 0`. `X`, `M`, `S` and `A` are hidden on a fresh data folder; a
pick needs them in the selectors.
| # | Step | State after | Also checked |
|---|---|---|---|
| 1 | `preset_list {type: "filament", query: P}` for each of "FilAr PLA Blanco Calido", "Bambu PLA Matte", "Bambu Support For PLA" and "Bambu Support for ABS", then the same with `include_uninstalled: true` | `B \| B \| 4 \| #111111 \| 0` | the first lists none of them; the second's items include `X`, `M`, `S` and `A`, each with `installed: false` |
| 2 | tool "FilAr PLA Blanco Calido" | `X \| X \| 4 \| #FFF8E7 \| 0` | reply `selected` and `shown` `X` |
| 3 | tool "Bambu PLA Matte" | `M \| M \| 4 \| #FFF8E7 \| 0` | reply `selected` and `shown` `M`; the colour stays, as `M` has no default colour |
| 4 | tool "Bambu Support For PLA" | `S \| S \| 8 \| #FFF8E7 \| 0` | reply `selected` and `shown` `S` |
| 5 | tool "Bambu Support for ABS" | `A \| A \| 12 \| #FFF8E7 \| 0` | reply `selected` and `shown` `A` |
| 6 | tool "Bambu PLA Basic" | `B \| B \| 4 \| #FFF8E7 \| 0` | reply `selected` `B` and no `shown` |
| 7 | `preset_list {type: "filament", query: P}` for each of the four | as after 6 | each lists its preset, with no `installed` field: a preset a call showed stays shown |
**Scenario: one slot, a PLA with a default colour**
Every row starts from `arrange([B])`, with `dirty` where the Start column says so: clean is `B | B | 4 | #111111 | 0`,
dirty is `B | B* | 9 | #111111 | 0`. The matrix of one slot has nothing to recalculate, so it stays `0`.
| # | Start | Step | State after | Also checked |
|---|---|---|---|---|
| 1 | clean | pick `X` | `X \| X \| 4 \| #FFF8E7 \| 0` | no dialog opened |
| 2 | clean | tool `X` | as 1 | reply `selected` `X`, and no `shown`, `discarded` or `modified` |
| 3 | clean | api `X` | as 1 | nothing raised; commit `{target_name: X, selection_changed: true, slot_assignment_changed: true, shared_slots: [1], keys: [], dirty: false}` |
| 4 | dirty | pick `X`, answered Transfer | `X \| X* \| 9 \| #FFF8E7 \| 0` | the click replies `blocked_by_dialog`; `dialogs()` is the prompt alone, its buttons including Transfer, Discard and Save |
| 5 | dirty | pick `X`, answered Discard | `X \| X \| 4 \| #FFF8E7 \| 0` | the prompt as in 4 |
| 6 | dirty | pick `X`, answered cancel | `B \| B* \| 9 \| #FFF8E7 \| 0` | the prompt as in 4; the slot and the tab are as at the start, but the colour is `X`'s (see To settle) |
| 7 | dirty | tool `X`, `preset_changes: "transfer"` | as 4 | no dialog opened; reply `selected` `X`, `modified` `{filament: {name: X, keys: [slow_down_layer_time]}}`, no `discarded` |
| 8 | dirty | tool `X`, `preset_changes: "discard"` | as 5 | no dialog opened; reply `selected` `X`, `discarded` `{filament: {name: B, keys: [slow_down_layer_time]}}`, no `modified` |
| 9 | dirty | tool `X`, answered Transfer | as 4 | the call replies `blocked_by_dialog`; the prompt as in 4; the job's result as 7's reply |
| 10 | dirty | tool `X`, answered Discard | as 5 | the prompt as in 4; the job's result as 8's reply |
| 11 | dirty | tool `X`, answered cancel | as 6 | the prompt as in 4; the job's result is not refused: `selected` `B`, `modified` `{filament: {name: B, keys: [slow_down_layer_time]}}`, no `discarded` |
| 12 | dirty | api `X`, answered Transfer | as 4 | the prompt as in 4; commit as in 3 but `dirty: true` |
| 13 | dirty | api `X`, answered Discard | as 5 | the prompt as in 4; commit as in 3 |
| 14 | dirty | api `X`, answered cancel | `B \| B* \| 9 \| #111111 \| 0` | the prompt as in 4; raised `RuntimeError` "Switching the edited filament preset to "FilAr PLA Blanco Calido" for filament slot 1 was canceled; neither the slot assignment nor any setting was changed": the api assigns only after the tab switched, so nothing changed |
**Scenario: one slot, a support filament of another type**
As the scenario before, with `A`, a filament of type ABS, so the prompt offers no Transfer. `A` has no default colour,
so the colour stays `#111111` on every row.
| # | Start | Step | State after | Also checked |
|---|---|---|---|---|
| 1 | clean | pick `A` | `A \| A \| 12 \| #111111 \| 0` | no dialog opened |
| 2 | clean | tool `A` | as 1 | reply `selected` `A` |
| 3 | clean | api `A` | as 1 | commit `{target_name: A, selection_changed: true, slot_assignment_changed: true, shared_slots: [1], keys: [], dirty: false}` |
| 4 | dirty | pick `A`, answered Discard | as 1 | `dialogs()` is the prompt alone, its buttons including Discard and Save and not Transfer |
| 5 | dirty | pick `A`, answered cancel | `B \| B* \| 9 \| #111111 \| 0` | the prompt as in 4 |
| 6 | dirty | tool `A`, `preset_changes: "transfer"` | as 5 | refused, `transfer_not_offered`, before any dialog opened |
| 7 | dirty | tool `A`, `preset_changes: "discard"` | as 1 | reply `discarded` `{filament: {name: B, keys: [slow_down_layer_time]}}` |
| 8 | dirty | tool `A`, answered Discard | as 1 | the prompt as in 4; the job's result as 7's reply |
| 9 | dirty | tool `A`, answered cancel | as 5 | the prompt as in 4; the job's result `selected` `B`, not refused |
| 10 | dirty | api `A`, answered Discard | as 1 | the prompt as in 4; commit as in 3 |
| 11 | dirty | api `A`, answered cancel | as 5 | raised `RuntimeError` "Switching the edited filament preset to "Bambu Support for ABS @BBL X1C" for filament slot 1 was canceled; neither the slot assignment nor any setting was changed" |
**Scenario: one slot, the plugin API's forms that name no preset**
| # | Start | Step | State after | Also checked |
|---|---|---|---|---|
| 1 | clean | `begin_update(1).commit()` | `B \| B \| 4 \| #111111 \| 0` | commit `{target_name: B, selection_changed: false, slot_assignment_changed: false, shared_slots: [1], keys: [], dirty: false}` |
| 2 | clean | `update(1, "slow_down_layer_time", "8")` | `B \| B* \| 8 \| #111111 \| 0` | nothing raised |
| 3 | clean | `update("slow_down_layer_time", "8")` | as 2 | the tab's preset, which slot 1 holds |
| 4 | dirty | `begin_update(1).commit()` | `B \| B* \| 9 \| #111111 \| 0` | no dialog opened; commit as in 1 but `dirty: true` |
| 5 | dirty | `update(1, "slow_down_layer_time", "8")` | as 2 | no dialog opened |
| 6 | dirty | `update("slow_down_layer_time", "8")` | as 2 | |
| 7 | dirty | `begin_update(1, "Bambu PLA Basic").commit()`, the preset slot 1 holds | as 4 | no dialog opened; commit as in 4: nothing switched, nothing assigned |
**Scenario: three slots, what Auto-flush does to the flushing volumes**
`slots()` is `0,0,0`. Every case starts from `arrange([B, B, B])`: `B B B | B | 4,4,4 | c3 | S3`. Each preference is set
with `preferences_set` and read back with `preferences_get` before its cases. Each filament row is run by three routes
on slot 2: the pick and the tool leave the tab on `B`, the api moves it to the preset it names.
| Auto-flush | Into slot 2 | State after (pick, tool) | Tab after api | Also checked |
|---|---|---|---|---|
| All | `X` | `B X B \| B \| 4,4,4 \| cX \| R2` | `X` | entries 1 and 7 (from the greys into the lighter `X`) are each greater than entries 3 and 5 (from `X` into them) |
| All | `M` | `B M B \| B \| 4,4,4 \| c3 \| R2` | `M` | |
| All | `S` | `B S B \| B \| 4,8,4 \| c3 \| Sup` | `S` | |
| Color | `X` | `B X B \| B \| 4,4,4 \| cX \| R2` | `X` | the colour changed, so the volumes are recalculated |
| Color | `M` | `B M B \| B \| 4,4,4 \| c3 \| S3` | `M` | no colour of its own, so nothing is recalculated |
| Color | `S` | `B S B \| B \| 4,8,4 \| c3 \| S3` | `S` | only All recalculates for a support filament |
| None | `X` | `B X B \| B \| 4,4,4 \| cX \| S3` | `X` | the colour follows the preset; the volumes stay |
| None | `M` | `B M B \| B \| 4,4,4 \| c3 \| S3` | `M` | |
| None | `S` | `B S B \| B \| 4,8,4 \| c3 \| S3` | `S` | |
After the filament rows of each preference, one more case from the same start: `project_set_settings {values:
{filament_colour: {index: 1, value: "#FFF8E7"}}}`, the colour picker's change. Under All and Color it leaves `B B B | B
| 4,4,4 | cX | R2`; under None `B B B | B | 4,4,4 | cX | S3`. Where `R2` is expected, the three routes and the colour
change give the same four entries under one preference, and Color gives what All gave for `X`: an assignment
recalculates as a colour change does.
**Scenario: three slots, unsaved changes in the preset the tab edits**
Rows 1 to 7 start from `arrange([B, B, B], dirty)`: `B B B | B* | 9,9,9 | c3 | S3`, every slot holding the preset the
tab edits. Rows 8 and 9 start from `arrange([B, M, B], dirty)`: `B M B | B* | 9,4,9 | c3 | S3`.
| # | Step | State after | Also checked |
|---|---|---|---|
| 1 | pick `X` | `B X B \| B* \| 9,4,9 \| cX \| R2` | no dialog opened: with several slots a pick does not switch the tab, and its changes stay |
| 2 | tool `X` | as 1 | reply `selected` `X`, `modified` `{filament: {name: B, keys: [slow_down_layer_time]}}`, no `discarded` |
| 3 | tool `X`, `preset_changes: "transfer"` | as 1 | not refused; the reply as in 2 |
| 4 | tool `X`, `preset_changes: "discard"` | as 1 | the reply as in 2: nothing is discarded |
| 5 | api `X`, answered Transfer | `B X B \| X* \| 4,9,4 \| cX \| R2` | the call replies `blocked_by_dialog`, the prompt's buttons including Transfer and Discard; commit `{target_name: X, selection_changed: true, slot_assignment_changed: true, shared_slots: [2], keys: [], dirty: true}` |
| 6 | api `X`, answered Discard | `B X B \| X \| 4,4,4 \| cX \| R2` | the prompt as in 5; commit as in 5 but `dirty: false` |
| 7 | api `X`, answered cancel | `B B B \| B* \| 9,9,9 \| c3 \| S3` | the prompt as in 5; raised `RuntimeError` "Switching the edited filament preset to "FilAr PLA Blanco Calido" for filament slot 2 was canceled; neither the slot assignment nor any setting was changed" |
| 8 | api `begin_update(2).commit()`, answered cancel | `B M B \| B* \| 9,4,9 \| c3 \| S3` | the prompt as in 5; raised `RuntimeError` "Switching the edited filament preset to "Bambu PLA Matte @BBL X1C" for filament slot 2 was canceled; neither the slot assignment nor any setting was changed" |
| 9 | api `update(2, "slow_down_layer_time", "8")`, answered cancel | as 8 | the prompt as in 5; the same `RuntimeError` |
**Scenario: three slots, the selector's value and the plugin API's other forms**
No unsaved changes. Each row starts from `arrange` with the presets it names.
| # | Start | Step | State after | Also checked |
|---|---|---|---|---|
| 1 | `B B B` | `widget_set_value {target: {class: "PlaterPresetComboBox", index: 2}, value: "FilAr PLA Blanco Calido"}` | `B X B \| B \| 4,4,4 \| cX \| R2` | as a pick of the row |
| 2 | `B B B` | api `begin_update(2, X)`, not committed | `B X B \| X \| 4,4,4 \| cX \| R2` | the transaction `{target_name: X, selection_changed: true, slot_number: 2}`: the slot is assigned as the transaction is made |
| 3 | `B M B` | api `begin_update(2, "Bambu PLA Matte").commit()` | `B M B \| M \| 4,4,4 \| c3 \| S3` | commit `{target_name: M, selection_changed: true, slot_assignment_changed: false, shared_slots: [2], keys: [], dirty: false}`: the tab switches and nothing is assigned or recalculated |
| 4 | `B M B` | api `begin_update(2).commit()` | as 3 | commit as in 3 |
| 5 | `B M B` | api `t = begin_update(2); t.set("slow_down_layer_time", "8"); t.commit()` | `B M B \| M* \| 4,8,4 \| c3 \| S3` | commit `{target_name: M, selection_changed: true, slot_assignment_changed: false, shared_slots: [2], keys: [slow_down_layer_time], dirty: true}` |
| 6 | `B M B` | api `update(2, "slow_down_layer_time", "8")` | as 5 | nothing raised |
| 7 | `B M B` | api `update("slow_down_layer_time", "8")` | `B M B \| B* \| 8,4,8 \| c3 \| S3` | the preset the tab edits, which slots 1 and 3 share |
**Scenario: three slots, refusals and hidden presets**
Every row starts from `arrange([B, B, B])`, and every refused row leaves `B B B | B | 4,4,4 | c3 | S3`.
| # | Step | Checked |
|---|---|---|
| 1 | tool, slot 5, "FilAr PLA Blanco Calido" | refused, `no_such_slot`, "Filament slot 5 does not exist (the slots are 1..3)" |
| 2 | api `begin_update(5, X).commit()` | raised `IndexError` "Filament slot 5 is out of range; slot numbers are 1-based and this printer has 3 filament slot(s)" |
| 3 | api `begin_update(0, X).commit()` | raised `IndexError` "Filament slot 0 is out of range; slot numbers are 1-based and this printer has 3 filament slot(s)" |
| 4 | api `update(5, "slow_down_layer_time", "8")` | raised `IndexError`, as in 2 |
| 5 | tool, slot 2, "No Such Filament" | refused, `preset_not_offered`, starting "The selector of filament slot 2 does not offer "No Such Filament"." |
| 6 | api `begin_update(2, "No Such Filament").commit()` | raised `ValueError` "The selector of filament slot 2 does not offer "No Such Filament"." |
| 7 | tool, slot 2, "Bambu PLA Basic @BBL A1" | refused, `preset_incompatible`, starting ""Bambu PLA Basic @BBL A1" is not compatible with the selected printer." |
| 8 | api `begin_update(2, "Bambu PLA Basic @BBL A1").commit()` | raised `ValueError` ""Bambu PLA Basic @BBL A1" is not compatible with the selected printer." |
| 9 | api `begin_update("FilAr PLA Blanco Calido")`, with no slot | raised `ValueError` starting "begin_update on the filament editor takes (slot_number, preset_name="")" |
| 10 | `preset_list {type: "filament", query: "Bambu PETG"}`, then with `include_uninstalled: true` | the first lists neither `G` nor `H`; the second lists both with `installed: false`; `state()` as at the start |
| 11 | tool, slot 2, "Bambu PETG Basic" | `state()` is `B G B \| B \| 4,12,4 \| c3 \| R2`; reply `selected` and `shown` `G`; `preset_list {type: "filament", query: "Bambu PETG Basic"}` lists `G` |
| 12 | api `begin_update(2, H).commit()` | `state()` is `B H B \| H \| 4,10,4 \| c3 \| R2`; nothing raised; commit `slot_assignment_changed: true`; `preset_list {type: "filament", query: "Bambu PETG HF"}` lists `H` |
**Scenario: filaments of objects and parts**
`slots()` is `0,0`, both slots `B`. A cube "cube" of 20 × 20 × 10 mm at (100, 100) and a cylinder "cylinder" of 20 × 10
mm at (160, 100) are added with `object_add_primitive`, then a cube part of 5 mm with `part_add {object: 0, type:
"part", shape: "cube", size: [5, 5, 5]}`. The start is checked: `filaments()` is `cube 1 (1, 1) · cylinder 1`;
`item(object 1, extruder)` is `{value: "1", effective: "1", source: "object"}`, as an object added this way is given
filament 1 (`ObjectList::load_mesh_object()`); `item(object 0, extruder)` is `{value: "1", effective: "1", source:
"object", parts: [{part: 1, value: "1"}]}`, as a part added to it is given its object's filament
(`ObjectList::load_generic_subobject()`); and a first slice, the control, gives outcome `ok` and `grams()` slot 1
`model_g` above 0, slot 2 `model_g` 0 and `flush_g` 0, and `filament_changes` 0.
| # | Step | `filaments()` after | Also checked |
|---|---|---|---|
| 1 | `settings_set {target: "object", object: 1, values: {extruder: 2}}` | `cube 1 (1, 1) · cylinder 2` | reply `applied.extruder` "2" and `objects[0].index` 1; `item(object 1, extruder)` `{value: "2", effective: "2", source: "object"}`; `item(object 0, extruder)` as at the start |
| 2 | `undo` | `cube 1 (1, 1) · cylinder 1` | `item(object 1, extruder)` `{value: "1", effective: "1", source: "object"}` |
| 3 | `redo` | `cube 1 (1, 1) · cylinder 2` | `item(object 1, extruder)` as after 1 |
| 4 | `settings_set {target: "part", object: 1, part: 0, values: {extruder: 1}}` | `cube 1 (1, 1) · cylinder 1` | reply `applied.extruder` "1" and `note` "A single-part object's filament is the object's; it was set there."; `item(object 1, extruder)` `{value: "1", effective: "1", source: "object"}` |
| 5 | `settings_set {target: "part", object: 0, part: 1, values: {extruder: 2}}` | `cube 1 (1, 2) · cylinder 1` | reply `applied.extruder` "2", `parts` `[{object: 0, part: 1}]` and no `note`; `item(part 0/1, extruder)` `{value: "2", effective: "2", source: "part"}` with `note` "A part's value (source "part", or in parts) applies only inside that part's volume."; `item(object 0, extruder)` `{value: "1", effective: "1", source: "object", parts: [{part: 1, value: "2"}]}` with the same note |
| 6 | `plate_slice` | as after 5 | outcome `ok`; `grams()` slot 2 `model_g` above 0: the cube's part alone is on filament 2, and the control printed nothing with it |
| 7 | `settings_set {target: "part", object: 0, part: 1, values: {extruder: null}}` | `cube 1 (1, 1) · cylinder 1` | reply `applied.extruder` "1"; `item(part 0/1, extruder)` `{value: "1", effective: "1", source: "part"}`: a part's Default writes its object's filament into the part (`ObjectList::set_extruder_for_items()`) |
| 8 | `settings_set {target: "part", object: 0, part: 1, values: {extruder: 2}}`, then `settings_set {target: "object", object: 1, values: {extruder: 2}}` | `cube 1 (1, 2) · cylinder 2` | `item(part 0/1, extruder)` as after 5; `item(object 1, extruder)` as after 1 |
| 9 | `settings_set {target: "object", object: 0, values: {extruder: 2, wall_loops: 5}}` | `cube 2 (2, 2) · cylinder 2` | reply `applied` `{extruder: "2", wall_loops: "5"}`; `item(object 0, extruder)` `{value: "2", effective: "2", source: "object"}` with no `parts`: the object's filament clears its parts'; `item(object 0, wall_loops)` `{value: "5", effective: "5", source: "object"}` |
| 10 | `undo` | `cube 1 (1, 2) · cylinder 2` | `item(object 0, extruder)` as after 5; `item(object 0, wall_loops)` `{value: null, effective: "2", source: "global"}`: the call was one undo step |
| 11 | `plate_slice` | as after 10 | outcome `ok`; `grams()` slot 2 `model_g` above step 6's: the cylinder prints with filament 2 too; slot 1 `model_g` above 0; `filament_changes` above 0 |
**Scenario: the project's own settings, the print and the file**
`slots()` is `0,0`, slot 1 `B` and slot 2 `M`, set with `preset_select`. The cube, its part and the cylinder of the
scenario before are added the same way, and the part and the cylinder given filament 2 with `settings_set`:
`filaments()` is `cube 1 (1, 2) · cylinder 2`. Then, with `project_set_settings`, the colours `#111111;#222222`, the
matrix `0,777,777,0`, the multiplier 1, the plate type "Cool Plate" and plate 0's prime tower at (60, 150). The start is
checked: `project()` is `#111111;#222222 | 1 | 0,777,777,0 | Cool Plate | 60,150`, and `app_state` `presets.filaments`
is `[B, M]`. `project()` is read after every step; a value it gives is written out in full in the table.
| # | Step | `project()` after | Also checked |
|---|---|---|---|
| 1 | `project_get_settings {keys: [filament_is_mixed, curr_bed_type, prime_volume_mode]}` | `#111111;#222222 \| 1 \| 0,777,777,0 \| Cool Plate \| 60,150` | `filament_is_mixed` "0,0" with `meta.read_only` true; `curr_bed_type`'s `meta.offered` holds "Cool Plate" and "Textured PEI Plate"; `prime_volume_mode` "Default" with `meta.offered` empty: the X1C has no purge mode to choose |
| 2 | `project_set_settings {values: {filament_colour: {index: 0, value: "#ffffff"}}}` | `#FFFFFF;#222222 \| 1 \| 0,<a>,<b>,0 \| Cool Plate \| 60,150` | reply `applied.filament_colour` "#FFFFFF;#222222": stored in upper case. `<a>` and `<b>` are worked out by the app, neither 777, and `<b>` (into white) greater than `<a>` (out of it) |
| 3 | `flush_volumes_matrix: [0, 777, 777, 0]`, then one call with `filament_colour: {index: 1, value: "#000000"}`, `flush_multiplier: 0.7`, `flush_volumes_matrix: {index: 1, value: 400}` and `curr_bed_type: "Textured PEI Plate"` | `#FFFFFF;#000000 \| 0.7 \| 0,400,<c>,0 \| Textured PEI Plate \| 60,150` | `<c>` neither 777 nor 400: the colour went first, its recalculation replaced entry 2, and the entry given replaced entry 1 |
| 4 | `flush_volumes_matrix: [0, 400, 300, 0]` | `#FFFFFF;#000000 \| 0.7 \| 0,400,300,0 \| Textured PEI Plate \| 60,150` | |
| 5 | `wipe_tower_x: {index: 0, value: 150}` and `wipe_tower_y: {index: 0, value: 180}` in one call | `#FFFFFF;#000000 \| 0.7 \| 0,400,300,0 \| Textured PEI Plate \| 150,180` | reply has no `note`: the tower fits there |
| 6 | `wipe_tower_x: {index: 0, value: 40}` | `#FFFFFF;#000000 \| 0.7 \| 0,400,300,0 \| Textured PEI Plate \| 40,180` | |
| 7 | `undo` | `#FFFFFF;#000000 \| 0.7 \| 0,400,300,0 \| Textured PEI Plate \| 150,180` | the move was one undo step of its own |
| 8 | `filament_is_mixed: "1"` | as after 7 | refused, "filament_is_mixed is read-only: mixed filaments are made in the sidebar's mixed filament list"; `slots()` `0,0` |
| 9 | `filament_colour: {index: 1, value: "white"}` with `flush_multiplier: 0.5` in one call | as after 7 | refused, "Slot 2's colour "white" is not #RRGGBB"; the multiplier in the same call is not set either |
| 10 | `prime_volume_mode: "Saving"` | as after 7 | refused, "prime_volume_mode: this printer has no purge mode to choose"; `prime_volume_mode` reads "Default" |
| 11 | `flush_volumes_matrix: {index: 0, value: 10}` | as after 7 | refused, "flush_volumes_matrix[0] (nozzle 1, from slot 1 to slot 1) must be 0: no flush from a filament to itself" |
| 12 | `wipe_tower_x: {index: 0, value: 300}` | as after 7 | refused, "The prime tower of plate 0 would be off the plate" |
| 13 | `plate_slice` | as after 7 | outcome `ok`; `grams()` each slot's `model_g` and `flush_g` above 0, and `filament_changes` above 0 |
| 14 | `flush_volumes_matrix: {index: 1, value: 200}`, then `plate_slice` | `#FFFFFF;#000000 \| 0.7 \| 0,200,300,0 \| Textured PEI Plate \| 150,180` | `grams()`: slot 2's `flush_g` lower than after 13; slot 1's `flush_g` and `filament_changes` as after 13, `flush_g` to 0.01 g |
| 15 | `flush_multiplier: 1.4`, then `plate_slice` | `#FFFFFF;#000000 \| 1.4 \| 0,200,300,0 \| Textured PEI Plate \| 150,180` | `grams()`: each slot's `flush_g` higher than after 14 |
| 16 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 15 | `filaments()` `cube 1 (1, 2) · cylinder 2`; `app_state` `presets.filaments` `[B, M]`; `slots()` `0,0`: the project file keeps them |
**To settle in review:**
- A cancelled prompt with one slot (one slot, rows 6 and 11) leaves the colour of the preset not chosen. The pick and
the tool write the new preset's default colour before the tab asks (`PlaterPresetComboBox::item_picked()` runs
`PresetComboBox::update_ams_color()` from `Sidebar::select_filament_preset()` or the selector's own handler); the
cancel then runs `Tab::on_presets_changed()`, whose `Sidebar::update_presets()` puts the tab's preset back in a
single slot, so the slot ends on `B` and the tool's reply says `selected` `B`, but nothing restores the colour. The
api assigns only once the tab switched, so it leaves `#111111` (row 14). The rows expect what the code gives,
`#FFF8E7` on `B`; this looks like a bug, and if the app is changed to restore the colour, rows 6 and 11 expect
`#111111`.
- `R2` is checked by properties, since the app works out the volumes from the colours: each recalculated entry other
than the sentinel and above 0, the four equal across routes and to a colour change, and for `X` the volumes into the
lighter colour above those out of it. With the X1C's `nozzle_flush_dataset` 0, `FlushVolCalculator::calc_flush_vol_rgb()`
takes the flush predictor's value where it has one and its colour formula otherwise; both make a dark-to-light change
cost far more than the reverse.
- `Sup` is exact: 230 into a support filament and `max(<colour volume>, 700)` out of it
(`Sidebar::auto_calc_flushing_volumes_internal()`); from `#222222` to `#111111` or `#333333` the colour volume plus the
calculator's minimum (the X1C's 107 mm³ nozzle volume, less the cut retraction where it applies) stays far under 700.
- The prompt's buttons are checked as "including" Transfer, Discard and Save (the dialog also lays out other labelled
controls), and "not including" Transfer for `A`.
- The flush grams in the print (project, rows 13 to 15). The purge of a filament change is `flush_volumes_matrix[from][to]`
times `flush_multiplier` (`GCode.cpp`, at least `g_min_purge_volume`, 100 mm³; the X1C's `grab_length` is 0), extruded
between `; FLUSH_START` and `; FLUSH_END`. The processor charges the first nozzle volume of each purge, 107 mm³ on the
X1C, to the outgoing filament and the rest to the incoming one (`GCodeProcessor.cpp`, the remaining volume reset at
each tool change). Entry 1 at 400 or 200 times 0.7 (280 or 140 mm³) is above 107 either way, so a change from slot 1
to slot 2 charges slot 1 107 mm³ in both slices and slot 2 the rest, and the changes from slot 2 to slot 1 are the
same: slot 1's `flush_g` stays to 0.01 g while slot 2's falls. At 1.4 both entries grow and so do both slots' grams.
- The preference is set with `preferences_set`, where the replays picked it in the Preferences dialog; the dialog's
choice control writes the same key (`PreferenceOps.cpp`), and `test_preferences` checks the dialog against
`preferences_get`.
- Run time: about 60 assignment cases and six slices; the entry may need a `timeout_s` above 900 in `sweep.json`.
**Not checked:**
- Adding and deleting slots, and the mixed filament's rules: `test_plates` (its filament slots scenario). Assigning a
preset to a mixed slot, by the tool and the plugin API: `test_operation_routes`, which checks the code and the
words; the state that refusal leaves is not read there either.
- The prompt's Save button: saving the edits as a new preset is `test_presets`'s.
- Whether an assignment takes an undo step: a preset change is not in the project's undo history (as `settings_set`
says of a preset's), and the snapshots can be read only from the app's log.
- The values of `R2`, `<a>`, `<b>` and `<c>`, beyond the properties above.
- The flushing volumes after a hidden preset's assignment (refusals scenario, rows 11 and 12) beyond `R2`: what an
assignment does to them is the Auto-flush scenario's.
- `filament_colour_type` and `filament_multi_colour`, which `update_ams_color()` writes beside `filament_colour`: no
MCP tool lists them, and for a preset that is not an AMS slot's they only mirror `filament_colour` (an empty type,
the colour itself).
- A text part made with the Text gizmo, which `multicolor.json` gave filament 2: the second part here is a cube from
`part_add`. Both are model parts, which `settings_set` gives a filament the same way; the gizmo is not this area's.
- How the sidebar shows a slot: the colour swatch and the badge are not read, and no screenshot is taken.
- A printer with several extruders, where the filament grouping applies: `test_printer_extruders`.
- The exact list of plate types the X1C offers: the step checks two of them.
- Which layers print with filament 2: the slice's grams per slot show that filament 2 prints, not where.
**Fixtures:** none; the plugin API calls are the test's own code.
## `test_settings`
`test_settings.py` · Python · takes the place of `settings_targets.json` and its fixture `tests/fixtures/settings_targets.py`
**Tests:** The settings commands' targets. `settings_list` giving a type's settings whole, a saved preset's and a
filament slot's, and the settings an object and a region take; then `settings_set` and `settings_get` on an object, a
part, a modifier and a height range, named by index and taken from the selection, with each value's `effective` and
`source` in the order the slicer applies them; what the targets' settings do in the print; and the height ranges
replaced, the range that stays keeping its settings. It runs on the harness's default printer, the Bambu Lab X1 Carbon
0.4, with the process 0.20mm Standard @BBL X1C (`layer_height` 0.2, `wall_loops` 2, `sparse_infill_density` 15%,
`top_shell_layers` 5).
**Reads:**
- `listed(type, **args)` gives `settings_list`'s reply: `total`, `next_offset` where given, and the items as `{key:
value}` in order, with whether each has `meta`.
- `item(target, key, ...)` gives one item of `settings_get {target, keys: [key], include_meta: false}` whole: `value`,
`effective`, `source`, and `parts`, `height_ranges`, `object_effective` and `object_source` where given; and the
reply's `note` and the target it names (`objects`, `parts`, `height_range`).
- `overrides(target, ...)` gives `settings_get` with the target and no keys as `{key: value}`: what the target sets, a
filament of 0 (Default) not counting.
- `ranges()` gives object 0's `layer_config_ranges` from `object_list`, as `[{min_z, max_z, values}]`, every key of
`values` included: a range made by `object_set_height_ranges` carries `extruder` "0" (Default) and the object's
`layer_height` (`ObjectList::get_default_layer_config()`).
- `targets()` gives the targets' settings, written `O · P0 · P1 · ranges`: `overrides(object 0)`, `overrides(part
0/0)`, `overrides(part 0/1)` and `ranges()`, a range as `min–max {values}`. Values are written without their quotes.
It is compared whole after every step of the targets scenario.
- `layers()` gives `plate_slice_stats {include: ["layer_features"], limit: 1000}`'s layers as `{z, height, inner,
sparse}`, `inner` and `sparse` being the layer's "Inner wall" and "Sparse infill" seconds.
Every scenario starts with `project_new {discard_changes: true, preset_changes: "discard"}` in the Prepare view, deletes
filament slots with `filament_delete` until it is refused, puts `B` (Bambu PLA Basic @BBL X1C) in slot 1 with
`preset_select`, and checks that `app_state.presets` is the X1C, 0.20mm Standard @BBL X1C and `[B]`, and that
`object_list` lists no object: a new project keeps the slots of the project before it.
**Scenario: a type's settings, whole**
| # | Step | Checked |
|---|---|---|
| 1 | `listed(process)` | `total` at least 300, as many items as `total`, no `next_offset` and no item with `meta`; the items include `layer_height` "0.2", `wall_loops` "2", `sparse_infill_density` "15%" and `top_shell_layers` "5" |
| 2 | `listed(printer)` | `total` above 100, whole as in 1; `nozzle_diameter` "0.4", `printable_height` "250" |
| 3 | `listed(filament)` | `total` above 100, whole as in 1; `filament_type` "PLA", `slow_down_layer_time` "4" |
| 4 | `listed(process, include_meta: true)`, then with `offset` 100, 200 and on until a page has no `next_offset` | each page but the last holds 100 items and `next_offset` the next hundred; every item has `meta`; the pages' keys, in order, are step 1's |
| 5 | `listed(process, limit: 50)` | 50 items, `next_offset` 50, none with `meta`; they are step 1's first 50 |
| 6 | `listed(process, preset: "0.16mm High Quality @BBL X1C")` | `layer_height` "0.16"; `app_state.presets.process` is still 0.20mm Standard @BBL X1C: reading a preset does not select it |
| 7 | `filament_add`, then `preset_select {type: "filament", name: "Bambu PETG Basic", filament_slot: 2}` | `app_state.presets.filaments` `[B, Bambu PETG Basic @BBL X1C]`; `listed(filament, filament_slot: 2)` gives `filament_type` "PETG" and `slow_down_layer_time` "12", `listed(filament, filament_slot: 1)` "PLA" and "4" |
**Scenario: what an object and a region take**
| # | Step | Checked |
|---|---|---|
| 1 | `listed(object)` and `listed(region)` | the object list holds more than 200 settings and the region list more than 100; every key of the object list is a process setting with the value `listed(process)` gives it; every key of the region list but `layer_height` is in the object list; both give `wall_loops` "2" and `sparse_infill_density` "15%"; the region list's `layer_height` is "0.2" with `targets` `["height_range"]`, and no other item of either list has `targets` |
**Scenario: targets and precedence**
A cube "cube" of 20 × 20 × 20 mm at the middle of plate 0 (`origin` plus half `size` from `plate_list`), a 5 mm
modifier cube at its centre with `part_add {object: 0, type: "modifier", shape: "cube", size: [5, 5, 5], position: [<x>,
<y>, 10]}`, so it spans 7.5 to 12.5 mm, and the ranges 0 to 5 and 5 to 10 mm with `object_set_height_ranges`. The start
is checked: `object_list` gives the cube with part types `[part, modifier]` and `overrides` `["extruder"]`; `targets()`
is `{extruder: 1} · {} · {} · 0–5 {extruder: 0, layer_height: 0.2}, 5–10 {extruder: 0, layer_height: 0.2}` (an object
added this way is given filament 1, and a modifier's filament 0 does not count). Then the filament's cooling slowdown
is turned off for the scenario's slices, `settings_set {type: "filament", values: {slow_down_for_layer_cooling:
false}}`, and `settings_get {type: "filament", keys: ["slow_down_for_layer_cooling"]}` reads "0": a layer then prints
at its features' own speeds, so their seconds follow their lengths. A first slice is the control: outcome `ok`, every
layer of `layers()` 0.2 mm high to 0.001 mm, and the layers at z 3.0 and 15.0 mm with the same `inner` to 2 %.
| # | Step | `targets()` after | Also checked |
|---|---|---|---|
| 1 | `settings_set {target: "object", object: 0, values: {wall_loops: 4}}` | `{extruder: 1, wall_loops: 4} · {} · {} · 0–5 {extruder: 0, layer_height: 0.2}, 5–10 {extruder: 0, layer_height: 0.2}` | reply `applied` `{wall_loops: "4"}`, `objects[0].index` 0; `object_list` `overrides` `["extruder", "wall_loops"]` |
| 2 | `settings_set {target: "part", object: 0, part: 1, values: {wall_loops: 5}}` | `{extruder: 1, wall_loops: 4} · {} · {wall_loops: 5} · 0–5 {extruder: 0, layer_height: 0.2}, 5–10 {extruder: 0, layer_height: 0.2}` | reply `applied` `{wall_loops: "5"}`, `parts` `[{object: 0, part: 1}]` |
| 3 | `settings_set {target: "height_range", object: 0, min_z: 0, max_z: 5, values: {wall_loops: 6}}` | `{extruder: 1, wall_loops: 4} · {} · {wall_loops: 5} · 0–5 {extruder: 0, layer_height: 0.2, wall_loops: 6}, 5–10 {extruder: 0, layer_height: 0.2}` | reply `applied` `{wall_loops: "6"}`, `objects[0].index` 0, `height_range` `{min_z: 0, max_z: 5}`; `overrides(range 0–5)` `{layer_height: "0.2", wall_loops: "6"}` |
| 4 | `settings_set {target: "height_range", object: 0, min_z: 5, max_z: 10, values: {layer_height: 0.12}}` | `{extruder: 1, wall_loops: 4} · {} · {wall_loops: 5} · 0–5 {extruder: 0, layer_height: 0.2, wall_loops: 6}, 5–10 {extruder: 0, layer_height: 0.12}` | reply `applied` `{layer_height: "0.12"}` |
| 5 | `object_select {parts: [[0, 1]]}`, then `settings_get {target: "part"}` | as after 4 | the reply names `parts` `[{object: 0, part: 1}]`; its items are `wall_loops` "5" alone |
| 6 | `settings_get {target: "part", keys: ["wall_loops"]}`, the part still selected | as after 4 | `{value: "5", effective: "5", source: "part"}`, no `height_ranges`: a modifier that sets its own value keeps it inside a range; `note` "A part's value (source "part", or in parts) applies only inside that part's volume." |
| 7 | `settings_set {target: "part", object: 0, part: 0, values: {sparse_infill_density: "30%"}}` | `{extruder: 1, wall_loops: 4} · {sparse_infill_density: 30%} · {wall_loops: 5} · 0–5 {extruder: 0, layer_height: 0.2, wall_loops: 6}, 5–10 {extruder: 0, layer_height: 0.12}` | reply `applied` `{sparse_infill_density: "30%"}` |
| 8 | `item(part 0/1, sparse_infill_density)` | as after 7 | `{value: null, effective: null, source: "overlapped_part", object_effective: "15%", object_source: "global", parts: [{part: 0, value: "30%"}]}`; `note` "A part's value (source "part", or in parts) applies only inside that part's volume. Inside a modifier, mesh or painted, that sets none of a key (source "overlapped_part"), the value of the part it overlaps applies: that part's own in parts, else object_effective; which parts it overlaps is not worked out." |
| 9 | `item(object 0, wall_loops)` | as after 7 | `{value: "4", effective: "4", source: "object", parts: [{part: 1, value: "5"}], height_ranges: [{min_z: 0, max_z: 5, value: "6"}]}`; `note` "A part's value (source "part", or in parts) applies only inside that part's volume. A height range's value (source "height_range", or in height_ranges) applies only between its min_z and max_z." |
| 10 | `settings_get {target: "height_range", object: 0, min_z: 0, max_z: 5, keys: ["wall_loops", "sparse_infill_density"], include_meta: false}` | as after 7 | `wall_loops` `{value: "6", effective: "6", source: "height_range", parts: [{part: 1, value: "5"}]}`; `sparse_infill_density` `{value: null, effective: "15%", source: "global", parts: [{part: 0, value: "30%"}]}`; `note` as in 9 |
| 11 | `object_select {objects: [0]}`, then `settings_get {target: "height_range", min_z: 5, max_z: 10, keys: ["layer_height"], include_meta: false}` | as after 7 | the reply names `objects[0].index` 0 and `height_range` `{min_z: 5, max_z: 10}`; the item `{value: "0.12", effective: "0.12", source: "height_range"}`, and `note` "A height range's value (source "height_range", or in height_ranges) applies only between its min_z and max_z.": the selected object stands for the range's object |
| 12 | `plate_slice`, then `layers()` | as after 7 | outcome `ok`; every layer whose z is from 5.3 to 9.7 mm is 0.12 mm high, and every layer from 10.5 to 19.5 mm 0.2 mm, to 0.001 mm; the layer at z 3.0 mm has more `inner` than the layer nearest z 15 mm (six walls in the range, four on the object), and that one more than the control's layer at 15.0 mm (two walls); the layer nearest z 15 mm has more `sparse` than the control's at 15.0 mm (part 0's infill at 30%, not 15%). Then `settings_set {type: "filament", reset_all: true}`, and `slow_down_for_layer_cooling` reads "1" again, so that step 14's new project asks about no unsaved preset |
| 13 | `object_set_height_ranges {object: 0, ranges: [{min_z: 0, max_z: 5}, {min_z: 5, max_z: 12}]}` | `{extruder: 1, wall_loops: 4} · {sparse_infill_density: 30%} · {wall_loops: 5} · 0–5 {extruder: 0, layer_height: 0.2, wall_loops: 6}, 5–12 {extruder: 0, layer_height: 0.2}` | the range that stays keeps its settings; the new one takes the object's layer height and the Default filament |
| 14 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 13 | `object_list` part types `[part, modifier]` and `overrides` `["extruder", "wall_loops"]`: the project file keeps every target's settings |
**To settle in review:**
- The walls and the infill in the print (step 12) are checked as order, not amount. A wall loop more adds about a
loop's printing time, so six walls print longer than four and four longer than two, with the cube's 20 mm
cross-section the same at 3 and 15 mm, and the modifier (7.5 to 12.5 mm) and the top and bottom shells away from both
layers; the control slice shows the two layers print alike without the targets' settings. The sparse infill's time
follows its area times its density: at 15 mm the two more walls take about a fifth of the infill area and the density
doubles, so the infill prints about 1.6 times as long. Both comparisons hold only with the cooling slowdown off:
`CoolingBuffer` otherwise stretches a layer shorter than `slow_down_layer_time` (4 s for `B`) across its features, so a
feature's seconds would depend on the rest of the layer.
- The layer heights (step 12) are checked away from the range boundaries: where a range starts or ends, the slicer may
give one or two layers a height between the two, so the windows leave out 0.3 mm on either side.
- An object added with `object_add_primitive` carries `extruder` 1 from the start (`ObjectList::load_mesh_object()`), so
it is among the object's overrides throughout.
- The list totals stay lower bounds: the count follows the settings the app has, which grows; the lists are checked to
be whole, paged consistently, and to hold known keys with their values.
**Not checked:**
- Refusals of a key a target does not take, a missing height range and a null `layer_height` on a range:
`test_additions_refusals`.
- A setting's meta, searches, comparisons and per-variant values: `test_presets`.
- The values of the object and region lists beyond the few known ones: they are compared with `listed(process)`, the
same process read through another view, so a value wrong in both views passes.
- The modifier's `wall_loops` in the print: inside the infill a modifier with settings of its own becomes a region of
its own, walled on both sides, so the print shows the region rather than its wall count.
- Which object list keys are object-only: the scenario checks the lists against the process and each other, and a few
known keys.
**Fixtures:** none; `tests/fixtures/settings_targets.py` leaves with the replay.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `ops_assign_filament_preset_one_slot`
`tests/ops_assign_filament_preset_one_slot.json` · replay, 258 steps, 90 expects, 69 optional
**Tests:** Assigning a filament preset to the only slot, where the assignment also switches the filament tab and its unsaved-changes prompt applies. Each route (sidebar, `preset_select`, plugin API `begin_update(1, name)`) for a PLA (Transfer offered) and a support filament of another type (no Transfer), without and with unsaved changes, with each `preset_changes` value and none, and the prompt answered each way. Then the plugin API forms that name no preset.
**Decides by:** Fails when a non-optional call errors, a fixture raises, or an expect misses. Every expect sits on setup.
- Case setup (`arrange_filaments`, 32 steps): no dialog open, `flush_volumes_matrix` eq `0`, and ` (modified)` on the filament tab in dirty cases.
- Setup: one slot; `auto_calculate_flush` reads `all`.
- Implicit: non-optional calls must succeed without a prompt: the clean sidebar picks, `preset_select` with no `preset_changes` on a clean tab, `transfer` and `discard` for the PLA, `discard` for the support filament. The `await: false` calls in the dirty cases must not be refused at once.
**Not checked:**
- No `probe()` after a call is asserted: whether the slot changed, the tab switched, the edits were transferred or dropped, or the colour settings were written.
- Whether the prompt opens and offers Transfer for the PLA but not for the support filament: `app_wait {for: dialog}` cannot fail, and the answers are optional. `preset_changes: "transfer"` for the support filament is optional, so neither its refusal nor its acceptance is checked.
- The plugin API route cannot fail (`preset_api` catches exceptions), including the `update`/`begin_update` forms without a name.
- `undo_taken` is never asserted.
**Strength:** Smoke — the tool and sidebar routes must succeed without a prompt, but nothing a call leaves is asserted.
### `ops_assign_filament_preset_multi_slot`
`tests/ops_assign_filament_preset_multi_slot.json` · replay, 303 steps, 110 expects, 32 optional
**Tests:** Assigning a filament preset to slot 2 of three through the sidebar selector (row click, and once `widget_set_value`), `preset_select` and the plugin API's `filament.begin_update(2, name)`, under each Auto-flush preference (All, Color, None), for a PLA with a default colour, one without, and a support filament. Then the plugin API's other forms, unsaved changes in the filament the tab edits, the refusals (no such slot, no such name, an incompatible preset, a mixed-colour slot) and a hidden preset.
**Decides by:** Fails when a non-optional call errors, a fixture raises, or an expect misses. Every expect sits on setup; none is on what a call under test left.
- Case setup (`arrange_filaments`, 46 steps): no dialog open (`/result/dialogs` empty), `flush_volumes_matrix` equal to the sentinels `0,777,777,777,0,777,777,777,0`, and in the dirty cases a filament tab name ending ` (modified)`. Because no dialog may be open, a prompt the previous case left open fails the next case.
- Preferences: `auto_calculate_flush` reads `all`, `color change`, `disabled` after each pick in the Preferences dialog.
- Setup: three slots (`/presets/filaments/2` exists, `/3` does not). The Add Mixed Filament dialog opens (title eq), `filament_is_mixed` becomes `0,0,0,1` and goes back to `0,0,0`.
- Implicit: the non-optional `preset_select` calls and sidebar row clicks must not be refused and must not open a prompt, since an awaited call held by a dialog times out after 120 s and fails. That includes the hidden `Bambu PETG Basic` through `preset_select`.
**Not checked:**
- The `probe()` after each call has no expect. The slot mapping, the edited filament preset, the three colour settings, the project's colours and the flushing volumes are only recorded, so whether the flush matrix is recalculated under All, Color or None (the reason for the three passes) is never asserted.
- Every plugin API call goes through `ops_presets.preset_api`, which catches any exception and returns it as data. That route cannot fail any case, including the assignments that should succeed and the hidden `Bambu PETG HF`.
- The refusals (slots 5 and 0, `No Such Filament`, `Bambu PLA Basic @BBL A1`, the mixed slot, `begin_update` without a slot) are optional `preset_select` steps or caught exceptions. Neither the refusal nor its code or text is asserted.
- The unsaved-changes prompt: `app_wait {for: dialog}` returns `satisfied: false` on timeout without failing, and the Transfer/Discard/cancel `dialog_answer` steps and "second prompt" waits are optional. Whether a prompt opens, and which buttons it offers, is not checked.
- `undo_taken` is never asserted.
- `arrange_filaments` does not assert the slots it set (`/result/slots`).
**Strength:** Smoke — the tool and sidebar routes must succeed without a prompt, but nothing a call leaves is asserted.
### `multicolor`
`tests/multicolor.json` · replay, 56 steps, 26 expects, 5 optional
**Tests:** Filaments assigned to objects and parts through `settings_set`'s object and part targets, read back with `settings_get`'s effective value and source, with undo and redo; then the project's slot colours, flush multiplier, a flush-matrix entry, plate type and prime tower position through `project_set_settings`, refusals that should change nothing, and a slice.
**Decides by:** Fails when a non-optional call errors or one of its 55 matchers misses.
- Object filament: `/applied/extruder` = `"2"`; effective `"2"` with source `object` on object 1, `"1"` on object 0; undo gives `"1"`, redo `"2"`.
- Parts: part 0 of a one-part object sets the object (`"1"`, with a `/note`); a text part takes `"2"` with source `part` and is listed under the object's `/items/0/parts/0` (part 1, `"2"`); `null` resets it to the object's `"1"`.
- One undo step: after `extruder` and `wall_loops` in one call and an undo, `extruder` effective `"1"`, the part's `"2"` back, `wall_loops` value null with source `global`.
- Project settings: meta (`read_only`, `offered`), `filament_colour` `^#FFFFFF;#000000`, `flush_multiplier` `"0.7"`, matrix `^0,400,` and bed type, all read back with `project_get_settings`; after four refused calls the colour, multiplier, matrix and `filament_is_mixed` still match.
- Prime tower: x/y set to 150/180, then x to 40, undo back to 150/180.
- Slice: `/status` = `done`, outcome `ok`.
**Not checked:**
- The refused `prime_volume_mode: "Saving"` and `wipe_tower_x: 300` calls are optional and never read back; if either were accepted the test still passes.
- The refused colour `"white"` targets slot 0, which is already `#FFFFFF`; only the multiplier in the same call shows the call was refused.
- The slice is checked only for `ok`; nothing shows the cylinder and the text part print with filament 2.
- `Add one filament` is checked only by `/presets/filaments/1` existing, which a datadir with several slots satisfies without the click.
- `/note` matchers are `exists`; `filaments.png` is saved and never compared.
**Strength:** Partial — filament targets and project settings are read back exactly, but two refusals and the slice's use of filament 2 are unchecked.
### `settings_targets`
`tests/settings_targets.json` · replay, 39 steps, 83 expects, 0 optional
**Tests:** `settings_list` returning a type whole, a saved preset's and a slot's values, and what an object and a region take; `settings_set`/`settings_get` on targets object, part and height range by index and from the selection, with `effective` and `source` in the slicer's precedence; ranges replaced keeping the one that stays.
**Decides by:** Fails when a call errors, a fixture raises, or an expect misses.
- Whole lists (`listing()`): process ≥ 300, printer and filament > 100 settings, items equal to total, no next page; with meta 100 a page and `limit` 50 pages without meta.
- Values (`value_of()`): `layer_height` "0.2", "0.16" in the named saved preset, slot 2 "PETG", slot 1 "PLA".
- `nested()`: the object list has > 200 keys, all process keys with the process's values; the region list > 100 keys, all object keys except `layer_height`, whose targets are exactly ["height_range"].
- Per target: `settings_set` replies `applied` and name the object, part or range; `object_list` reads the range values "6" and "0.12"; `overrides()` lists each target's own overrides (4, 5, 6; the range also has `layer_height`, no `extruder`).
- Precedence: the selected part reads "5" from source "part"; the modifier over a part that sets `sparse_infill_density` reads source "overlapped_part" with the part's "30%" and a note; the object reads effective "4" with the part's "5" and range's "6"; the range reads effective "6" from "height_range" and the density null from "global"; the selected object stands for the range target ("0.12").
- Replacing ranges keeps the lower range's "6", gives the new upper range `max_z` 12 at "0.2" with no `wall_loops`; the plate slices "ok".
- Fixture `settings_targets.py` asserts nothing; it returns totals, values and key lists computed from the tools' replies.
**Not checked:**
- The slice is checked only as "ok"; no printed result shows the object, part or range `wall_loops`.
- `nested()` compares two `settings_list` views with each other, not with known values, so a fault shared by both passes.
- Loose: list totals as lower bounds; the range's `layer_height` override and `object_effective` checked with `exists` where the values are known; `settings_get {target: part}` without keys checks only that an item has a key.
**Strength:** Strong — target naming, values, effective values and sources are matched exactly for every target.

View file

@ -0,0 +1,485 @@
# Project files, imports and exports
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_files`
`test_files.py` · Python · takes the place of `filaments_and_files.json`, `new_project_keeps_layer_gcode.json` and
`ops_open_project.json` · in `sweep.json` as `{"path": "test_files.py", "timeout_s": 1200}`
**Tests:** What the project's files do: a new project and the question New Project asks about unsaved changes; opening
a project file and saving one under a name; importing models (STL, a project's `.3mf`, a ZIP archive, a STEP file and
files that hold no model); exporting the objects as STL, DRC and the Preview's toolpaths as OBJ, the model as a 3MF,
the plate's G-code and the sliced file; sending G-code to a printer with no print host; and the filament slots that a
merge and a mix leave in the project file. Every written file is read back: the test opens it itself (a G-code's text,
a sliced file's entries, a folder's file names and sizes), or the app reads it (an exported mesh imported into an empty
project, a saved project opened again). It runs on the harness's default printer, the Bambu Lab X1 Carbon 0.4, with
its 0.20mm Standard @BBL X1C process (`wall_loops` 2, `top_shell_layers` 5, layers of 0.2 mm from the first).
**Files:** The test writes into a folder of its own, `W` (`tempfile.mkdtemp()`): the STL cubes and ZIP archives it
imports, written with `zipfile` and an ASCII STL writer of its own, and every file the app exports or saves. It reads
`tests/data/test_stl/ASCII/20mmbox-LF.stl` (a 20 mm box, 12 triangles), `tests/data/named_single_body.step` (a
tetrahedron with 10 mm legs: 4 triangles, 166.667 mm³), `resources/handy_models/3DBenchy.drc`, and
`tools/mcp/tests/fixtures/heightmap.png` and `mcp_import_pla.json` (a filament preset, `MCP Import PLA`). It does not
use `tests/fixtures/filaments_and_files.py`. When the replay leaves, that fixture keeps what
`test_additions_refusals.py` imports from it: `write_zip(args)` (`args` `name` and `cubes`, `{entry: size}`; returns
`{path}`), with the `folder()` and `cube_stl()` it calls. Its `export`, `write_project_zip` and `import_zip` and the
docstring's mention of the replay go with the replay.
**Reads:** `plates()` and `slots()` as `test_plates` reads them. New readers in `checks.py`:
- `project()`: `app_state.project`, whose fields are `name`, `path` and `dirty`, as `{name, file, dirty}`: `file` is
`path` normalised (`os.path.normcase` of `os.path.abspath`), or none where `path` is `""`.
- `meshes()`: each object from `object_list` as `{name, offset, size, filament, parts}`: its first instance's `offset`
x and y, its `bbox.size`, its `filament`, and each part as `{id, type, triangles, mesh_volume}`.
- `values(keys, type="process")`: `settings_get {type, keys}` as `{key: value}`.
- `unsaved(type)`: the keys `settings_get {type, compare: ":saved"}` lists, sorted: what differs from the preset as it
is stored.
- `recent()`: the files of the Recent Projects actions, read from each action's `description` ("Open the recent
project <path>.") in `action_search {group: "Recent Projects"}`, normalised as `project()` normalises.
- `undo_steps()`: the names of the undo steps logged since its previous call, from the lines
`Undo / Redo snapshot taken: <name>` of the app's log (`app_log`'s `file`), as `fixtures/ops_undo.py` reads them. A
row that checks it calls it once just before its step, which sets the mark, and checks what the call after the step
gives.
- `dialogs()`: `app_state.dialogs` as `{title, message}`.
- `sliced_flags()`: `plate_list`'s `sliced` of each plate, in order.
- `layer_gcode()`: plate 0's `layer_gcode` from `plate_list`, each code as `{z, type}`.
- `gcode(path)`: what a G-code file holds, read as text: `layers`, the number on its `; total layer number: N` line;
`labels`, how many ids its `; model label id:` line lists; and `config`, the `; key = value` lines between
`; CONFIG_BLOCK_START` and `; CONFIG_BLOCK_END` as `{key: value}`.
- `sliced(path)`: the names of a `.gcode.3mf`'s G-code entries (`Metadata/plate_<n>.gcode`), sorted, and the `gcode()`
of each.
- `obj_facts(path)`: an OBJ's first line, its `mtllib` line, its numbers of `v` and `f` lines and its highest vertex z.
- `reimport(path)`: `project_new {discard_changes: true}`, then `project_import {paths: [path]}`, then `meshes()`.
- `answer_all(expected)`: answers the dialogs a call opens, each OK as it comes topmost, waiting with `app_wait {for:
"dialog"}` (a wait that runs out fails) until it has answered one dialog for each `{title, message words}` in
`expected`, in whatever order they come; it checks that no other dialog opened and that `dialogs()` is then empty.
**Start of a scenario:** `project_new {discard_changes: true, preset_changes: "discard"}`, then `view_set {tab:
"prepare"}` (the new-project and open scenarios show `"home"` instead), then `app_wait {for: "idle"}`, which must be
satisfied. The start is checked: `project()` is `Untitled · none · clean`, `meshes()` is empty, `plates()` is
`"" 0 *`, and `dialogs()` is empty. Presets, preferences, recent projects, auto-answer rules and the filament slots
persist from one scenario to the next, so the filament scenario comes last.
**Notation:** A project is written `name · file · clean` or `dirty` (`project()`), `none` for no file, and a file in
`W` by its name. Objects are listed by name, in `object_list`'s order, between brackets: `[small, big]`. A mesh is
written `name t/v [x, y, z]`: its object's name, its one part's `triangles` and `mesh_volume` (mm³, rounded to 0.001
as `object_list` rounds it), and its `bbox.size` to 0.001 mm. A part alone is written `type t/v`. Cubes are added with
`object_add_primitive {shape: "cube", size: [s, s, s], name, position: [x, y, 0]}`, written "cube `name` s at
(x, y)"; plate 0 covers 0 to 256 mm in x and y, and `offset` x and y equal the position given, to 0.001 after a
round trip through a file. A refusal is checked with `refused()` by its code, or by its words where it has none, and
every refused call is followed by the read-back of its row. "No file" means the path does not exist afterwards; the
control for each is the scenario where the same export or save writes its file. A plate slice is checked through its
reply (`outcome`, `layers`) and then `sliced_flags()`.
**Scenario: a new project**
Each call is made from the Home tab (`view_set {tab: "home"}` first), so that `app_state.tab` shows the tab it leaves.
New Project (the action) is `action_run {id: "new_project"}`.
| # | Step | Project after | Also checked |
|---|---|---|---|
| 1 | New Project | `Untitled · none · clean` | the reply is not `blocked_by_dialog` and its `ran` is `orca_command:new_project:orca`; `dialogs()` empty; tab `prepare`; `undo_steps()` `["Reset Project", "New Project"]` |
| 2 | `project_new {silent: true}` | `Untitled · none · clean` | reply `objects` 0, `names` `[]`, `plates` 1, no `discarded` or `modified`; tab `home`; `undo_steps()` `["Reset Project", "New Project"]` |
| 3 | cube `box` 20 at (128, 128), then `project_new {silent: true}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `[box]` at (128, 128); tab `home` |
| 4 | `project_new {discard_changes: true}` | `Untitled · none · clean` | reply `objects` 0; `[]`; tab `home` |
| 5 | `settings_set {values: {top_shell_layers: 7}}` | `Untitled · none · dirty` | `values([top_shell_layers])` `7`; `unsaved("process")` `[top_shell_layers]` |
| 6 | New Project | as after 5 | reply `blocked_by_dialog`; `dialogs()` is one dialog, titled `Creating a new project: unsaved changes`: a project with no objects asks nothing about saving it |
| 7 | `dialog_answer` Discard; the job is followed to its end | `Untitled · none · clean` | `top_shell_layers` `5`; `unsaved("process")` `[]`; `dialogs()` empty; tab `prepare` |
| 8 | `settings_set {values: {top_shell_layers: 7}}`, New Project, `dialog_answer` Transfer, the job followed to its end | `Untitled · none · clean` | the dialog of 6 opened; `top_shell_layers` `7`, `unsaved("process")` `[top_shell_layers]`: the change is carried into the new project; tab `prepare` |
| 9 | `project_new {discard_changes: true, preset_changes: "discard"}` | `Untitled · none · clean` | reply `discarded` `{process: {name: "0.20mm Standard @BBL X1C", keys: ["top_shell_layers"]}}` and no `modified`; `top_shell_layers` `5`; `unsaved("process")` `[]`; tab `home` |
| 10 | `settings_set {values: {top_shell_layers: 7}}`, then `project_new {silent: true}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `top_shell_layers` `7`; tab `home` |
| 11 | `project_new {discard_changes: true}` | `Untitled · none · clean` | reply `modified` `{process: {name: "0.20mm Standard @BBL X1C", keys: ["top_shell_layers"]}}` and no `discarded`; `top_shell_layers` `7`, `unsaved("process")` `[top_shell_layers]`: the presets' changes carry over by default |
**Scenario: New Project's question keeps the layer G-code**
The project is saved before the pause and the move, so only the question's Save can have written them to its file.
| # | Step | Project after | Also checked |
|---|---|---|---|
| 1 | cube `kept` 20 at (100, 100), `project_save {path: W/kept.3mf}` | `kept · kept.3mf · clean` | reply `path` the file and `bytes` its size on disk |
| 2 | `plate_slice` | as after 1 | outcome `ok`, `layers` 100; `sliced_flags()` `[true]` |
| 3 | `plate_set_custom_gcode {add: [{layer: 26, type: "pause"}]}` | `kept · kept.3mf · dirty` | reply `layer_gcode` `[{z: 5.2, layer: 26, type: "pause"}]`; `layer_gcode()` `[{z: 5.2, type: pause}]`; `sliced_flags()` `[false]`: a layer code invalidates the slice |
| 4 | `object_transform {object: 0, translate: [5, 0, 0]}` | `kept · kept.3mf · dirty` | `kept` at (105, 100) |
| 5 | New Project, `dialog_answer` Cancel, the job followed to its end | `kept · kept.3mf · dirty` | the dialog was titled `Orca Slicer - Save` and its message holds "The current project has unsaved changes"; `[kept]` at (105, 100); `layer_gcode()` `[{z: 5.2, type: pause}]`; `dialogs()` empty |
| 6 | New Project, `dialog_answer` Yes, the job followed to its end | `Untitled · none · clean` | the dialog was `Orca Slicer - Save`, and no other opened; `[]`; `layer_gcode()` `[]`; `plates()` `"" 0 *`; tab `prepare` |
| 7 | `project_open {path: W/kept.3mf}` | `kept · kept.3mf · clean` | `[kept]` at (105, 100); `layer_gcode()` `[{z: 5.2, type: pause}]`: the Save wrote the pause and the move |
**Scenario: opening a project**
The project opened is made first and saved: cube `source` 20 at (100, 100) with `settings_set {values: {wall_loops:
5}}`, `project_save {path: W/open_src.3mf}`. The test then copies the file to `W/clean.3mf`, `W/dirty.3mf` and
`W/presets.3mf`, which no call names before its case opens it, so each open shows in `recent()`. Each case starts with
`project_new {discard_changes: true, preset_changes: "discard"}` and `view_set {tab: "home"}`. "Opened" in a row
means: the reply (or the job's reply) is `{opened: "project", objects: 1, names: ["source"], plates: 1}`; `[source]`
at (100, 100); `values([wall_loops, top_shell_layers])` `5`, `5`; `unsaved("process")` `[wall_loops]`; tab
`prepare`; `dialogs()` empty.
| # | Step | Project after | Also checked |
|---|---|---|---|
| 1 | `recent()` | `Untitled · none · clean` | `recent()` holds `open_src.3mf` and none of the three copies |
| 2 | `project_open {path: W/clean.3mf}` | `clean · clean.3mf · clean` | opened; `recent()` holds `clean.3mf`; `undo_steps()` `["Reset Project", "Load Project"]` |
| 3 | (new case) cylinder `cyl` `[20, 10]`, then `project_open {path: W/dirty.3mf}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `[cyl]`; `dialogs()` empty; tab `home`; `recent()` lacks `dirty.3mf` |
| 4 | the same with `discard_changes: true` | `dirty · dirty.3mf · clean` | opened; `recent()` holds `dirty.3mf` |
| 5 | (new case) `settings_set {values: {top_shell_layers: 7}}`, then `project_open {path: W/presets.3mf}` | `Untitled · none · dirty` | refused, `unsaved_changes`; `[]`; `top_shell_layers` `7`; `dialogs()` empty |
| 6 | the same with `discard_changes: true` | `Untitled · none · clean` | reply `blocked_by_dialog`; `dialogs()` is one dialog titled `Load project: unsaved changes`; read while it is open: `[]`, `top_shell_layers` `7`, `unsaved("process")` `[top_shell_layers]`. The call has dropped the project's changes with a silent new project, which leaves the presets' changes and reads clean, and the open then asks about the presets' |
| 7 | `dialog_answer` Discard; the job is followed to its end | `presets · presets.3mf · clean` | opened: the file's `top_shell_layers` 5, the unsaved 7 gone; `recent()` holds `presets.3mf` |
**Scenario: saving a project under a name**
Each save's `undo_steps()` is `[]`: a save takes no undo step.
| # | Step | Project after | Also checked |
|---|---|---|---|
| 1 | `project_save {path: W/empty.3mf}` | `empty · empty.3mf · clean` | reply `path` the file and `bytes` its size on disk; `recent()` holds `empty.3mf`: a project with no objects is saved |
| 2 | (new project) `project_open {path: W/empty.3mf}` | `"" · none · clean` | the reply is `blocked_by_dialog`; `answer_all([Warning "The file does not contain any geometry data."])`; the job's reply `{opened: "project", objects: 0, names: [], plates: 1}`; `plates()` `"" 0 *` |
| 3 | (new project) cube `box` 20 at (100, 100), `project_save {path: W/saved.3mf}` | `saved · saved.3mf · clean` | reply `path` and `bytes` as in 1; `recent()` holds `saved.3mf` |
| 4 | `object_transform {object: 0, translate: [5, 0, 0]}` | `saved · saved.3mf · dirty` | `box` at (105, 100) |
| 5 | `project_save {path: W/saved.gcode.3mf}` | `saved · saved.3mf · dirty` | refused, `sliced_file_name`; no file; `[box]` at (105, 100) |
| 6 | `project_save {path: W/missing/saved.3mf}` | `saved · saved.3mf · dirty` | refused, with the words "directory does not exist"; `W/missing` does not exist; `[box]` at (105, 100) |
| 7 | `project_save {path: W/saved.3mf}` | `saved · saved.3mf · dirty` | refused, with the words "file exists (pass overwrite: true to replace it)"; `[box]` at (105, 100) |
| 8 | `project_open {path: W/saved.3mf, discard_changes: true}` | `saved · saved.3mf · clean` | `[box]` at (100, 100): the refused saves wrote nothing |
| 9 | `object_transform {object: 0, translate: [5, 0, 0]}`, then `project_save {path: W/saved.3mf, overwrite: true}` | `saved · saved.3mf · clean` | reply `bytes` the file's size; `[box]` at (105, 100) |
| 10 | (new project) `project_open {path: W/saved.3mf}` | `saved · saved.3mf · clean` | `[box]` at (105, 100): the file was replaced |
**Scenario: importing models**
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | `project_import {paths: [20mmbox-LF.stl]}` | `20mmbox-LF.stl 12/8000 [20, 20, 20]` | reply `{opened: "models", added: 1, objects: 1, names: ["20mmbox-LF.stl"], plates: 1}`; `project()` `20mmbox-LF · none · dirty`: an untitled project takes the name of the first file imported, as File > Import names it; `undo_steps()` `["Import Objects: 20mmbox-LF.stl"]`; `unsaved("process")` `[]`; `recent()` lacks the STL (the `recent_models` preference is off) |
| 2 | `undo` | `[]` | the import is one undo step |
| 3 | (new project) cylinder `cyl` `[20, 10]`, `settings_set {values: {top_shell_layers: 7}}`, then the import of 1 | `[cyl, 20mmbox-LF.stl]`, the box as in 1 | reply `added` 1; `project()` `20mmbox-LF · none · dirty`; `top_shell_layers` `7`; `unsaved("process")` `[top_shell_layers]` |
| 4 | `undo` | `[cyl]` | `top_shell_layers` `7`; `unsaved("process")` `[top_shell_layers]` |
| 5 | (new project) cube `source` 20 at (100, 100), `settings_set {values: {wall_loops: 5}}`, `project_save {path: W/import_src.3mf}`; (new project) cylinder `cyl` `[20, 10]`, `settings_set {values: {top_shell_layers: 7}}` | `[cyl]` | `values([wall_loops, top_shell_layers])` `2`, `7` |
| 6 | `project_import {paths: [W/import_src.3mf]}` | `[cyl, source]`, `source 12/8000 [20, 20, 20]` | reply not `blocked_by_dialog`, `added` 1; `dialogs()` empty; `values([wall_loops, top_shell_layers])` `2`, `7`: a project's `.3mf` adds its objects and none of its settings; `unsaved` of process `[top_shell_layers]`, of filament and printer `[]`; `project()` `import_src · none · dirty`; `undo_steps()` `["Import Objects: import_src.3mf"]` |
| 7 | `undo` | `[cyl]` | `values([wall_loops, top_shell_layers])` `2`, `7`; `unsaved("process")` `[top_shell_layers]` |
| 8 | (new project) cube `box` 20 at (128, 128); `project_import {paths: [W/missing.stl]}` | `[box]` | refused, with the words "file not found"; `undo_steps()` `[]` |
| 9 | `project_import {paths: [heightmap.png]}` | `[box]` | the reply is `blocked_by_dialog`; `answer_all([Warning "The file does not contain any geometry data.", Orca Slicer error "Unknown file format"])`; the job ends refused, `nothing_loaded`; `undo_steps()` `["Import Objects: heightmap.png"]`; `project()` `Untitled · none · dirty`: an import that adds nothing names nothing |
| 10 | `project_import {paths: [mcp_import_pla.json]}` | `[box]` | as 9, with `Import Objects: mcp_import_pla.json`; `preset_list {type: "filament", source: "user"}` lists no `MCP Import PLA`: a preset file is no model and loads no preset |
A file the loader cannot read opens two dialogs. `load_files()` catches the reader's "Unknown file format: input file
must have .stl, .obj, or .amf(.xml) extension." and shows it with `show_error()`, which defers the `Orca Slicer error`
dialog with `CallAfter`; then, having loaded nothing, it shows the `Warning` "The file does not contain any geometry
data." at once, inside the call. So the call replies `blocked_by_dialog`, and the error dialog opens over the warning
or after it, as the event loop runs it: `answer_all()` takes either order.
**Scenario: ZIP archives**
The import unpacks the entries into the system's temporary folder and names each object after its file there, adding a
number when the folder has one of that name (`Plater::preview_zip_archive()`), which a file left by another run could
cause. So the entries' file names start with a tag the run makes, `T`: the base name of `W`, which `mkdtemp()` makes
unique. The test writes `W/cubes.zip` with, in this order, the entries `parts/T_large.stl` (a 20 mm cube),
`parts/T_middle.stl` (15 mm), `T_small.stl` (10 mm) and `readme.txt` (no model), and `W/not_a.zip`, a text file.
Objects come in the archive's order.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | `project_import {paths: [W/cubes.zip], entries: ["T_small.stl", "parts/T_large.stl"]}` | `T_large.stl 12/8000 [20, 20, 20]`, `T_small.stl 12/1000 [10, 10, 10]` | reply `added` 2, `archives` `[{path: W/cubes.zip, entries: ["T_small.stl", "parts/T_large.stl"]}]`; the objects in the archive's order, not the order `entries` names them; `undo_steps()` `["Import Objects: cubes.zip"]`; `dialogs()` empty |
| 2 | `undo` | `[]` | one undo step |
| 3 | (new project) `project_import {paths: [W/cubes.zip]}` | `T_large.stl 12/8000 [20, 20, 20]`, `T_middle.stl 12/3375 [15, 15, 15]`, `T_small.stl 12/1000 [10, 10, 10]` | reply `added` 3, `archives[0].entries` `["parts/T_large.stl", "parts/T_middle.stl", "T_small.stl"]`: every model file, and not the text file |
| 4 | `project_import {paths: [W/not_a.zip]}` | as after 3 | refused, `unreadable_archive`; `undo_steps()` `[]` |
| 5 | (new project) cube `inside_zip` 10 at (128, 128), `project_export {format: "3mf", path: W/project.3mf}`; the test puts it alone into `W/project.zip` as `project.3mf` | `[inside_zip]` | |
| 6 | (new project) cubes `first` 20 at (80, 128) and `second` 30 at (176, 128); `project_import {paths: [W/project.zip]}` | `[first, second, inside_zip]`, `inside_zip 12/1000 [10, 10, 10]` | reply `added` 1, `archives[0].entries` `["project.3mf"]`; `dialogs()` empty; `project()` `Untitled · none · dirty`: the project's objects join those there, its file does not become the project's, and an archive names no project, as Import ZIP Archive names none; `undo_steps()` `["Import Objects: project.zip"]` |
**Scenario: a STEP file's mesh options**
Each call with the STEP file replies `blocked_by_dialog` with `dialogs` one dialog titled `STEP file import
parameters`; the test answers it OK and follows the call's job to its end, and `dialogs()` is then empty.
| # | Step | Parts after (object 0) | Also checked |
|---|---|---|---|
| 1 | `project_import {paths: [named_single_body.step]}` | `part 4/166.667` | the job's reply `added` 1; 1 object; `project()` `named_single_body · none · dirty` |
| 2 | `part_add {object: 0, type: "part", path: named_single_body.step}` | `part 4/166.667`, `part 4/166.667` | part 0's `id` as after 1 |
| 3 | `part_add {object: 0, type: "part", shape: "cube", size: [5, 5, 5]}` | `part 4/166.667`, `part 4/166.667`, `part 12/125` | no dialog; parts 0 and 1 keep their ids |
| 4 | `part_replace {object: 0, part: 2, path: named_single_body.step}` | `part 4/166.667`, `part 4/166.667`, `part 4/166.667` | parts 0 and 1 keep their ids; part 2's `id` is the `part_id` the reply gives and not the cube's: the cube's mesh was replaced by the file's; 1 object |
**Scenario: exporting meshes**
It starts with cube `small` 20 at (100, 100) and cube `big` 30 at (160, 100): together they span 90 to 175 in x, 85 to
115 in y and 0 to 30 in z. A binary STL is 84 bytes and 50 a triangle: 684 bytes for a cube, 1284 for two. The test
creates the folders `W/each` and `W/each_drc` before it exports into them. Each export's `undo_steps()` is `[]`, and
`project()` stays `Untitled · none · dirty`.
| # | Step | Written | Also checked |
|---|---|---|---|
| 1 | `project_export {format: "stl", path: W/small.stl, objects: [0]}` | `small.stl`, 684 bytes | reply `objects` `[{index: 0, name: "small"}]`, `bytes` 684 |
| 2 | `project_export {format: "stl", path: W/both.stl}` | `both.stl`, 1284 bytes | reply `objects` `[{index: 0, name: "small"}, {index: 1, name: "big"}]`, `bytes` 1284 |
| 3 | `project_export {format: "stl", path: W/each, per_object: true}` | `each` holds exactly `big.stl` and `small.stl`, 684 bytes each | reply `objects` as in 2, `files` `[W/each/small.stl, W/each/big.stl]`, no `bytes` |
| 4 | the same again | `each` holds exactly `big(1).stl`, `big.stl`, `small(1).stl`, `small.stl`, 684 bytes each | reply `files` `[W/each/small(1).stl, W/each/big(1).stl]`: a name the folder has gets a number |
| 5 | `project_export {format: "drc", path: W/both.drc}` | `both.drc` | reply `objects` as in 2, `bytes` the file's size |
| 6 | `project_export {format: "drc", path: W/each_drc, per_object: true}` | `each_drc` holds exactly `big.drc` and `small.drc` | reply `objects` as in 2, `files` `[W/each_drc/small.drc, W/each_drc/big.drc]` |
| 7 | `project_export {format: "3mf", path: W/one.3mf, objects: [0]}` | nothing | refused, `objects_not_taken` |
| 8 | `project_export {format: "stl", path: W/five.stl, objects: [5]}` | nothing | refused, `no_such_object`, with the words "Object 5 does not exist (the project has objects 0..1)" |
| 9 | `plate_slice {preview: true}`, then `project_export {format: "toolpaths_obj", path: W/toolpaths.obj}` | `toolpaths.obj` and `toolpaths.mtl` | outcome `ok`, `layers` 150; `sliced_flags()` `[true]`; reply `bytes` the file's size; `obj_facts()`: first line `# G-Code Toolpaths`, `mtllib ./toolpaths.mtl`, more than 0 `v` and `f` lines, highest vertex z 30.1 ± 0.01: `big`'s top layer at 30 plus half its 0.2 mm height |
| 10 | `meshes()` | | `[small, big]` at (100, 100) and (160, 100): the exports moved nothing |
Each file is then read back with `reimport()`; the files of a folder are imported one call each:
| File | Meshes |
|---|---|
| `small.stl` | `small.stl 12/8000 [20, 20, 20]` |
| `both.stl` | `both.stl 24/35000 [85, 30, 30]`: both cubes as placed, in one object |
| `each/small.stl`, then `each/big.stl` | `small.stl 12/8000 [20, 20, 20]`, `big.stl 12/27000 [30, 30, 30]` |
| `both.drc` | `both.drc 24/35000 [85, 30, 30]` |
| `each_drc/small.drc`, then `each_drc/big.drc` | `small.drc 12/8000 [20, 20, 20]`, `big.drc 12/27000 [30, 30, 30]` |
**Scenario: exporting the model as a 3MF**
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | cube `box` 20 at (100, 100); `project_export {format: "3mf", path: W/model.3mf}` | `[box]` at (100, 100) | reply `bytes` the file's size; `project()` `Untitled · none · dirty`: the export does not make the file the project's; `recent()` lacks `model.3mf`; `undo_steps()` `[]` |
| 2 | `undo` | `[]` | undo takes back the cube: the export left nothing for it to take back first |
| 3 | `reimport(W/model.3mf)` | `box 12/8000 [20, 20, 20]` | reply `added` 1; `project()` `model · none · dirty` |
**Scenario: exporting the sliced file**
After each export, `project()` is `Untitled · none · dirty`, `sliced_flags()` is as the row's plates say (step 1: `[false]`,
step 2: `[true]`, from step 3: `[true, false]`), and `undo_steps()` is `[]` unless the row names a step.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | cube `a` 20 at (128, 128), `app_wait {for: "idle"}`; `project_export {format: "sliced_3mf", path: W/unsliced.gcode.3mf}` | `"" 1 *` | written; `sliced()` holds no G-code entry: a plate that is not sliced is written without G-code |
| 2 | `plate_slice`, then `project_export {format: "sliced_3mf", path: W/sliced.gcode.3mf}` | `"" 1 *` | outcome `ok`, `layers` 100; `sliced()` `[Metadata/plate_1.gcode]`, its `gcode()` `layers` 100, `labels` 1 |
| 3 | `plate_add`, then `object_add_primitive {shape: "cube", size: [20, 20, 20], name: "b", plate: 1}`, `plate_slice {plates: 0}`, `plate_select {plate: 0}` | `"" 1 *` · `"" 1` | outcome `ok`, `layers` 100 |
| 4 | `project_export {format: "sliced_3mf", path: W/half_current.gcode.3mf}` | as after 3 | `sliced()` `[Metadata/plate_1.gcode]` |
| 5 | the same with `plates: "all"`, to `W/half_all.gcode.3mf` | as after 3 | `sliced()` `[Metadata/plate_1.gcode]`: plate 1, not sliced, adds none |
| 6 | the same with `plates: 1`, to `W/half_1.gcode.3mf` | `"" 1` · `"" 1 *` | `sliced()` holds no G-code entry; the plate named is made current first, `undo_steps()` `["select partplate!"]` |
| 7 | the same with no `plates`, to `W/from_1.gcode.3mf` | as after 6 | `sliced()` holds no G-code entry |
| 8 | the same with `plates: "all"`, to `W/all_from_1.gcode.3mf` | as after 6 | `sliced()` `[Metadata/plate_1.gcode]` |
| 9 | the same with `plates: 0`, to `W/half_0.gcode.3mf` | `"" 1 *` · `"" 1` | `sliced()` `[Metadata/plate_1.gcode]`; `undo_steps()` `["select partplate!"]` |
| 10 | `project_export {format: "gcode", path: W/plate_1.gcode, plates: 1}` | `"" 1 *` · `"" 1` | refused, `plate_not_sliced`; no file; `undo_steps()` `[]`: a refused export leaves the current plate and the undo history as they were |
**Scenario: a G-code export refused**
After each export, `project()` is `Untitled · none · dirty` (or `clean` before step 2) and `undo_steps()` is `[]`.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `project_export {format: "gcode", path: W/empty.gcode}` | `"" 0 *` | refused, `no_objects`; no file |
| 2 | cube `a` 20 at (100, 128), `app_wait {for: "idle"}`; `project_export {format: "gcode", path: W/unsliced.gcode}` | `"" 1 *` | refused, `plate_not_sliced`; no file; `sliced_flags()` `[false]` |
| 3 | `project_export {format: "gcode", path: W/three.gcode, plates: 3}` | `"" 1 *` | refused, `no_such_plate`; no file |
| 4 | cube `b` 20 at (160, 128); `dialog_auto_answer {rules: [{match: "Spiral mode only works", button: "yes"}]}`; `plate_set_settings {plate: 0, values: {spiral_mode: true}}`; `plate_slice` | `"" 2 *` | the rule's `uses` 1; outcome `error`: spiral vase mode prints one object; `sliced_flags()` `[false]` |
| 5 | `project_export {format: "gcode", path: W/error.gcode}` | `"" 2 *` | refused, `slice_has_errors`; no file |
| 6 | `project_export {format: "sliced_3mf", path: W/error.gcode.3mf}` | `"" 2 *` | refused, `sliced_file_not_written`; no file |
**Scenario: the G-code written**
The layer height is set so that the G-code shows a setting reaching the print: a 20 mm cube in layers of 0.25 mm,
the first included, is 80 layers, against 100 at the process's 0.2 mm.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | cube `box` 20 at (128, 128), `settings_set {values: {layer_height: 0.25, initial_layer_print_height: 0.25}}`, `plate_slice` | `[box]` | outcome `ok`, `layers` 80; `sliced_flags()` `[true]` |
| 2 | `project_export {format: "gcode", path: W/box.gcode}` | `[box]` | reply `{export: "ok", path: W/box.gcode}`; the file is there when the reply comes; `gcode()` `layers` 80, `labels` 1, `config.layer_height` `0.25`, `config.initial_layer_print_height` `0.25`; `undo_steps()` `[]`; `project()` `Untitled · none · dirty` |
| 3 | `project_export {format: "gcode", path: W/box_again.gcode}` at once | `[box]` | the same reply with its path, and the same `gcode()`; `undo_steps()` `[]`; `project()` `Untitled · none · dirty` |
| 4 | `sliced_flags()` | `[box]` | `[true]`: an export leaves the slice as it was; `project()` `Untitled · none · dirty` |
| 5 | `undo` | `[]` | undo takes back the cube: the exports left nothing for it to take back first |
**Scenario: a G-code export while a slice runs**
A second client, `OrcaMcp(port, token)` of the same session, runs in a thread of the test and starts the slice; the
test's own client exports meanwhile. The second client follows its call to its end with `await_job()`, so a reply that
outlasts the reply budget is followed as a job.
An attempt: `settings_set {values: {wall_loops: w}}` with a value no attempt has used (3, then 4, 5, ...), so that the
slice starts over from the walls; `app_wait {for: "idle"}`; the second client starts the action; the test waits up to
10 s until `app_state.slicing` is true or the second client's call has ended (a wait that runs out with neither fails),
and on `slicing` exports at once to `W/during_<w>.gcode`. A Benchy's slice lasts seconds and the export follows within
a few tens of milliseconds, but the slice can end in between, or before the test sees it. An attempt overlaps when the
export is refused with "Busy: job": MCP's admission (`McpCore::admit()`) gives that refusal only while an operation is
held, and the second client's slice is the only one. An attempt that does not overlap (the slice ended before the test
saw it, or the export went through) is followed by the next one once the second client's call has ended; the check
fails when three attempts in a row do not overlap. A refusal with other words fails at once.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | `project_import {paths: [3DBenchy.drc]}`, `app_wait {for: "idle"}` | `[3DBenchy.drc]` | reply `added` 1; `project()` `3DBenchy · none · dirty` |
| 2 | attempts with `action_run {id: "slice_and_preview"}` until one overlaps | as after 1 | the overlapping export refused, with the words "Busy: job"; its file `W/during_<w>.gcode` not there; `project()` `3DBenchy · none · dirty`. Its undo steps are not read: the interval holds the second client's slice, and Slice All selects plate 0 first, which logs a `select partplate!` step (`on_action_slice_all()` calls `Plater::select_plate()`) |
| 3 | the second client's call ends; `app_wait {for: "idle"}`; `project_export {format: "gcode", path: W/after_preview.gcode}` | as after 1 | that call's result `status` `done`, outcome `ok`, `layers` N; `sliced_flags()` `[true]`; the export's `export` `ok`; `gcode()` `layers` N and `config.wall_loops` the last attempt's `w`; `app_state.tab` `preview`; `project()` `3DBenchy · none · dirty`; `undo_steps()` `[]`, its mark set after the second client's call has ended |
| 4 | 2 and 3 again with `action_run {id: "slice_all"}`, the attempts going on with the next unused `w`, and the file `after_all.gcode` | as after 1 | the same checks, N being this result's `layers` |
**Scenario: sending G-code without a print host**
Send is `action_run {id: "send_gcode"}`. After each send, `app_state.uploads` is `[]` and `dialogs()` is empty.
| # | Step | Printer after (`bbl_use_printhost`, `print_host`) | Also checked |
|---|---|---|---|
| 1 | (the start) `values([bbl_use_printhost, print_host], "printer")` | `0`, `""` | `app_state.uploads` `[]` |
| 2 | Send, with no objects | as after 1 | refused, `not_a_print_host_printer`: the X1 Carbon prints through the Bambu network |
| 3 | `settings_set {type: "printer", values: {bbl_use_printhost: true, host_type: "octoprint", print_host: "", use_3mf: false}}`; Send, with no objects | `1`, `""` | refused, `no_print_host` |
| 4 | cube `box` 20 at (128, 128), `plate_slice`; Send | `1`, `""` | outcome `ok`, `layers` 100, `sliced_flags()` `[true]`; refused, `no_print_host` |
| 5 | `project_new {discard_changes: true, preset_changes: "discard"}` | `0`, `""` | `unsaved("printer")` `[]` |
**Scenario: filament slots merged and mixed**
Objects are read with `meshes()` as their names and `filament`; `colours` is `filament_colour` from
`project_get_settings`. It starts with `filament_delete` while `slots()` lists more than one slot.
| # | Step | `slots()` after | Also checked |
|---|---|---|---|
| 1 | (the start) | `"0"` | |
| 2 | `filament_add` | `"0,0"` | reply `filament_slot` 2, `filament_slots` 2 |
| 3 | `filament_add` | `"0,0,0"` | reply `filament_slot` 3, `filament_slots` 3 |
| 4 | `project_set_settings {values: {filament_colour: {index: i, value: c}}}` for slot index 0, 1 and 2 with `#FF0000`, `#00FF00` and `#0000FF` | `"0,0,0"` | `colours` `#FF0000;#00FF00;#0000FF` |
| 5 | cubes `on_two` 20 at (80, 128) and `on_three` 20 at (176, 128); `settings_set {target: "object", object: 0, values: {extruder: 2}}` and the same for object 1 with 3 | `"0,0,0"` | `on_two` filament 2, `on_three` filament 3 |
| 6 | `filament_delete {filament_slot: 2, merge_into: 1}` | `"0,0"` | reply `{filament_slot: 2, merged_into: 1, filament_slots: 2}`; `on_two` filament 1, `on_three` filament 2; `colours` `#FF0000;#0000FF`: the slot after the deleted one moved down, with its objects |
| 7 | `filament_add_mixed {components: [1, 2], ratios: [50, 50]}` | `"0,0,1"` | reply `{filament_slot: 3, added: true}`; `app_state.presets.filaments` has 3 entries; `on_two` 1, `on_three` 2 |
| 8 | the same again | `"0,0,1"` | reply `{filament_slot: 3, added: false}`; still 3 entries |
| 9 | `project_save {path: W/filaments.3mf}`, `project_new {discard_changes: true}`, `project_open {path: W/filaments.3mf}` | `"0,0,1"` | `[on_two, on_three]`, `on_two` filament 1, `on_three` filament 2; `colours` starts with `#FF0000;#0000FF;`: the merge and the mix are kept in the project file |
**To settle in review:**
- A refused export of a plate by index selects the plate first (sliced file, step 10). `Ops::start_gcode_export()`
(`src/slic3r/GUI/Operations/ExportOps.cpp`) calls `plater.select_plate(*args.plate)` and only then
`Plater::export_gcode_to()`, which refuses an unsliced plate, so the refusal leaves plate 1 current and a "select
partplate!" undo step (`Plater::select_plate()` takes `take_plate_selection_snapshot()`). The fix, in
`ExportOps.cpp`: an export that names a plate refuses, on that plate and before it selects it, all it can know
there. `start_gcode_export()` makes `export_gcode_to()`'s checks in its order on the named plate:
`plater.is_export_gcode_scheduled()` (`export_already_running`), `plater.is_slicing_any()` (`slicing_in_progress`),
`plater.plate_validation_error(*args.plate)` not empty (`slice_has_errors`) and
`plates.get_plate(*args.plate)->is_slice_result_valid()` (`plate_not_sliced`), and calls `select_plate()` only after
them. `export_sliced_3mf()` checks the named plate's slice error the same way before `select_named_plate()`. What can
fail only once the export runs on the selected plate (`export_not_started`; `sliced_file_not_written` for a
configuration that fails validation, a post-processing script that fails on a printer outside the Bambu network, or a
failed write; `file_not_written` of `export_model_3mf()` and `export_stl()`) selects the plate that was current back,
so the current plate is as it was, with the two selection steps left in the undo history. The step expects the fixed
behaviour: plate 0 current and no undo step.
- An object index the project lacks (exporting meshes, step 8) is refused by the target check,
`IndexCheck::object()` (`src/slic3r/GUI/Mcp/McpTargets.cpp`), with "object index 5 is out of range" and no code,
before `Ops::export_objects_refusal()` runs, so the export's own refusal for it, `no_such_object`, never answers. The
fix: `project_export`'s handler (`src/slic3r/GUI/Mcp/McpToolsProject.cpp`) runs `Ops::export_objects_refusal()` on
the indices `objects` gives before `resolve_targets()`. The step expects the fixed behaviour: `no_such_object`, "Object
5 does not exist (the project has objects 0..1)".
- `project_import` of model files leaves an untitled project named `Untitled`, while File > Import names it after the
first file without its extension (`Plater::add_file()`, `p->set_project_name(from_u8(paths.front().stem()...))`).
`Ops::import_models()` (`src/slic3r/GUI/Operations/ProjectOps.cpp`) calls `load_files()` alone, and `Plater` has no
public way to set the name (`Plater::priv::set_project_name()` is private). The fix: a new public
`Plater::name_untitled_project(const boost::filesystem::path& file)` that, when `get_project_name()` is `Untitled`,
sets the name to the file's name without its extension through `p->set_project_name()` and updates the title
(`wxGetApp().mainframe->update_title()`), leaving the project's file unset, and does nothing otherwise; and
`import_models()`, once the load has added objects, calls it with its first path that is not a ZIP archive. An
archive alone names nothing, as Import ZIP Archive names nothing (`Plater::preview_zip_archive()`). The steps expect
the fixed behaviour (importing models, steps 1, 3 and 6; a STEP file's mesh options, step 1; model 3MF, step 3; the
export while a slice runs). The recent projects stay as they are: `add_file()` adds a model there only with the
`recent_models` preference, which is off.
- Opening a saved project with no objects (saving, step 2) leaves the project named `""` with no file, and the loader
warns that the file holds no geometry. `Plater::load_project()` sets the project's file only when something loaded,
and `reset()` has emptied the name; `load_files()` shows the no-geometry `Warning` whenever it loaded no object
(`Plater.cpp`). This is the app's own code, left as it is: `main` has both (the condition there is `!res.empty()`;
this branch only lets a Design-tab recipe count as loaded), a bug for a fix of its own. The step expects what the app
does today.
- A failed import keeps its undo step (importing models, steps 9 and 10): `Ops::import_models()` takes the snapshot
before loading and says the step stays, as after a failed File > Import.
- The undo steps a project replacement logs: `reset()` takes "Reset Project" and `new_project()` "New Project", or
`load_project()` "Load Project", each a project separator that clears the history (`Plater::priv::take_snapshot()`),
and `load_files()` takes none. The new-project steps 1 and 2 and the open step 2 expect exactly those two.
- A project's `.3mf` imported as models opens no dialog (importing models, step 6). The removed replay was ready to
cancel one; `load_files()` with `LoadModel` alone skips the project-config messages, and the staged 3MF path offers
no options for a 3MF project.
- An export while a slice runs (step 2 of that scenario) is refused by MCP's admission ("Busy: job ... running an
operation"), since the slice is the second client's operation (`docs/HLSD/mcp-server.md`, Admission). The operations
layer's own refusal, `slicing_in_progress`, answers only a slice no MCP call holds, such as a person's; no tool
starts one without holding it.
- After New Project's question is answered Transfer (a new project, step 8), and after any new project or open, the
project reads clean though the process differs from its stored preset: `new_project()` copies the edited presets into
the saved copy the project's dirty state compares with (`update_saved_preset_from_current_preset()`, read by
`has_unsaved_preset_changes()` in `ProjectDirtyStateManager::update_from_presets()`), while `unsaved()` compares with
the preset as stored (`compare: ":saved"` finds the stored preset). After an open (opening, "opened") `unsaved("process")`
is exactly `[wall_loops]`: the project's own `wall_loops` 5 is the one key that differs from the 0.20mm Standard
@BBL X1C process it names.
- The layer count of the 0.25 mm layers (the G-code written): 0.25 is exact in binary, so the 80 layer tops fall on
0.25 to 20.0; if the slicer adds a layer, the count is 81 and the expectation moves with it.
- A DRC file is read back exactly (exporting meshes): `drc_bits` defaults to 0, so Draco stores the vertices without
quantising them. If the reimport differs, the DRC rows take `mesh_volume` within 0.1 % and the size to 0.01 mm.
- The OBJ's highest vertex (exporting meshes, step 9): `ToolpathsObjExporter::cross_section()` centres each
extrusion's cross section on the path vertex, whose z is the layer's top (the half-height shift in `ViewerImpl` is for
drawing only), so the top layer at 30 reaches 30.1.
**Not checked:**
- The exports and the save of a project with no objects (`3mf` written, `stl` and `sliced_3mf` refused `no_objects`,
and a `.gcode.3mf` name refused): `test_operation_routes`.
- A file per object and the toolpaths of a project or Preview with none, a ZIP entry the archive lacks, and the filament
slot refusals (the only slot, a mix that uses the slot, a mixed slot, too many slots): `test_additions_refusals`.
- The menu items' routes with their file dialogs: the files the Export, Save and Import actions write or read, the
sliced file of two sliced plates, Import ZIP Archive, Load Project, New Project on a project with two cubes answered
No, and File > Import's picker are `test_every_action`'s; which actions open a picker is `test_person_forms`'.
- The Bambu-network refusal with a cube not sliced and the no-host refusal with a cube not sliced, and an upload to a
print host with its errors: `test_send_gcode`. The Bambu-network refusal on a sliced plate: `test_every_action`. The
control for "nothing uploaded" is `test_send_gcode`'s upload, which shows in `app_state.uploads`.
- Opening a project under the Preferences' load behaviour: `test_project_open_settings`. A plate's names, locks and own
settings through the project file: `test_plates`.
- Two exports that overlap: a cube's G-code is written in well under a second, so no client can reliably send a second
export while the first runs; MCP's refusal of a change during an operation is shown here for a slice and by
`test_worker_admission` for an arrange.
- What `undo` does once a new or opened project has cleared the history: the scenarios check the steps that clear it,
and an undo with nothing to take back is the Undo command's, not the files'.
- The NewProject and ProjectOpened plugin events: they need a plugin that reports them.
- A G-code file opened with `project_open`: `test_additions_refusals` opens one; the exported G-code here is read as
text.
- What a mixed filament prints (its components layer by layer) and the colour of its slot: the scenario checks the slot
the project keeps, not the print. The STEP dialog answered Cancel, and its options' effect on the mesh.
- Inside the files, beyond what the readers take: a 3MF's thumbnails and metadata, the `.mtl`'s materials, and the
G-code's moves beyond its layer count, label ids and configuration block.
- `overwrite` on an export: it is the same path check as `project_save`'s (`resolve_output_path()`), which the saving
scenario checks.
**Strength:** Strong — every export and save is read back from its file, and every refusal by its code or words with
the state written out after it.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `filaments_and_files`
`tests/filaments_and_files.json` · replay, 65 steps, 71 expects, 0 optional
**Tests:** `filament_delete` merging slot 2 into slot 1, `filament_add_mixed` (and the same mix again), `project_export` of some objects and of each object as STL and DRC and of the Preview's toolpaths as OBJ, `project_import` of a ZIP's named entries, of all its models, and of a ZIP holding one project, and the STEP mesh-options dialog for `project_import`, `part_add` and `part_replace`.
**Decides by:** Fails when a call errors, a fixture raises, or an expect misses.
- Slots: `filament_add` replies slots 2 and 3; the object on slot 2 prints with slot 1 after the merge, whose reply gives `merged_into` 1 and 2 slots.
- Mixed: the reply adds slot 3; `filament_is_mixed` is "0,0,1"; the same mix replies `added` false and no fourth slot appears.
- Exports through `export()`, which reads each written file's size from disk: STL replies name the objects, `bytes` 684 for one cube and 1284 for two, and per-object exports write exactly two files of 684 bytes; DRC replies and files > 0 bytes; the toolpaths OBJ after a Preview slice > 0 bytes.
- ZIP: named entries add 2 objects, named "large.stl" then "small.stl" with volumes 8000 and 1000; one "Import Objects: cubes.zip" snapshot; no dialog; all entries add 3 (the readme is skipped).
- Project ZIP: adds 1 object from entry "project.3mf" after the two there, no dialog, the project path stays "", one "Import Objects: project.zip" snapshot.
- STEP: each call runs with `await: false`, the dialog titled "STEP file import parameters" is answered, the job is waited for; then 1 object with one part, two parts after `part_add`, still two after `part_replace`.
- Fixture `filaments_and_files.py` asserts nothing: it writes files and archives, calls tools and returns replies and on-disk sizes; a tool error raises `ToolError`.
**Not checked:**
- STL byte sizes depend only on triangle count: the per-object "big.stl" eq 684 passes whatever cube it holds, and no export is re-imported.
- DRC exports and the toolpaths OBJ are checked only as non-empty.
- STEP: the `app_wait {for: job}` steps have no expect, so a job still running after 30 s passes; `part_replace`'s effect is not checked (the follow-up also holds if it changed nothing); the `blocked_by_dialog` reply the header describes is not asserted.
**Strength:** Partial — slots, STL sizes and ZIP imports are exact, but DRC and toolpath exports are only non-empty and the STEP replace is only run.
### `new_project_keeps_layer_gcode`
`tests/new_project_keeps_layer_gcode.json` · replay, 22 steps, 6 expects, 0 optional
**Tests:** New Project's question about unsaved changes keeps the plate's layer G-code (a pause at layer 26) whatever the answer: Cancel leaves it on the project, and Save writes it to the project's file before the new project starts.
**Decides by:** Fails when a call errors (including `dialog_answer` finding no dialog titled "- Save", or the action's job failing) or one of its 13 matchers misses.
- Setup: one object, slice `done`/`ok`, `plate_set_custom_gcode` gives exactly one `pause`.
- Cancel: `plate_list` still has 1 object and exactly one `pause`.
- Save: the new project has 0 objects and `layer_gcode` = []; reopening `kept.3mf` gives 1 object and exactly one `pause`.
**Not checked:**
- Save: `kept.3mf` already holds the pause from the explicit `project_save` before the 5 mm move, so the reopen catches a Save that writes the file without the pause but not a Save that writes nothing; the move only Save would store is never read back.
- Only each layer G-code's `type` is read, not its layer (26).
**Strength:** Partial — Cancel is checked, but whether the dialog's Save wrote the file cannot be told from the earlier `project_save`.
### `ops_open_project`
`tests/ops_open_project.json` · replay, 54 steps, 18 expects, 7 optional
**Tests:** `project_open` with a `.3mf` path: on a clean project; on one with unsaved project changes (a cylinder), refused and then opened with `discard_changes`; on an empty one with unsaved preset changes (`top_shell_layers` 7), refused and then opened with `discard_changes` after its presets dialog is answered Discard.
**Decides by:** Fails when a non-optional call errors or an expect misses. The `project_open` calls are optional, but the state read after the refused and discarding cases is asserted.
- Refused, dirty project: still dirty, no dialog, one object named `Cylinder`.
- `discard_changes`: name `open_src`, not dirty, one object named `Cube`.
- Refused, dirty presets: no dialog, no objects, `top_shell_layers` still `7`.
- `discard_changes` with dirty presets: a dialog whose title matches `unsaved changes` is open; after Discard the name is `open_src`, no dialog, one `Cube`, `wall_loops` `5` and `top_shell_layers` not `7`.
**Not checked:**
- The clean open: its `project_open` is optional and nothing read after it (`app_state`, `object_list`, `settings_get`, recent projects) has an expect, so a clean open that fails passes.
- The refusal's code (`unsaved_changes`) and text; only the state it leaves is checked.
- The dirty flag after the preset-case open, the recent projects, the undo snapshots and the `compare: ":saved"` reads.
- `top_shell_layers` is checked with `ne "7"` rather than the value the opened project gives.
**Strength:** Partial — the refused and discarding cases' state is checked exactly; the clean open and the refusal codes are not.

View file

@ -0,0 +1,453 @@
# Gizmos and canvas input
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_gizmos`
`test_gizmos.py` · Python · takes the place of `gizmos.json` and `dialogs_canvas_input.json`
**Tests:** The Prepare view's gizmos driven as a person drives them, through the generic GUI tools: gizmo icons,
fields, combos, buttons and links in their panels, and clicks and strokes at points of the model. Each gizmo's work
is read back from the model it leaves (placements, painted facets, texture layers, text and SVG parts, brim ears,
parts made or removed, positions in the assemble view), its undo is read before any redo, and what a person keeps
is read again from a saved and reopened project. It also tests the canvas input those gizmos rely on: a press held
across gestures and released by a gesture that fails, a toolbar item that a selection has just enabled, model points
on a negative part and seen from below the bed; and that auto-answer rules run the Transfer and Discard buttons of
the preset prompt. It runs on the harness's default printer, the Bambu Lab X1 Carbon 0.4.
**Reads:**
- `scene()` gives each object of `object_list` as `{name, offset, rotation_deg, scale, bbox, brim_ears, overrides,
layer_height_profile, parts}`, the first four of its instance 0, and each part as `{name, type, triangles,
mesh_volume, bbox, painted, text, svg}`.
- `gizmo()` gives `app_state.gizmo` as `{name, canvas}`, or none.
- `panel()` gives the open gizmo's ImGui panel as `widget_list` lists it: its texts in order, and its named items
with the value each shows (a field's text, a combo's choice).
- `assembly()` gives each object's position in the assemble view, `assemble_offset()` of its instance 0, from a
`script_run` that reads `orca.host.model()`. No other tool reports it: `object_list` gives the Prepare placement.
- `setting(object, key)` gives `settings_get {target: object}`'s `{value, effective, source}` for one key.
- `selection()` gives `app_state.selection.objects`; `rules()` gives `app_state.auto_answer_rules` with their `uses`.
- `toolbar(name)` gives a 3D view toolbar item's `{enabled, pressed}` from `widget_list`.
- `slots()` is the reader `test_plates` defines (`filament_is_mixed`, one digit per slot).
The test switches to Expert mode first (the Expert action, then `app_state.mode` is `expert`), since some panel
items show only there. Every scenario starts with `project_new {discard_changes: true}` in the Prepare view and checks
that `scene()` is empty and `gizmo()` is none. Objects are then added with `object_add_primitive {shape, size,
position, name}` resting on the bed, so a 20 mm cube placed at `[100, 100, 0]` has its offset at (100, 100, 10).
Row 0 of each table reads `scene()` (and whatever else the scenario's opening sets up) and checks the start written
there, before any gizmo acts.
Notation. An object is written as its name and its offset, `A (90, 100, 10)`, with `rot [x, y, z]` for
`rotation_deg`, `scale s` for a scale of s on all three axes and `size [x, y, z]` for `bbox.size` where a row gives
them; `·` separates objects. Offsets and sizes are checked to 0.001 mm and angles to 0.01°, unless a row gives
another tolerance. `undo` and `redo` are the tools, on the project's history.
Every gizmo is opened and closed with `widget_click {target: {gizmo: name}}` (with `canvas: "assemble"` in the
assemble view). Each opening replies `active: true` and is followed by `gizmo()` giving that name and canvas; each
closing, by that second click or by the panel's Done, Close or Return button, is followed by `gizmo()` none. The rows
below do not repeat this. A `widget_set_value` reply, the value as the field shows it, is checked too, never instead
of the read-back. A step that starts a job in the background says "then idle": it is followed by `app_wait {for:
"idle"}` before its read-back, and that wait must be met. Those are every edit in the Text panel, `object_add_svg`,
`svg_change`, a texture stroke, Simplify's ratio and Apply, Mesh Boolean's Union, the cut and the variable layer
height panel's Adaptive. Simplify's first ratio is the one such step without a wait, on purpose.
**Scenario: prompts a rule answers**
The preset prompt that asks to transfer or discard unsaved changes is answered by an auto-answer rule naming the
button. `wall_loops` is read with `settings_get {type: "process"}` and the selected process preset from
`app_state`. Both presets inherit `wall_loops` "2" from `fdm_process_common`.
| # | Step | Process after | Also checked |
|---|---|---|---|
| 0 | start | the process preset `app_state` names | `rules()` lists no rule |
| 1 | `dialog_auto_answer {rules: [{match: "Transfer or discard", button: "Transfer"}]}`, then `preset_select {type: "process", name: "0.20mm Standard @BBL X1C"}` | 0.20mm Standard, `wall_loops` "2" | `rules()`: the rule, `uses` 0 |
| 2 | `settings_set {type: "process", values: {wall_loops: 5}}` | 0.20mm Standard, "5" | |
| 3 | `preset_select` of "0.16mm High Quality @BBL X1C" | 0.16mm High Quality, "5" | the reply's `selected`; the rule's `uses` is 1: the prompt was asked once and Transfer moved the edit (the preset's own value is "2") |
| 4 | the rules replaced by `[{match: "Transfer or discard", button: "Discard"}]`, then `preset_select` of "0.20mm Standard @BBL X1C" | 0.20mm Standard, "2" (the edit was dropped, not moved back) | the reply's `selected`; the new rule's `uses` goes from 0 to 1; `app_state.project.dirty` is false |
**Scenario: Move, Rotate and Scale**
A 20 mm cube A at (100, 100), selected, the camera at `iso` and fitted to the objects.
| # | Step | A after | Also checked |
|---|---|---|---|
| 0 | start | A (100, 100, 10) rot [0, 0, 0] scale 1 size [20, 20, 20] | `selection()` is [0] |
| 1 | Move opened | as after 0 | `gizmo()` Move on `3d` |
| 2 | `widget_set_value {target: {imgui_name: "position_x"}, value: 90}` | A (90, 100, 10) | reply `90.00` |
| 3 | `undo` | A (100, 100, 10) | |
| 4 | `redo` | A (90, 100, 10) | |
| 5 | Move closed, `object_transform {object: 0, rotate: [0, 0, 90], mode: "absolute"}`, Move opened, `widget_set_value {target: {imgui_name: "coordinates"}, value: "Object"}` | A (90, 100, 10) rot [0, 0, 90] size [20, 20, 20] | reply `selected: "Object"`; `panel()` shows the caption `Relative` where it showed `Position`, and `position_x` reads `0.00` |
| 6 | `position_x` set to 10 | A (90, 110, 10) rot [0, 0, 90] | the move goes along A's own X axis, which the turn points along the bed's +Y |
| 7 | `coordinates` set to index 0 | as after 6 | reply `selected: "World"`; `panel()` shows `Position`, and `position_x` reads `90.00` |
| 8 | Move closed, Rotate opened, `absolute_rotation_z` set to 30 | A (90, 110, 10) rot [0, 0, 30] size [27.32, 27.32, 20] to 0.01 | reply `30.00` |
| 9 | `undo` | rot [0, 0, 90] size [20, 20, 20] | |
| 10 | `redo` | as after 8 | |
| 11 | `absolute_rotation_z` set to 0 | A (90, 110, 10) rot [0, 0, 0] size [20, 20, 20] | |
| 12 | Rotate closed, Scale opened, `scale_x` set to 120 | A (90, 110, 12) scale 1.2 size [24, 24, 24] | reply `120.00`; uniform scale is on, so all three axes; A rests on the bed (`bbox.min` z 0) |
| 13 | `undo` | A (90, 110, 10) scale 1 size [20, 20, 20] | |
| 14 | `redo` | as after 12 | |
| 15 | `scale_x` set to 100 | A (90, 110, 10) scale 1 size [20, 20, 20] | |
| 16 | Scale closed | as after 15 | |
**Scenario: aligning in the Move panel**
A 20 mm cube A at (100, 100) and a 40 mm cube B at (150, 150): their front edges (`bbox.min` y) are at 90 and 130.
The Move panel aligns within the selection when two objects are selected.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 0 | start | A (100, 100, 10) size [20, 20, 20] · B (150, 150, 20) size [40, 40, 40] | |
| 1 | `object_select {all: true}`, Move opened | as after 0 | `selection()` is [0, 1] |
| 2 | `widget_click {target: {imgui_name: "Align front"}}` | A (100, 100, 10) · B (150, 110, 20) | B's front edge is at y 90, A's: the objects align on the front-most edge, not on their centres (B's centre would be at y 100) |
| 3 | `undo` | A (100, 100, 10) · B (150, 150, 20) | one undo step |
| 4 | `redo` | as after 2 | |
| 5 | Move closed | as after 2 | |
**Scenario: lay on face**
A 20 × 20 × 40 mm box P at (100, 100), standing, selected, the camera at `iso` and fitted to it.
| # | Step | P after | Also checked |
|---|---|---|---|
| 0 | start | P (100, 100, 20) rot [0, 0, 0] size [20, 20, 40] | |
| 1 | Flatten opened | as after 0 | |
| 2 | `mouse_gesture {at: {object: 0, spot: "front"}}` | P (100, 100, 10) rot [90, 0, 0] size [20, 40, 20] | the front face lies on the bed (`bbox.min` z 0) |
| 3 | `undo` | as after 0 | |
| 4 | `redo` | as after 2 | |
| 5 | Flatten closed | as after 2 | |
**Scenario: painting**
A 20 mm cube at (100, 100) with two filament slots (`filament_delete` until refused, then `filament_add`) and
support switched on for it (`settings_set {target: "object", object: 0, values: {enable_support: true}}`), so painted
enforcers raise no warning that could cover the panel. It is selected, the camera at `iso` and fitted to it. Part
0's `painted` is written as `supports e/b` (enforcers/blockers), `seam e/b`, `fuzzy n` and `mmu {slot: n}`; `>0` is
a count a brush stroke gives, which the app computes; `—` is an annotation `painted` does not list. A Fill click
fills the face it lands on: the two triangles of a cube's face.
| # | Step | Painted after | Also checked |
|---|---|---|---|
| 0 | start | no `painted` | the cube (100, 100, 10) size [20, 20, 20], one part with 12 triangles; `slots()` "0,0"; `setting(0, "enable_support")` value true from `object` |
| 1 | Support Painting (`FdmSupports`) opened, `{imgui_name: "Fill"}` clicked, then `mouse_gesture {at: {object: 0, spot: "front"}}` | supports 2/0 | |
| 2 | `undo` | no `painted` | |
| 3 | `redo` | supports 2/0 | |
| 4 | `Circle` clicked, `Brush size` set to 3, a right-button drag from `{spot: "top"}` to `{point: [5, 5, 10]}` | supports 2/>0 | the right button paints blockers; the front face's enforcers stay, since the stroke keeps 2 mm from the top's edges |
| 5 | Done | supports 2/>0 | |
| 6 | Seam opened, a click at `{spot: "front"}` | supports 2/>0, seam >0/0 | the default circle brush |
| 7 | `undo` | supports 2/>0, seam — | |
| 8 | `redo`, then Done | supports 2/>0, seam >0/0 | |
| 9 | `settings_set {target: "object", object: 0, values: {fuzzy_skin: "disabled_fuzzy"}}`, Fuzzy Skin Painting opened | as after 8, fuzzy — | `setting(0, "fuzzy_skin")` is `disabled_fuzzy` from `object`; `panel()` shows "Warning: Fuzzy skin is disabled, painted fuzzy skin will not take effect!" |
| 10 | `widget_click {target: {imgui_name: "Enable painted fuzzy skin"}}` | as after 9 | `fuzzy_skin` is `none` (Painted only) from `object`; the warning is no longer shown |
| 11 | Fill, then a click at `{spot: "left"}` | supports 2/>0, seam >0/0, fuzzy 2 | |
| 12 | `undo` | as after 9 | `fuzzy_skin` still `none`: the link took no undo step of its own |
| 13 | `redo`, then Done | as after 11 | |
| 14 | Color Painting opened, `{imgui_name: "extruder_color_2"}` clicked, Fill, a click at `{spot: "front"}` | as after 11, mmu {2: 2} | |
| 15 | `undo` | as after 11 | |
| 16 | `redo`, then Done | as after 14 | |
| 17 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 14 | `slots()` "0,0"; the object's `enable_support` true and `fuzzy_skin` `none`: painting and the settings it needs are kept in the project file |
**Scenario: texture layers**
A 20 mm cube at (100, 100), selected, the camera at `iso` and fitted to it. Part 0's `painted.texture` is written as
its layers in order, each as `slot name painted`, with `?` for a name the scenario does not fix and `>0` for painted
facets a stroke gives. A stroke is a drag from a spot through a waypoint to a point of the cube's part frame. The
panel names each closed layer's row by its place in the list, "Layer 1" for the first; the open layer's card has no
such row.
| # | Step | Layers after | Also checked |
|---|---|---|---|
| 0 | start | no `painted` | the cube (100, 100, 10) size [20, 20, 20] |
| 1 | Texture Displacement opened | `0 ? 0` | the gizmo gives a part without layers one layer in slot 0 |
| 2 | `gizmo_pick_file {action: "texture_import", path: heightmap.png}` | `0 heightmap 0` | `depth_mm` 0.4 (the default); `path` ends in `heightmap.png` and lies in `app_state.config_folder` |
| 3 | `widget_click {target: {imgui_name: "add_layer"}}` | `0 heightmap 0` · `1 ? 0` | |
| 4 | a stroke from `{spot: "top"}` through `[6, 0, 10]` to `[6, 6, 10]`, then idle | `0 heightmap 0` · `1 ? >0` | the new layer, slot 1, is the active one, and a stroke paints only the active layer |
| 5 | `widget_click {target: {imgui_name: "Layer 1"}}`, the first layer's row | as after 4 | `panel()` lists the item `midlevel`: the card now open shows all its settings |
| 6 | a stroke from `{spot: "front"}` through `[6, -10, 0]` to `[6, -10, 6]`, then idle | `0 heightmap >0` · `1 ? >0` | the paint went to slot 0: the click made the first layer the active one |
| 7 | `widget_click {target: {imgui_name: "more"}}` | as after 6 | `panel()` no longer lists `midlevel`: the link folded the open card's settings |
| 8 | `widget_click {target: {imgui_name: "Remove", index: 1}}`, the second layer's | `0 heightmap >0` | slot 1 and its paint are gone |
| 9 | `undo` | `0 heightmap >0` · `1 ? >0` | |
| 10 | `redo` | as after 8 | |
| 11 | `widget_click {target: {imgui_name: "close"}}` | as after 8 | the Close button closes the gizmo and leaves the layers |
| 12 | `project_save` to a new file, `project_new`, `project_open` of the file | `0 heightmap >0` | `depth_mm` 0.4 |
**Scenario: text**
A 20 mm cube at (100, 100), selected, the camera at `top` and fitted to it, so the screen's centre is the middle of
the cube's top. The text is part 1, written as its `type`, `text.text`, `text.style` and its `bbox` z range `z
a–b`, to 0.01 mm. A text is embossed from 0.015 mm under the surface it stands on (`SAFE_SURFACE_OFFSET` in
`EmbossJob.cpp`), outward for a part and inward for a negative part, by its depth: 1 mm by default. The panel's style
combo shows the style's name, followed by the app's modified marker `*` (`Preset::suffix_modified()`, which
`GUI_App::load_language` sets to `"* "`) while the style's font or depth differ from the style as stored
(`draw_style_list` in `GLGizmoEmboss.cpp`). "Shows `ITALIC`" means exactly that text; "shows `ITALIC*`" means the text
starts with it.
| # | Step | Text after | Also checked |
|---|---|---|---|
| 0 | start | no part 1 | the cube (100, 100, 10) size [20, 20, 20], one part |
| 1 | Text opened (`widget_click {target: {gizmo: "Text"}}`) | part "Embossed text", z 19.985–20.985 | the reply has `created: true` and `active: true`; 2 parts; the part's name is "Embossed text"; its `bbox` centre lies over the top's square (x and y 90 to 110): the text lands on the cube's top |
| 2 | `widget_set_value {target: {imgui_name: "Text"}, value: "Orca\nMCP"}`, then idle | part "Orca\nMCP" | reply value `Orca\nMCP`; the part's name is "Orca MCP" |
| 3 | `widget_set_value {target: {imgui: "Style"}, value: "ITALIC"}`, then idle | style `ITALIC` | reply `selected: "ITALIC"`; the style combo shows `ITALIC` |
| 4 | `Combo_Font` set to "HarmonyOS Sans SC", then idle | font "HarmonyOS Sans SC" | style still `ITALIC`; the style combo shows `ITALIC*` |
| 5 | `widget_click {target: {imgui_name: "Revert font"}}`, then idle | font not "HarmonyOS Sans SC" | the style combo shows `ITALIC` again: the font is the style's own |
| 6 | `Depth` set to 2.5, then idle | z 19.985–22.485 | reply `2.50 mm`; the style combo shows `ITALIC*` |
| 7 | `widget_click {target: {imgui_name: "Revert Depth"}}`, then idle | z 19.985–20.985 | the Depth field reads `1.00 mm`; the style combo shows `ITALIC` |
| 8 | `widget_click {target: {imgui: "Cut"}}`, then idle | negative, z 19.015–20.015 | the text cuts 1 mm into the top |
| 9 | `undo` | part, z 19.985–20.985 | |
| 10 | `redo` | as after 8 | |
| 11 | Done | as after 8 | |
| 12 | `project_save` to a new file, `project_new`, `project_open` of the file | negative "Orca\nMCP", style `ITALIC`, z 19.015–20.015 | |
**Scenario: SVG**
A 20 mm cube at (100, 100), nothing selected, the camera at `top` and fitted to the objects. `star.svg` is the
fixture `tools/mcp/tests/fixtures/star.svg`, whose star spans 18.6 × 17.6 mm; an SVG is embossed 10 mm deep by
default (`select_shape` in `GLGizmoSVG.cpp`). The panel names the file without its folder and `.svg`.
| # | Step | After | Also checked |
|---|---|---|---|
| 0 | start | the cube (100, 100, 10), one part | `selection()` is empty |
| 1 | `object_add_svg {path: star.svg}`, then idle | cube · star: one part, `svg.path` star.svg, size [18.6, 17.6, 10] to 0.05, `bbox.min` z 0 | `gizmo()` SVG; `panel()` shows `star` |
| 2 | `gizmo_pick_file {action: "svg_save_as", path: <test folder>/star-copy.svg}` | the star's `svg.path` is star-copy.svg | the file holds the star's path data (`M10 1 L12.6 7.2`); `panel()` shows `star-copy` |
| 3 | `gizmo_pick_file {action: "svg_change", path: star.svg}`, then idle | `svg.path` star.svg, size as after 1 | `panel()` shows `star`, and no longer `star-copy` |
| 4 | SVG closed, `object_select {objects: [0]}`, the camera at `top` and fitted to it, `object_add_svg {path: star.svg}`, then idle | the cube has 2 parts: part 1 a part with `svg.path` star.svg, z 19.985–29.985 | `gizmo()` SVG; the part's `bbox` centre lies over the top's square |
| 5 | SVG closed, `undo` | the cube has 1 part | adding the part is one undo step |
| 6 | `redo` | as after 4 | |
| 7 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 4 | both SVG parts keep `svg`, with `path_in_3mf` `3D/star.svg`: the file is stored in the project |
**Scenario: Measure**
A 20 mm cube at (100, 100), selected, the camera at `iso` and fitted to it. The panel is written as its two selection
lines, `Selection 1 / Selection 2`, and the rows of its result table, each a label and a value.
| # | Step | Panel after | Also checked |
|---|---|---|---|
| 0 | start | | the cube (100, 100, 10) size [20, 20, 20] |
| 1 | Measure opened | None / None, no result row | |
| 2 | a click at `{spot: "front"}` | Plane / None, no result row | |
| 3 | a click at `{spot: "left"}` | Plane / Plane, Angle `90.000°` | no Distance row: two faces at an angle give an angle only |
| 4 | a Shift-click at `{point: [-10, 0, -4]}` | Plane / Point on plane, Distance `d mm` | d within 0.25 of 10, the point's distance from the front face (the click lands within a pixel of the point); no Angle row |
| 5 | Measure closed | | the cube as after 0: measuring moved nothing |
**Scenario: Simplify**
A 20 mm sphere S at (100, 100), selected. Its mesh has 24648 triangles: `its_make_sphere` with the step
`primitive_angle_step` gives a radius of 10 mm, 158 sectors and 79 stacks, 2 × 158 × 78 triangles. A new shape may be
turned toward the part-cooling fan (`load_shape_object`), which leaves a sphere's triangle count and size as they are.
| # | Step | S's triangles after | Also checked |
|---|---|---|---|
| 0 | start | 24648 | S size [20, 20, 20] to 0.01 |
| 1 | Simplify opened, `use_count` set to true, `Decimate ratio` set to 60, with no wait | 24648 | reply `60.00%` |
| 2 | at once Simplify closed, while it works out the result, then `app_wait {for: "idle", timeout_s: 15}` | 24648 | that wait is met: closing leaves nothing running and applies nothing |
| 3 | Simplify opened, `use_count` true, `Decimate ratio` set to 90, then idle | 24648 | `panel()` shows `2465 triangles`, the count asked for (24648 × 10 %, rounded) |
| 4 | Apply, then idle | 2464 | the even count at or below 2465: each edge collapse removes two triangles from the even 24648; Apply closes the gizmo (`gizmo()` none) |
| 5 | `undo` | 24648 | |
| 6 | `redo` | 2464 | |
**Scenario: Mesh Boolean**
A 20 mm cube at (100, 100) and a 10 mm cube part added to it with `part_add {object: 0, type: "part", shape: "cube",
size: [10, 10, 10], position: [110, 110, 20]}`, which shares a 5 mm cube with the first at the corner. It is selected,
the camera at `iso` and fitted to it.
| # | Step | Parts after | Also checked |
|---|---|---|---|
| 0 | start | part 0 `mesh_volume` 8000 · part 1 1000, both type part | the object's `bbox` is x 90–115, y 90–115, z 0–25 |
| 1 | Mesh Boolean opened, `{imgui: "Union", index: 0}` clicked | as after 0 | |
| 2 | `select_source_volume`, a click at `{object: 0, part: 0, spot: "front"}`, `select_tool_volume`, a click at `{object: 0, part: 1, spot: "top"}`, then `{imgui_name: "btn"}`, then idle | one part, type part, its name ending ` - union`, `mesh_volume` 8875 to 1 | the object's `bbox` is x 87.5–112.5, y 87.5–112.5, z -2.5–22.5: the union lands 2.5 mm off along each axis, its bounding-box centre where part 0's centre was, and nothing drops it back onto the bed |
| 3 | `undo` | as after 0 | the `bbox` as after 0 |
| 4 | `redo` | as after 2 | |
| 5 | Mesh Boolean closed | as after 2 | |
**Scenario: brim ears**
A 20 mm cube at (100, 100), selected, the camera at `iso` and fitted to it. The process's `brim_type` is `auto_brim`.
| # | Step | After | Also checked |
|---|---|---|---|
| 0 | start | `brim_ears` 0; `setting(0, "brim_type")` value null, effective `auto_brim` | the cube (100, 100, 10) |
| 1 | Brim Ears opened | as after 0 | `panel()` shows the warning that the brim type is not set to "painted" |
| 2 | `widget_click {target: {imgui_name: "Set brim type to painted"}}` | `brim_ears` 0; `brim_type` `painted` from `object` | the warning is no longer shown |
| 3 | `{imgui: "Auto-generate"}` clicked | `brim_ears` 4 | one ear at each corner of the square first layer |
| 4 | `undo` | `brim_ears` 0 | `brim_type` still `painted`: the link took no undo step |
| 5 | `redo` | `brim_ears` 4 | |
| 6 | a click at `{object: 0, point: [0, -10, -9.5]}`, on the front face 0.5 mm above the bed | `brim_ears` 5 | |
| 7 | `undo` | `brim_ears` 4 | |
| 8 | `redo`, then Done | `brim_ears` 5 | |
| 9 | `project_save` to a new file, `project_new`, `project_open` of the file | `brim_ears` 5, `brim_type` `painted` | |
**Scenario: assembly in the assemble view**
Two 20 mm cubes, A at (100, 100) and B at (160, 100), both selected, then `view_set {canvas: "assemble"}` and the
camera at `iso`. Each object is written as its Prepare offset from `scene()` and its assemble-view position from
`assembly()`, `A (100, 100, 10) / (x, y, z)`. A new object gets its assemble-view position when it is added
(`Model::set_assembly_pos`, which shifts it along x and y only), so both stand at z 10 there.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 0 | start | A (100, 100, 10) · B (160, 100, 10); in the assemble view both at z 10 | `selection()` is [0, 1] |
| 1 | `object_select {objects: [0]}`, Move opened on `assemble`, `position_x` 100, `position_y` 100, Move closed; the same on B with 60 and 160 | A (100, 100, 10) / (100, 100, 10) · B (160, 100, 10) / (60, 160, 10) | a move in the assemble view changes only the assembly position |
| 2 | `object_select {all: true}`, the camera fitted to the objects, Assembly opened on `assemble`, `widget_set_value {target: {imgui: "Mode"}, value: "Face and face assembly"}` | as after 1 | reply `selected` |
| 3 | a click at `{object: 0, spot: "left"}`, then at `{object: 1, spot: "left"}` on `assemble` | as after 1 | `panel()` shows `Face 1 (Fixed)` and `Face 2 (Moving)` both `Plane`, and `parallel_distance_z` reads `40.00`, B's left face 40 mm from A's along A's normal |
| 4 | `parallel_distance_z` set to 0 | A as after 1 · B (160, 100, 10) / (100, 160, 10) | B moves along x until its left face is in A's |
| 5 | `undo` | as after 1 | |
| 6 | `redo` | as after 4 | |
| 7 | `widget_click {target: {imgui: "Return"}}` | as after 4 | `app_state.tab` is `prepare`, and `object_select {objects: [0]}` replies `canvas: "3d"`: it selects in Prepare's 3D view, so the assemble view is no longer shown |
| 8 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 4 | the assembly positions are kept in the project file |
**Scenario: cut with a connector**
A 20 mm cube named block at (100, 100), then a 10 mm cube named other at (150, 100); block selected, the camera at
`iso` and fitted to it. Cutting at z 8 leaves a 12 mm upper half and an 8 mm lower half; the cut object leaves the
list and its halves are added at its end, upper first (`Plater::apply_cut_object_to_model`). A plug connector becomes
a negative part of the upper half and a part of the lower half (`process_connector_cut` in `CutUtils.cpp`); a square
frustum connector's unit mesh (`its_make_frustum` with 4 sectors, a top half the base's width) has `mesh_volume`
(2 + 0.5 + 1) / 3 = 1.167, where a square prism's would be 2.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 0 | start | block (100, 100, 10) one part `mesh_volume` 8000 · other (150, 100, 5) | `selection()` is [0] |
| 1 | Cut opened, `move_Z` set to 8 | as after 0 | reply `8.00` |
| 2 | `{imgui: "Add connectors"}` clicked, `Style` set to `Frustum`, `Shape` to `Square`, then a click at `{object: 0, point: [100, 100, 8], frame: "world"}` with `check: "point"`, on the cut plane | as after 0 | the replies `selected: "Frustum"` and `"Square"` |
| 3 | `{imgui: "Confirm connectors"}`, then `{imgui: "Perform cut"}`, then idle | other (150, 100, 5) · block, the upper half: parts [part `mesh_volume` 4800, negative 1.167], size z 12 · block, the lower half: parts [part 3200, part 1.167] | both halves have `bbox.min` z 0 and stand where block stood (`bbox` x and y 90–110); the cut closes the gizmo |
| 4 | `undo` | as after 0 | the cut is one undo step |
| 5 | `redo` | as after 3 | |
| 6 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 3 | |
**Scenario: canvas input**
A 20 mm cube at (100, 100) with a negative part, `part_add {object: 0, type: "negative", shape: "cube", size: [6, 6,
6], position: [100, 100, 20]}`, whose top stands 3 mm above the cube's. The camera at `iso` and fitted to it. A
middle-button drag pans the camera on a new datadir (`middle_mouse_drag_action` defaults to Pan).
| # | Step | Reply and state after | Also checked |
|---|---|---|---|
| 0 | start | the cube (100, 100, 10) size [20, 20, 20]; parts [part, negative], the negative's `bbox` z 17–23 | `app_state.camera` read: the camera the pans below are measured from |
| 1 | `mouse_gesture {action: "down", button: "middle", x: 300, y: 300}` | `held: true` | `app_state.camera` as read at row 0: a press alone does not move it |
| 2 | `mouse_gesture {action: "move", x: 310, y: 300}` | `held: true`, `camera_moved: true` | `app_state.camera.look_at` differs from row 0's: the held button pans |
| 3 | `mouse_gesture {action: "move", at: {object: 0, point: [0, 0, 5000], frame: "world"}}` | refused, its words "off screen" | `scene()` as after 0; the camera did not move during the step: `app_state.camera` reads as it did at the end of step 2 |
| 4 | `mouse_gesture {action: "move", x: 320, y: 300}` | neither `held` nor `camera_moved` | the camera did not move: `app_state.camera` reads as it did just before this step. The failed gesture released the press |
| 5 | the control: `mouse_gesture {action: "down", button: "middle", x: 300, y: 300}`, `{action: "move", x: 330, y: 300}`, then `{action: "up", x: 330, y: 300}` | the move replies `held: true` and `camera_moved: true`; the up replies no `held` | `app_state.camera.look_at` after the move differs from its reading at the end of step 4: a new press still pans, so step 4's still camera is the released press, not a canvas that ignores the pointer |
| 6 | `object_select {none: true}`, then `widget_click {target: {gltoolbar: "layersediting"}}` | refused, its words "is disabled" | `toolbar("layersediting")` is `{enabled: false, pressed: false}` before and after the click; `widget_list` lists no `Adaptive` button; the cube has no `layer_height_profile` |
| 7 | `object_select {objects: [0]}` and at once the same click | reply `pressed: true` | `toolbar("layersediting")` is `{enabled: true, pressed: true}`; `widget_list` lists the variable layer height panel's `Adaptive` button |
| 8 | `widget_click {target: {imgui: "Adaptive"}}`, then idle | the cube has a `layer_height_profile` with points | the panel takes clicks as soon as it shows |
| 9 | the `layersediting` click again | reply `pressed: false` | `toolbar("layersediting")` is `{enabled: true, pressed: false}`; `Adaptive` is no longer listed; the profile stays |
| 10 | the camera at `top` and fitted, `object_select {none: true}`, `mouse_gesture {action: "move", at: {object: 0, part: 1, spot: "top"}}` with the default surface check | not refused | `selection()` is empty: a move selects nothing |
| 11 | `mouse_gesture {at: {object: 0, part: 1, spot: "top"}}` | | `selection()` is [0]: a click on the negative part lands on its object |
| 12 | the camera at `bottom` and fitted, `object_select {none: true}`, `mouse_gesture {at: {object: 0, spot: "bottom"}}` | not refused | `selection()` is [0]: from below the bed hides nothing |
| 13 | `object_select {none: true}`, `mouse_gesture {action: "move", at: {object: 0, part: 1, spot: "top"}}` | refused, its words "is in front of the point" | `selection()` still empty, `scene()` as after 0, and the camera did not move during the step (`app_state.camera` reads as it did after `object_select`): the check runs for a negative part, and from below the cube hides its top |
**To settle in review:**
- Mesh Boolean moves its result (step 2 of its scenario): a bug in the app's own code, which is on `main`, left as
it is and a bug for a fix of its own. `GLGizmoMeshBoolean::generate_new_volume` builds the union in the object's
frame (both parts' meshes transformed by their part matrices) and adds it with `ModelObject::add_volume`, which
centres the mesh on its bounding box and sets the part's offset to that centre, so the union is still in place; it
then sets the new part's offset to the source part's (`GLGizmoMeshBoolean.cpp:504`), dropping that shift, and the
`ensure_on_bed` call after it is commented out. Step 2 expects where the union lands today: moved by (-2.5, -2.5,
-2.5) mm, from x, y and z 90–115, 90–115 and 0–25 to 87.5–112.5, 87.5–112.5 and -2.5–22.5. The earlier `gizmos.json`
run shows the same shift, its union moved 9.87 mm along y.
- Undo and redo lose a text part's font face name: a bug in the app's own code, on `main`, left as it is.
`FontProp::save` and `load` (`TextConfiguration.hpp`), which undo and redo serialize the style through, leave out
`face_name`, so after an undo `object_list`'s `text.font` gives the style's font descriptor (`style.path`, such as
`1;9;-12;...;Times New Roman` on Windows) in place of the face name. No step reads `text.font` after an undo or a
redo: the descriptor depends on the system's fonts.
- The links that set a setting (Fuzzy Skin's "Enable painted fuzzy skin", Brim Ears' "Set brim type to painted")
change the object's setting without an undo step of their own (`GLGizmoFuzzySkin.cpp` and `GLGizmoBrimEars.cpp`
assign the config directly): the app's own code, on `main`, left as it is. The entry expects that, so an undo of
the next step keeps the setting.
- The style combo's marker (text, steps 3 to 7): right after the pick the style reads unmodified, since a text
created on the top under the `top` camera has no angle or surface distance of its own (`calc_up` and
`calc_distance` give none for 0), and those are part of the comparison.
- The simplified count (Simplify, step 4): 2464 follows from the stopping rule in `its_quadric_edge_collapse`
(`actual_triangle_count > triangle_count`) if every collapse removes exactly two triangles; one that removed more
would leave fewer. A tolerance of 2464 down to 2460 is the fallback.
- The ears Auto-generate makes on a 20 mm cube (brim ears, step 3): 4, one per corner. `generate_points` works it out
from the first layer; the earlier run gave 4 on a 25.6 mm cube.
- Undo while a gizmo is open (brim ears, Texture Displacement's Remove, Assembly's parallel distance): each of those
takes a gizmo-action snapshot, so undo is expected to restore the model as before that step, with the gizmo still
open. The earlier replay only undid painting and Move this way.
- The Measure distance tolerance (Measure, step 4): 0.25 mm covers a click landing a pixel off the point at this zoom.
- `path_in_3mf` after saving SVG parts (SVG, step 7): `3D/star.svg` for both, from `create_unique_3mf_filepath`,
the second taking the first's name because it has the same local file.
**Not checked:**
- How gizmos draw: no screenshot is taken or compared.
- Other window sizes. The sweep runs the test at 1600×900. An ImGui panel or a notification over a model point or
an item is refused, which `tests/slic3rutils/test_mcp_results.cpp` checks without the app ("a click goes to the
frontmost ImGui window", "what covers a click is named"), with the surface check's cases in
`tests/slic3rutils/test_mcp_ui.cpp`.
- Grabbers dragged on the canvas: `mouse_gesture` sets them through the panel fields, as its description says.
- The Move panel's other align and distribute buttons and its align-to-plate mode; Rotate's and Scale's other
fields, Reset buttons and non-uniform scale.
- Painting tools other than Fill and the circle brush (sphere, gap fill, triangle, height range), erasing with Shift,
the smart fill angle, and where a brush's facets lie: a brush's counts are checked as above 0.
- The Painted Modifier gizmo: neither replay drives it.
- Texture Displacement's bake, its tile, rotation and midlevel values, the texture library popup, and the name of
the texture a new layer starts with (the library's first, which depends on the installed textures).
- Text: the font a style names, which depends on the system's fonts (the style combo's marker shows it is the
style's own); the size, boldness, line gap and alignment fields, the surface option, saving or renaming a style
and the prompt when a modified style is changed, a text as a modifier, and the font after reopening.
- SVG: its size, depth and mirror fields, "Forget the file path" and reload from disk.
- Measure: edges, circles and points as features, the XYZ distance fields that move objects, and inches.
- Assembly: point-and-point mode, Flip by Face 2, rotation around the faces' centre and the Parallel button for faces
at an angle.
- Cut: dowel and snap connectors, cutting by groove or contour, flipping or placing the halves, keeping one half,
and the connector's size and depth.
- Simplify by error, Mesh Boolean's difference and intersection and their Delete input option, and deleting or
resizing brim ears.
- What the painting, fuzzy skin, brim ears and connectors do to a slice: the test checks what the gizmos leave on the
model and in the project file; turning it into toolpaths is the slicer's.
- What other tests assert: Select All with Move open, and refused with Lay on face open, in
`test_menu_items_refusals`; Measure in the assemble view and Select All refused there in `test_person_forms`;
arranging with Move open and from the assemble view in `test_operation_routes`; refs to the Text font button and a
texture layer row surviving their renames in `test_ref_locator_export`; the Text action opening its gizmo on a new
object in `test_every_action`.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `gizmos`
`tests/gizmos.json` · replay, 251 steps, 92 expects, 1 optional
**Tests:** Every Prepare gizmo driven through the generic GUI tools (gizmo icons, ImGui panel fields, combos and links, clicks and strokes at model points): Move, Rotate, Scale, Flatten, the four painting gizmos, Texture Displacement, Text, SVG, Measure, Simplify, Brim Ears, Mesh Boolean, Assembly (assemble view) and Cut, and what each leaves on the model.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Open and close: `widget_click {gizmo}` replies `/active` true then false for each gizmo; `app_state /gizmo/name` is "Move" and "SVG" when expected, `/gizmo` null after Move and after Assembly's Return.
- Panel fields: each `widget_set_value` reply `/value` or `/selected` equals the text set ("90.00", "30.00", "120.00", "3.00", "2.50 mm", "60.00", "0.00", "10.00", "ITALIC", "Frustum", "Square", "HarmonyOS Sans SC", "Object"/"World").
- Transforms in `object_list`: Move X `offset/0` 90, undo 100, redo 90; Rotate `rotation_deg/2` > 29.9; Scale `scale/2` > 1.19, undo 1; Flatten `rotation_deg/0` > 89, undo < 1.
- Painting: supports `painted/supports/enforcers` > 0, `painted` gone after undo, `blockers` > 0 after a right-drag; seam `enforcers` > 0, gone after undo; fuzzy skin's link sets the object's `fuzzy_skin` to "none" and `painted/fuzzy_skin` > 0; colour `painted/mmu/2` > 0; texture layer `name` contains "heightmap" and `painted` > 0, a second layer present after `add_layer` and absent after Remove.
- Text and SVG: the text part's `text/text` is "Orca\nMCP" and `text/style` "ITALIC"; after Revert Depth no node reads "2.50 mm"; the SVG object makes `total` 3 with `svg/path` containing star.svg, then star-copy.svg after Save as, star.svg after Change file; a second SVG becomes part 2 of object 0.
- Others: Measure's panel has nodes matching "90.000", "Point on plane" and "Distance"; Simplify closed mid-calculation leaves the app idle (`/satisfied` true) and Apply at 90 % leaves `triangles` < 1000; Brim Ears' link puts `brim_type` in the object's overrides and Auto-generate gives `brim_ears` > 0; Mesh Boolean removes part 2 and undo restores it; Cut makes `total` 4.
- Held press: `mouse_gesture down` replies `/held` true; after a gesture that fails (the optional step), the next move has no `/held`.
**Not checked:**
- Move's alignment cannot fail: both cubes already stand at y 100 with the same size, so `/plates/0/objects/1/instances/0/offset/1` eq 100 is the value before Align front is clicked.
- Undo for Rotate, Fuzzy skin and Color painting: undo and redo run back to back and only the redone value is read, so an undo that does nothing passes.
- Bounds looser than the known value: rotation > 29.9 (30 set), scale > 1.19 (1.2 set), flatten > 89 (90), none with an upper bound; the brim override is checked for the key `brim_type`, not its value.
- Only run, never read back: the font Revert, Rotate's reset to 0 and Scale's to 100, texture "Layer 1", "more" and "close", the brim ear added by a click (the ear count is not read again), Assembly's move apart (only the field reads "60.00") and the face-to-face mate (no object position is read), Cut's connectors (only the combos; the cut is checked by object count, not by connector parts).
- Absence-only text checks: Revert Depth and "The panel shows the new file's name" check only that "2.50 mm" and "star-copy" are not shown; both pass if the panel shows nothing, and the new file name is never looked for.
- Measure's results are matched by text search; I could not confirm whether the "Distance" label appears before any measurement.
- Simplify: the triangle count before is not read, so the < 1000 bound does not show a reduction.
- 17 canvas screenshots are saved and never compared.
- The sweep runs it at 1600×900 only; the 1100×760 run in the header is manual.
**Strength:** Partial — most gizmos' main model edit is read back, but several outcomes (Assembly, Cut connectors, Brim click, Measure) are only run or matched by text, three undos are unverified, and the alignment check cannot fail.
### `dialogs_canvas_input`
`tests/dialogs_canvas_input.json` · replay, 32 steps, 9 expects, 0 optional
**Tests:** That auto-answered "Transfer or discard" prompts on a process preset switch run their buttons' handlers; that a toolbar item a selection just enabled (variable layer height) takes a click at once; and that a negative part, and model points seen from below through the bed, resolve as `mouse_gesture` targets.
**Decides by:** Fails when a call errors (a point that does not resolve or is hidden is refused) or one of its 9 matchers misses.
- Transfer: after `wall_loops` 5 and a switch to the 0.16 mm preset (`/selected` exact), `wall_loops` reads `"5"`.
- Discard: after switching back (`/selected` exact), `wall_loops` `ne "5"` and `app_state /project/dirty` = false.
- Toolbar: `layersediting` click `/pressed` = true, then false.
- Negative part: Text gizmo `/created` = true; after Cut and Done, `object_list` part 1 type = `negative`.
- Canvas targets: the three `mouse_gesture move` steps only have to not be refused.
**Not checked:**
- Discard is read back as `ne "5"`, not as the preset's own value.
- The `mouse_gesture` steps have no expect; the negative-part step turns the visibility check off (`check: point`), so only resolving the part is tested.
- "The text lands on the cube's top" is not checked; only the part's type.
**Strength:** Partial — the auto-answers and toolbar click are read back, but the canvas targets are only "not refused".

View file

@ -0,0 +1,583 @@
# GUI automation tools
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
Three tests take the place of the six replays of this area. One entry for all six would hold eleven scenarios and
over 130 steps (`test_plates` has 82), and would mix three launches the sweep judges differently:
- `test_gui_tools` drives the app's own menus, rows, popups and web dialogs with the generic GUI tools
(`context_menus.json`, `rows.json`, `web_dialogs.json`). It runs on the sweep's default launch.
- `test_recording` makes and encodes recordings (`recording.json`). What it can check depends on the machine's
ffmpeg, and it says so in its output, so its verdict is kept apart from the others'.
- `test_call_forms` checks the forms a call takes: the names and values agents send, and a call with exactly an
action's arguments doing what a person's pick does (`agent_forms.json`, `actions_ask.json`). `actions_ask` needs
the Design tab, so this test launches with it (`"cad": true`), which the other two must not.
Their `sweep.json` entries:
```json
"test_gui_tools": {"path": "test_gui_tools.py"},
"test_recording": {"path": "test_recording.py"},
"test_call_forms": {"path": "test_call_forms.py", "cad": true}
```
## `test_gui_tools`
`test_gui_tools.py` · Python · takes the place of `context_menus.json`, `rows.json` and `web_dialogs.json`
**Tests:** The generic GUI tools on the app's own widgets, as an agent drives any of them: context menus and a
button's menu listed and run by path without being shown, the Edit menu's items, the rows of the object list, of
Compare presets and of the parameter table, the print button's popup, a drop-down list, and Orca's web dialogs (the
preset bundle dialog, the colour picker over the filament picker, the setup wizard). Every menu item, row and page
element the test runs or clicks is checked by what it does to the project, the selection, the camera or the
settings; a menu's listing is checked by the items it holds. It runs on the harness's default printer, the Bambu
Lab X1 Carbon 0.4, in a 1600 × 900 window (`window_set`).
**Reads:** `objects()` gives each object from `object_list` as its name, the plate it is on, its parts, each part as
its name and `type` (`part`, `modifier`, `negative`, ...), and whether its first instance is printable. `selection()` gives
`app_state.selection` as `{objects, parts}`, or empty. `menu(reply)` gives a reply's `popup_menu` as `{items,
checked, disabled}`, an absent list read as `[]`. `rows(target)` parses `widget_list`'s tree into rows, each with
its label path, its value, and whether it is selected or checked. `dialogs()` gives the titles of
`app_state.dialogs`, `windows()` the titles `window_list` lists, `colours()` the project's `filament_colour` from
`project_get_settings`, `project_file(path)` the JSON of a saved project's `Metadata/project_settings.config`, and
`canvas_png(name)` the file `window_screenshot {target: "canvas", include_image: false, save_path: OUT/<name>.png}`
writes. `OUT` is the test's output folder: the folder `--out` names, else a new temporary folder. Every scenario
starts with `project_new {discard_changes: true, preset_changes: "discard"}` in the Prepare view and the
auto-answer rules for "Uniform scale" and "per-object setting mode" (OK) registered, and checks that `dialogs()` is
`[]` and `plate_list` gives one unnamed plate, current.
In the tables an object is written as its name, a colon, and its parts as name and type joined by `+`: `Cube: Cube
part + Generic-Cylinder modifier`. "As after N" means the state written out at step N, compared whole again.
**Scenario: menus of the 3D view and of a button**
It starts with one filament slot (`filament_delete` until it is refused `last_filament_slot`), the cube of the Add
Cube action (`action_run`) and the iso view (`view_set {camera: "iso"}`). The start is checked: `objects()` is
`Cube: Cube part`, printable; `app_state.presets.filaments` has 1 entry; `app_state.view.labels` is false. `C` is
`mouse_gesture {action: "click", button: "right", at: {object: 0, point: [6, -6, 12.8]}}`, a point on the cube's
top away from the diagonal its two top triangles share; `E` is the same right click at the canvas pixel (1000,
150), empty space above the bed.
`OBJECT` is the set of menu items the object menu must list: `Add Part>Cube`, `Add Negative Part>Cylinder`, `Add
Modifier>Cylinder`, `Add Support Blocker>Cube`, `Add Support Enforcer>Cube`, `Delete`, `Printable` and `Auto Drop`.
`DEFAULT` is the empty space's whole menu, in order: `Add Primitive>Cube`, `Add Primitive>Cylinder`, `Add
Primitive>Sphere`, `Add Primitive>Cone`, `Add Primitive>Disc`, `Add Primitive>Torus`, `Add Primitive>Text`, `Add
Primitive>SVG`, the ten handy models `Add Handy models>Orca Cube`, `>OrcaSliced Combo`, `>Orca Badge`, `>Orca
Tolerance Test`, `>3DBenchy`, `>Cali Cat`, `>Autodesk FDM Test`, `>Voron Cube`, `>Stanford Bunny`, `>Orca String
Hell`, then `Add Models` and `Show Labels`.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | `C` | `Cube: Cube part`, printable | `menu()`'s items hold `OBJECT` and not `Add Primitive>Cube` or `Assemble`; `checked` is exactly `[Printable, Auto Drop]`; `dialogs()` `[]`: listing a menu runs nothing |
| 2 | `C` with `popup_item: "add modifier>cylinder"` | `Cube: Cube part + Generic-Cylinder modifier` | reply `ran` is `Add Modifier>Cylinder`: the path is matched ignoring case and named as the menu shows it |
| 3 | `action_run` Undo | `Cube: Cube part` | the menu item's command is one undo step |
| 4 | `action_run` Redo | as after 2 | |
| 5 | `widget_click {target: {menu: "Edit>Undo"}}` | `Cube: Cube part` | reply `clicked` is `Edit>Undo` (its label alone, though macOS shows the key after it) |
| 6 | `widget_click {target: {menu: "Edit>Redo"}}` | as after 2 | reply `clicked` is `Edit>Redo` |
| 7 | `C` with `popup_item: "Printable"` | as after 2, not printable | reply `ran` is `Printable` |
| 8 | `C` | as after 7 | `checked` is exactly `[Auto Drop]`: the listing reads the check item's state |
| 9 | `C` with `popup_item: "Printable"` | as after 2, printable | |
| 10 | `C` with `popup_item: "Add Modifier"` | as after 9 | refused, saying `Add Modifier` is a submenu; its details list `Add Modifier>Cylinder` |
| 11 | `C` with `popup_item: "Add Modifier>Pyramid"` | as after 9 | refused, saying the menu has no item `Add Modifier>Pyramid` |
| 12 | `object_select {none: true}`, then `E` | as after 9 | `selection()` empty after the select; the menu's items exactly `DEFAULT`, no `checked`, no `disabled` |
| 13 | `canvas_png("labels_off")`, then `E` with `popup_item: "Show Labels"`, then `canvas_png("labels_on")` | as after 9 | `app_state.view.labels` true; `labels_on.png` differs from `labels_off.png`: the 3D view draws the cube's label |
| 14 | `E` | as after 9 | `checked` exactly `[Show Labels]` |
| 15 | `E` with `popup_item: "Show Labels"`, then `canvas_png("labels_off_again")` | as after 9 | `app_state.view.labels` false; `labels_off_again.png` differs from `labels_on.png`: the label is gone again |
| 16 | `E` with `popup_item: "Add Primitive>Cylinder"` | as after 9, then `Cylinder: Cylinder part` | `app_state.objects` 2 |
| 17 | `widget_click {target: {label: "Add one filament"}}` | as after 16 | `app_state.presets.filaments` has 2 entries |
| 18 | `project_set_settings {values: {filament_colour: "#FF0000;#0000FF"}}` | as after 16 | `colours()` `#FF0000;#0000FF` |
| 19 | `widget_click {target: {label: "Click to edit preset", index: 0}}` | as after 16 | items exactly `Edit`, `Merge with>F2`, `Decompose Color`, `Delete`, where F2 is the filament of slot 2 as the selector names it; `dialogs()` `[]`; `app_state.tab` `prepare` |
| 20 | the same with `popup_item: "Delete"` | as after 16 | reply `ran` `Delete`; `app_state.presets.filaments` has 1 entry and `colours()` is `#0000FF`: the slot whose button was clicked is the one deleted |
| 21 | `object_select {all: true}`, then `C` | as after 16 | `selection()` objects `[0, 1]` after the select; the items hold `Assemble`, `Align/Distribute>Align left (-X)` and `Delete`, and not `Add Part>Cube`: the menu is the multi-selection's, not one object's |
| 22 | `C` with `popup_item: "Delete"` | none | reply `ran` `Delete`: the multi-selection's Delete removes both objects; `app_state.objects` 0, `closed_menus` `[]`, `dialogs()` `[]` |
**Scenario: rows of the object list**
It starts with the Add Cube action's cube and the sidebar's Global/Objects switch on Objects (`widget_set_value
{target: {class: "SwitchButton", label: "Process"}, value: true}`). The start is checked: `objects()` is `Cube: Cube
part`, printable, on plate 0.
| # | Step | Checked after |
|---|---|---|
| 1 | `widget_list {target: "main", query: "row"}` | `rows()` holds the object list's `Plate 1` and, one level under it, `Cube` |
| 2 | `widget_click {target: {gltoolbar: "addplate"}}` | `plate_list` has 2 plates; `app_state.plates.current` 1 |
| 3 | `widget_click {target: {row: "Plate 1"}}` | reply `selected` `["Plate 1"]`; `app_state.plates.current` 0 |
| 4 | `widget_click {target: {row: "Plate 2"}}` | reply `selected` `["Plate 2"]`; current 1 |
| 5 | `widget_click {target: {row: "Plate 1"}}` | current 0 |
| 6 | `object_select {none: true}`, then `widget_click {target: {row: "Cube"}}` | `selection()` empty after the select; reply `selected` `["Plate 1>Cube"]`; `selection()` objects `[0]`, no parts |
| 7 | `view_set {look_at: [0, 0, 0], zoom: 1}` | `app_state.camera` `look_at` `[0, 0, 0]`, `zoom` 1 |
| 8 | `widget_click {target: {row: "Plate 1>Cube"}, double: true}` | reply `selected` `["Plate 1>Cube"]`; `app_state.camera.look_at` is the centre of the cube's `bbox` from `object_list` to 0.01 mm, and `zoom` above 1: a double click frames the object |
| 9 | `widget_click {target: {row: "Cube"}, button: "right"}` | `menu()`'s items hold `OBJECT`, `checked` exactly `[Printable, Auto Drop]`: the row's menu is the object's |
| 10 | the same with `popup_item: "Add Modifier>Cylinder"` | reply `ran` `Add Modifier>Cylinder`; `objects()` `Cube: Cube part + Generic-Cylinder modifier` |
| 11 | `widget_click {target: {row: "Cube>Generic-Cylinder"}}` | reply `selected` `["Plate 1>Cube>Generic-Cylinder"]`; `selection()` parts `[[0, 1]]` |
| 12 | `widget_click {target: {row: "Cube>Cube"}, modifiers: ["ctrl"]}` | reply `selected` `["Plate 1>Cube>Cube", "Plate 1>Cube>Generic-Cylinder"]`; `selection()` parts `[[0, 0], [0, 1]]` |
| 13 | `widget_click {target: {row: "Cube>Generic-Cylinder"}}` | `selection()` parts `[[0, 1]]`: a right click keeps a selection it is in, so the part is clicked alone first |
| 14 | the same with `button: "right", popup_item: "Change Type>Negative Part"` | reply `ran` `Change Type>Negative Part`; `objects()` `Cube: Cube part + Generic-Cylinder negative` |
| 15 | `widget_click {target: {row: "Plate 1>Cube", column: "Printable"}}` | `objects()` as after 14, not printable |
| 16 | `plate_slice` | plate 0's outcome `empty`, and `plate_list` gives it `sliced` false: the column did what Printable is for |
| 17 | `project_save {path: OUT/rows.3mf}`, `project_new`, `project_open` of the file | `objects()` is `[]` after the new project, then as after 15: the part's type and the printable flag are kept in the project file |
| 18 | `widget_click {target: {row: "Plate 1>Cube", column: "Printable"}}` | `objects()` as after 14, printable |
| 19 | `plate_slice` | plate 0's outcome `ok`; `plate_list` gives it `sliced` true |
| 20 | `app_state` | `dialogs` `[]`, `closed_menus` `[]` |
**Scenario: a dialog's rows, a table, a popup and a drop-down list**
It starts with the Add Cube action's cube, the Objects switch on, and a cylinder modifier added from the cube row's
menu as in the rows scenario. The start is checked: `objects()` is `Cube: Cube part + Generic-Cylinder modifier`,
`app_state.presets.process` is `0.20mm Standard @BBL X1C`, the project's `curr_bed_type` is `Cool Plate`, and
`windows()` holds no `Compare presets`.
| # | Step | Checked after |
|---|---|---|
| 1 | `widget_click {target: {label: "Compare presets"}}` | `windows()` holds `Compare presets`; `dialogs()` `[]`, as it is modeless |
| 2 | `widget_set_value {target: {class: "PresetComboBox", within: "Compare presets", index: 5}, value: "0.12mm Fine @BBL X1C"}` | `rows()` of the window hold the header row `"0.20mm Standard @BBL X1C" vs "0.12mm Fine @BBL X1C"` and, under it, `Quality>Layer height>Layer height` with the value `0.2 \| 0.12`: both presets' values |
| 3 | `widget_click {target: {row: "Quality>Layer height>Layer height", within: "Compare presets"}}` | reply `clicked` holds that path; `rows()` read the row as selected |
| 4 | `keyboard_press {target: {class: "DiffPresetDialog"}, keys: "Escape"}` | `windows()` holds no `Compare presets`; `app_state.presets.process` is still `0.20mm Standard @BBL X1C` and `preset_list` marks no process preset modified: comparing changed nothing |
| 5 | steps 1 to 3 again, then `widget_set_value {target: {label: "Transfer values from left to right", within: "Compare presets"}, value: true}`; then `widget_set_value {value: false}` on each option row `rows()` reads checked, and `widget_set_value {target: {row: "Quality>Layer height>Layer height", within: "Compare presets"}, value: true}` | after the checkbox, `rows()` read every option row checked, as each row's toggle starts on; at the end, the layer height row alone of the option rows reads checked, and the bottom shell layers row (3 against 5) reads unchecked |
| 6 | `widget_click {target: {label: "Transfer", within: "Compare presets"}}` | `windows()` holds no `Compare presets`; `app_state.presets.process` is `0.12mm Fine @BBL X1C` and `preset_list` marks it modified; `settings_get` of the process gives `layer_height` `"0.2"`, the left preset's value, and `bottom_shell_layers` `"5"`, the right preset's own: only the checked row was transferred |
| 7 | `object_select {objects: [0]}`, then `widget_click {target: {row: "Plate 1>Cube"}, button: "right", popup_item: "Edit in Parameter Table"}` | `selection()` objects `[0]`, no parts, after the select; the click replies `blocked_by_dialog`; `dialogs()` `["Object/Part Settings"]` |
| 8 | `widget_list {target: "dialog"}` | the table's rows are `Cube` twice (the object, then its part) and `Generic-Cylinder` once |
| 9 | `widget_click {target: {row: "Generic-Cylinder", within: "Object/Part Settings", column: "Wall loops"}}` | reply `column` `Wall loops`; `selection()` parts `[[0, 1]]`: a cell's click selects its part, as the table tells the object list |
| 10 | `dialog_answer {dialog: {title: "Object/Part Settings"}, button: "close"}` | reply `closed` true; the step 7 job ends without an error; `dialogs()` `[]` |
| 11 | `widget_click {target: {class: "SideButton", index: 3}}` | `widget_list {target: "popup", query: "Export plate sliced file"}` lists exactly 1 node |
| 12 | `widget_click {target: {class: "SideButton", label: "Export plate sliced file"}}` | `widget_list {target: "popup"}` lists no node; `widget_list {target: "main", query: "Export plate sliced file", include_menus: false}` lists exactly 1: the print button shows the mode picked; `dialogs()` `[]` |
| 13 | `widget_click {target: {class: "ComboBox", label: "Smooth Cool Plate"}}` | the popup's rows are exactly, in order, `Smooth Cool Plate`, `Engineering Plate`, `Smooth High Temp Plate`, `Textured PEI Plate`, `Textured Cool Plate`, `Cool Plate (SuperTack)` |
| 14 | `widget_click {target: {row: "Textured PEI Plate"}}` | reply `clicked` `Textured PEI Plate`; the project's `curr_bed_type` `Textured PEI Plate`, and `plate_list` gives plate 0 that type |
| 15 | `project_save {path: OUT/plate_type.3mf}` | `project_file()` of it gives `curr_bed_type` `Textured PEI Plate`: the pick is kept in the project file |
| 16 | `widget_set_value {target: {class: "ComboBox", label: "Textured PEI Plate"}, value: "Smooth Cool Plate"}` | `curr_bed_type` `Cool Plate` |
| 17 | `app_state` | `dialogs` `[]`, `closed_menus` `[]` |
**Scenario: Orca's own web dialogs**
It starts with one filament slot holding `Bambu PLA Basic @BBL X1C` (`filament_delete` until it is refused, then
`preset_select` if the slot holds another), and slot 1's colour set with `project_set_settings {values:
{filament_colour: "#26A69A"}}`. The start is checked: `app_state.presets.filaments` is `["Bambu PLA Basic @BBL
X1C"]`, `colours()` is `#26A69A`, `preferences_get` gives `region` as `""`, and `preset_list {type: "printer"}`
offers exactly `Bambu Lab X1 Carbon 0.4 nozzle`, selected. `HEX` is the locator `{web: "Hex color", within: "Color
Picker"}`; `WIZARD` is `within: "Setup Wizard"`.
| # | Step | Checked after |
|---|---|---|
| 1 | `action_run` Preset Bundle | `blocked_by_dialog`; `dialogs()` `["Preset Bundle"]`; its page lists the elements named `#refresh_btn` and `#close_btn` and the text `Version` and `Update` of its top list's header |
| 2 | `widget_click {target: {css: "#close_btn", within: "Preset Bundle"}}` | reply `closed` true; the step 1 job ends without an error; `dialogs()` `[]` |
| 3 | `widget_click {target: {label: "1", class: "wxBitmapButton"}}`, slot 1's colour | `blocked_by_dialog`; `dialogs()` `["Select Filament"]`; the dialog lists `#26A69A`, the slot's colour |
| 4 | `widget_click {target: {label: "+ More Colors", within: "Select Filament"}}` | `blocked_by_dialog`; `dialogs()` `["Select Filament", "Color Picker"]`, the picker on top |
| 5 | `widget_set_value {target: HEX, value: "FF0000"}` | reply `value` `FF0000FF`; `HEX`'s field lists `FF0000FF` |
| 6 | `mouse_gesture {target: {css: "#spectrum", within: "Color Picker"}, action: "drag", x: 20, y: 20, to: [200, 100], steps: 6}` | reply `done` `drag`; `HEX`'s field lists eight hex digits other than `FF0000FF`: the drag picked another colour |
| 7 | `widget_set_value {target: HEX, value: "3366CC"}` | reply `value` `3366CCFF`; `HEX`'s field lists `3366CCFF` |
| 8 | `widget_click {target: {web: "OK", within: "Color Picker"}}` | reply `closed` true and `dialogs` `["Select Filament"]`; the step 4 job ends without an error; the dialog lists `#3366CC` and no `#26A69A` |
| 9 | `dialog_answer {dialog: {title: "Select Filament"}, button: "cancel"}` | the step 3 job ends without an error; `dialogs()` `[]`; `colours()` `#26A69A`: a cancelled pick changes nothing |
| 10 | steps 3, 4, 7 and 8 again, then `dialog_answer {dialog: {title: "Select Filament"}, button: "ok"}` | `dialogs()` `[]`; `colours()` `#3366CC`: the colour the picker returned is slot 1's |
| 11 | `project_save {path: OUT/colour.3mf}` | `project_file()` of it gives `filament_colour` `["#3366CC"]` |
| 12 | `action_run` Setup Wizard | `blocked_by_dialog`; `dialogs()` `["Setup Wizard"]`; its page lists `Europe` within 30 s |
| 13 | `widget_click {target: {web: "Europe", WIZARD}}` | reply `checked` true; `widget_list` of the wizard lists `Europe` checked |
| 14 | `widget_click {target: {web: "Next", WIZARD}}` | setup only, to reach the printer page; what Next does is `test_web_ui`'s check, and step 15 finds the printer page's card |
| 15 | `widget_click {target: {web: "Nozzle 0.4 Marlin", kind: "button", WIZARD}}` | reply `checked` true; `widget_list` of the wizard lists that card checked |
| 16 | `dialog_answer {dialog: {title: "Setup Wizard"}, button: "close"}` | reply `closed` true; the step 12 job ends; `dialogs()` `[]`; `region` still `""` and the printers as at the start: closing the wizard keeps neither choice |
**To settle in review:**
- The object menu's `checked` for a new cube (menus, step 1; rows, step 9): `Printable` and `Auto Drop`, as an
instance is printable and an object's `auto_drop` starts true (`Model.hpp`); Flush Options' check items show only
when the plate holds two filaments. The object menu (`create_extra_object_menu()`) has no `Assemble`, which the
multi-selection menu adds while only objects are selected (`can_merge_to_multipart_object()`).
- The empty space's menu `DEFAULT` (menus, step 12), from `create_default_menu()` and `handy_models()` in
`GUI_Factories.cpp`, with labels off on a new datadir. Writing it whole makes a new handy model a change to this
entry.
- `Click to edit preset` at index 0 is filament 1's button on every platform (menus, step 19): the printer's button of
that name is hidden until the pointer is over its panel. Its menu is `create_filament_action_menu()`'s, and its
`Delete` is enabled on the X1 Carbon, which shows the multi-material buttons.
- A plate whose only object is not printable slices to `empty` (rows, step 16): `classify_plates()` gives `empty` to a
plate without printable instances. If the slice is refused instead, the step asserts that refusal's code.
- Compare presets (dialog rows, steps 2 to 4): the row value `0.2 | 0.12` (the cells after the label, joined) and the
header row's label. Index 5 is the process preset's right-hand combo, the printer's and filament's coming first and
the SLA material's being hidden. Escape closes the window: a wx dialog's Escape presses its `wxID_CANCEL` button,
which `DiffPresetDialog` has (its `DialogButtons` Cancel), and that button's handler hides the dialog.
- Compare presets' Transfer (dialog rows, steps 5 and 6): the checkbox "Transfer values from left to right" shows
the rows' toggle column and the Transfer button, which is enabled while a row is selected and the process preset
has no unsaved changes; Transfer hides the dialog and the process tab's `transfer_options()` selects the right-hand
preset and gives it the toggled rows' left-hand values (`MainFrame::make_diff_dialog()`, `Tab.cpp`). A row's toggle
starts on (`ModelNode::m_toggle`) and is set as a row's checkbox, which `widget_set_value` takes. The two presets'
values come from the profiles: `layer_height` 0.2 against 0.12, `bottom_shell_layers` 3 (`fdm_process_common`)
against 5 (`fdm_process_single_0.12`).
- A cell's click in the parameter table selects its part in the object list (dialog rows, step 9), as the table's
cell selection calls the object list's `select_items()`. The table lists an object's row and, for an object of
more than one part, a row per part (`construct_object_configs()`).
- A double click frames at once (rows, step 8): the camera's target is set to the selection's box centre in the
click's own handling (`Camera::zoom_to_box()`).
- The Select Filament dialog shows `#26A69A` as hex, not a colour name (web dialogs, step 3), as that colour has no
Bambu colour code; and its OK stores the picked colour as `#3366CC`, in capitals (step 10).
- A new datadir stores no login region, so `preferences_get` reads `region` as `""` (web dialogs, start and step 16).
- The preset bundle page (web dialogs, step 1), from `PresetBundleDialog/index.html`: the Refresh button and the
Close element by their ids, and the top list's column headings as text; its auto-update switch is commented out of
the page, and its bundle lists are empty on a new datadir.
- Two labels' captures differ (menus, steps 13 and 15): the object's label is drawn into the 3D view, which the
canvas capture holds, so turning it on or off changes the picture's bytes.
**Not checked:**
- The refusals of a disabled menu item, an input that opened no menu, a bad column, a row without a checkbox and a
locator that names two rows: unit tests in `tests/slic3rutils/test_mcp_results.cpp` cover them on built menus and
lists.
- The object menu and the multi-selection menu whole: they hold items that depend on the object, the selection and
the slots (Edit Text, cut info, Change Filament, Flush Options, Fix Model), so only the sets named are fixed.
- The menu items only listed, not run (the other add submenus, `Auto Drop`, the handy models, `Add Models`): the
commands behind them are other tests' (`test_every_action` runs the add-primitive and handy-model actions).
- What the labels show: the canvas captures are compared with each other only, so a label drawn wrong but drawn
passes.
- `closed_menus` is checked empty with no control: a call fills it only when it opens a second menu, which the unit
test "a menu opened while a call acts on the UI is listed, run by its path or closed unseen, never shown" covers.
- Editing a parameter table cell: `widget_set_value` sets no table cell, so the GUI tools cannot edit the table.
- Compare presets' transfer to presets of other types, or of more than one value.
- What the print button does in the mode picked: `test_every_action` exports the sliced file through its action.
- The wizard's Next and its navigation: `test_web_ui` checks them. Finishing the wizard, which installs printers and
filaments: the install tests own installs.
- Closing the preset bundle dialog from its page by a script: `test_webview_modal`.
- The colour the spectrum drag picks: the page works it out from the canvas's layout, so only "another valid colour"
is checked.
- How menus, rows and dialogs look: nothing is shown or captured.
## `test_recording`
`test_recording.py` · Python · takes the place of `recording.json`
**Tests:** `recording_start`, `recording_stop` and `recording_encode`: a recording made while the GUI is driven, its
report and its file; a recording a nested `replay_run` starts and never stops, which the replay's end closes;
overlays and the time limit; and encoding asked for at the start, run as a job by the stop, deleting or keeping the
`.mkv`. The recordings are read back from their files, and every encode is checked when the machine has an ffmpeg
with the encoder it needs.
**Reads:** `recording()` gives `app_state.recording`, or none. `mkv(path)` reads a Matroska file the way the app
writes it: its codec id, its video's pixel width and height, its default frame duration, its number of blocks
(frames) and its duration. `mp4(path)` reads an MP4's first sample entry (`hvc1` for H.265, `avc1` for H.264) and
its movie header's duration. `fitted(w, h)` is the video size the app makes of a `w` × `h` capture: scaled down so
its longer side is at most 1920, then each side rounded down to even (`video_size()`). `capture(target)` is the
`width` and `height` `window_screenshot {target, include_image: false}` reports. `ffmpeg()` finds ffmpeg as the app
does: `ORCA_FFMPEG` when set, else `ffmpeg` on `PATH`, else on macOS `/opt/homebrew/bin`, `/usr/local/bin` and
`/opt/local/bin`; then it lists the encoders that ffmpeg has (`-hide_banner -encoders`). Every scenario starts with
`project_new {discard_changes: true}` in the Prepare view, checks that `recording()` is none and `plate_list` gives
one unnamed plate, current, and records into the test's output folder `OUT`.
**Without ffmpeg.** What `ffmpeg()` finds decides each encode. A direct `recording_encode` with the encoder runs its
checks; with ffmpeg but not the encoder it must be refused, saying ffmpeg has no `libx265` (or `libx264`) encoder;
with no ffmpeg it must be refused with the reason the app gives: ffmpeg was not found, or, with `ORCA_FFMPEG` set to
something that is not a file, that `ORCA_FFMPEG` names it. An encode asked for at the start is refused at the start
only when ffmpeg is missing; with ffmpeg but not the encoder, the start and stop succeed and the encode job ends
with the encoder's error. A refusal or an error is checked like any other result, and the file checks the encode
would have had are printed as `SKIP <check>: <why>`, never passed silently. The test's last line names what it could
encode: `encodes checked: h265 yes, h264 no (ffmpeg has no libx264)`. The `Checks` module gains `skip(name, why)`
for this; see **To settle**.
**Scenario: a recording while the GUI is driven**
`MAIN` is `fitted(capture("main"))`, read before step 1.
| # | Step | Checked after |
|---|---|---|
| 1 | `recording_start {save_path: OUT/session.mkv, overwrite: true, captions: true, pointer: true}` | reply `path` `OUT/session.mkv`, `target` `main`, `fps` 10, `captions` true, `pointer` true, `max_seconds` 3600, `width` and `height` `MAIN`; `recording()` has that `path` and `target` `main` |
| 2 | `project_import` of `OrcaCube_v2.drc` | reply `added` 1; `object_list` total 1; `app_state.selection` objects `[0]`, as an import selects what it adds |
| 3 | `mouse_gesture {action: "click", x: 300, y: 200}` | `app_state.selection` empty: a click on empty space deselects |
| 4 | `mouse_gesture {action: "click", at: {object: 0, spot: "top"}}` | `app_state.selection` objects `[0]` |
| 5 | `widget_set_value {target: {label: "Process"}, value: false}`, then `widget_set_value {target: {option: "layer_height"}, value: "0.16"}` | `settings_get` of the process gives `layer_height` `"0.16"` |
| 6 | `keyboard_press {target: {option: "initial_layer_print_height"}, keys: "ctrl+a", text: "0.24"}`, then `keys: "Return"` | `initial_layer_print_height` `"0.24"` |
| 7 | `action_run` Preferences, then `dialog_answer {dialog: {title: "Preferences"}, button: "close"}` | the first replied `blocked_by_dialog` with `Preferences`; its job ends without an error; `app_state.dialogs` `[]` |
| 8 | `plate_slice`, then `project_export {path: OUT/session.gcode, overwrite: true}` | plate 0's outcome `ok`; the G-code's config block holds `; layer_height = 0.16` and `; initial_layer_print_height = 0.24`, and its first two distinct `; Z_HEIGHT:` values are 0.24 and 0.4: the values typed shaped the layers printed |
| 9 | `recording_stop {silent: true}` | reply `ended` `stopped`, `path` `OUT/session.mkv`, `frames` and `written` at least 5, `failed` 0, `seconds` above 1, `capture_ms` above 0, `width` and `height` `MAIN`, `size_bytes` the file's size; `recording()` none. `mkv()`: codec `V_MJPEG`, `MAIN`, default frame duration 100 ms, `written` blocks or one more (the last frame held to the end), duration within 0.1 s of `seconds` |
| 10 | `recording_encode {save_path: OUT/session.mp4, overwrite: true, keep_raw_video_file: true}` | with libx265: reply `path` `OUT/session.mp4`, `source` `OUT/session.mkv`, `codec` `h265`, `encoder` `libx265`, `raw_video_file_deleted` false, `size_bytes` the file's size; `mp4()`: `hvc1`, duration within 0.3 s of step 9's `seconds`; `OUT/session.mkv` is still there. Without: refused as above; no `OUT/session.mp4`, and `OUT/session.mkv` is still there |
**Scenario: a recording a replay starts**
`CANVAS` is `fitted(capture("canvas"))`, read before step 1 in the Prepare view.
| # | Step | Checked after |
|---|---|---|
| 1 | `replay_run` of a replay whose steps are `recording_start {target: "canvas", fps: 5, save_path: OUT/inner.mkv, overwrite: true}` (with the expects `/target` `canvas` and `/fps` 5), `view_set {camera: "iso"}` and a `mouse_gesture` drag from (400, 300) to (500, 340) | reply `passed` true, no `unfinished_recording`; `recording()` none: the recording ended with the replay |
| 2 | `recording_stop {silent: true}` | reply `ended` `run_ended`, `path` `OUT/inner.mkv`, `written` at least 1, `failed` 0, `width` and `height` `CANVAS`; `mkv()`: `CANVAS`, default frame duration 200 ms (5 fps), `written` blocks or one more |
| 3 | `recording_stop {silent: true}` | refused, `No recording is running`: an ended recording is reported once; `recording()` none |
| 4 | `recording_encode {overwrite: true, codec: "h264"}` | with libx264: reply `path` `OUT/inner.mp4`, `source` `OUT/inner.mkv` (the session's last finished recording), `encoder` `libx264`, `raw_video_file_deleted` true; `OUT/inner.mkv` is gone and `mp4()` gives `avc1`. Without: refused as above; no `OUT/inner.mp4`, and `OUT/inner.mkv` is still there |
| 5 | `recording_start {save_path: OUT/inner.mkv, overwrite: true}` | it starts: reply `captions` false and `pointer` false, by default; `recording()` has `OUT/inner.mkv`: the replay's end released the file |
| 6 | `recording_stop {silent: true}` | `ended` `stopped`; `recording()` none |
**Scenario: overlays and the time limit**
| # | Step | Checked after |
|---|---|---|
| 1 | `recording_start {save_path: OUT/plain.mkv, overwrite: true, pointer: true}` | reply `captions` false, `pointer` true; `recording()` has `OUT/plain.mkv` |
| 2 | `recording_stop {silent: true}` | `ended` `stopped`; `recording()` none |
| 3 | `recording_start {save_path: OUT/plain.mkv, overwrite: true, captions: true}` | reply `captions` true, `pointer` false; `recording()` has `OUT/plain.mkv` |
| 4 | `recording_stop {silent: true}` | `ended` `stopped`; `recording()` none |
| 5 | `recording_start {save_path: OUT/short.mkv, overwrite: true, max_seconds: 2}` | reply `max_seconds` 2; `recording()` has `OUT/short.mkv` |
| 6 | wait up to 10 s for `recording()` to be none | the recording ended on its own; a wait that runs out fails |
| 7 | `recording_stop {silent: true}` | reply `ended` `max_seconds`, `seconds` within 0.5 of 2; `mkv()`'s duration within 0.1 s of `seconds`: the limit is what ended it |
| 8 | `recording_start {save_path: OUT/wrong.avi}` | refused, saying `save_path must end with .mkv`; `recording()` none; no `OUT/wrong.avi` |
The default limit of an hour is step 1 of the first scenario (`max_seconds` 3600).
**Scenario: an encode asked for at the start**
| # | Step | Checked after |
|---|---|---|
| 1 | `recording_start {save_path: OUT/encoded.mkv, overwrite: true, encode: true, encode_preset: "compatible", crf: 30}` | reply `encode` is `{codec: h264, crf: 30, speed: medium, profile: high, keep_raw_video_file: false}`; `recording()` has `OUT/encoded.mkv`. With no ffmpeg: refused, saying `Cannot encode: ` and the reason above, `recording()` none and no `OUT/encoded.mkv`; the rest of the scenario is printed as `SKIP` |
| 2 | `recording_stop {silent: true}` | reply `path` `OUT/encoded.mkv`, `ended` `stopped`, and an `encode`: either `status` `running` with a `job`, or the encode's own result or error when it finished first; `recording()` none |
| 3 | `app_wait {for: "job", job}` when step 2 gave a job; otherwise step 2's `encode` is the result checked | with libx264: the result has `path` `OUT/encoded.mp4`, `encoder` `libx264`, `raw_video_file_deleted` true; `OUT/encoded.mkv` is gone, `mp4()` gives `avc1` and a duration within 0.3 s of step 2's `seconds`. With ffmpeg but not libx264: the result is an error saying ffmpeg has no `libx264` encoder; `OUT/encoded.mkv` is still there and there is no `OUT/encoded.mp4` |
| 4 | `recording_start {save_path: OUT/kept.mkv, overwrite: true, encode: true, encode_preset: "compatible", keep_raw_video_file: true}` | reply `encode.keep_raw_video_file` true; `recording()` has `OUT/kept.mkv` |
| 5 | `recording_stop {silent: true}` | an `encode`, a job or a result as in step 2; `recording()` none |
| 6 | `app_wait {for: "job", job}` when step 5 gave a job; otherwise step 5's `encode` is the result checked | with libx264: `raw_video_file_deleted` false; `OUT/kept.mkv` and `OUT/kept.mp4` both there, `mp4()` `avc1`. With ffmpeg but not libx264: the same error; `OUT/kept.mkv` is still there and there is no `OUT/kept.mp4` |
**To settle in review:**
- How a missing ffmpeg shows in the sweep. The proposal: `Checks.skip(name, why)` prints `SKIP <name>: <why>` and
counts it, and `run_sweep.py` adds the count of a passing test's `SKIP` lines to its result line (`passed, 9
skipped`), so a sweep on a machine without ffmpeg says so without reading the log. The other choice is an
environment variable that turns the encode `SKIP`s into failures on a machine that must have ffmpeg. Either is a
change to the harness, not to the app.
- A recording's first frame is the size `window_screenshot` captures of the same target (`MAIN`, `CANVAS`): both
capture the window, or the 3D view, in physical pixels; the recorder then fits the capture with `video_size()`.
- The file holds `written` blocks or one more (first scenario, step 9): closing the sink writes the last frame again
at the end time when the recording ran past it.
- A recording that reached its limit is reported by the next `recording_stop` with `ended` `max_seconds` (overlays,
step 7), as `recording_stop`'s description says; the reason is set when the timer ends it, before the stop.
- The stop's `encode` (encode, steps 2 and 5) is nearly always `running` with a job, with or without the encoder: the
stop starts the encode with no reply budget. `McpCore` checks for a finished job before the budget, so an encode
that ended first comes back as its result or error, and the test takes either.
- The `seconds` an encode reports and the MP4's duration: within 0.3 s of the recording's, as the encode keeps the
frames' timing; the tolerance is a proposal.
- The G-code of the X1 Carbon holds the config block and marks each layer with `; Z_HEIGHT: <z>` (first scenario,
step 8): both are written for Bambu Lab printers (`GCode.cpp`).
**Not checked:**
- The frames' pixels: the captions and the pointer are drawn into MJPEG frames that the sweep's Python cannot decode
without an image library. Their drawing is unit-tested in `tests/slic3rutils/test_mcp_recording.cpp` ("the caption
is centred at the bottom with its spans in their roles' colours", "the pointer's ring leaves what it circles
uncovered").
- The exact number of frames and the capture time: they depend on the machine's speed, so `frames`, `written` and
`capture_ms` have lower bounds, and the file is checked to agree with the report.
- The person's forms (the Start Recording dialog, the Stop Recording action): `test_every_action` runs both.
- What `speed`, `profile` and `crf` do to the MP4: the ffmpeg command lines are unit-tested ("the ffmpeg command takes
the speed and profile, and main10 encodes 10 bits").
- `job_cancel` of an encode, a write error and the size limit: the sink's unit tests cover write errors.
- A recording ending when a script ends or the server is turned off: only a replay's end is tested.
## `test_call_forms`
`test_call_forms.py` · Python, launched with the Design tab (`"cad": true`) · takes the place of `agent_forms.json`
and `actions_ask.json`
**Tests:** The forms a call takes. Names and value shapes agents send in place of the schema's (a lone path for
`paths`, `object` and a string index for `objects`, `action` and an action's short name for `id`, a camera direction
as `view_set`'s `canvas`, `key` for `keys`, `plate` as a string, legend rows in another case or with `_`, a gizmo by
its toolbar title in any case, `app_wait` with no condition, `project_export` without `format`), each shown by what
the call did; `settings_list` leaving meta out of a whole listing. And a call with exactly an action's arguments
doing what a person's pick does: `calibration_generate_test {test}` asking in the test's dialog where `silent` asks
nothing, View: Top turning the camera of the view shown, Deselect All closing the open gizmo too, Go to layer
through `action_run`, and `plate_slice {preview: true}`.
**Reads:** `objects()` gives each object from `object_list` as its name, plate, first instance's `offset` and
`bbox`. `selection()` gives `app_state.selection` as `{objects, parts}`, or empty. `camera()` gives
`app_state.camera`'s `elevation`, `azimuth`, `look_at` and `zoom`. `legend()` gives `plate_slice_stats {include:
["view"]}`'s `view.legend`. `modified()` gives the printer, process and filament presets `preset_list` marks
modified. `stl(path)` reads a binary STL's triangle count and size. Every scenario starts with `project_new
{discard_changes: true, preset_changes: "discard"}` in the Prepare view, an auto-answer rule for the restore prompt
(No) registered, and checks that `objects()` is `[]`, `app_state.dialogs` `[]` and `plate_list` one unnamed plate,
current. `CUBE` is `resources/handy_models/OrcaCube_v2.drc`; `OUT` is the test's output folder.
**Scenario: names and values agents send**
| # | Step | Checked after |
|---|---|---|
| 1 | `project_import {paths: CUBE}`, a lone path | reply `added` 1; `objects()` names `[OrcaCube_v2.drc]` |
| 2 | `project_import {paths: [CUBE]}` | names `[OrcaCube_v2.drc, OrcaCube_v2.drc]` |
| 3 | `object_select {objects: [0]}` | `selection()` objects `[0]` |
| 4 | `object_select {object: "1"}` | `selection()` objects `[1]` |
| 5 | `object_rename {name: "renamed"}` | reply `ran` `object_rename`; names `[OrcaCube_v2.drc, renamed]`: the selected object was renamed |
| 6 | `action_run {action: "view_top"}` | reply `ran` `orca_command:view_top:orca`; `camera()` elevation 90 to 0.1° |
| 7 | `view_set {canvas: "front"}` | reply `camera` `front`; `camera()` elevation 0 and azimuth -90, to 0.1° |
| 8 | `object_transform {object: 0, position: [100, 110, 0]}`, the same for object 1 | both `offset`s x 100 and y 110 to 0.01 mm: the two objects overlap |
| 9 | `object_select {objects: [0]}`, then `keyboard_press {key: "Escape", target: {name: "OrcaSceneCanvas"}}` | `selection()` objects `[0]` after the select, then empty: the key reached the 3D view as `keys` |
| 10 | `action_run` Preferences | reply `blocked_by_dialog`; `app_state.dialogs` `["Preferences"]` |
| 11 | a second client calls `app_wait {}`; this client waits (up to 10 s) until `replay_export`'s `left_out_running` is `[{tool: "app_wait"}]`, waits one second, reads `replay_export` and `app_state` again, then calls `dialog_answer {dialog: {title: "Preferences"}, button: "close"}` | a second after the wait was first seen unfinished, `left_out_running` is still `[{tool: "app_wait"}]` and `app_state.dialogs` still `["Preferences"]`: with no condition the wait does not return while a dialog is open. After the answer, the wait replies `satisfied` true with `waited_ms` at least 1000, `replay_export` has no `left_out_running`, and `app_state.dialogs` is `[]`. The two replies' order is not checked |
| 12 | `object_select {objects: [0]}`, then `widget_click {target: {gizmo: "Support Painting"}}` | `selection()` objects `[0]` after the select; reply `gizmo` `FdmSupports`, `active` true; `app_state.gizmo.name` `FdmSupports` |
| 13 | `widget_click {target: {gizmo: "support painting"}}` | reply `active` false; `app_state.gizmo` null |
| 14 | `object_arrange {plate: "0"}` | both objects on plate 0, their `bbox` footprints apart and inside plate 0's rectangle (`origin` and `size` from `plate_list`) |
| 15 | `plate_slice {plate: "0"}` | reply `plates` `[{index: 0, outcome: ok}]`; `plate_list` gives plate 0 `sliced` true |
| 16 | `view_set {tab: "preview", legend: {sparse_infill: false, Travel: false, "Prime tower": false, Pauses: false}}` | reply `legend` exactly `{"Sparse infill": false, "travel": false}`: rows this print lacks are left out, not refused; `legend()` gives `features["Sparse infill"]` false and `options["travel"]` false |
| 17 | `view_set {legend: {"Sparse infill": true, travel: true}}` | `legend()` gives both true |
| 18 | `view_set {tab: "prepare"}`, then `project_export {path: OUT/forms.gcode, overwrite: true}` | `app_state.tab` `prepare`; reply `export` `ok`; the file starts with `; HEADER_BLOCK_START`: the format came from the path |
| 19 | `project_export {path: OUT/forms.stl, overwrite: true}` | reply `objects` `[0, 1]` and `bytes` the file's size; `stl()`: its triangle count is the sum of the two objects' parts' `triangles` from `object_list`, and its size 84 + 50 × that count |
| 20 | `settings_list {type: "process", limit: 5}` | 5 items, each with a `value` and none with `meta` |
| 21 | `settings_get {type: "process", keys: ["wall_loops"]}` | `items[0].meta.type` `int` |
**Scenario: a test's dialog, asked or silent**
The start also checks that `app_state.project.name` is `Untitled` and `modified()` is empty.
| # | Step | Checked after |
|---|---|---|
| 1 | `calibration_generate_test {test: "temperature"}` | reply `status` `blocked_by_dialog`; `app_state.dialogs` `["Temperature calibration"]` |
| 2 | `dialog_answer {dialog: {title: "Temperature calibration"}, button: "cancel"}` | the step 1 job ends without an error; `app_state.dialogs` `[]`; `objects()` `[]`, `project.name` `Untitled`, `project.dirty` false and `modified()` empty: Cancel changes nothing |
| 3 | `calibration_generate_test {test: "temperature", silent: true, discard_changes: true, preset_changes: "discard"}` | reply `test` `temperature`, `names` `[temperature_tower.drc]`; `objects()` names `[temperature_tower.drc]`; `project.name` `Nozzle temperature test`; `app_state.dialogs` `[]`: silent asks nothing |
**Scenario: the shown view's camera and selection, and a slice shown in the Preview**
It starts with `CUBE` imported and sized to 20 mm (`object_transform {object: 0, size: [20, 20, 20]}`). The start
is checked: `objects()` is one object, on plate 0, `bbox.size` `[20, 20, 20]` to 0.01 mm.
| # | Step | Checked after |
|---|---|---|
| 1 | `view_set {tab: "prepare", camera: "front"}` | `app_state.tab` `prepare`; `camera()` elevation 0 to 0.1° |
| 2 | `view_set {tab: "design", camera: "front"}` | reply `camera_state.elevation` 0 to 0.1°; `app_state.tab` `design`, `camera()` elevation 0 |
| 3 | `action_run {id: "view_top"}` | reply `ran` `orca_command:view_top:orca` and `camera_state.elevation` 90 to 0.1°; `app_state.tab` `design`, `camera()` elevation 90 |
| 4 | `view_set {tab: "prepare"}` | `app_state.tab` `prepare`; `camera()` elevation 0: View: Top turned the Design tab's camera, the view shown, and not the Prepare view's |
| 5 | `object_select {objects: [0]}`, then `widget_click {target: {gizmo: "Support Painting"}}` | `selection()` objects `[0]`; `app_state.gizmo.name` `FdmSupports` |
| 6 | `action_run {id: "deselect_all"}` | reply `ran` `orca_command:deselect_all:orca`, `empty` true, `canvas` `3d`; `selection()` empty and `app_state.gizmo` null: Deselect All closes the open gizmo too |
| 7 | `plate_slice {preview: true}` | reply `status` `done`, plate 0's outcome `ok`; `app_state.tab` `preview`; `plate_list` gives plate 0 `sliced` true |
| 8 | `action_run {id: "go_to_layer", args: {percent: 50}}` | `plate_slice_stats {include: ["view"]}` gives `view.layer_count` 100 and `view.layers` `[1, 51]`: the top of the shown range moves to layer round(0.5 × 99) + 1 and its bottom stays |
**To settle in review:**
- Escape in the 3D view clears the selection (names, step 9): the canvas's key handling deselects all on Escape.
- Two clients' calls run at once (names, step 11): `app_wait` waits off the UI thread, so `dialog_answer` from
another client goes through while it waits, as `test_web_ui`'s second client's calls do during a dialog's close.
`app_wait` runs inline and makes no job, but it is journaled (`wait.journal`) from the moment `McpCore` admits it,
so `replay_export` lists it under `left_out_running` until it replies (`Journal::to_replay()`); the Preferences
action's call, which replied `blocked_by_dialog`, is kept in the replay and is not listed there.
- An imported `.drc` keeps its extension in its object's name (names, step 1), as `temperature_tower.drc` does in
the calibration replay.
- The Design tab's camera is its own (shown view, step 4): `test_set_view_camera` finds the Design zoom apart from
the Prepare view's, so View: Top there leaves the Prepare view's elevation at 0.
- A new project is named `Untitled` (dialog, start and step 2), the name the Plater gives a project without a file.
- The temperature dialog's Cancel ends its job without an error (dialog, step 2), as the replay's wait on the job
passes today; the reply's fields are not fixed.
- Deselect All closes the open gizmo (shown view, step 6), as `object_select`'s description says of `none`, which the
action's arguments are.
- The 20 mm object slices to 100 layers at the X1 Carbon's 0.2 mm first and other layers, and Go to layer 50 % shows
layers 1 to 51 (shown view, step 8): `show_layer_percent()` takes the top to `lround(0.5 × 99) + 1`.
**Not checked:**
- The normaliser's rules on their own (aliases, value forms, enum moves, the window pairs): unit tests in
`tests/automation/test_mcp_protocol.cpp`. This test shows only that the forms work on the real schemas.
- Go to tab through `action_run`, the Slice and Preview action, and Deselect All's clearing of the selection alone:
`test_every_action` checks each one's effect. Speed Dial picks of View: Top, Deselect All and Go to layer:
`test_person_forms`.
- The silent calibration's parameters and preset changes, and the dialog's OK: the calibration tests and
`test_every_action`'s `calib_temp`.
- That a legend row a print lacks is never shown: no print here has a prime tower or a pause, so the reply's lack of
`Prime tower` and `Pauses` has no control. An unknown row's refusal is `test_set_view_preview`'s.
- Deselect All while the Design tab or the assemble view is shown.
- The G-code's content beyond its first line: names, step 18, checks only which format the path chose.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `context_menus`
`tests/context_menus.json` · replay, 34 steps, 19 expects, 0 optional
**Tests:** Context and button menus listed or run by path (`mouse_gesture`/`widget_click` with `popup_item`) without ever being shown: the object menu on a cube, the empty-bed menu, a preset edit button's menu, the multi-selection menu, and the Edit menu's Undo and Redo picked as `Edit>Undo`/`Edit>Redo`.
**Decides by:** Fails when a call errors or one of its 22 matchers misses.
- Object menu: the listing contains `Add Modifier>Cylinder` and checked contains `Printable`; running it gives `/ran` = the path and an `object_list` part 1 of type `modifier`; undo removes it and redo restores it, both through the action and the Edit menu items (`/clicked` = path).
- Empty bed: the listing contains `Add Primitive>Cube`; running `Add Primitive>Cylinder` leaves `app_state /objects` = 2.
- Button menu: `Click to edit preset` index 0 gives a non-empty `/popup_menu/items`; no dialog open, tab still `prepare`.
- Multi-selection: the listing contains `Align/Distribute>Align left (-X)` and `Delete`; running `Delete` leaves 0 objects and `closed_menus` empty.
**Not checked:**
- The button menu is checked only as non-empty; which button's menu opened and what it lists are not.
- Each listing is matched by one known item (`contains`); missing or wrong other items pass.
- `widget_click {label: "Add one filament"}` has no expect (it matters only on Linux).
**Strength:** Strong — every item run is checked by its effect on the model, and every listing by a known item.
### `rows`
`tests/rows.json` · replay, 54 steps, 28 expects, 0 optional
**Tests:** Rows of lists, trees and tables as `widget_click` targets and popups as `widget_list` roots: object list plate, object and part rows (Ctrl-click, the Printable column, a double click), menus run from rows, Compare presets' data view rows, the object settings table, the print button's popup, and the plate-type drop-down list.
**Decides by:** Fails when a call errors or one of its 30 matchers misses.
- Plate rows: `/selected` = `["Plate 2"]` and `app_state` current plate 1, then back to 0.
- Object and part rows: `/selected` exact for a click and a Ctrl-click; row menus list and run `Add Modifier>Cylinder` and `Change Type>Negative Part`, read back as part types in `object_list`.
- Printable column: `printable` false, then true; the double click's `/selected` exact.
- Compare presets: `/clicked` contains the `Quality>Layer height>Layer height` path.
- Parameter table: the dialog opens, lists one `Generic-Cylinder` node, a `Wall loops` cell click returns `/column` = `Wall loops`, and `dialog_answer` closes it.
- Print button popup: exactly one "Export plate sliced file" node in the popup, none after the pick, one on the main window.
- Drop-down: ≥ 2 rows; picking `Textured PEI Plate` gives `/clicked` exact and one main-window node with that text; set back, one with "Smooth Cool Plate"; no dialog open, no unseen menu.
**Not checked:**
- Compare presets: the second preset (`widget_set_value` index 5) has no expect, neither preset's values are read, and Escape closing it is not checked (the final `/dialogs` check lists modal dialogs only; Compare presets is modeless).
- The parameter table being read-only is not tested; only a cell click.
- The double click's framing of the object is not checked.
- The plate type is checked by counting widgets with its text, not by reading `curr_bed_type`.
**Strength:** Partial — tree rows and their menus are checked by effect, but the Compare presets and table sections mostly check that the click resolved.
### `web_dialogs`
`tests/web_dialogs.json` · replay, 30 steps, 17 expects, 0 optional
**Tests:** Orca's own web dialogs driven only through the generic GUI tools: the preset bundle dialog closed by its page's button; the colour picker behind a filament swatch's "+ More Colors" (hex field set, spectrum canvas dragged, colour returned to the native Select Filament dialog); and the setup wizard's first steps (a region, Next, a printer card).
**Decides by:** Fails when a call errors or one of its 19 matchers misses.
- Preset bundle: the dialog opens, its page lists > 2 nodes, `#close_btn` gives `/closed` = true, the job ends, no dialog left.
- Colour picker: hex `FF0000` reads back `/value` = `FF0000FF` and is listed; the drag gives `/done` = `drag`, after which nothing reads `FF0000FF`; OK gives `/closed` = true with "Select Filament" on top; then no node reads `#26A69A`; Select Filament is cancelled and no dialog is left.
- Wizard: `Europe` `/checked` = true; Next `/navigated` = true with URL containing `/guide/21/`; the printer card `/checked` = true; closed, no dialog left.
**Not checked:**
- The colour returned to Select Filament is never read; the only check is that `#26A69A` is absent, and no step shows that text was listed before (the preview label may show a colour name instead), so it may pass whatever comes back.
- After the drag, `FF0000FF` being absent passes for any change of the hex field.
- Closing the wizard is not checked to leave the region and printer choice unapplied, nor cancelling Select Filament to leave slot 1's colour unchanged.
**Strength:** Partial — each control's own reply is checked, but the colour round trip's result is not.
### `recording`
`tests/recording.json` · replay, 42 steps, 28 expects, 11 optional
**Tests:** `recording_start`, `recording_stop` and `recording_encode`: a recording made while the GUI is driven (clicks, a typed setting, the Preferences dialog, a slice), stopped and encoded to H.265; a recording a nested `replay_run` starts and never stops, which that replay's end closes, encoded to H.264; overlay defaults (`captions`, `pointer`); the one-hour default limit; and encoding asked for at start, run as a job on stop, deleting or keeping the `.mkv`.
**Decides by:** Fails when a non-optional call errors or a non-optional step's matcher misses.
- Start: `/width` ≥ 320, `/fps` = 10, `captions`/`pointer` as asked; `app_state /recording/path` ends in `session.mkv`.
- Stop: `/ended` = `stopped`; `frames` and `written` ≥ 5; `seconds` > 1; `size_bytes` and `capture_ms` > 0; `app_state` then has no `/recording`.
- Nested replay: `/passed` = true with no `unfinished_recording`; the next stop reports `/ended` = `run_ended` for `inner.mkv`; recording to that path again starts at once.
- Overlays and limit: without flags both are false; each flag turns on only its own overlay; `/max_seconds` = 3600.
**Not checked:**
- Every encode step is optional (both `recording_encode` calls and all nine steps of the encode-on-stop section), so H.265/H.264 encoding, the encode job, and deleting or keeping the `.mkv` can fail without failing the test, with or without ffmpeg.
- Captions and pointer are checked only as flags in the start reply; no frame is inspected.
- The driven GUI steps (`mouse_gesture`, `widget_set_value` layer height 0.16, `keyboard_press` 0.24) have no expect, and the settings are never read back.
- Frame counts, duration and size are lower bounds only.
**Strength:** Partial — start, stop and the replay-owned recording are checked, but encoding is entirely optional.
### `agent_forms`
`tests/agent_forms.json` · replay, 27 steps, 17 expects, 0 optional
**Tests:** The argument normaliser: names and value shapes agents send in place of the schema's (a lone path for `paths`, `object` with a string index, `action` for `id`, an action by its short name, `canvas` for a camera direction, `position`, `key`, `plate` as a string, legend rows in another case or with `_`, a gizmo by its toolbar title in any case, `app_wait` with no condition, `project_export` without `format`), and `settings_list` leaving meta out of a whole listing.
**Decides by:** Fails when a call errors (the schemas are closed, so an alias that stopped working is an "unknown argument" error) or one of its 25 matchers misses.
- Objects: both `project_import` forms `/added` = 1; after `object_select {object: "1"}` and `object_rename`, object 1 is named "renamed" and object 0 is not; `object_transform {position}` lands at offset 100 ± 0.01, 110 ± 0.01.
- Actions and camera: `action_run {action: "view_top"}` `/ran` = `orca_command:view_top:orca`; `view_set {canvas: "front"}` `/camera` = `front`; `app_wait {}` `/satisfied` = true.
- Gizmo: `{gizmo: "Support Painting"}` opens `FdmSupports` (reply `/gizmo`, `/active`, and `app_state /gizmo/name`); the lower-case title closes it (`/active` = false).
- Slice and export: `plate_slice {plate: "0"}` outcome `ok`; the `.gcode` export without `format` `/export` = `ok`.
- Legend: `/legend/Sparse infill` and `/legend/travel` = false after hiding them as `sparse_infill` and `Travel`.
- Settings: `settings_list` `/items/0/value` exists and `/items/0/meta` does not; `settings_get` `/items/0/meta/type` exists.
**Not checked:**
- `object_select {object: "1"}`: the second import leaves object 1 selected already, so the rename check passes even if the select does nothing.
- `keyboard_press {key: "Escape"}` and `object_arrange {plate: "0"}` are accepted but their effect is never read.
- The `.stl` export has no expect; the format inferred from the path is not read from the reply or the file.
- `/legend/Prime tower` `exists: false` cannot fail: the reply lists only rows this single-colour print has. `Pauses` is not read at all.
- The second legend `view_set` (rows shown again) reads back `Sparse infill` only, not `travel`.
**Strength:** Partial — most forms are proven by a read-back, but `key`, `plate` for arrange and the STL format are only accepted, not checked for effect.
### `actions_ask`
`tests/actions_ask.json` · replay, 33 steps, 19 expects, 0 optional
**Tests:** That a call with exactly an action's arguments does what a person's pick does (run with the Design tab on): `calibration_generate_test {test}` opens the test's dialog while `silent` runs with defaults; View: Top turns the Design tab's camera; Deselect All clears the shown view's selection; Go to tab and Go to layer take their value through `action_run`; `plate_slice {preview: true}` and Slice and Preview slice and switch to the Preview.
**Decides by:** Fails when a call errors or one of its 32 matchers misses.
- Asking: the un-awaited `calibration_generate_test {test: temperature}` returns `/status` = `blocked_by_dialog`; `dialog_answer` must find "Temperature calibration"; the job must end without error.
- Silent: `/test` = `temperature`; `object_list` `/total` ≥ 1.
- Design camera: `view_set` front gives `/camera_state/elevation` in [-5, 5]; `view_top` `/ran` = full id with elevation ≥ 85, and `app_state` shows tab `design` and elevation ≥ 85.
- Deselect All: `object_select` `/objects` = [0]; `deselect_all` `/empty` = true, `/canvas` = `3d`; `app_state /selection/empty` = true.
- Go to: `/tab` = `preview` in the reply and `app_state`; after `go_to_layer {percent: 50}`, `plate_slice_stats` `/view/layer_count` in [90, 110] and `/view/layers/1` in [45, 56].
- Slice actions: `/status` = `done`, outcome `ok`, and `app_state /tab` = `preview`, for both.
**Not checked:**
- Cancel in the temperature dialog: nothing checks that no test model was added or presets changed (the next step replaces the project anyway).
- The silent run's model is checked as `/total ge 1` and a name that `exists`; the known single `temperature_tower.drc` is not compared.
- `layer_count` 90–110 is looser than the known 100 layers of a 20 mm cube at 0.2 mm.
**Strength:** Partial — each action's main effect is read back, but the Cancel path and the silent run's model are not.

View file

@ -0,0 +1,704 @@
# Objects
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
Two tests take the place of the object replays. One entry would hold seventeen scenarios and some 190 steps, more
than one review can check value by value against the code. They split where their checks do: `test_objects` measures
where objects stand and how many there are (places in mm, instances, arrangements, the print's copies), and
`test_object_structure` reads what objects are made of and how the list orders them (parts and their types, names,
order, meshes and the files they come from). What each replaced replay checks goes to these tests as follows:
| Replay | Where its checks go |
|---|---|
| `menu_items_objects.json` | instances and Set as Individual Objects: `test_objects`, the number of instances; rename, delete and the layer commands on the selection: `test_object_structure`, renaming and deleting |
| `menu_items_placement.json` | `test_objects`: adding a shape; placing objects |
| `menu_items_structure.json` | `test_object_structure`: splitting and assembling; ordering |
| `objects_state.json` | Printable: `test_objects`, leaving instances out of the print; Auto Drop: `test_objects`, moving an instance; Fix Model: `test_object_structure`, repairing a mesh |
| `objects_order.json` | `test_object_structure`: ordering |
| `objects_files.json` | Clone: `test_objects`, cloning; Reload from disk, Replace 3D file and keep_painting: `test_object_structure`, files a part comes from, and painting kept through a mesh change |
| `scene.json` | instance and part moves, the selection, Mirror, shapes, Arrange and Fill bed, instances: `test_objects`; `part_add`, Change Type, Rename, Assemble, Order By: `test_object_structure` |
| `ops_set_instance_count.json` (removed) | `test_objects`, the number of instances |
| `ops_start_arrange.json` (removed) | `test_objects`, arranging and filling the bed |
## `test_objects`
`test_objects.py` · Python · takes the place of `menu_items_placement.json`, and with `test_object_structure` of
`menu_items_objects.json`, `objects_state.json`, `objects_files.json` and `scene.json`; covers what the removed
`ops_set_instance_count.json` and `ops_start_arrange.json` recorded · in `sweep.json` as
`{"path": "test_objects.py"}`
**Tests:** Where objects stand and how many there are: adding a shape at a size, a place, a plate and a name; moving,
turning and scaling an instance, moving it to another plate, and what Auto Drop does to a move; moving and scaling a
part; what the selection says; Mirror, Drop to Bed, Center, Scale to Fit and Auto-Orient; the number of instances and
Set as Individual Objects; Arrange and Fill bed; Clone; and leaving instances out of the print. Each command is called
by index and, where its menu item acts on the selection, with no target on the selection. It runs on the harness's
default printer, the Bambu Lab X1 Carbon 0.4: a bed 256 mm square and 250 mm high, with an excluded area of
18 × 28 mm at its front left corner (`bed_exclude_area`), and plates laid out 307.2 mm apart (the bed and a fifth of
it), two to a row.
**Files:** The test writes into a folder of its own, `W` (`tempfile.mkdtemp()`), the project it saves and the G-code
files it exports. It does not use `tests/fixtures/objects_files.py`, which leaves with `objects_state.json` and
`objects_files.json`; `tests/fixtures/ops_undo.py` stays for `test_menu_items_refusals.py`. Undo steps are counted by
undoing them and reading the state back, not from the log.
**Reads:** `plates()` as `test_plates` reads it. New readers in `checks.py`:
- `scene()`: each object of `object_list` in index order, its entry whole (`name`, `id`, `filament`, `auto_drop`,
`bbox`, `mesh_errors`, `parts`, and `layer_config_ranges` and `layer_height_profile` when it has them), with its
`instances` gathered from every plate and from `outside`, each given its `plate` (−1 outside). A part is its entry
whole: `name`, `id`, `type`, `subtype`, `filament`, `position`, `rotation_deg`, `scale`, `mirrored`, `triangles`,
`mesh_volume`, `scaled_volume`, `bbox`, `painted`, `svg`. It sits beside `test_plates`' `objects()`, which gives only
each object's name and plate.
- `selection()`: `app_state`'s `selection` as `{objects, instances, parts}`, `parts` absent when whole instances are
selected.
- `corner(p)`: plate p's `origin` from `plate_list`, and `rect(p)`: its `origin` and `size`.
- `gcode_prints(path)`: the `; printing object <name> id:<n> copy <c>` comments of a G-code file, as the names in the
order they first print, each with the number of different `id`, `copy` pairs printed under it: its copies
(`gcode_label_objects` is on in the X1C's process).
- Geometry on `bbox`: an instance's square is its `bbox` in x and y; two squares are apart when they do not overlap;
a square is inside plate p when it lies within `rect(p)`; the gap between two squares is their distance along the
axis on which they are apart.
Every scenario starts with `project_new {discard_changes: true}` in the Prepare view and checks that `plates()` is
`"" 0 *` and that there are no objects; a `project_new` within a scenario is followed by the same check.
In the tables `plates()` is written as in `test_plates`; a table without a plates column says in its introduction what
`plates()` is after every step, and one without an objects column says what its objects are. The objects are listed in index order between `·`, each as
its name, `@` and the plate its instances stand on, and `×n` when it has n instances: `a@0×3` · `b@0` is object 0
named a with three instances on plate 0, then object 1 named b with one. An object the tables call by a name of its
own (first, block, a, kept and so on) is added with `name` set to it; Cube, a shape's own name, is added without one.
After every step the names, plates and
instance counts of `scene()` are compared with the row whole. A place is written `+(x, y)`: an instance's `offset`
x and y measured from the corner of the plate it stands on, checked to 0.001 mm (a part's place is its `position`,
written the same way with its z). An instance keeps the place the table last gave it until a row gives it another, or
says that the app places it, after which the row says what that place must hold. Unless a row says otherwise, an
instance has `rotation_deg` `[0, 0, 0]`, `scale` `[1, 1, 1]`, `mirrored` false and `printable` true and rests on the
bed (`bbox.min` z 0 to 0.001), and its object has `auto_drop` true; what a row changes holds until a later row changes
it again. After every step these values and every place the table fixes are compared for every instance.
**Scenario: adding a shape**
| # | Step | Plates after | Objects after | Also checked |
|---|---|---|---|---|
| 1 | `plate_add`, twice | `"" 0` · `"" 0` · `"" 0 *` | none | |
| 2 | `object_add_primitive {shape: "cube", size: [20, 20, 20], plate: 1, name: "first"}` | `"" 0` · `"" 1 *` · `"" 0` | first@1 | the reply's `object` 0, `plate` 1 and `objects` naming first; the app places first, its square inside plate 1; `bbox.size` `[20, 20, 20]`; `selection()` objects `[0]` |
| 3 | the same with `name: "second"` and `position: corner(1) + (112.8, 110, 0)` in place of `plate`, first still selected | `"" 0` · `"" 2 *` · `"" 0` | first@1 · second@1 | the reply's `object` 1, `plate` 1 and `offset` `corner(1) + (112.8, 110, 10)`; second at +(112.8, 110); `selection()` objects `[1]`: a call with a size adds the shape whatever is selected, and selects it |
| 4 | `undo` | `"" 0` · `"" 1 *` · `"" 0` | first@1 | adding, naming and placing second were one undo step |
| 5 | `redo` | as after 3 | as after 3 | second at +(112.8, 110) |
| 6 | `object_select {none: true}`, then `object_add_primitive {shape: "cube", size: [40, 30, 10]}` | `"" 0` · `"" 3 *` · `"" 0` | first@1 · second@1 · Cube@1 | named after its shape; `bbox.size` `[40, 30, 10]`; the app places it, its square inside plate 1 |
| 7 | `object_add_primitive {shape: "cylinder", size: [1, 2, 3]}` | as after 6 | as after 6 | refused, saying that a cylinder's size is `[diameter, height]` |
**Scenario: moving an instance, and Auto Drop**
block and other are 20 mm cubes added with `object_add_primitive` at a `position`, with `object_select {none: true}`
between them.
| # | Step | Plates after | Objects after | Also checked |
|---|---|---|---|---|
| 1 | block at `corner(0) + (100, 100, 0)`, other at `corner(0) + (200, 200, 0)` | `"" 2 *` | block@0 · other@0 | block at +(100, 100), other at +(200, 200) |
| 2 | `object_transform {object: 0, scale: 1.5}` | as after 1 | as after 1 | block's `scale` `[1.5, 1.5, 1.5]` and `bbox.size` `[30, 30, 30]`; it rests on the bed: a scale that grows it drops it back; still at +(100, 100) |
| 3 | `object_transform {object: 0, size: [45, null, null]}` | as after 1 | as after 1 | `scale` `[2.25, 2.25, 2.25]`, `bbox.size` `[45, 45, 45]`: one size and two nulls keep the proportions |
| 4 | `object_transform {object: 0, size: [30, 20, 10]}` | as after 1 | as after 1 | `scale` `[1.5, 1, 0.5]`, `bbox.size` `[30, 20, 10]` |
| 5 | `object_transform {object: 0, rotate: [0, 0, 30], mode: "absolute"}` | as after 1 | as after 1 | `rotation_deg` `[0, 0, 30]`, `bbox.size` `[35.98, 32.32, 10]` to 0.01 |
| 6 | `object_transform {object: 0, rotate: [0, 0, 15]}` | as after 1 | as after 1 | `rotation_deg` `[0, 0, 45]`: a call is relative by default; `bbox.size` `[35.36, 35.36, 10]` to 0.01 |
| 7 | `object_transform {object: 0, translate: [10, -20, 0]}` | as after 1 | as after 1 | block at +(110, 80) |
| 8 | `object_transform {object: 0, position: corner(0) + (50, 60, 0)}` | as after 1 | as after 1 | block at +(50, 60): `position` is where it goes, whatever `mode` says |
| 9 | `plate_add` | `"" 2` · `"" 0 *` | as after 1 | |
| 10 | `object_transform {object: 0, plate: 1}` | `"" 1` · `"" 1 *` | block@1 · other@0 | the reply's `plate` 1; block at +(50, 60) on plate 1; `object_list {plate: 1}` lists block alone, with its instance 0 |
| 11 | `object_transform {object: 0, plate: 0}` | `"" 2` · `"" 0 *` | as after 1 | block at +(50, 60) on plate 0 again; moving an instance leaves the current plate |
| 12 | `object_transform {object: 0, translate: [0, 0, 15]}` | as after 11 | as after 1 | block rests on the bed: with Auto Drop on, a lifted object drops |
| 13 | `object_set_auto_drop {objects: [0], auto_drop: false}` | as after 11 | as after 1 | the reply's `objects` naming block alone and `auto_drop` false; block's `auto_drop` false, other's true |
| 14 | `object_transform {object: 1, translate: [0, 0, 15]}` | as after 11 | as after 1 | other rests on the bed: its Auto Drop is on |
| 15 | `object_transform {object: 0, translate: [0, 0, 15]}` | as after 11 | as after 1 | block's `bbox.min` z 15 and `bbox.max` z 25: with Auto Drop off it stays where it is moved |
| 16 | `undo` | as after 11 | as after 1 | block rests on the bed: the move was one undo step |
**Scenario: moving a part, the selection, and Mirror**
base is a 30 × 30 × 10 mm cube at `corner(0) + (100, 100, 0)`, single a 20 mm cube at `corner(0) + (200, 200, 0)`.
Parts are read from `scene()`; part 0 of base, the cube itself, is at +(100, 100, 5) after every step but 2. After
every step the objects are base@0 · single@0, base at +(100, 100) (but in step 2, as the row says) and single at
+(200, 200), and `plates()` is `"" 2 *`.
| # | Step | Part 1 of base after | Also checked |
|---|---|---|---|
| 1 | base and single, then `part_add {object: 0, type: "part", shape: "cube", size: [10, 10, 10], position: corner(0) + (120, 100, 15)}` | named `Generic-Cube`, `type` part, at +(120, 100, 15) | the reply's `part` 1 and `part_count` 2; part 1's `filament` 1, `triangles` 12, `mesh_volume` 1000, `scaled_volume` 1000; base's `bbox.size` `[40, 30, 20]` |
| 2 | `object_transform {object: 0, size: [60, null, null]}` | at +(130, 100, 22.5) | base's `scale` `[1.5, 1.5, 1.5]` and `bbox.size` `[60, 45, 30]`: the size of an object of two parts scales both in proportion, about the instance's place; it rests on the bed, part 0 at +(100, 100, 7.5) |
| 3 | `undo` | at +(120, 100, 15) | base's `scale` `[1, 1, 1]` |
| 4 | `object_transform {object: 0, part: 1, translate: corner(0) + (110, 100, 15), mode: "absolute"}` | at +(110, 100, 15) | the reply's `part_info.position` the same |
| 5 | `object_transform {object: 0, part: 1, translate: [5, 0, 0]}` | at +(115, 100, 15) | |
| 6 | `undo` | at +(110, 100, 15) | each part move is one undo step |
| 7 | `object_transform {object: 0, part: 1, scale: 2, mode: "absolute"}` | `scale` `[2, 2, 2]`, at +(110, 100, 15) | the reply's `size` `[20, 20, 20]`; `scaled_volume` 8000; base still rests on the bed |
| 8 | `object_transform {object: 0, part: 1, size: [null, null, 3]}` | `scale` `[0.3, 0.3, 0.3]` | the reply's `size` `[3, 3, 3]`: one size keeps the proportions; `mesh_volume` 1000, `scaled_volume` 27 |
| 9 | `object_transform {object: 0, part: 1, rotate: [0, 0, 45]}` | `rotation_deg` `[0, 0, 45]`, at +(110, 100, 15) | |
| 10 | `object_transform {object: 0, part: 1, rotate: [0, 0, 0], mode: "absolute"}` | as after 9 | refused, saying a part rotates relative to its current rotation |
| 11 | `object_transform {object: 0, part: 1, plate: 1}` | as after 9 | refused, saying `plate` moves an instance |
| 12 | `object_transform {object: 1, part: 0, translate: [1, 0, 0]}` | as after 9 | refused, saying object 1 has one part; single at +(200, 200) |
| 13 | `object_select {parts: [[0, 1]]}` | as after 9 | the reply is `{canvas: "3d", empty: false, objects: [0], instances: [[0, 0]], parts: [[0, 1]]}`, and `selection()` the same |
| 14 | `object_select {objects: [0]}` | as after 9 | the reply's `objects` `[0]` and `instances` `[[0, 0]]` and no `parts`: a whole instance lists none; `selection()` the same |
| 15 | `object_mirror {parts: [[0, 1]], axis: "x"}` | `mirrored` true, at +(110, 100, 15) | the reply names part 1 of base; a part mirrors in its place; base's instance not mirrored. From here part 1's `rotation_deg` is not compared (see Not checked) |
| 16 | `object_mirror {objects: [0], axis: "x"}` | at +(90, 100, 15) | base's instance `mirrored` true; an instance mirrors about the centre of the selection's box, here x 100, as part 1 lies within the cube's width: part 1 goes to the other side and part 0 stays at +(100, 100, 5); single not mirrored |
| 17 | `object_mirror {objects: [0], axis: "y"}` | at +(90, 100, 15) | base's instance `mirrored` false: a mirror along X and one along Y make a half turn; the box's centre is y 100, so the places stay |
| 18 | `object_select {none: true}`, then `object_mirror {axis: "x"}` | as after 17 | refused, `nothing_selected`; base's instance and single not mirrored, part 1 `mirrored` true |
**Scenario: the number of instances**
a and b are 20 mm cubes at `corner(0) + (60, 60, 0)` and `corner(0) + (180, 60, 0)`; b has a modifier, added with
`part_add {object: 1, type: "modifier", shape: "cube", size: [5, 5, 5]}`. An instance a call adds goes 12.8 mm
(0.05 of the bed's 256 mm) further along x and y than the object's last instance. The plate is `"" 2 *` after
every step but these: `"" 3 *` after 18 and 20, and `"" 5 *` after 21.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | a and b | a@0 · b@0 | a at +(60, 60), b at +(180, 60) |
| 2 | `object_select {none: true}`, then `object_set_instances {count: 3}` | as after 1 | refused, `nothing_selected` |
| 3 | `object_set_instances {object: 0, count: 3}` | a@0×3 · b@0 | the reply's `object` 0, `instances` 3 and `objects` naming a; a at +(60, 60), +(72.8, 72.8), +(85.6, 85.6); `selection()` objects `[0]` |
| 4 | `undo` | as after 1 | the count was one undo step |
| 5 | `object_set_instances {object: 0, count: " 2 "}` | a@0×2 · b@0 | a count written as text is read as the number; a at +(60, 60), +(72.8, 72.8) |
| 6 | `object_set_instances {object: 0, delta: 1}` | a@0×3 · b@0 | a's third at +(85.6, 85.6) |
| 7 | `object_set_instances {object: 0, delta: -1}` | a@0×2 · b@0 | the last instance goes |
| 8 | `object_set_instances {object: 0, count: 1}` | as after 1 | a at +(60, 60) |
| 9 | `object_set_instances {object: 0, count: c}` for c 0, −2, 1001, 2.5 and `"three"` | as after 1 after each | each refused: 0 and −2 by the schema, saying `count must be >= 1`; 1001 as `bad_instance_count`; 2.5 and `"three"` by the schema, saying `count must be of type integer` |
| 10 | `object_select {objects: [0, 1]}`, then `object_set_instances {count: 2}` | as after 1 | refused, `one_object_only` |
| 11 | `object_set_instances {object: 0, count: 2}`, then `object_select {instances: [[0, 1]]}` | a@0×2 · b@0 | the reply's `objects` `[0]` and `instances` `[[0, 1]]`, and `selection()` the same |
| 12 | `object_select {objects: [0]}` | as after 11 | the reply's `instances` `[[0, 0], [0, 1]]`: the selection names the instances it is in |
| 13 | `object_select {instances: [[0, 1]]}`, then `object_set_instances {count: 4}` | a@0×4 · b@0 | the selected instance stands for its object: a at +(60, 60), +(72.8, 72.8), +(85.6, 85.6), +(98.4, 98.4) |
| 14 | `object_select {parts: [[1, 1]]}`, then `object_set_instances {count: 2}` | a@0×4 · b@0×2 | the selected part stands for its object: b at +(180, 60), +(192.8, 72.8) |
| 15 | `object_set_printable {instances: [[1, 0]], printable: false}`, then `object_set_instances {object: 1, count: 3}` | as after 14 | refused, `unprintable_instance`; b's instances `printable` false, true |
| 16 | `object_set_instances {object: 1, count: 1}` | a@0×4 · b@0 | fewer instances need no printable rule; b's instance at +(180, 60), `printable` false |
| 17 | `object_set_printable {objects: [1], printable: true}`, `object_select {objects: [1]}`, then the Set Number of Instances action (`action_run` of `obj_set_instances`), its dialog answered Cancel | as after 16 | the call replies `blocked_by_dialog`, the dialog open titled `Copies of the selected object`; after Cancel, `app_wait {for: "job"}` on its job is met and gives `object` 1 and `instances` 1; b `printable` true |
| 18 | `object_set_instances {object: 1, count: 2}`, then `object_separate_instances {object: 1}` | a@0×4 · b@0 · b@0 | the reply's `objects` names b at 1 and 2; object 2 at +(192.8, 72.8) with parts of `type` part and modifier: each instance's object keeps the parts |
| 19 | `undo` | a@0×4 · b@0×2 | Set as Individual Objects was one undo step |
| 20 | `object_separate_instances {instances: [[0, 3]]}` | a@0×3 · b@0×2 · a@0 | the reply's `objects` names a at 2; object 2 at +(98.4, 98.4), where the instance stood |
| 21 | `object_select {objects: [0]}`, then `object_separate_instances {}` | a@0 · b@0×2 · a@0 · a@0 · a@0 | the reply's `objects` names a at 0, 3 and 4; a at +(60, 60), object 3 at +(85.6, 85.6), object 4 at +(72.8, 72.8): each instance but the first becomes an object, the last instance first |
| 22 | `project_new`, a 20 mm cube named cut, cut in two with a connector through the Cut gizmo (as `test_menu_items_refusals` cuts it), then `object_set_instances {object: 0, count: 2}` | cut_A@0 · cut_B@0, in either order | refused, `cut_object`; each half one instance; `plates()` `"" 2 *` |
**Scenario: placing objects**
first, second, third, fourth, fit and fit2 are 20 mm cubes added with `object_add_primitive {shape: "cube", size:
[20, 20, 20]}` at the `plate`, `position` and `name` the row gives; second has a 5 mm cube part, added with
`part_add {object: 1, type: "part", shape: "cube", size: [5, 5, 5], position: corner(1) + (115, 60, 2.5)}`, 15 mm to
the right of its centre.
| # | Step | Plates after | Objects after | Also checked |
|---|---|---|---|---|
| 1 | `plate_add`, twice; first at plate 1 +(40, 60), second at plate 1 +(100, 60) with its part, third at plate 2 +(60, 60) | `"" 0` · `"" 2` · `"" 1 *` | first@1 · second@1 · third@2 | the places as added; second's part at +(115, 60, 2.5) |
| 2 | `object_mirror {objects: [1], axis: "x"}` | as after 1 | as after 1 | the reply names second; second `mirrored` true, first and third false. An instance mirrors about the centre of the selection's box, x +103.75 (the cube from +90 to +110, its part to +117.5): second at +(107.5, 60), its part at +(92.5, 60, 2.5) |
| 3 | `object_transform {object: 1, translate: [0, 0, 15], drop_to_bed: false}` | as after 1 | as after 1 | second's `bbox.min` z 15: an object of two parts stays above the bed |
| 4 | `object_transform {object: 0, translate: [0, 0, 15], drop_to_bed: false}` | as after 1 | as after 1 | first rests on the bed: an object of one part left above it drops anyway |
| 5 | `object_drop {objects: [1]}` | as after 1 | as after 1 | the reply's `moved` true and `objects` naming second; second rests on the bed |
| 6 | `object_drop {objects: [1]}` | as after 1 | as after 1 | not refused: the reply's `moved` false |
| 7 | step 3 again, `object_select {objects: [1]}`, then `object_drop {}` | as after 1 | as after 1 | the reply's `moved` true; second rests on the bed: no target drops the selection |
| 8 | `object_center {objects: [0, 2]}` | as after 1 | as after 1 | the reply's `plates` `[{plate: 1, objects: [0]}, {plate: 2, objects: [2]}]`: each goes to the centre of its own plate; first at +(128, 128), third at +(128, 128) |
| 9 | the same | as after 1 | as after 1 | the places as after 8 |
| 10 | fourth at plate 1 +(128, 60) | `"" 0` · `"" 3 *` · `"" 1` | first@1 · second@1 · third@2 · fourth@1 | |
| 11 | `object_center {objects: [0, 3], plate: 0}` | `"" 2` · `"" 1 *` · `"" 1` | first@0 · second@1 · third@2 · fourth@0 | the reply's `plates` `[{plate: 0, objects: [0, 3]}]`; the two move as one group, its box to plate 0's centre: first at +(128, 162), fourth at +(128, 94) |
| 12 | `object_select {objects: [2]}`, then `object_center {}` | `"" 2` · `"" 2 *` · `"" 0` | first@0 · second@1 · third@1 · fourth@0 | the selection goes to the centre of the current plate, plate 1, not its own: third at +(128, 128) on plate 1; the reply's `plates` `[{plate: 1, objects: [2]}]` |
| 13 | `object_transform {object: 2, rotate: [45, 0, 0], mode: "absolute"}` | as after 12 | as after 12 | third's `rotation_deg` `[45, 0, 0]`, `bbox.size` z 28.28 to 0.01 |
| 14 | `object_auto_orient {objects: [1, 2]}` | as after 12 | as after 12 | the reply's `objects` naming second and third, and `rotations` an entry for instance 0 of each; third lies on a face: `rotation_deg` x 90 to 0.1, `bbox.size` z 20 to 0.01, resting on the bed; first and fourth keep `rotation_deg` `[0, 0, 0]`: naming objects turns no other; `selection()` objects `[1, 2]`. The app turns second: its rotation is not fixed, and it rests on the bed |
| 15 | `object_select {none: true}`, `object_transform {object: 0, rotate: [0, 45, 0], mode: "absolute"}`, then `object_auto_orient {}`, the Auto-Orient action's arguments | as after 12 | as after 12 | with nothing selected every object is oriented: the reply's `rotations` one entry for each of objects 0 to 3, and each entry's `rotation_deg` is that instance's in `scene()`; first lies on a face, `bbox.size` z 20 to 0.01; which turn second, third and fourth get is not fixed |
| 16 | fit at plate 1 +(60, 200), then `object_scale_to_fit {objects: [4]}` | `"" 2` · `"" 3 *` · `"" 0` | as after 12 · fit@1 | the reply's `scales` `[{object: 4, instance: 0, scale: [s, s, s]}]`, and fit's `scale` the same, with s 11.888 to 0.001; fit's `bbox.size` `[237.76, 237.76, 237.76]` to 0.02, at +(137, 128) to 0.01, resting on the bed: it fills the widest free part of the bed, beside the excluded corner |
| 17 | fit2 at plate 1 +(200, 60), `object_select {objects: [5]}`, then `object_scale_to_fit {}`, the Scale to Fit action's arguments | `"" 2` · `"" 4 *` · `"" 0` | as after 16 · fit2@1 | no target scales the selection: the reply's `scales` names object 5 with s, fit2's `scale` s and at +(137, 128) |
**Scenario: arranging and filling the bed**
A, B and C are 20 mm cubes added with `object_add_primitive` at a `position`, with `object_select {none: true}`
between them. After an arrange the app places the objects it arranged; the row says what their places hold. An arrange
may reorder objects, so in this scenario the objects are found by name, and a row's objects are compared as names,
plates and instance counts in any order.
| # | Step | Plates after | Objects after | Also checked |
|---|---|---|---|---|
| 1 | `object_arrange {}` | `"" 0 *` | none | refused, `no_objects_to_arrange` |
| 2 | `object_arrange {plates: 0}` | `"" 0 *` | none | refused, `no_objects_to_arrange` |
| 3 | A and B both at `corner(0) + (128, 128, 0)` | `"" 2 *` | A@0 · B@0 | A and B at +(128, 128): one on the other |
| 4 | `view_set {tab: "preview"}`, then `object_arrange {}` | as after 3 | A@0 · B@0 | the reply's `off_plate` `[]` and `plates` 1; `app_state` `tab` `prepare`: an arrange shows the Prepare view; A's and B's squares apart and inside plate 0 |
| 5 | `undo` | as after 3 | as after 3 | A and B at +(128, 128): the arrange was one undo step |
| 6 | `object_arrange {plates: 0, spacing: 30, rotate: false, align_y: false}` | as after 3 | as after 3 | the reply's `settings` `spacing` 30, `rotate` false, `align_y` false, and `off_plate` `[]`; the gap between A's and B's squares at least 29.9; both inside plate 0, `rotation_deg` `[0, 0, 0]` |
| 7 | A and B back to `corner(0) + (128, 128, 0)` with `object_transform {position}`, then `object_arrange {}` | as after 3 | as after 3 | the reply's `settings` `spacing` 30: the arrange options panel kept it; the gap at least 29.9 |
| 8 | `object_arrange {plates: 0, spacing: 10}` | as after 3 | as after 3 | the reply's `settings` `spacing` 10; the gap at least 9.9 and under 29.9: the spacing decides how far apart they go |
| 9 | `plate_add`, then `object_arrange {plates: 1}` | `"" 2` · `"" 0 *` | as after 3 | refused, saying that plate 1 has no objects to arrange |
| 10 | A to `corner(0) + (60, 60, 0)` and B to `+ (180, 180, 0)` with `object_transform`, C at `plate: 1`, `position: corner(1) + (128, 128, 0)` | `"" 2` · `"" 1 *` | A@0 · B@0 · C@1 | A at +(60, 60), B at +(180, 180), C at +(128, 128) |
| 11 | `object_arrange {plates: 7}` | as after 10 | as after 10 | refused, saying `Plate 7 does not exist (the project has plates 0..1)`; the places as after 10 |
| 12 | `object_arrange {fill_object: 0, plates: 0}` | as after 10 | as after 10 | refused, saying `fill_object` fills the object's own plate; the places as after 10 |
| 13 | `object_set_instances {object: <C>, count: 3}`, then `object_arrange {plates: 1, spacing: 10, rotate: false}` | as after 10 | A@0 · B@0 · C@1×3 | the reply's `settings` `spacing` 10 and `rotate` false; C's three squares apart and inside plate 1, each `rotation_deg` `[0, 0, 0]`; A at +(60, 60), B at +(180, 180): arranging one plate leaves the other plates' objects |
| 14 | `object_arrange {plates: 0}` | `"" 2 *` · `"" 1` | as after 13 | the plate arranged is made current; A's and B's squares apart and inside plate 0; C's three inside plate 1 |
| 15 | A to +(60, 60) and B to +(180, 180) again, then `object_arrange {fill_object: <A>}` | as after 14 | A@0×n · B@0 · C@1×3, n at least 2 | the reply's `object` A's index, `filled_with` `instances`, `added` n − 1, `instances` n, `plate` 0, `off_plate` `[]`; B at +(180, 180): Fill bed adds to its object alone, and moves no other; every square on plate 0 apart from every other and inside the plate |
| 16 | `undo` | as after 14 | as after 13 | A at +(60, 60), B at +(180, 180): Fill bed was one undo step |
| 17 | `object_arrange {fill_object: <C>}` | `"" 2` · `"" 1 *` | A@0 · B@0 · C@1×m, m at least 4 | the reply's `plate` 1, `added` m − 3 and `instances` m: an object on another plate than the current one fills its own plate, which is made current; C's squares apart and inside plate 1; A at +(60, 60), B at +(180, 180) |
**Scenario: cloning**
cube is a 20 mm cube at `corner(0) + (60, 60, 0)`, added with nothing selected. The plate is `"" n *` throughout, n
the number of objects.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | cube, then `object_clone {objects: [0], arrange: false}` | cube@0 · cube@0 | the reply's `objects` names cube at 1, `copied.objects` names cube at 0 and nothing else, `object_count` 2, `arranged` false; object 0 at +(60, 60): without an arrange the source stays; the app places the copy, its square apart from object 0's and inside plate 0; `selection()` objects `[1]` |
| 2 | `undo` | cube@0 | object 0 at +(60, 60) |
| 3 | `object_clone {objects: [0], count: 3, arrange: true}` | cube@0 four times | the reply's `objects` at 1, 2 and 3, `object_count` 4, `arranged` true; every square apart from every other and inside plate 0, none outside |
| 4 | `undo` | cube@0 four times | object 0 at +(60, 60): the arrangement is an undo step of its own |
| 5 | `undo` | cube@0 | object 0 at +(60, 60): the copies were one undo step |
| 6 | `view_set {camera: "iso"}`, `view_set {camera: "fit_objects"}`, `object_select {objects: [0]}`, `app_wait {for: "idle"}`, then a right click on object 0's top (`mouse_gesture`) picking `Clone`, and the dialog answered OK | cube@0 · cube@0 | the gesture's reply `ran` `Clone`; the waits are met; the dialog that opens is titled `Clone`; afterwards no dialog is open, and the two squares are apart and inside plate 0 |
| 7 | `object_set_instances {object: 0, count: 2}`, `object_select {instances: [[0, 1]]}`, then `object_clone {arrange: false}` | cube@0×2 · cube@0 · cube@0 | the reply's `copied.instances` `[{object: 0, instance: 1}]` and no `copied.objects`, `objects` naming cube at 2, `object_count` 3: a selected instance is copied as a new object of one instance |
**Scenario: leaving instances out of the print**
a is a 10 mm cube at `corner(0) + (60, 60, 0)` with three instances (`object_set_instances {object: 0, count: 3}`),
at +(60, 60), +(72.8, 72.8) and +(85.6, 85.6); b a 15 mm cube at `corner(0) + (180, 60, 0)`. A slice is
`plate_slice {plates: 0}`, which must reply `outcome` `ok`, then `project_export {format: "gcode", path}` into `W`.
After every step the objects are a@0×3 · b@0 at those places, and `plates()` is `"" 2 *`.
| # | Step | `printable` after | Also checked |
|---|---|---|---|
| 1 | a and b, then a slice | a true, true, true; b true | `gcode_prints()` prints a in 3 copies and b in 1 |
| 2 | `object_set_printable {instances: [[0, 1]], printable: false}` | a true, false, true; b true | the reply's `instances` `[{object: 0, instance: 1, printable: false}]` and no `objects` |
| 3 | a slice | as after 2 | `gcode_prints()` prints a in 2 copies and b in 1: an instance that is not printable is left out of the G-code |
| 4 | `undo` | as after 1 | Printable was one undo step |
| 5 | `object_set_printable {objects: [0], printable: false}` | a false, false, false; b true | the reply's `instances` instances 0, 1 and 2 of a, each `printable` false, and `objects` naming a: an object sets every instance of its own and no other's |
**Scenario: what the project keeps**
`plates()` is `"" 1 *` · `"" 0` after step 1, `"" 1` · `"" 1 *` after step 2, and `"" 1 *` · `"" 1` after step 3:
opening a project makes plate 0 current.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | `plate_add`; kept, a 20 mm cube at `plate: 0`, `position: corner(0) + (60, 60, 0)`; `object_set_instances {object: 0, count: 2}`; `object_transform {object: 0, instance: 0, rotate: [0, 0, 30], mode: "absolute"}`; `object_transform {object: 0, instance: 1, scale: 1.5}`; `object_mirror {instances: [[0, 1]], axis: "x"}`; `object_set_printable {instances: [[0, 1]], printable: false}` | kept@0×2 | instance 0 at +(60, 60), `rotation_deg` `[0, 0, 30]`; instance 1 at +(72.8, 72.8), `scale` `[1.5, 1.5, 1.5]`, `mirrored` true, `printable` false. From here instance 1's `rotation_deg` is not compared (see Not checked) |
| 2 | lifted, a 20 mm cube at `plate: 1`, `position: corner(1) + (60, 60, 0)`; `object_set_auto_drop {objects: [1], auto_drop: false}`; `object_transform {object: 1, translate: [0, 0, 15]}` | kept@0×2 · lifted@1 | lifted at +(60, 60), `auto_drop` false, `bbox.min` z 15 |
| 3 | `project_save` to a new file in `W`, `project_new`, then `project_open` of the file | as after 2 | every value as after 2: the places, turns, scales, mirrors, printable flags and Auto Drop of the instances are kept in the project file |
**To settle in review:**
- Scale to Fit (placing, steps 16 and 17). The fit is into the plate's free print volumes, the bed less its excluded
area: the widest is the bed beside the 18 mm wide corner, 238 mm wide, 256 mm deep and 250 mm high. The selection's
box, grown by 0.01 mm on every side (20.02 mm), scales by the least of 238 / 20.02, 256 / 20.02 and 250 / 20.02, so
s = 11.888, and its centre goes to that volume's centre, +(137, 128). The replay checked only s > 5.
- The spacing's effect (arranging, step 8). With spacing d each item is grown by d / 2, so two cubes end at least d
apart; that they end less than 29.9 mm apart at spacing 10 rests on the arranger packing them as close as that lets
it. Without that bound the step shows only that the spacing was taken.
- The plate an arrange of one plate or a Fill bed leaves current (arranging, steps 14 and 17): `Ops::start_arrange()`
selects the plate it arranges, and `FillBedJob` the plate of the object it fills.
- The refusals of a count by the schema (instances, step 9) carry no code, so they are matched by their words; 1001
passes the schema, which sets no maximum, and is refused by the operation as `bad_instance_count`. A count written
as text, `" 2 "`, is read as the number by the argument reader.
- The order of the objects Set as Individual Objects makes of a whole object (instances, step 21): it takes the
instances from the last down, so the new objects hold the last instance first.
- An object lifted with Auto Drop off reopens where it was saved, 15 mm above the bed (what the project keeps,
step 3): the project file stores `auto_drop`, and opening a project puts its objects on the bed through
`ModelObject::ensure_on_bed()`, which leaves an object with Auto Drop off where it is.
- The rotation Auto-Orient gives a cube on its edge (placing, step 14): x 90, the value `menu_items_placement.json`
passes with. That it lies on a face, z 20, holds whichever face it picks.
**Not checked:**
- A person's pick of the Speed Dial actions of these commands (Center, Drop to Bed, Scale to Fit, Auto-Orient,
Mirror, the instance actions, Set as Individual Objects, Auto-Arrange) and Add Primitive's shape actions with their
size dialog: `test_every_action` checks each action's effect. This test calls the commands with no target on the
selection, which for Center, Drop to Bed, Scale to Fit and Auto-Orient are the actions' own arguments (`{}`), and
reads their results whole, the Auto-Orient rotations among them. The Set Number of Instances action is run here only
to show its dialog cancelled.
- Auto-Arrange's reply, journal step and replay against its action, and `object_select {all: true}`:
`test_person_forms`. An arrange from the assemble view and with the Move gizmo open, which `ops_start_arrange.json`
recorded: `test_operation_routes`. What a lock does to Arrange and Auto-Orient: `test_plates`.
- The refusals `test_menu_items_refusals` checks with the state after them: Set as Individual Objects on an object of
one instance, Add Primitive's pick with an object selected, `object_mirror` with no axis,
`object_center` and `object_add_primitive` on a plate the project lacks, a pick of Mirror with two objects selected,
a pick of Drop to Bed on an object on the bed, and Auto-Orient of an empty plate or of objects that are not printable.
- What `rotate: true` does to an arrangement: which turn the arranger picks is its own. Only that `rotate: false` turns
nothing is checked.
- Fill bed with copies (`fill_with: "copies"`) and Fill bed refused for a cut object: no replaced replay exercised them.
- The rotations Auto-Orient gives the objects it may turn without a fixed result (placing, steps 14 and 15): which
face a cube resting on one already ends on is the job's choice; step 15 checks them against the reply. The rotation
of a mirrored instance or part (moving a part, from step 15; what the project keeps, instance 1): a mirror of a
turned shape can be written as another turn and a mirror, so only `mirrored` and the places are compared.
- How the objects look: a greyed instance that is not printable, the selection's highlight. No screenshot is taken.
- `app_state`'s `python` and `design_tab`, which `scene.json` read in passing: they are not object state.
`test_command_line` checks the unrestricted-scripts switch.
- `scene.json`'s end-to-end run as one scenario. Each of its steps is checked in the scenario of its command: the size
of an object of several parts (moving a part, step 2), the instances of an object of parts made objects (the number
of instances, step 18), one plate arranged with options (arranging, step 13), Assemble and ordering by name across
plates (`test_object_structure`, splitting and ordering), Fill bed on another plate (arranging, step 17); its
closing slice is replaced by the G-code checks of leaving instances out of the print.
- `object_list {screen: true}` and paging with `limit` and `offset`: no replaced replay used them, and they change how
`object_list` reports the objects, not what the objects are.
## `test_object_structure`
`test_object_structure.py` · Python · takes the place of `menu_items_structure.json` and `objects_order.json`, and
with `test_objects` of `menu_items_objects.json`, `objects_state.json`, `objects_files.json` and `scene.json` · in
`sweep.json` as `{"path": "test_object_structure.py"}`
**Tests:** What objects are made of and how the list orders them: renaming and deleting objects, and the layer commands
acting on the selected object; Split to Objects and to Parts, and Assemble; adding parts of every type, changing a
part's type and renaming a part; ordering a plate's objects by a property or in a given order, and the print order that
sets; Fix Model by index and through the object's menu; Reload from disk and Replace 3D file; and the keep_painting
preference, shown against its control. Each command is called by index and, where its menu item acts on the selection,
with no target on the selection. It runs on the harness's default printer, the Bambu Lab X1 Carbon 0.4, whose by-object
printing lets objects lower than its rod (34 mm, `extruder_clearance_height_to_rod`) print in the object list's order
when they stand more than its clearance radius apart.
**Files:** The test writes into a folder of its own, `W` (`tempfile.mkdtemp()`), with an ASCII STL writer of its own:
`cube20.stl` (a 20 mm cube from the origin, 12 triangles), `cube30.stl` (the same at 30 mm), `holed.stl` (`cube20.stl`
less one triangle, which leaves three open edges) and `top4.stl` (a 20 mm cube from the origin whose top is four
triangles about its centre, 14 triangles). It reads `tests/data/two_hollow_squares.obj` (two square rings 10.67 mm wide
and 2.8 mm high, their centres 58 mm apart along x), `resources/handy_models/OrcaCube_v2.drc` and
`tools/mcp/tests/fixtures/star.svg`, `tools/mcp/tests/fixtures/heightmap.png`. The project it saves and the G-code it
exports go to `W` as well. It does not use `tests/fixtures/objects_files.py` or `tests/fixtures/ops_undo.py`: undo
steps are counted by undoing them and reading the state back.
**Reads:** `plates()`, and `scene()`, `gcode_prints(path)` and `corner(p)` as `test_objects` reads them. Also:
- `names()`: the objects' names in index order; `types(o)`: object o's parts' `type`s in order.
- `notices()`: the texts of `app_state`'s `notifications`; `dialogs()`: the titles of its `dialogs`.
Every scenario starts with `project_new {discard_changes: true}` in the Prepare view and checks that `plates()` is
`"" 0 *` and that there are no objects; a `project_new` within a scenario is followed by the same check. Places are
written as in `test_objects`, from plate 0's corner. An object the tables call by a name of its own is added with
`name` set to it; Cube is a shape's own name, and an imported object is named after its file. In the tables the
objects are written by their names in index order, and an object's parts by their types, after `:`
(`Assembly: part, modifier`). After every step `names()` is compared with its row whole, and the parts of every object
the row writes them for; a table without an objects column says in its introduction what the names are after every
step. `plates()` is `"" n *` after every step, n the number of objects, but where the ordering scenario says otherwise.
**Scenario: renaming and deleting**
Three 20 mm cubes are added with `object_add_primitive` at `corner(0) + (40, 60, 0)`, `+ (100, 60, 0)` and
`+ (160, 60, 0)`, with `object_select {none: true}` between them. Each is named Cube after its shape.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | the three cubes | Cube · Cube · Cube | at +(40, 60), +(100, 60), +(160, 60) |
| 2 | `object_rename {object: 1, name: "middle"}` | Cube · middle · Cube | the reply's `objects` `[{index: 1, name: "middle"}]` |
| 3 | `object_delete {objects: [0]}` | middle · Cube | the reply's `objects` `[{index: 0, name: "Cube"}]` and `object_count` 2; middle at +(100, 60), Cube at +(160, 60): the objects after the deleted one move down |
| 4 | `undo` | Cube · middle · Cube | the delete was one undo step |
| 5 | `redo` | as after 3 | |
| 6 | `object_select {objects: [0]}`, then `object_delete {}` | Cube | the reply's `objects` `[{index: 0, name: "middle"}]` and `object_count` 1; Cube at +(160, 60) |
| 7 | `object_rename {object: 0, name: "a/b"}`, then `object_rename {object: 0, name: ""}` | Cube | refused, `invalid_name`, then `empty_name` |
| 8 | layered, a 20 mm cube at `+ (60, 160, 0)`, `object_select {objects: [1]}`, then `object_set_height_ranges {ranges: [{min_z: 0, max_z: 5}]}` | Cube · layered | the reply's `object` 1, `objects` `[{index: 1, name: "layered"}]` and `layer_config_ranges` one range, `min_z` 0 and `max_z` 5; `object_list` gives layered that range and Cube no `layer_config_ranges` |
| 9 | `object_set_variable_layer_height {action: "adaptive"}` | Cube · layered | the reply's `object` 1 and `objects` naming layered, with a `layer_height_profile`; `object_list` gives layered a `layer_height_profile` with `points` and Cube none |
**Scenario: splitting and assembling**
Each import is `project_import {paths: [two_hollow_squares.obj]}`, whose reply's `added` is 1; the object is named
after the file. A ring's box is `bbox.size` `[10.67, 10.67, 2.8]` to 0.01; two rings stand side by side when their
boxes' centres are 58 apart along x and level along y, to 0.01.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | an import | two_hollow_squares.obj: part | its `bbox.size` `[68.67, 10.67, 2.8]` to 0.01 |
| 2 | `object_split {object: 0, into: "objects"}` | two_hollow_squares.obj_1: part · two_hollow_squares.obj_2: part | the reply's `objects` at 0 and 1 and `object_count` 2; each a ring's box, the two side by side; `selection()` objects `[0, 1]`: the pieces are selected |
| 3 | an import, then `object_split {object: 2, into: "parts"}` | as after 2 · two_hollow_squares.obj: part, part | the reply's `parts` `[{object: 2, part: 0}, {object: 2, part: 1}]` and `object_count` 3; the parts named `two_hollow_squares.obj_1` and `two_hollow_squares.obj_2`, in that order; each part a ring's box, the two side by side |
| 4 | `object_assemble {objects: [0, 1]}` | two_hollow_squares.obj: part, part · Assembly: part, part | the reply's `object` 1 and `name` `Assembly`: the two go and the assembly comes last; its `bbox.size` `[68.67, 10.67, 2.8]` to 0.01: the pieces keep their places |
| 5 | `part_change_type {parts: [[1, 0]], type: "modifier"}` | two_hollow_squares.obj: part, part · Assembly: part, modifier | the reply's `parts` `[{object: 1, part: 1, type: "modifier"}]`: parts are listed by type; Assembly's `bbox.size` `[10.67, 10.67, 2.8]`: a modifier is left out of the object's box |
| 6 | `undo` | as after 4 | Assembly's `bbox.size` x 68.67 again: the change was one undo step |
| 7 | `object_select {objects: [0]}`, then `object_split {into: "objects"}` | Assembly: part, part · two_hollow_squares.obj_1: part · two_hollow_squares.obj_2: part | no target splits the selected object, by its parts, each piece named after its part; the reply's `objects` at 1 and 2 and `object_count` 3; the two pieces' boxes rings', side by side |
| 8 | `object_select {objects: [1, 2]}`, then `object_assemble {}` | Assembly: part, part · Assembly: part, part | no target assembles the selected objects; the reply's `object` 1 and `name` `Assembly` |
**Scenario: parts**
block is a 40 × 40 × 10 mm cube at `corner(0) + (100, 100, 0)`. The positions are of the parts, from plate 0's corner,
to 0.001 unless a tolerance is given. The parts are of the scenario's one object: `names()` is `[block]` after steps 1
to 9, `[scaled]` after 10, `[plain]` after 11 to 20 and `[base]` after 21 and 22.
| # | Step | The object's parts after | Also checked |
|---|---|---|---|
| 1 | block, then `part_add {object: 0, type: "negative", shape: "cylinder", size: [6.2, 3.2], position: corner(0) + (100, 100, 1.6)}` | part, negative | the reply's `part` 1 and `part_count` 2; the negative part at +(100, 100, 1.6), `bbox.min` z 0 and `bbox.size` z 3.2 to 0.01, `bbox.size` x 6.1 to 6.21; block's `bbox.size` z 10: a negative part is left out of its box |
| 2 | `undo` | part | adding a part is one undo step |
| 3 | `redo` | part, negative | |
| 4 | `part_add {object: 0, type: "modifier", path: OrcaCube_v2.drc}` | part, negative, modifier | the reply's `part` 2 and `part_count` 3; the modifier named `OrcaCube_v2.drc` |
| 5 | `part_add {object: 0, type: "part", shape: "cube", size: [10, 10, 20], position: corner(0) + (125, 100, 10)}` | part, part, negative, modifier | the reply's `part` 1: parts are listed by type; the new part named `Generic-Cube`, `filament` 1, `bbox.size` z 20 to 0.01; block's `bbox.size` z 20 |
| 6 | `part_add {object: 0, type: "support_blocker", shape: "sphere", position: corner(0) + (110, 110, 10)}` | part, part, negative, modifier, support_blocker | the blocker at +(110, 110, 10) |
| 7 | `part_add {object: 0, type: "precise_seam", shape: "cube", size: [2, 2, 2]}` | part, part, negative, modifier, support_blocker, precise_seam | the seam's `subtype` `center` |
| 8 | `part_add` with `{type: "modifier", shape: "cube", path: OrcaCube_v2.drc}`, `{type: "modifier", shape: "cylinder", size: [1, 2, 3]}`, `{type: "part", path: star.svg}` and `{type: "modifier", path: heightmap.png}`, each on object 0 | as after 7 after each | refused, saying in turn to give shape or path, that a cylinder's size is `[diameter, height]`, that SVG parts come from `object_add_svg`, and that the file could not be loaded |
| 9 | `object_set_instances {object: 0, count: 2}`, then `part_add {object: 0, type: "modifier", shape: "cube"}` | as after 7 | refused, saying object 0 has 2 instances |
| 10 | `project_new`; scaled, a 20 mm cube, `object_transform {object: 0, scale: 1.5}`, then `part_add {object: 0, type: "modifier", shape: "cube"}` | part, modifier | the reply's `part` 1; the instance's `scale` `[1, 1, 1]` and part 0's `[1.5, 1.5, 1.5]`, and the object's `bbox.size` `[30, 30, 30]`: adding a shape folds the instance's scale into the parts |
| 11 | `project_new`; plain, a 30 × 30 × 10 mm cube, then `part_add {object: 0, type: "modifier", shape: "cube", size: [10, 10, 10]}` | part, modifier | part 0 named plain, part 1 `Generic-Cube` |
| 12 | `object_select {parts: [[0, 1]]}`, then `part_change_type {type: "negative"}` | part, negative | no target changes the selected part; the reply's `parts` `[{object: 0, part: 1, type: "negative"}]` |
| 13 | `part_change_type {parts: [[0, 1]], type: "support_blocker"}` | part, support_blocker | |
| 14 | `undo` | part, negative | each change is one undo step |
| 15 | `part_change_type {parts: [[0, 1]], type: "precise_seam"}` | part, precise_seam | `subtype` `center` |
| 16 | `part_change_type {parts: [[0, 1]], type: "part"}`, then `part_change_type {parts: [[0, 1]], type: "modifier"}` | part, part, then part, modifier | a seam made a part again is listed after the first part |
| 17 | `part_change_type {parts: [[0, 0]], type: "modifier"}` | part, modifier | refused, `last_solid_part` |
| 18 | `object_select {objects: [0]}`, then `part_change_type {type: "part"}` | part, modifier | refused, `wrong_selection`: an object's row is not a part |
| 19 | `object_select {objects: [0]}`, `object_add_svg {path: star.svg}`, `app_wait {for: "idle"}`, then `object_select {none: true}` | part, part, modifier | the met wait; part 1's `svg.path` ends in `star.svg`; no gizmo open afterwards |
| 20 | `part_change_type {parts: [[0, 1]], type: "support_enforcer"}` | part, part, modifier | refused, `text_part` |
| 21 | `object_select {objects: [0]}`, `object_rename {name: "base"}`, `object_select {parts: [[0, 2]]}`, then `object_rename {name: "infill zone"}` | part, part, modifier | no target renames the selected object, then the selected part: the object named base (it was plain); part 0 still named plain, as the object has three parts; part 2 named `infill zone` (it was `Generic-Cube`) |
| 22 | `object_rename {name: "a/b"}` | part, part, modifier | refused, `invalid_name`; the object named base, part 2 `infill zone` |
**Scenario: ordering**
tall, short and mid are 20 × 20 mm cubes 30, 10 and 20 mm high, added with `object_add_primitive` at
`corner(0) + (30, 60, 0)`, `+ (128, 60, 0)` and `+ (226, 60, 0)` with those names, nothing selected between them.
Each keeps its place throughout; an order reply is written as its names, every entry on plate 0 and its `object` the
entry's place in the list. `plates()` is `"" 3 *` after steps 1 to 6, `"" 3` · `"" 0 *` after steps 7 to 10, and
`"" 3 *` · `"" 0` from step 11: `plate_set_settings` makes the plate it sets current, as its Plate Settings dialog
works on the current plate.
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | the three cubes | tall · short · mid | their `bbox.size` z 30, 10 and 20 |
| 2 | `object_order {by: "height", plate: 0}` | short · mid · tall | the reply's `descending` false and `order` short, mid, tall |
| 3 | the same | short · mid · tall | `descending` false: a call that gives `plate` sorts ascending, whatever order they have |
| 4 | `object_order {by: "height", descending: true}` | tall · mid · short | `descending` true |
| 5 | `object_order {by: "height"}`, the Order By action's arguments | short · mid · tall | `descending` false: from a descending order it sorts ascending |
| 6 | the same | tall · mid · short | `descending` true: an order they already have is reversed |
| 7 | `plate_add`, `plate_select {plate: 1}`, then `object_order {by: "size"}` | tall · mid · short | refused, `no_objects_to_order`: the current plate is empty |
| 8 | `object_order {by: "size", all: "every"}` | tall · mid · short | refused by the schema, saying `all must be of type boolean` |
| 9 | `object_order {by: "size", all: true}` | short · mid · tall | the reply's `descending` false and `order` short, mid, tall and no more: every plate's objects, by volume (4000, 8000, 12000 mm³) |
| 10 | `object_order {by: "name", all: true}` | mid · short · tall | the reply's `descending` false and `order` mid, short, tall: with the current plate empty, `all` orders plate 0's objects, by name as `scene.json` ordered them |
| 11 | `plate_set_settings {plate: 0, values: {print_sequence: "by object"}}` | mid · short · tall | `plate_list` gives plate 0 `print_sequence` `by object` |
| 12 | `object_order {plate: 0, order: [2, 0, 1]}` | tall · mid · short | the reply's `order` tall, mid, short and no `descending` |
| 13 | `object_order {plate: 0, order: [0, 1, 2]}` | tall · mid · short | the reply's `order` tall, mid, short: the order they have changes nothing |
| 14 | `undo` | mid · short · tall | step 12 was one undo step and step 13 took none |
| 15 | `redo` | tall · mid · short | |
| 16 | `plate_slice {plates: 0}`, then `project_export {format: "gcode", plates: 0, path}` into `W` | tall · mid · short | `outcome` `ok`; `gcode_prints()` prints tall, mid, short, in that order: the list's order is the print order |
**Scenario: repairing a mesh**
`names()` is `[holed.stl]` after steps 1 to 4 and `[holed.stl, holed.stl]` after 5 and 6; object 0 at +(60, 60)
throughout, object 1 at +(128, 128) from step 5.
| # | Step | `open_edges` after | Also checked |
|---|---|---|---|
| 1 | `project_import {paths: [holed.stl]}`, then `object_transform {object: 0, position: corner(0) + (60, 60, 0)}` | 3 | `mesh_errors.manifold` false |
| 2 | `object_fix {objects: [0]}` | 0 | the reply has no `status`: the call waited for the repair; its `objects` names object 0 and its `repairs` one entry, `object` 0, `changed` true, `mesh_errors_before.open_edges` 3, `mesh_errors_after.open_edges` 0, `painting_removed` false; `mesh_errors.manifold` true; `dialogs()` empty, and no notice holds any of the endings of Fix Model's notices (`has been repaired`, `have been repaired`, `needed no repair`, `Failed to repair`, `Repairing was canceled`) |
| 3 | `undo` | 3 | the repair was one undo step |
| 4 | `redo` | 0 | |
| 5 | another import of `holed.stl`, `object_transform {object: 1, position: corner(0) + (128, 128, 0)}`, `view_set {camera: "iso"}`, `view_set {camera: "fit_objects"}`, `object_select {objects: [1]}`, `app_wait {for: "idle"}`, then a right click on object 1's top picking `Modify>Fix Model` | object 0: 0; object 1: 0 | the gesture's reply `ran` `Modify>Fix Model`; a wait of up to 30 s, which fails when it runs out, for object 1's open edges to be 0 and for a notice holding `has been repaired`: the person's path ends in its notice, which shows the reader of step 2 can see one |
| 6 | `undo` | object 0: 0; object 1: 3 | the menu item's repair was one undo step |
**Scenario: the files a part comes from**
`names()` is `[reload.stl]` after steps 1 to 6 and `[cube20.stl]` after 7 to 11, the object at +(100, 100)
throughout; it has one part after steps 1 to 6 and two after 7 to 11.
| # | Step | Parts after | Also checked |
|---|---|---|---|
| 1 | `cube20.stl` copied to `W/reload.stl`, `project_import` of it, `object_transform {object: 0, position: corner(0) + (100, 100, 0)}` | part 0 `mesh_volume` 8000 | |
| 2 | `cube30.stl` copied over `reload.stl`, then `object_reload_from_disk {objects: [0]}` | part 0 `mesh_volume` 27000 | the reply's `reloaded` `[{object: 0, part: 0, path}]`, the path ending in `reload.stl`, `missing` and `unmatched` `[]`, and no `unreadable`; the object rests on the bed |
| 3 | `undo` | part 0 `mesh_volume` 8000 | the reload was one undo step |
| 4 | `redo` | part 0 `mesh_volume` 27000 | |
| 5 | `reload.stl` deleted, then `object_reload_from_disk {objects: [0]}` | as after 4 | the reply's `missing` `[{object: 0, part: 0, path}]`, the path ending in `reload.stl`, and `reloaded` `[]`; `dialogs()` empty: no file dialog asks for it |
| 6 | `undo` | part 0 `mesh_volume` 8000 | the call that reloaded nothing took no undo step, so undo takes back step 4's |
| 7 | `project_new`; `filament_add`; `project_import` of `W/cube20.stl`, moved with `object_transform {object: 0, position: corner(0) + (100, 100, 0)}`; `part_add {object: 0, type: "modifier", shape: "cylinder", size: [10, 10], position: corner(0) + (100, 100, 10)}`; `settings_set {type: "process", target: "part", object: 0, part: 0, values: {extruder: 2}}` | part 0: part, `filament` 2, 12 `triangles`, at +(100, 100, 10); part 1: modifier, no `filament`, `mesh_volume` under 785.4, at +(100, 100, 10) | |
| 8 | `part_replace {object: 0, part: 0, path: W/top4.stl}` | part 0: part, `filament` 2, 14 `triangles`, `mesh_volume` 8000, at +(100, 100, 10); part 1 as after 7 | the reply's `parts` `[{object: 0, part: 0}]` named `top4.stl`, with a `part_id` other than the one part 0 had and the one `object_list` gives it: the part keeps its type, filament and place, its mesh the file's |
| 9 | `part_replace {object: 0, part: 1, path: W/top4.stl}` | part 1: modifier, no `filament`, 14 `triangles`, `mesh_volume` 8000, at +(110, 110, 15) to 0.05 | the mesh keeps its place in its file: the cylinder's centre was at (0, 0, 5) in its own frame and the cube's is at (10, 10, 10) in `top4.stl`'s, so the modifier moves by (10, 10, 5) |
| 10 | `undo` | part 1 as after 7 | |
| 11 | `undo` | part 0: 12 `triangles` | each replace was one undo step |
**Scenario: painting kept through a mesh change**
The supports are painted on a cube's front face as a person paints them: `view_set {camera: "front"}`, `view_set
{camera: "fit_objects"}`, `object_select {objects: [0]}`, `app_wait {for: "idle"}`, then a click on the Paint-on
supports gizmo (`widget_click {gizmo: "FdmSupports"}`, whose reply's `active` is true), on its `Fill` tool, at the
part's front (`mouse_gesture`), and on `Done`. The preference is set with `preferences_set`, and it persists to the
end of the test. The object has one part throughout; `names()` is `[painted.stl]` after steps 1 to 4 and `[top4.stl]`
after 5 and 6, as replacing an object's only part names the object after the new file (`replace_part_with_file()`).
| # | Step | part 0's painted enforcers after | Also checked |
|---|---|---|---|
| 1 | `project_import` of `W/cube20.stl` copied to `W/painted.stl`, then the painting | more than 0 | no gizmo open afterwards |
| 2 | `preferences_set {values: {keep_painting: false}}`, then `object_reload_from_disk {objects: [0]}` | none: no `painted` | the reply's `reloaded` names part 0; `preferences_get` gives `keep_painting` false: with the preference off a reload drops the painting |
| 3 | `undo` | more than 0 | |
| 4 | `preferences_set {values: {keep_painting: true}}`, then `object_reload_from_disk {objects: [0]}` | more than 0 | `preferences_get` gives `keep_painting` true: with it on the same call keeps the painting |
| 5 | `part_replace {object: 0, part: 0, path: W/top4.stl}` | more than 0 | part 0's `triangles` 14: with the preference on, the painting is carried onto a mesh of other triangles |
| 6 | `preferences_set {values: {keep_painting: false}}` | more than 0 | the preference as the test found it |
**Scenario: what the project keeps**
| # | Step | Objects after | Also checked |
|---|---|---|---|
| 1 | base, a 30 × 30 × 10 mm cube at `corner(0) + (60, 60, 0)`; `part_add {object: 0, type: "negative", shape: "cylinder", size: [6, 3], position: corner(0) + (60, 60, 1.5)}`; `part_add {object: 0, type: "modifier", shape: "cube", size: [10, 10, 10], position: corner(0) + (60, 60, 5)}`; `part_add {object: 0, type: "precise_seam", shape: "cube", size: [2, 2, 2], position: corner(0) + (75, 60, 5)}`; `object_rename {object: 0, part: 2, name: "infill zone"}`; `part_change_type {parts: [[0, 3]], type: "precise_seam", subtype: "left"}`; other, a 20 mm cube at `+ (180, 180, 0)`; `object_order {plate: 0, order: [1, 0]}` | other: part · base: part, negative, modifier, precise_seam | base's parts named `base`, `Generic-Cylinder`, `infill zone`, `Generic-Cube`, at +(60, 60, 5), +(60, 60, 1.5), +(60, 60, 5), +(75, 60, 5); the seam's `subtype` `left` |
| 2 | `project_save` to a new file in `W`, `project_new`, then `project_open` of the file | as after 1 | every value as after 1: names, part types, the seam's subtype, the parts' places and the order are kept in the project file |
**To settle in review:**
- The names a split gives (splitting, steps 2, 3 and 7). Split to Objects of an object of one part names the pieces
after the object with `_1` and `_2` in the order it adds them (`ModelObject::split()`); Split to Parts names the
parts after the part the same way (`ModelVolume::split()`); Split to Objects of an object of several parts names each
piece after its part. The object is named after the OBJ file it came from, whose path the test gives in the system's
own form (`os.path.normpath`), as the loader takes the name after its last separator. Which ring is `_1` is not
fixed, so the rings are checked as a pair by their boxes.
- That Assemble keeps the pieces where they stand (splitting, step 4), so the assembly's box is the two rings' box:
`ObjectList::merge()` gives each part its object's instance placement times its own.
- The open edges of `holed.stl` once imported (repairing, step 1): the loader's repair matches the edges it can and
leaves the hole, three edges. `objects_state.json` checked only more than 0.
- Fix Model's notice through the menu (repairing, step 5) is the text `objects_state.json` passes with,
`has been repaired`.
- The modifier's move on Replace 3D file (files, step 9). The new mesh is moved by the difference between the two
meshes' centres in their files, (10, 10, 5) here, for an instance that is neither turned nor scaled. The cylinder's
centre is (0, 0, 5) only to its facets, hence 0.05.
- A reload that finds only missing files takes no undo step (files, step 6): `Ops::reload_parts()` reloads nothing,
so it takes no snapshot. The command's description says "One undo step" without that exception; this is MCP code
added on this branch, fixed when the test is written: in `src/slic3r/GUI/Mcp/McpToolsScene.cpp`,
`register_object_tools()`, `object_reload_from_disk`'s description says that a call that reloads nothing, its parts'
files all missing, takes no undo step, and so does the comment on `reload_parts()` in
`src/slic3r/GUI/Operations/ObjectOps.hpp`.
- An order the objects already have takes no undo step (ordering, steps 13 and 14): `Ops::reorder_objects()` takes its
snapshot only when it moves an object, as `ObjectList::order_objects()`, the app's own code, takes one only when the
order changes. The command's description and the operations' comments say "one undo step" without that exception;
this is MCP code added on this branch, fixed when the test is written: in `src/slic3r/GUI/Mcp/McpToolsScene.cpp`,
`register_object_menu_commands()`, `object_order`'s description, and in `src/slic3r/GUI/Operations/ObjectOps.hpp`,
the comments on `order_objects()` and `reorder_objects()`, say that a call that leaves the order as it was takes no
undo step.
- The names of parts (parts, steps 11 and 21; what the project keeps, step 1): a part added as a shape is named
`Generic-` and its shape (`ObjectList::load_generic_subobject()`), and naming an object of one part names its part
too (`ObjectList::update_name_in_model()`), so the first part is named after the object while it has no other.
**Not checked:**
- The refusals `test_menu_items_refusals` checks with the state after them: Delete of an object's last solid part and
of a cut object, Split of a mesh of one shell and a split that would ask the Auto-Drop question, the picks of Split,
Assemble and Change Type on rows they refuse, Rename with two objects or an instance selected.
`test_additions_refusals` checks an `object_order` that leaves an object out.
- The Speed Dial actions of these commands (Delete, Delete All, Split to Objects and to Parts, Assemble, the Change Type
actions, Rename, the four Order By actions): `test_every_action` checks each action's effect. This test checks the
commands' forms with no target on the selection, and the Order By action's arguments as a call.
- Deleting instances, parts, a plate's objects (`plate`) and every object (`all`): no replaced replay deleted them but
by index and on the selection; the parts are deleted in `test_menu_items_refusals`.
- The layer heights a height range or an adaptive profile gives: the layers entry checks them. Here only which object
the selection names.
- What `part_replace` does with keep_painting off. It then copies the painting by triangle (`replace_part_with_file()`
in `Plater.cpp`), so on a mesh of other triangles the painted count stays and only where the painting lies changes,
which no reader gives; on the same mesh off and on give the same painting. The preference's effect is shown on
Reload from disk, which drops the painting with it off (painting, steps 2 and 4).
- Painting other than supports under keep_painting (seam, colour, fuzzy skin): `ModelVolume::save_painting()` carries
every kind together, so the supports stand for them. keep_painting with Fix Model: no replaced replay repaired a
painted mesh; `ModelVolume::repair()` keeps painting through the same `save_painting()`.
- Fix Model by plate or `all`, and its cancel: no replaced replay used them, and a cancel needs a repair slow enough to
stop, which a 12-triangle cube is not. Reload from disk with `all`: no replaced replay used it; it reloads every
object but the cut ones through the same `Ops::reload_parts()`. A STEP file's mesh options on Replace 3D file:
`test_files` (the files entry) checks them.
- The order of objects of the same height, such as the two rings `menu_items_structure.json` ordered with its cubes:
which of two equal objects comes first is the sort's. The ordering scenario's objects differ in height, size and
name, so the whole order is read at every step.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `menu_items_objects`
`tests/menu_items_objects.json` · replay, 31 steps, 36 expects, 0 optional
**Tests:** The object commands made from menu items called by index and with no target on the selection: `object_rename`, `object_set_instances`, `object_separate_instances`, `object_delete` and the Delete Selected action, and `object_set_height_ranges` / `object_set_variable_layer_height` acting on the selected object.
**Decides by:** Fails when a call errors or an expect misses.
- Rename: the reply names object 1 "middle"; `object_list` has it on object 1 and not object 0.
- Instances: the reply gives object 0 with 3 instances; separating instance [0, 2] replies new object 3 and `object_list` shows 4 objects, object 0 with two instances.
- Delete: by index replies index 0 and `object_count` 3, leaving "middle" first; on the selection replies "middle" and count 2, and the list no longer starts with it; the `obj_delete` action replies count 1.
- Selection targets: height ranges reply object 1 "layered" with `max_z` 5, and `object_list` shows the range on object 1 and none on object 0; variable layer height replies object 1 "layered".
**Not checked:**
- Variable layer height is checked only by `/layer_height_profile` existing in the reply; `object_list` is not read, so a profile also landing on object 0 passes.
- The separated object's position or geometry is not read.
**Strength:** Strong — every command's target and result are read back by index and name.
### `menu_items_placement`
`tests/menu_items_placement.json` · replay, 51 steps, 67 expects, 0 optional
**Tests:** Placement commands by index: `object_add_primitive` on a plate and at a position in one undo step, `object_mirror`, `object_drop`, `object_center` (each on its own plate, then as a group on one plate), `object_scale_to_fit`, `object_auto_orient`, and the Center, Drop, Scale to Fit and Auto-Orient actions on the selection, on the X1C's 256 mm bed with three plates.
**Decides by:** Fails when a call errors or an expect misses.
- Add: replies `object`, `plate` 1 and name; the selection is [0]; the second cube's `offset` is 420/110 ± 0.01 on plate 1; the undo log shows exactly one "Add Primitive" snapshot (`ops_undo.taken()`, which reads the app log and asserts nothing); both names listed and the second on the bed.
- Mirror and drop: only object 0 is mirrored; a two-part object lifted 15 mm without drop has `min/2` ≥ 10, `object_drop` replies `moved` true and puts it at 0 ± 0.001, a second drop replies `moved` false; the `obj_drop` action replies `moved` true and drops it.
- Centre: by index replies plate 1 only and puts object 0 at 435.2/128 ± 0.1; objects 0 and 2 each go to their own plate's centre (reply groups exact, plate 2 at 128/−179.2 ± 0.1); a second call leaves them; all three on plate 1 replies [0, 1, 2], lists "third" on plate 1 and nothing outside; the Center action puts object 2 on plate 1's centre.
- Scale to fit: replies object 0 and 2 with scale > 5; object 0's listed scale > 5.
- Auto-orient: reply indices and object 2's `rotation_deg/0` 89.9–90.1, matched in `object_list`; the selection stays [1, 2]; the action with nothing selected replies rotations for objects 0–2 and no fourth.
**Not checked:**
- Scale to fit is checked as > 5, where the fitted factor follows from the bed; the action's scale is not read in `object_list`.
- The Auto-Orient action's rotations are not read, only which objects it processed.
- The group centring's resulting positions are not read, only plate membership and nothing outside.
**Strength:** Strong — positions are read back to 0.1 mm against the bed's geometry; Scale to Fit and the Auto-Orient action are loosely checked.
### `menu_items_structure`
`tests/menu_items_structure.json` · replay, 28 steps, 45 expects, 0 optional
**Tests:** The object structure commands by index: `object_split` into objects and into parts, `object_assemble`, `part_change_type`, `object_order` by height (ascending, repeated, descending), and the Split to Objects action on the selection, using a two-shell OBJ.
**Decides by:** Fails when a call errors or an expect misses.
- Split into objects: reply indices 0 and 1, `object_count` 2, each a single part.
- Split into parts: reply parts 0 and 1 of object 2, `object_count` 3; the list shows two parts of type "part".
- Assemble: reply object 1 "Assembly"; the list has 2 objects, both multi-part.
- Change type: the reply moves the new modifier to part 1; the list shows part, then modifier.
- Order: ascending puts the 10 mm cube at index 2 and the 30 mm at 3 (bbox ± 0.01); the same call again stays ascending; descending reverses it; the reply's `/descending` matches each time.
- The action splits object 4 into 4 and 5, `object_count` 6.
**Not checked:**
- Order by height reads only the two cubes' slots; the two-shell objects' relative order is not read.
- Split and assemble geometry (part sizes, positions) is not read.
**Strength:** Strong — each command's reply and the resulting list are matched by index, type and name.
### `objects_state`
`tests/objects_state.json` · replay, 42 steps, 45 expects, 0 optional
**Tests:** `object_set_printable` on one instance and on a whole object, `object_fix` on a cube missing a triangle (no dialog, no notice, one undo step), Fix Model through the object's menu ending in its notice, and `object_set_auto_drop` off letting a lifted object stay up.
**Decides by:** Fails when a call errors, a fixture raises, or an expect misses.
- Printable: the reply names only instance [0, 1]; `object_list` shows it false and its siblings and the other object true; undo restores it; naming object 0 sets all three of its instances and leaves object 1.
- Fix by index: before, `open_edges` > 0 and `manifold` false; the reply is not a job, `changed` true, open edges before > 0 and after 0; then `open_edges` 0 and `manifold` true; `repair_notices()` finds no notice and no dialog; exactly one "Repairing model object" snapshot.
- Fix by menu: the gesture replies `ran` "Modify>Fix Model"; `wait_repaired()` polls `object_list` and `app_state` for up to 30 s, then `open_edges` must be 0 and the first notice contain "has been repaired"; the undo log contains "Repairing model object".
- Auto drop: with it on, a 15 mm lift leaves `min/2` < 0.01; the reply and list show `auto_drop` false on object 0 only; then a lift leaves it at 15–35 mm.
- Fixtures `objects_files.py` and `ops_undo.py` assert nothing; `wait_repaired()` returns on timeout without raising, and the step's expects decide.
**Not checked:**
- The drop with Auto Drop on is `min/2` < 0.01 with no lower bound, so an object sunk below the bed passes.
- The menu path's undo check is `contains`, so extra snapshots pass.
**Strength:** Strong — each state change is read back per instance and object, with before-and-after mesh errors and a control for Auto Drop.
### `objects_order`
`tests/objects_order.json` · replay, 21 steps, 23 expects, 0 optional
**Tests:** `object_order {order}` putting three objects on a by-object plate in the order [2, 0, 1], as dragging them in the object list does; the same order again changes nothing; one undo restores the order.
**Decides by:** Fails when a call errors or an expect misses.
- `plate_set_settings` applies `print_sequence` "by object", and `plate_list` reads it back.
- The reply's `order` names and new indices are exact and there is no fourth; `object_list` lists third, first, second.
- `[0, 1, 2]` replies the same order, and one undo then restores first, second, third (which also shows the no-op added no undo step).
**Not checked:**
- The plate is never sliced, so the header's claim that this is the print order is not checked.
**Strength:** Strong — the order is read back by name from the reply, the list and after undo.
### `objects_files`
`tests/objects_files.json` · replay, 62 steps, 62 expects, 0 optional
**Tests:** `object_clone` by index and on a selected instance, the Clone dialog through the object's right-click menu, `object_reload_from_disk` of an overwritten and of a deleted file, and `part_replace` keeping a part's type, filament and position, a modifier staying a modifier, and painted supports kept with the `keep_painting` preference.
**Decides by:** Fails when a call errors, a fixture raises, or an expect misses.
- Clone: replies the new indices 1–3, `copied` object 0, `object_count` 4, `arranged`; nothing listed outside. The right-click gesture replies `ran` "Clone", the dialog is answered, no dialog remains and `object_count()` gives 5. Cloning selected instance [2, 1] replies that instance and new object 5 with one instance, object 2 keeping two.
- Reload: `mesh_volume` 8000, then exactly 27000 after the file is rewritten at 30 mm; the reply names part 0 and the path, with `missing` and `unmatched` empty; exactly one "Reload from disk" snapshot; after removal the reply lists the part under `missing`, `reloaded` is empty, no dialog opens and the volume stays 27000.
- Replace: `replace_keeps()` (object_list read before and after) gives a new part id, type "part", filament 2 and `moved` < 0.01; the modifier replace gives volume 8000, type "modifier" and the same filament; exactly two "Replace with 3D file" snapshots.
- keep_painting: enforcers > 0 before; the checkbox is clicked in the Preferences dialog and `preferences_get` reads true; after `part_replace` with the same box, enforcers > 0.
- Fixture `objects_files.py` asserts nothing: it writes STL files, calls tools and returns dicts. A tool error raises `ToolError`; `remove()` returns `removed` false rather than raising. `ops_undo.py` reads the app log and asserts nothing.
**Not checked:**
- keep_painting has no control case: a replace with the preference off is never tried, so a `part_replace` that always keeps painting, or ignores the preference, passes.
- The modifier's move by the file-origin difference, which the comment describes, is not matched (`moved` is returned but unchecked for part 1).
- Arranged clones are checked only as not outside the plates.
**Strength:** Partial — clone, reload and replace are checked exactly, but the keep_painting section cannot tell the preference's effect from the default.
### `scene`
`tests/scene.json` · replay, 208 steps, 203 expects, 23 optional
**Tests:** `object_transform` on instances, parts and plates; what `object_list`, `object_select` and `app_state` report; shapes at a size; `object_arrange` and Fill bed; `part_add`; the object list's context-menu commands through `action_run` (Change Type, Rename, instances, Set as Individual Objects, Assemble, Order By); then all of them on one scene, sliced.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Instance and part transforms: after a scale the bbox `min/2` is 0 ± 0.001; `size` keeps proportions and sets exact sizes (± 0.01); a plate move replies `/plate` 1 and `object_list {plate: 1}` lists it; part translate, relative move, scale and size replies match to 0.01 (or 0.001), and one undo takes back one part move.
- `object_list` fields: object and part `filament` 1, `auto_drop` true, `mirrored` flags, instance bbox, part position, part bbox and volume ranges.
- Selection: `object_select` replies `/canvas`, `/objects`, `/instances`, `/parts` exactly, also for one instance of two; `app_state /selection/parts` and `/selection/instances` match.
- Mirror: a mirrored part is mirrored and its instance not; the instance mirrored on Y then X reads unmirrored.
- Shapes and arrange: `object_add_primitive` sizes ± 0.01, a wrong-count size adds nothing (`total` 2), a size adds the shape with an object selected; Fill bed replies `/added` > 0 on plate 1 with nothing off the plate, its instance listed then gone after one undo; arranging plate 0 replies `spacing` 10, `rotate` false, 2 plates, and plate 1 keeps "Cylinder" while plate 0 has two objects; Arrange and the `obj_arrange` action reply the saved spacing 10.
- `part_add`: replies give part index, `part_count`, type, position, bbox (± 0.01), name "OrcaCube_v2.drc", filament 1, subtype "center"; undo removes and redo restores the negative part; parts are ordered by type (2 negative, 3 modifier, 6 parts); after four optional refusals and a two-instance refusal there is still no part 6; a shape folds the instance's 1.5 scale into the parts.
- Structure commands: each Change Type read back, one undo each; the refused changes and the SVG part's refused change leave the types; renames "base" and "infill zone" kept over a refused "a/b"; 6 instances undone, 3 kept over refused 0 and "three"; instances to objects reply indices and `total` 4; Assemble replies object 2 "Assembly", `total` 3.
- Order By: ascending then descending, reply `/descending` and bbox heights in list order; refusals leave the order; `object_order {all: true}` ascending.
- End to end: block 50 wide and 18.75 tall on the bed, moved to plate 1, 6 instances arranged there with plate 0 empty, 6 objects each with "boss" and a negative part, mirror on object 5 only, Assemble as object 4 with the mirrored one at index 3, order by name with "Assembly" first, Fill bed adds > 0 on plate 1, plate 1 slices "ok".
**Not checked:**
- Refusals whose follow-up reads nothing they would change: the absolute rotation of a part (rotation never read), the part move on single-part object 1 (position never read), Arrange on a locked plate (positions never read), `fill_object 0` with `plates 0` (only plate 1's object is read), `plates 7` (only that there is no plate 2), Set as Individual Objects on a single instance.
- The Speed Dial `obj_mirror_x` with nothing selected, which the header and README call "an error step", is optional, so it checks nothing in either direction.
- Arrange options: `spacing` and `rotate` are checked only as echoes in the reply; no position or gap between objects is read.
- Loose: Fill bed `/added` > 0; `app_state /python/scripts_unrestricted` and `/design_tab` only `ne null`; the SVG part's bbox and volume ranges (documented: its orientation varies).
- Mirroring is checked by the `mirrored` flag only, not by geometry.
- The end-to-end Fill bed result is not read in `object_list`; the slice is checked only by outcome; the screenshot is never compared.
**Strength:** Partial — transforms, `part_add` and the structure commands are read back exactly, but about half of the refusals and the arrange options have no check that could fail.

View file

@ -0,0 +1,252 @@
# Plates
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_plates`
`test_plates.py` · Python · takes the place of `plates.json`, `menu_items_plates.json` and `plate_icons.json`
**Tests:** The plates of the Prepare view: adding, duplicating, naming, locking, selecting and deleting plates, and
undoing that; what a lock keeps Arrange and Auto-Orient from doing; the settings a plate sets for itself; the
filament slots its filament orders count on; and the plate icons and plate menu, which do the same jobs from a
click. It runs on the harness's default printer, the Bambu Lab X1 Carbon 0.4.
**Reads:** `plates()` gives each plate as `{name, current, locked, objects}` from `plate_list`. `objects()` gives
each object as `{name, plate}` from `object_list`, and the objects outside the plates by name. `slots()` gives the
filament slots as `filament_is_mixed` from `project_get_settings`, one digit per slot (`"0,0,1"`: three slots, the
third a mixed filament). Every scenario starts with `project_new {discard_changes: true}` in the Prepare view and
checks that `plates()` is `"" 0 *`.
In the tables a plate is written as its name and its number of objects, with `*` on the current plate and `L` on a
locked one, and the plates are listed in order between `·`: `"" 1 *` · `"Copy" 1 L` is an unnamed current plate with
one object, then a locked plate named Copy with one object. After every step, `plates()` is compared with its row
whole.
**Scenario: a plate's life**
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `plate_delete` | `"" 0 *` | refused, `last_plate` |
| 2 | `plate_add` | `"" 0` · `"" 0 *` | the new plate is made current |
| 3 | `plate_add` | `"" 0` · `"" 0` · `"" 0 *` | |
| 4 | `plate_rename {plate: 1, name: "Left"}` | `"" 0` · `"Left" 0 *` · `"" 0` | naming a plate makes it current |
| 5 | `plate_lock {plate: 2, locked: true}` | `"" 0` · `"Left" 0 *` · `"" 0 L` | |
| 6 | `plate_delete {plate: 0}` | `"Left" 0 *` · `"" 0 L` | the plates after it move down; the current plate stays current |
| 7 | `undo` | `"" 0` · `"Left" 0 *` · `"" 0 L` | the delete is one undo step |
| 8 | `redo` | `"Left" 0 *` · `"" 0 L` | |
| 9 | `project_save` to a new file, `project_new`, `project_open` of the file | `"Left" 0 *` · `"" 0 L` | names and locks are kept in the project file |
**Scenario: by index, and on the current plate**
| # | Step | Plates after | Objects after |
|---|---|---|---|
| 1 | `object_add_primitive {shape: "cube", size: [20, 20, 20], name: "first"}` | `"" 1 *` | first on 0 |
| 2 | `plate_add` | `"" 1` · `"" 0 *` | |
| 3 | the same with `name: "second", plate: 1` | `"" 1` · `"" 1 *` | first on 0, second on 1 |
| 4 | `plate_select {plate: 0}` | `"" 1 *` · `"" 1` | |
| 5 | `plate_duplicate {plate: 1}` | `"" 1 *` · `"" 1` · `"" 1` | and second on 2: the new plate comes last, and plate 0 stays current |
| 6 | `plate_duplicate` | `"" 1 *` · `"" 1` · `"" 1` · `"" 1` | and first on 3 |
| 7 | `plate_rename {plate: 2, name: "Copy"}` | `"" 1` · `"" 1` · `"Copy" 1 *` · `"" 1` | |
| 8 | `plate_select {plate: 1}`, then `plate_rename {name: "Second"}` | `"" 1` · `"Second" 1 *` · `"Copy" 1` · `"" 1` | |
| 9 | `plate_rename {name: "Second"}` | as after 8 | |
| 10 | `undo` | `"" 1` · `"" 1 *` · `"Copy" 1` · `"" 1` | the unchanged name took no undo step, so undo takes back step 8's |
| 11 | `redo` | as after 8 | |
| 12 | `plate_lock {plate: 3, locked: true}` | `"" 1` · `"Second" 1 *` · `"Copy" 1` · `"" 1 L` | reply `changed: true` |
| 13 | `plate_lock {plate: 3}` | as after 8 | without `locked` it toggles |
| 14 | `plate_lock` | `"" 1` · `"Second" 1 * L` · `"Copy" 1` · `"" 1` | the current plate |
| 15 | `plate_lock {locked: true}` | as after 14 | reply `changed: false` |
| 16 | `undo` | as after 8 | the unchanged lock took no undo step, so undo takes back step 14's |
| 17 | `redo`, then `plate_lock {locked: false}` | as after 8 | |
| 18 | `plate_select {plate: 2}` | `"" 1` · `"Second" 1` · `"Copy" 1 *` · `"" 1` | |
| 19 | `plate_select` | as after 18 | without a plate the current plate stays |
| 20 | `plate_delete {plate: 1}` | `"" 1` · `"Copy" 1 *` · `"" 1` | first on 0, second on 1, first on 2; outside: second |
| 21 | `plate_delete` | `"" 1 *` · `"" 1` | first on 0, first on 1; outside: second, second. Deleting the current plate makes the plate before it current |
| 22 | `undo` | as after 20 | as after 20 |
**Scenario: duplicating a plate**
A copy must be the same objects at the same places on the new plate. A place is given as an offset from the plate's
front left corner (`origin` from `plate_list`), and objects are read from `object_list` as their name, plate,
`offset`, `rotation_deg`, `scale`, `bbox` and the `triangles` and `mesh_volume` of their part. Positions the app
works out from a plate's corner are checked to 0.001 mm.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `object_add_primitive {shape: "cube", size: [20, 20, 20], name: "cube", position: corner + (40, 60)}`, then `object_transform {object: 0, rotate: [0, 0, 30], mode: "absolute"}` | `"" 1 *` | cube on plate 0, `offset` x and y at corner + (40, 60), resting on the bed (`bbox.min` z 0), `rotation_deg` `[0, 0, 30]`, `bbox.size` `[27.32, 27.32, 20]` to 0.01; its part has 12 triangles and `mesh_volume` 8000 |
| 2 | `object_add_primitive {shape: "cylinder", size: [20, 30], name: "cylinder", position: corner + (120, 80)}` | `"" 2 *` | cylinder on plate 0 at corner + (120, 80), resting on the bed, `bbox.size` `[20, 20, 30]` to 0.1, `mesh_volume` within 1 % of 9425 |
| 3 | `plate_duplicate {plate: 0}` | `"" 2 *` · `"" 2` | the reply's `new_plate` is 1. Plate 1 holds a cube and a cylinder, named so, at plate 1's corner + (40, 60) and + (120, 80), resting on the bed, each with its source's `rotation_deg`, `scale`, `bbox.size`, `triangles` and `mesh_volume`. The sources are as after 2; there are 4 objects, none outside the plates |
| 4 | `object_transform` of the cube's copy, `translate: [10, 0, 0]` | as after 3 | the copy is 10 mm further along x and the source cube has not moved: a copy is an object of its own, not another instance of its source |
| 5 | `undo`, twice | `"" 2 *` | the duplicate is one undo step: 2 objects, as after 2 |
**Scenario: what a lock does**
A lock keeps Arrange and Auto-Orient off a plate, and nothing else: the plate's objects can still be moved by hand.
Two cubes of 20 × 20 × 10 mm are turned onto their side with `object_transform {rotate: [0, 90, 0], mode:
"absolute"}`, so that each stands 20 mm tall (`bbox.size` `[10, 20, 20]`) and Auto-Orient would lay it flat. A is
added on plate 0 and B on plate 1, each with `position` 30 mm in from its plate's front left corner (the plate's
`origin` from `plate_list`). Objects are read from `object_list` as their plate, `offset`, `rotation_deg` and
`bbox.size`.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | A and B added and turned, then `plate_lock {plate: 0, locked: true}` | `"" 1 L` · `"" 1 *` | A at its corner, standing |
| 2 | `object_arrange` | `"" 1 L` · `"" 1 *` | A's `offset` and `rotation_deg` as after 1; B on plate 1; the reply lists plate 0 among the plates it skipped |
| 3 | `object_arrange {plates: 0}` | as after 2 | refused, saying plate 0 is locked; A as after 1 |
| 4 | `object_auto_orient {plates: [0]}` | as after 2 | refused, `plate_locked`; A still standing, `rotation_deg` `[0, 90, 0]` |
| 5 | `object_auto_orient {objects: [0, 1]}` | as after 2 | B lies flat (`bbox.size` z 10) and A still stands; the reply names B alone |
| 6 | `object_transform {object: 0, translate: [5, 0, 0]}` | as after 2 | A is 5 mm further along x: a lock does not stop a move by hand |
| 7 | `plate_lock {plate: 0, locked: false}`, then `object_auto_orient {objects: [0]}` | `"" 1` · `"" 1 *` | A lies flat: the call that left it standing turns it once the plate is unlocked |
| 8 | `object_arrange` | `"" 2` · `"" 0 *` | A and B both on plate 0, their squares apart and inside the plate; plate 1, empty now, is kept |
**Scenario: a plate's own settings**
It starts with two filament slots (`slots()` is `"0,0"`, made with `filament_add` and `filament_delete`), the project's
plate type set to Cool Plate with `project_set_settings`, and steps 1 to 3 of the by-index scenario: two plates with
a cube each, plate 1 current. A plate's settings are read from `plate_list` as `{curr_bed_type,
print_sequence, spiral_mode, first_layer_print_sequence, other_layers_print_sequence, overrides}`. In the table, a
plate whose settings are not named has the project's: `Cool Plate`, `by layer`, spiral off, both orders `null`, and
no `overrides`.
| # | Step | Settings after | Also checked |
|---|---|---|---|
| 1 | `plate_set_settings {plate: 1, values: {curr_bed_type: "Textured PEI Plate", print_sequence: "by object"}}` | plate 1: `Textured PEI Plate`, `by object`, overrides `[curr_bed_type, print_sequence]` | `plate_get_settings {plate: 1}` gives the same two values, `meta.offered` of `curr_bed_type` holds `Cool Plate`, and `spiral_mode` is `null` with effective `false` |
| 2 | `undo` | both plates the project's | |
| 3 | `redo` | as after 1 | |
| 4 | `plate_set_settings {plate: 1, values: {print_sequence: null}}` | plate 1: `Textured PEI Plate`, overrides `[curr_bed_type]` | the reply's effective `print_sequence` is `by layer` |
| 5 | `plate_set_settings {plate: 1, values: {curr_bed_type: "Glass Plate", print_sequence: "by object"}}` | as after 4 | refused, saying this printer does not offer `curr_bed_type "Glass Plate"`; the print sequence, which was valid, is not set either |
| 6 | `plate_set_settings {plate: 0, values: {first_layer_print_sequence: [1, 1]}}` | as after 4 | refused, saying a filament order lists every slot 1..2 once |
| 7 | `plate_set_settings {plate: 0, values: {other_layers_print_sequence: [{from: 2, order: [1, 2]}, {from: 5, to: 9, order: [2, 1]}]}}` | as after 4 | refused, saying the layer ranges overlap |
| 8 | `plate_set_settings {plate: 0, values: {skirt_start_angle: 90}}` | as after 4 | refused as a setting a plate does not take |
| 9 | `plate_lock {plate: 2, locked: true}` | as after 4, and `plates()` as before | refused, `no_such_plate` |
| 10 | `plate_set_settings {plate: 0, values: {first_layer_print_sequence: [2, 1], other_layers_print_sequence: [{from: 10, order: [1, 2]}, {from: 2, to: 9, order: [2, 1]}]}}` | plate 0: first `[2, 1]`, others `[{from: 2, to: 9, order: [2, 1]}, {from: 10, order: [1, 2]}]`, overrides `[first_layer_print_sequence, other_layers_print_sequence]` | the ranges come back sorted, and the open-ended one has no `to`; plate 0 is made current, as the Plate Settings dialog works on the current plate |
| 11 | `plate_set_settings {values: {first_layer_print_sequence: null, other_layers_print_sequence: null}}` | as after 4 | with no plate it sets the current plate, plate 0 |
| 12 | `plate_set_settings {plate: 0, values: {spiral_mode: true}}` | plate 0: spiral on, overrides `[spiral_mode]` | the spiral mode question was asked once, answered by an auto-answer rule whose use count goes from 0 to 1 |
| 13 | `plate_set_settings {plate: 0, values: {spiral_mode: null}}` | as after 4 | |
| 14 | `plate_slice {plates: 1}` | as after 4 | outcome `ok`; `plate_list` gives plate 1 `sliced: true` with no `layer_gcode`, and plate 0 `sliced: false` |
| 15 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 4 | a plate's own settings are kept in the project file |
**Scenario: filament slots**
| # | Step | `slots()` after | Also checked |
|---|---|---|---|
| 1 | `filament_delete` until it is refused | `"0"` | the last call refused, `last_filament_slot` |
| 2 | the Add filament action (`action_run`) | `"0,0"` | message `Added filament slot 2.` |
| 3 | the same | `"0,0,0"` | message `Added filament slot 3.` |
| 4 | `filament_delete {filament_slot: 4}` | `"0,0,0"` | refused, `no_such_slot` |
| 5 | `filament_delete {filament_slot: 2}` | `"0,0"` | message `Deleted filament slot 2.` |
| 6 | a click on Add Mixed Filament, answered OK | `"0,0,1"` | the dialog that opens is titled Add Mixed Filament |
| 7 | `filament_delete {filament_slot: 3}` | `"0,0,1"` | refused, `mixed_filament_slot` |
| 8 | `plate_set_settings {plate: 0, values: {first_layer_print_sequence: [2, 1]}}` | `"0,0,1"` | refused, saying it cannot be set while the project has mixed filaments; plate 0's order stays `null` |
| 9 | the Add filament action | `"0,0,0,1"` | message `Added filament slot 3.`: a new slot goes ahead of the mixed one |
| 10 | the Delete filament action | `"0,0,1"` | message `Deleted filament slot 3.` |
| 11 | a click on Remove last mixed filament | `"0,0"` | |
**Scenario: plate icons and the plate menu**
Each step is a `widget_click` on `{plate_icon, plate}` unless it says otherwise. The cubes are 20 mm and added with
`object_add_primitive` at a `position`; "on plate 1" means a cube's 20 mm square lies inside plate 1's rectangle
(`origin` and `size` from `plate_list`).
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `widget_list {query: "plate_icon"}` | `"" 0 *` | plate 0 shows exactly the icons `plate`, `orient`, `arrange`, `lock`, `settings` and `name` |
| 2 | `lock` on plate 0 | `"" 0 * L` | |
| 3 | `lock` on plate 0 | `"" 0 *` | |
| 4 | `settings` on plate 0, answered Cancel | `"" 0 *` | the dialog is titled Plate Settings; plate 0's settings are the project's afterwards |
| 5 | the Add Plate button of the 3D view's toolbar (`gltoolbar: "addplate"`) | `"" 0` · `"" 0 *` | |
| 6 | two cubes at plate 1's middle | `"" 0` · `"" 2 *` | both on plate 1 at the same `x` and `y` |
| 7 | `arrange` on plate 1 | `"" 0` · `"" 2 *` | the reply has `started` and `done`; the wait for idle is met; both cubes on plate 1 and their squares apart |
| 8 | a right click on `plate` of plate 1 | as after 7 | the menu lists `Edit Plate Name`, `Lock` and `Delete Plate` |
| 9 | the same, picking `Lock` | `"" 0` · `"" 2 * L` | the reply's `ran` is `Lock` |
| 10 | `lock` on plate 1 | `"" 0` · `"" 2 *` | |
| 11 | `move_to_front` on plate 1 | `"" 2 *` · `"" 0` | both cubes on plate 0 |
| 12 | `app_state` | as after 11 | no dialog open and no menu left open |
**To settle in review:**
- After undoing a delete, the plate that was current before the delete is current again (a plate's life, step 7;
by index, step 22). Selecting a plate takes an undo snapshot of its own, so this is what undo is expected to give.
- The plate commands refuse with codes from the operations layer (`last_plate`, `no_such_plate`), but most of
`plate_set_settings`'s refusals carry no code, so steps 5 to 8 of the settings scenario match their words. Giving
them codes is a change to the app.
- The icons plate 0 shows on its own (icons, step 1): the replay this takes the place of counted at least seven
nodes, one more than the six named here.
- An object with instances on two plates, which no step uses. A duplicate copies each object that has an instance on
the source plate, with all of its instances, and moves the copy by the distance between the two plates, so the copy
of an instance that stood on another plate lands beside that plate or on a third one. This is the app's own plate
code (`PartPlateList::duplicate_plate()`), left as it is: a bug for a fix of its own.
- What a duplicate leaves out: the new plate gets the objects, but not the source plate's name, lock or own
settings. The scenarios expect that (a copy of a named plate is unnamed).
- Arranging only a locked plate (lock, step 3): `object_arrange` refuses it with "Plate 0 is locked; unlock it first
…" and no code, while Auto-Orient refuses a locked plate with `plate_locked`, so the step matches the words "Plate 0
is locked". The refusal's advice says to select the plate before `plate_lock`, although `plate_lock` takes the
plate; that is a bug in the MCP code (`McpToolsScene.cpp`, `object_arrange`), fixed with this test.
- Where the last arrange leaves things (lock, step 8): both cubes packed on plate 0 and plate 1 left empty, with
plate 1 still current. An arrange never removes a plate, but which plate is current afterwards is to confirm.
**Not checked:**
- The refusals of a plate index the project lacks for each plate command, and Rename Plate's name dialog: they are
checked in `test_menu_items_refusals`.
- How the plates and icons look: no screenshot is taken.
- The plate's `wipe_tower` position and `origin` and `size` themselves, beyond containing the arranged cubes.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `plates`
`tests/plates.json` · replay, 69 steps, 35 expects, 13 optional
**Tests:** `plate_set_settings`, `plate_lock` and `plate_rename` as the Plate Settings dialog and plate icons do, read back with `plate_list` and `plate_get_settings`: a per-plate plate type and print sequence with undo/redo, first- and other-layer filament orders, spiral vase, an idempotent lock and a name; the `filament_add`/`filament_delete` commands; and a mixed filament whose slot cannot be deleted, ahead of which a new slot goes, and which blocks custom filament orders.
**Decides by:** Fails when a non-optional call errors or one of its 80 matchers misses.
- Slots: one slot after the optional deletes; `filament_add` messages "Added filament slot 2." and "3."; `filament_delete {filament_slot: 2}` message; `filament_is_mixed` = `"0,0"`.
- Start state: `plate_list` totals, object counts, empty overrides, `by layer`, unlocked, no layer G-code.
- Per-plate settings: applied and changed values; plate 1 `overrides` exactly `["curr_bed_type", "print_sequence"]`, plate 0 none; `plate_get_settings` value, effective and offered; undo empties overrides, redo restores `by object`; `null` gives effective `by layer`.
- Refusals: after five optional refused calls, plate 1 unlocked with overrides exactly `["curr_bed_type"]` and plate 0's empty.
- Filament orders: applied orders exact and sorted (open-ended range has no `to`), overrides exact, cleared with `null`.
- Spiral, lock, name, slice: exact values; locking twice reports `changed` true then false; plate 1 `sliced` true with no layer G-code.
- Mixed filament: dialog title exact; `filament_is_mixed` `"0,0,1"`; after the refused delete and order, plate 0's first-layer order is still null and a new slot gives `"0,0,0,1"`; delete and "Remove last mixed filament" return it to `"0,0"`.
**Not checked:**
- The refused `curr_bed_type: "Glass Plate"` + `by object` call: the read-back checks `overrides`, not plate 1's `curr_bed_type`, so accepting the bed type alone would pass.
- Redo is read back by `print_sequence` only, not `curr_bed_type`.
- The spiral-mode question is auto-answered; nothing confirms it was asked.
- `/items/0/wipe_tower` is `exists` only.
**Strength:** Strong — nearly every setting is read back exactly, and most refusals are followed by a read that would catch them.
### `menu_items_plates`
`tests/menu_items_plates.json` · replay, 37 steps, 58 expects, 0 optional
**Tests:** The plate commands by index and with no plate: `plate_duplicate`, `plate_rename` (which makes the plate current), `plate_lock`, `plate_select`, `plate_delete` (the deleted plate's object left outside), and undo of a delete.
**Decides by:** Fails when a call errors or an expect misses.
- Each reply's `plate`, `new_plate`, `current`, `name`, `locked`, `changed` and per-plate object counts are exact.
- `plate_list` after each: `total`, which plate is `current`, `name` (including an unnamed plate's ""), `locked`, object counts.
- `object_list`: duplicated plates hold "second" and "first"; after deleting plate 1 its object "second" is listed outside.
- Undo of the last delete gives `total` 3.
**Not checked:**
- The undo is checked by plate count only; the restored plate's object and name are not read.
**Strength:** Strong — every reply and the plate list are matched exactly after each command.
### `plate_icons`
`tests/plate_icons.json` · replay, 27 steps, 15 expects, 0 optional
**Tests:** `{plate_icon, plate}` locators doing what a click on the Prepare view's plate icon does: lock twice, Plate Settings opened and cancelled, a second plate's arrange icon spreading two stacked cubes, the plate's right-click menu listed and run, and move to front.
**Decides by:** Fails when a call errors or one of its 26 matchers misses.
- Listing: `widget_list {query: plate_icon}` `/nodes` ≥ 7.
- Lock: `/locked` true, then false.
- Settings: reply `/dialogs/0/title` contains `Plate`; `dialog_answer` must find "Plate Settings".
- Arrange: before, both cubes on plate 1 at Y offset 128.0; after the icon (`/started`, `/done` true, idle within 2 s), both still on plate 1 with Y offset ≠ 128.0.
- Menu: the listing contains `Edit Plate Name`; running `Lock` gives `/ran` = `Lock`, and the lock icon then reads `/locked` = false, showing the menu had locked it.
- Move to front: `/current` = 0; `app_state` current plate 0 of 2; both cubes on plate 0; no dialog open, no unseen menu.
**Not checked:**
- Arrange is checked only as "Y moved off 128"; the cubes could still overlap, and X is not read.
- The icon count is `ge 7`, not the known set of icons.
- Cancelling Plate Settings is not checked to leave the plate unchanged.
**Strength:** Strong — each icon's effect is read back from plate or object state.

View file

@ -0,0 +1,595 @@
# Presets and calibration
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_presets`
`test_presets.py` · Python · takes the place of `presets.json`, `presets_and_plate_map.json` and `ops_select_preset.json`,
and of the removed `ops_import_presets.json`
**Tests:** The presets of the three types, through the tools a person's preset work maps to: selecting a preset by
the name its selector shows, hidden ones included (`preset_select`); listing presets with filters (`preset_list`);
what a setting is and where it lives (`settings_get`, `settings_list`); saving, overwriting, reverting and deleting
presets (`preset_save`, `settings_set`, `preset_delete`); the unsaved-changes prompt of a preset switch and of a new
project, answered ahead (`preset_changes`) or in the dialog; the same selections through the plugin API's
`orca.host.preset.process` and `.printer` `begin_update(name)`; a preset kept inside the project; exporting a
filament with the Export Preset Bundle dialog and importing preset files (`preset_import`); a printer variant picked
by its nozzle diameter and the filament grouping of a printer with one extruder; a preference changed in its
dialog; and that the presets selected, a user preset and an unsaved edit are what the G-code is sliced with. It runs
on the harness's default printer, the Bambu Lab X1 Carbon 0.4, on the sweep's fresh app and data folder: the hidden
presets scenario needs presets nothing has shown yet, since a preset `preset_select` shows stays shown until the app
restarts, and the saves expect no preset of their names. Its scenarios run in the order written, and two of them
count on what an earlier one left: the nozzle scenario on the filament the hidden presets scenario showed, and the
printer switches on the process the X1E was last used with (see **To settle**).
**Terms:** printers `X1C` (Bambu Lab X1 Carbon 0.4 nozzle), `X1C 0.6` (Bambu Lab X1 Carbon 0.6 nozzle), `X1E` (Bambu
Lab X1E 0.4 nozzle), `A1M` (Bambu Lab A1 mini 0.4 nozzle); processes `Std` (0.20mm Standard @BBL X1C), `Opt` (0.16mm
Optimal @BBL X1C); filaments `PLA` (Bambu PLA Basic @BBL X1C), `HS` (Generic PLA High Speed @BBL X1C). Presets the
test makes are written by their full names ("MCP Test PLA").
**Reads:**
- `selection()` gives `app_state.presets` (the printer, the process and each slot's filament) and the unsaved edits of
the preset each tab edits: the keys `settings_get {type, compare: ":saved"}` lists, each once, for the process and
the printer, and for the filament the same read with `filament_slot` for each slot in turn, since a read without a
slot sees slot 1's preset and sees its edits only while the filament tab edits it. Each key comes with its whole
value, as `settings_get {type, keys: [key]}` (with the slot) reads it. It is written `printer | process |
filaments`, a preset's unsaved keys and their values in brackets after it: `X1C | Std[wall_loops 5] | PLA` is the
X1C, and Std with `wall_loops` edited to 5, and PLA in the one slot; `PLA, MCP Calib PLA[filament_cost 22]` is two
slots, the filament tab editing the second. A value with spaces is quoted. After every step `selection()` is
compared with its row whole, keys and values.
- `value(type, key, preset=None, slot=None)` gives one item's `value` from `settings_get {type, keys: [key],
include_meta: false}`, with `preset` the saved preset of that name and with `slot` that slot's, as OrcaSlicer writes
it.
- `listed(type, **filters)` gives every item of `preset_list` for the filters, reading page after page (`limit` 500 and
`offset`), each item whole.
- `dialogs()` gives the open dialogs from `app_state.dialogs` as `{title, buttons}`, a button by its label.
- `plugin(code)` runs `code` with `script_run` and gives what it returns; the code catches what the plugin API raises
and returns `{raised: {type, message}}`, so the test asserts the raise instead of losing it. It replaces
`ops_presets.preset_api`, which returns every raise as data.
- `gcode_config(path)` (new) gives the `; key = value` lines between `; CONFIG_BLOCK_START` and `; CONFIG_BLOCK_END` of
an exported G-code file as a dict, quotes around a value removed; `gcode_heights(path)` (new) gives the heights of
its `; Z_HEIGHT:` lines in order.
A call that the unsaved-changes prompt holds replies `blocked_by_dialog`. The test then reads `dialogs()`, answers
with `dialog_answer`, and waits for the call's job with `wait`; a wait that runs out of time fails. A refusal is
matched by its code where the operations layer gives one, otherwise by its words, and is always followed by
`selection()`.
The test turns on Simple mode once, with the `mode_simple` action, before the first scenario: the prompt lists only
the settings the mode shows, and one scenario counts on a setting Simple mode hides. Every scenario starts with
`project_new {discard_changes: true, preset_changes: "discard"}`, then `preset_select` of X1C, Std and PLA in slot 1
where the scenario before left others selected, and checks that `selection()` is `X1C | Std | PLA`, that the project
has one filament slot and no objects, that `app_state.mode` is `simple` and that `preferences_get` reads
`developer_mode` false.
**Scenario: hidden presets** (runs first)
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `preset_list {type: printer}`; `preset_list {type: filament, query: "Generic PLA High Speed @BBL X1C"}`, then the same with `include_uninstalled: true` | `X1C \| Std \| PLA` | the printers listed are X1C alone, the one model and nozzle the sweep seeds; the filament query lists nothing, and with `include_uninstalled` it lists HS alone, with `installed: false` |
| 2 | `preset_select {type: filament, name: "Generic PLA High Speed @BBL X1C", filament_slot: 1}` | `X1C \| Std \| HS` | reply `selected` and `shown` are both HS; `preset_list {type: filament, query: <HS>}` without `include_uninstalled` lists it with `selected: true` and no `installed` field |
| 3 | `preset_select {type: filament, name: "Bambu PLA Basic", filament_slot: 1}`, the name the slot's selector shows | `X1C \| Std \| PLA` | reply `selected` PLA, and no `shown` |
| 4 | `preset_select {type: printer, name: "Bambu Lab X1E 0.4 nozzle"}` | `X1E \| Std \| PLA` | reply `shown` X1E; no dialog opened. Std and PLA list the X1E among their printers and are its defaults, so they stay |
| 5 | `preset_select` of X1C | `X1C \| Std \| PLA` | |
| 6 | `preset_select {type: printer, name: "Bambu Lab A1 mini 0.4 nozzle", preset_changes: "discard"}` | `A1M \| 0.20mm Standard @BBL A1M \| <F>` | reply `shown` A1M. `<F>` is a system filament whose name ends ` @BBL A1M`: the switch lands slot 1 on one of the A1 mini's own filaments, not on the default filament |
| 7 | `preset_select` of X1C, then Std, then PLA in slot 1 | `X1C \| Std \| PLA` | |
**Scenario: listing presets**
The selection stays `X1C | Std | PLA` throughout; each step checks it.
| # | Step | Checked |
|---|---|---|
| 1 | `listed(filament, vendor: "Bambu Lab", filament_type: "PLA", include_uninstalled: true)` | PLA is among them, "Bambu PLA Basic @BBL A1M" is not; every item has `vendor` "Bambu Lab" and `filament_type` "PLA" |
| 2 | the same with `vendor: "bambu lab", filament_type: "pla"` | the same names in the same order as step 1 |
| 3 | the same as step 1 with `include_incompatible: true` | the names of step 1 and more, "Bambu PLA Basic @BBL A1M" among them with `compatible: false`; every item of step 1 is there without a `compatible` field: what step 1 leaves out is what does not fit the X1C |
| 4 | `listed(printer, include_uninstalled: true)` | "Bambu Lab X1 Carbon 0.2 nozzle" is listed with `installed: false`; every item with `system: true` has `vendor`, `printer_model` and `nozzle`; the X1C item has `vendor` "BBL", `printer_model` "Bambu Lab X1 Carbon", `nozzle` "0.4" and `selected: true` |
| 5 | `listed(filament, printer: "Bambu Lab X1 Carbon 0.2 nozzle", include_uninstalled: true)` against `listed(filament, include_uninstalled: true)` | "Bambu PLA Basic @BBL X1C 0.2 nozzle" is in the first list only and PLA in the second only |
| 6 | the first of step 5 with `include_incompatible: true` | PLA is listed with `compatible: false` and "Bambu PLA Basic @BBL X1C 0.2 nozzle" without a `compatible` field: compatibility is judged against the printer named, not the one selected |
| 7 | `preset_list {type: printer, printer: "Bambu Lab X1 Carbon 0.2 nozzle"}` | refused, "printer lists the filaments or processes that fit a printer preset, not printers" |
| 8 | `preset_list {type: process, filament_type: "PLA"}` | refused, "filament_type filters filaments (type filament)" |
**Scenario: what a setting is**
The selection stays `X1C | Std | PLA` throughout; each step checks it.
| # | Step | Checked |
|---|---|---|
| 1 | `settings_get {type: process, keys: [seam_slope_type, no_such_key]}` | one item, `seam_slope_type`, whose `meta.description` holds "scarf joint", `meta.where` is "Quality > Seam" and `meta.labels[1]` "Contour"; `unknown_keys` is `[no_such_key]` |
| 2 | `settings_get {type: printer, query: "ooze during long travel"}` | the first item is `retraction_length`, with `meta.where` "Extruder > Retraction" |
| 3 | `settings_get {query: "ooze during long travel"}` | the first item is `filament_retraction_length` of type `filament`, value "nil,0.4", and the second `retraction_length` of type `printer`, value "0.8,0.8": the two share their label and description, and the search keeps the order of the types it looks through, the filament's before the printer's |
| 4 | `settings_get {keys: [nozzle_temperature, layer_height, nozzle_diameter, curr_bed_type, no_such_key], include_meta: false}` | items, in this order: `nozzle_temperature` type `filament` "220,220", `layer_height` type `process` "0.2", `nozzle_diameter` type `printer` "0.4"; `unknown_keys` `[curr_bed_type, no_such_key]`; `type_of` `{curr_bed_type: project}` |
| 5 | `settings_get {type: process, keys: [nozzle_temperature]}` | no items; `type_of` `{nozzle_temperature: filament}` |
| 6 | `settings_set {values: {nozzle_temperature: 215}}` | refused, `"nozzle_temperature" is a filament setting: settings_set takes it with type "filament"`; `value(filament, nozzle_temperature)` is "220,220" |
| 7 | `settings_list {type: process, where: "Quality > Seam"}`, against the whole `settings_list {type: process, include_meta: true}`, every page | its keys are exactly the keys whose `meta.where` is "Quality > Seam" in the whole listing, `seam_position` and `seam_slope_type` among them; each item has a `meta.description`, and its `value` is the one the whole listing gives the key |
| 8 | `settings_get {type: process, keys: [fuzzy_skin]}` | `meta.values[1]` "external" and `meta.labels[1]` "Contour" |
**Scenario: saving a filament**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set {type: filament, values: {filament_cost: 21.5, slow_down_layer_time: 6, temperature_vitrification: 50}}` | `X1C \| Std \| PLA[filament_cost 21.5, slow_down_layer_time 6, temperature_vitrification 50]` | |
| 2 | `preset_save {type: filament, name: "MCP Test PLA"}` | `X1C \| Std \| MCP Test PLA` | reply `saved` "MCP Test PLA", `user` true, `project` false, `inherits` PLA, `selected` true, `filament_slots` `[1]`; `listed(filament, query: "MCP Test PLA")` is one item, `selected`, `user`, not `modified`, inheriting PLA; the saved preset reads `filament_cost` "21.5", `slow_down_layer_time` "6" and `temperature_vitrification` "50"; its `compatible_printers` names X1C, X1E 0.4 and X1E 0.6, the printers of the preset it was saved from |
| 3 | `preset_list` with `source: user`; with `source: system, query: "MCP Test PLA"`; with `source: project` | as after 2 | the user list is exactly "MCP Test PLA"; the other two list nothing |
| 4 | `settings_set` `filament_cost` 22, then `preset_save {type: filament, name: "MCP Test PLA"}` | as after 2 | saved without `overwrite`, as the tab's plain Save; `settings_get {type: filament, compare: ":parent", keys: [filament_cost, slow_down_layer_time, nozzle_temperature]}` gives `right` PLA, `total` 2, and the items `filament_cost` "22" (other "15.99") and `slow_down_layer_time` "6" (other "4") |
| 5 | `settings_set` `filament_cost` 23, then `preset_save {type: filament, name: "MCP Test PLA 2"}` | `X1C \| Std \| MCP Test PLA 2` | reply `filament_slots` `[1]`; "MCP Test PLA" is still listed, not selected, and `value(filament, filament_cost, preset: "MCP Test PLA")` is "22" |
| 6 | `preset_save {type: filament, name: "MCP Test PLA"}` | as after 5 | refused, `Preset "MCP Test PLA" already exists; pass overwrite: true to replace it`; "MCP Test PLA" still reads "22" |
| 7 | the same with `overwrite: true` | `X1C \| Std \| MCP Test PLA` | reply `selected` true; `filament_cost` reads "23" both edited and with `preset: "MCP Test PLA"` |
**Scenario: dropping and reverting edits**
The scenario first selects "MCP Test PLA" (filament cost 23) in slot 1.
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set {type: process, values: {wall_loops: 7, sparse_infill_density: "37%"}}` | `X1C \| Std[sparse_infill_density 37%, wall_loops 7] \| MCP Test PLA` | |
| 2 | `settings_set {type: process, reset_all: true, values: {wall_loops: 7}}` | `X1C \| Std[wall_loops 7] \| MCP Test PLA` | reply `reverted` holds `sparse_infill_density` and `wall_loops` and nothing else (the unsaved keys before the reset, the one set again included), `applied` `{wall_loops: "7"}`; `sparse_infill_density` reads "15%" |
| 3 | `settings_set {type: process, reset_all: true}` | `X1C \| Std \| MCP Test PLA` | reply `reverted` `[wall_loops]`; `wall_loops` reads "2" |
| 4 | the same | as after 3 | reply `reverted` `[]` |
| 5 | `settings_set` `wall_loops` 6, then `settings_set {type: process, reset_all: true, values: {wall_loops: "six"}}` | `X1C \| Std[wall_loops 6] \| MCP Test PLA` | the second call refused, "Invalid value for wall_loops": a bad value fails before the reset |
| 6 | `settings_set {type: process, reset_all: true, values: {wall_loops: 5, sparse_infill_density: "25%"}}`, then `settings_set {type: process, values: {wall_loops: null}}` | `X1C \| Std[sparse_infill_density 25%] \| MCP Test PLA` | the second reply `applied` and `changed` give `wall_loops` "2": null takes a key back to its saved value |
| 7 | `settings_set {type: process, values: {wall_loops: 3}, reset_to: "parent"}` | as after 6 | refused, "reset_to applies to the keys given as null"; `wall_loops` reads "2" |
| 8 | `settings_set {type: filament, values: {filament_cost: null}, reset_to: "parent"}` | `X1C \| Std[sparse_infill_density 25%] \| MCP Test PLA[filament_cost 15.99]` | reply `applied` `filament_cost` "15.99"; `settings_get {type: filament, compare: ":parent", keys: [filament_cost]}` gives `total` 0 |
| 9 | `settings_set {type: filament, values: {filament_cost: null}}` | as after 6 | reply `applied` `filament_cost` "23" |
| 10 | `settings_get {type: process, keys: [outer_wall_speed]}` | as after 6 | `meta.variants` `["Direct Drive Standard", "Direct Drive High Flow"]`, `meta.active` `[0]`, `value` "200,350" |
| 11 | `settings_set {type: process, values: {outer_wall_speed: 250}}` | `X1C \| Std[outer_wall_speed 250,350, sparse_infill_density 25%] \| MCP Test PLA` | reply `applied` "250,350": one value writes the entry in use, as typing into the tab's field does |
| 12 | `settings_set {type: process, values: {outer_wall_speed: [1, 2, 3]}}` | as after 11 | refused, "outer_wall_speed holds 2 values, one per extruder variant" |
| 13 | `settings_set {type: process, values: {outer_wall_speed: {index: 1, value: 300}}}` | `X1C \| Std[outer_wall_speed 250,300, sparse_infill_density 25%] \| MCP Test PLA` | reply `applied` and `changed` "250,300" |
| 14 | `settings_set {type: filament, values: {nozzle_temperature: {index: 0, value: 215}}}` | `X1C \| Std[outer_wall_speed 250,300, sparse_infill_density 25%] \| MCP Test PLA[nozzle_temperature 215,220]` | reply `applied` "215,220"; `settings_get {type: filament, compare: ":saved", keys: [nozzle_temperature]}` gives `total` 1 and one item, `index` 0, `value` "215", `other` "220": filaments are compared entry by entry |
| 15 | `settings_set {type: filament, reset_all: true}` | as after 13 | reply `changed` `nozzle_temperature` "220,220" |
| 16 | an auto-answer rule answering "Spiral mode only works" with Yes, then `settings_set {type: process, values: {spiral_mode: true}}` | printer, process and filament as after 13; the process's unsaved keys are `outer_wall_speed` 250,300 and every key of `changed` (below) with its value there | the rule's use count goes from 0 to 1: the question was asked once. Reply `applied` `spiral_mode` "1"; `changed` gives `spiral_mode` "1", `wall_loops` "1", `top_shell_layers` "0" and `sparse_infill_density` "0%" |
| 17 | `settings_set {type: process, reset_all: true}` | `X1C \| Std \| MCP Test PLA` | reply `changed` `spiral_mode` "0" |
**Scenario: reading presets that are not selected**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set {type: process, reset_all: true, values: {wall_loops: 5, sparse_infill_density: "25%"}}` | `X1C \| Std[sparse_infill_density 25%, wall_loops 5] \| PLA` | reply `changed` `{wall_loops: "5", sparse_infill_density: "25%"}` |
| 2 | `settings_get {type: process, compare: ":saved"}` | as after 1 | `total` 2, `left` "0.20mm Standard @BBL X1C (edited)", items `sparse_infill_density` "25%" (other "15%") and `wall_loops` "5" (other "2"), in that order |
| 3 | `settings_get {type: process, preset: <Std>, keys: [wall_loops]}`; `settings_get {type: process, preset: <Opt>, keys: [layer_height]}` | as after 1 | "2", the saved value without the edit, and "0.16"; reading Opt did not select it |
| 4 | `settings_get {type: process, compare: <Opt>, keys: [layer_height, wall_loops]}` | as after 1 | `right` Opt; items `layer_height` "0.2" (other "0.16") and `wall_loops` "5" (other "2") |
**Scenario: switching a process or a printer**
Each row starts as a scenario does: `project_new {discard_changes: true, preset_changes: "discard"}`, then
`preset_select` of X1C and Std with `preset_changes: "discard"` where the row before left others, and a check that
`selection()` is `X1C | Std | PLA`. It then makes the edit the row names: `process` is `settings_set {type: process,
values: {wall_loops: 5}}`, `printer` is `settings_set {type: printer, values: {printer_notes: "MCP pin"}}`. The call
is `preset_select` of the type and name given; "asks" means it is given no `preset_changes`, is held by a dialog, and
the dialog is answered as the row says. A row whose selection after shows no edit also reads `wall_loops` "2", the
saved value of Std and of Opt, so an edit that was dropped is seen to be gone.
| # | Edit | Call | Selection after | Also checked |
|---|---|---|---|---|
| 1 | none | process Opt | `X1C \| Opt \| PLA` | no dialog opened; the reply has no `discarded` and no `modified` |
| 2 | process | process Opt, `preset_changes: "transfer"` | `X1C \| Opt[wall_loops 5] \| PLA` | reply `modified` `{process: {name: Opt, keys: [wall_loops]}}`, no `discarded` |
| 3 | process | process Opt, `"discard"` | `X1C \| Opt \| PLA` | reply `discarded` `{process: {name: Std, keys: [wall_loops]}}`, no `modified` |
| 4 | process | process Opt, asks, answered Transfer | `X1C \| Opt[wall_loops 5] \| PLA` | one dialog held the call, titled "Transfer or discard changes", with the buttons Transfer, Discard and Save; the job's reply as in row 2 |
| 5 | process | process Opt, asks, answered Discard | `X1C \| Opt \| PLA` | the job's reply as in row 3 |
| 6 | process | process Opt, asks, closed (`cancel`) | `X1C \| Std[wall_loops 5] \| PLA` | the job ends refused, `selection_cancelled`, `Selecting "0.16mm Optimal @BBL X1C" was cancelled.` |
| 7 | process | process Std, the one the tab edits; asks, closed | `X1C \| Std[wall_loops 5] \| PLA` | a dialog of the same title and buttons held it; refused, `selection_cancelled` |
| 8 | none | process "No Such Process" | `X1C \| Std \| PLA` | refused, `preset_not_offered`, `The preset selector does not offer "No Such Process".` |
| 9 | none | process "0.16mm Optimal", Opt's alias | `X1C \| Std \| PLA` | refused, `preset_not_offered`, `The preset selector does not offer "0.16mm Optimal".`, its details' `similar` starting with Opt: a compatible preset carries the name, under another name in the selector |
| 10 | none | process "0.20mm Standard @BBL A1" | `X1C \| Std \| PLA` | refused, `preset_incompatible`, `"0.20mm Standard @BBL A1" is not compatible with the selected printer.` |
| 11 | none | printer X1E | `X1E \| Std \| PLA` | no dialog opened |
| 12 | printer | printer X1E, `"transfer"` | `X1C[printer_notes "MCP pin"] \| Std \| PLA` | refused, `transfer_not_offered`, "The unsaved changes cannot be transferred: a printer's changes stay with it." |
| 13 | printer | printer X1E, `"discard"` | `X1E \| Std \| PLA` | reply `discarded` `{printer: {name: X1C, keys: [printer_notes]}}` |
| 14 | printer | printer X1E, asks, answered Discard | `X1E \| Std \| PLA` | the dialog's title as in row 4, its buttons Discard and Save, no Transfer |
| 15 | printer | printer X1E, asks, closed | `X1C[printer_notes "MCP pin"] \| Std \| PLA` | refused, `selection_cancelled` |
| 16 | process | printer X1E, `"transfer"` | `X1E \| Std[wall_loops 5] \| PLA` | no dialog opened; reply `modified` `{process: {name: Std, keys: [wall_loops]}}`: the edit moved with the switch |
| 17 | process | printer X1E, `"discard"` | `X1E \| Std \| PLA` | reply `discarded` `{process: {name: Std, keys: [wall_loops]}}`: the X1E's process is selected again from its saved values |
| 18 | process | printer X1E, asks, answered Transfer | `X1E \| Std[wall_loops 5] \| PLA` | one dialog held the call, with the buttons Transfer, Discard and Save |
| 19 | process | printer X1E, asks, closed | `X1E \| Std \| PLA` | the job's reply `selected` X1E: closing the prompt does not stop this switch, and the edit is dropped as in row 17 |
| 20 | none | printer "No Such Printer" | `X1C \| Std \| PLA` | refused, `preset_not_offered` |
| 21 | none | printer "Bambu Lab X1 Carbon", the model's name | `X1C \| Std \| PLA` | refused, `preset_not_offered` |
**Scenario: switching through the plugin API**
The rows named, through `plugin("orca.host.preset.<process|printer>.begin_update(<name>).commit()")`, which returns
the commit's `target_name` and `selection_changed`, or what it raised. A row starts and makes its edit as the row it
names does, its selection after is that row's, and a refusal raises with the words of that row's refusal. The
plugin API has no `preset_changes`, so every switch with an edit asks.
| # | As row | Checked |
|---|---|---|
| 1 | 1 | `target_name` Opt, `selection_changed` true |
| 2 | 4 | the dialog's title and buttons as in row 4; `target_name` Opt |
| 3 | 5 | `target_name` Opt |
| 4 | 6 | raises `RuntimeError` (the plugin API's `SelectionCancelled` is a `std::runtime_error`) with the words of row 6 |
| 5 | 7, given Std, the preset the tab edits | no dialog opens; `target_name` Std, `selection_changed` false; selection `X1C \| Std[wall_loops 5] \| PLA` |
| 6 | 7, with no name | as 5 |
| 7 | 8, 9 and 10 | `ValueError` with each row's words |
| 8 | 11 | `target_name` X1E, `selection_changed` true |
| 9 | 14 and 15 | as those rows; the closed one raises `RuntimeError` |
| 10 | 18 | as row 18; `target_name` X1E |
| 11 | 19 | as row 19; nothing raised, `target_name` X1E |
| 12 | 20 and 21 | `ValueError` with each row's words |
| 13 | none: `orca.host.preset.process.begin_update(1, <Opt>)`, then `orca.host.preset.process.update(1, "wall_loops", "3")` | `ValueError`, "The slot_number form of begin_update() is only available on orca.host.preset.filament", then `ValueError`, "The slot_number form of update() is only available on orca.host.preset.filament"; selection `X1C \| Std \| PLA` after each |
**Scenario: what a switch carries**
It starts by selecting "MCP Test PLA" in slot 1 and setting `sparse_infill_density` "25%" on Std.
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set` `wall_loops` 4, then `preset_select {type: process, name: <Opt>, preset_changes: "transfer"}` | `X1C \| Opt[sparse_infill_density 25%, wall_loops 4] \| MCP Test PLA` | reply `modified.process.keys` `[sparse_infill_density, wall_loops]`, no `discarded` |
| 2 | `settings_set {type: process, values: {seam_slope_type: "all"}}`, then `preset_select` of Std with `"transfer"` | `X1C \| Std[sparse_infill_density 25%, wall_loops 4] \| MCP Test PLA` | reply `discarded` `{process: {name: Opt, keys: [seam_slope_type]}}`: Simple mode hides it, so the prompt does not list it and Transfer drops it, as in the GUI |
| 3 | `settings_set {type: filament, values: {slow_down_layer_time: 7}}`, then `preset_select` of Opt with `"discard"` | `X1C \| Opt \| MCP Test PLA[slow_down_layer_time 7]` | reply `discarded.process.keys` `[sparse_infill_density, wall_loops]`, no `modified.process`, and `modified.filament.keys` `[slow_down_layer_time]`: a filament that fits the new process keeps its edit whatever the answer |
| 4 | `settings_set {type: filament, reset_all: true, values: {filament_type: "PETG"}}`, `preset_save {type: filament, name: "MCP Test PETG"}`, then `preset_select` of "MCP Test PLA" in slot 1 | `X1C \| Opt \| MCP Test PLA` | `value(filament, filament_type, preset: "MCP Test PETG")` is "PETG" |
| 5 | `settings_set` `slow_down_layer_time` 8, then `preset_select {type: filament, name: "MCP Test PETG", filament_slot: 1, preset_changes: "transfer"}` | `X1C \| Opt \| MCP Test PLA[slow_down_layer_time 8]` | refused, `transfer_not_offered`, `The unsaved changes cannot be transferred: "MCP Test PETG" is a filament of another type.` |
| 6 | the same with `"discard"` | `X1C \| Opt \| MCP Test PETG` | reply `selected` "MCP Test PETG", `discarded` `{filament: {name: "MCP Test PLA", keys: [slow_down_layer_time]}}` |
**Scenario: a new project and unsaved presets**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set` `wall_loops` 6, then `project_new {discard_changes: true}` | `X1C \| Std[wall_loops 6] \| PLA` | reply `modified` `{process: {name: Std, keys: [wall_loops]}}`, no `discarded`; `preset_list {type: process, query: "0.20mm Standard @BBL X1C"}` gives the item `modified: true` |
| 2 | `project_new {discard_changes: true, preset_changes: "keep"}` | as after 1 | reply as in step 1 |
| 3 | `project_new {discard_changes: true, preset_changes: "discard"}` | `X1C \| Std \| PLA` | reply `discarded` `{process: {name: Std, keys: [wall_loops]}}`, no `modified`; the item has no `modified` |
**Scenario: a process kept inside the project**
It starts by selecting "MCP Test PLA" in slot 1.
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `preset_save {type: process, name: "MCP Project Process", inside_project: true}` | `X1C \| MCP Project Process \| MCP Test PLA` | reply `project` true, `user` false, `inherits` Std; `listed(process, query: "MCP Project Process")` is one item, `selected`, `project` true, `user` false |
| 2 | `preset_save {type: process, name: "MCP Detached", detach: true}` | as after 1 | refused, "Detach is offered only in Developer mode"; `listed(process, query: "MCP Detached")` is empty |
| 3 | the `toggle_developer_mode` action, the same save, the action again | `X1C \| MCP Detached \| MCP Test PLA` | reply `project` true and no `inherits` |
| 4 | `object_add_primitive {shape: "cube"}`, `project_save` to a new file, `project_new {discard_changes: true}` | `X1C \| Std \| MCP Test PLA` | `listed(process, query: "MCP")` is empty: presets inside a project leave with it |
| 5 | `project_open` of the file | `X1C \| MCP Detached \| MCP Test PLA` | `listed(process, query: "MCP")` is "MCP Detached" and "MCP Project Process", both `project` true and `user` false; "MCP Test PLA" is `selected` and not `modified` |
**Scenario: deleting presets**
It starts with "MCP Test PLA" in slot 1. The presets it deletes are those the scenarios before made.
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `preset_delete {type: filament, name: <PLA>}` | `X1C \| Std \| MCP Test PLA` | refused, `"Bambu PLA Basic @BBL X1C" is a system preset`; `value(filament, filament_type, preset: <PLA>)` is "PLA" |
| 2 | `preset_delete {type: filament, name: "MCP Test PLA 2"}` | as after 1 | reply `deleted` "MCP Test PLA 2", `selected` "MCP Test PLA", `filaments` `["MCP Test PLA"]`; `listed(filament, query: "MCP Test PLA 2")` is empty |
| 3 | `settings_set {type: filament, values: {slow_down_layer_time: 11}}`, then `preset_delete` of "MCP Test PETG" | `X1C \| Std \| MCP Test PLA[slow_down_layer_time 11]` | refused, `The edited filament "MCP Test PLA" has unsaved changes`; "MCP Test PETG" is still listed |
| 4 | `settings_set {type: filament, reset_all: true}`, `preset_select` of "MCP Test PETG" in slot 1, `slow_down_layer_time` 11, then `preset_delete` of "MCP Test PETG" | `X1C \| Std \| PLA` | reply `selected` PLA, the preset it inherits from, and `discarded` `{filament: {name: "MCP Test PETG", keys: [slow_down_layer_time]}}`; it is no longer listed |
| 5 | `preset_delete` of "MCP Test PLA" | `X1C \| Std \| PLA` | reply `selected` PLA; `listed(filament, query: "MCP Test")` is empty |
| 6 | Developer mode on, `preset_save {type: process, name: "MCP Delete Base", detach: true}`, Developer mode off | `X1C \| MCP Delete Base \| PLA` | reply `user` true and no `inherits` |
| 7 | `settings_set` `wall_loops` 3, then `preset_save {type: process, name: "MCP Delete Child"}` | `X1C \| MCP Delete Child \| PLA` | reply `inherits` "MCP Delete Base", `selected` true; the child reads `wall_loops` "3" |
| 8 | `preset_delete` of "MCP Delete Base" | as after 7 | refused, `"MCP Delete Base" cannot be deleted while other presets inherit from it`; `listed(process, query: "MCP Delete")` has both |
| 9 | `preset_select` of Std, `wall_loops` 4, then `preset_delete` of "MCP Delete Child" | `X1C \| Std[wall_loops 4] \| PLA` | refused, `The edited process "0.20mm Standard @BBL X1C" has unsaved changes`; both still listed |
| 10 | `settings_set {type: process, reset_all: true}`, then `preset_delete` of "MCP Delete Child" | `X1C \| Std \| PLA` | reply `deleted` "MCP Delete Child", `selected` Std, no `discarded`: it was selected, deleted and the selection restored; "MCP Delete Base" alone is listed |
| 11 | `preset_select` of "MCP Delete Base", `wall_loops` 5, then `preset_delete` of it | `X1C \| <P> \| PLA` | `<P>` is the reply's `selected`, a system process other than "MCP Delete Base"; `discarded` `{process: {name: "MCP Delete Base", keys: [wall_loops]}}`; `listed(process, query: "MCP Delete")` is empty |
| 12 | `preset_select` of Std, then `preset_save {type: printer, name: "MCP Test Printer"}` | `MCP Test Printer \| Std \| PLA` | reply `user` true, `inherits` X1C, `selected` true |
| 13 | `preset_select` of X1C, then `preset_delete {type: printer, name: "MCP Test Printer"}` | `X1C \| Std \| PLA` | refused, `"MCP Test Printer" is not the selected printer`; it is still listed |
| 14 | `preset_select` of "MCP Test Printer", then `preset_delete` of it | `X1C \| Std \| PLA` | reply `selected` X1C and no `attached`; it is no longer listed |
**Scenario: exporting and importing presets**
The test writes into a folder of its own. `costs()` reads `filament_cost` of "MCP Export PLA" and "MCP Import PLA" with
`value(..., preset: name)`, "absent" for one not listed. The selection stays `X1C | Std | PLA` except in step 5.
| # | Step | Checked |
|---|---|---|
| 1 | `settings_set` `filament_cost` 25; Developer mode on, `preset_save {type: filament, name: "MCP Export PLA", detach: true}`, Developer mode off; `preset_select` of PLA in slot 1 | reply no `inherits`; costs 25, absent |
| 2 | `preset_export {path: <folder>}`; a click on the label "Filament presets(.zip)" within Export Preset Bundle; `widget_set_value` of "MCP Export PLA" in it to true; OK; the Info dialog answered OK | the Info dialog's message is "Export successful"; the export's job ends with `level` "success"; no dialog is left. The file "Filament presets.zip" holds an entry ending "MCP Export PLA.json" whose `filament_cost` is 25: the check through the file |
| 3 | `preset_import {path: <zip>}` | reply `message` "Kept the existing presets: MCP Export PLA."; costs 25, absent |
| 4 | `preset_delete` of "MCP Export PLA", then `preset_import` of the zip | reply `message` "Imported presets: MCP Export PLA."; it is listed with `user` true; costs 25, absent |
| 5 | `preset_select` of "MCP Export PLA" in slot 1, `filament_cost` 30, `preset_save` under its name, `preset_select` of PLA | costs 30, absent |
| 6 | `preset_import` of the zip | `message` "Kept the existing presets: MCP Export PLA."; costs 30, absent |
| 7 | the same with `on_conflict: "overwrite"` | `message` "Replaced presets: MCP Export PLA."; costs 25, absent: the file's preset replaced the changed one |
| 8 | `preset_import` of `tests/fixtures/mcp_import_pla.json` | `message` "Imported presets: MCP Import PLA."; it is listed inheriting PLA; costs 25, 24 |
| 9 | the same again, then with `on_conflict: "overwrite"` | `message` "Kept the existing presets: MCP Import PLA.", then "Replaced presets: MCP Import PLA."; costs 25, 24 |
| 10 | `preset_import` of a path that does not exist | refused, "file not found"; costs 25, 24 |
| 11 | `preset_import` of `tests/fixtures/heightmap.png` | refused, "Not a preset file: give a .json, .zip, .orca_printer, .orca_filament, .orca_bundle or .gcode"; costs 25, 24 |
| 12 | `preset_import` of a `.json` the test writes, `{"not": "a preset"}` | refused, `no_presets_imported`; costs 25, 24; no dialog open |
| 13 | `preset_import` of the fixture with `overwrite: true` | refused, "unknown argument overwrite"; costs 25, 24 |
| 14 | `preset_import` of the fixture with `on_conflict: "merge"` | refused, "on_conflict must be one of"; costs 25, 24 |
| 15 | `preset_delete` of both | `listed(filament, query: "MCP ")` is empty |
**Scenario: a nozzle diameter, and one extruder's filament grouping**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set {type: printer, values: {nozzle_diameter: 0.6}}` | `X1C 0.6 \| 0.30mm Standard @BBL X1C 0.6 nozzle \| HS` | reply `applied` `nozzle_diameter` "0.6"; `nozzle_diameter` and `printer_variant` read "0.6": the variant's printer preset was selected, as the sidebar's nozzle diameter does. HS is the one shown filament that fits the 0.6 nozzle |
| 2 | `settings_set {type: printer, values: {nozzle_diameter: "0.4"}}` | `X1C \| Std \| PLA` | reply `applied` `nozzle_diameter` "0.4"; the X1C comes back with the process and filament it was last used with |
| 3 | `plate_get_settings {keys: [filament_map_mode, filament_map]}` | as after 2 | `filament_map_mode` value "Auto For Flush" with `meta.offered` empty; `filament_map` effective `[1]` |
| 4 | `plate_set_settings {values: {filament_map_mode: "Manual"}}` | as after 2 | refused, "filament_map_mode groups the filaments onto the extruders of a printer that has several; this one has one"; `plate_get_settings` as in step 3 |
**Scenario: what the print is sliced with**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `settings_set` `filament_cost` 23, `preset_save {type: filament, name: "MCP Print PLA"}`, `preset_select` of Opt, `settings_set` `wall_loops` 3, `object_add_primitive {shape: "cube", size: [20, 20, 20]}` | `X1C \| Opt[wall_loops 3] \| MCP Print PLA` | |
| 2 | `plate_slice`, then `project_export {format: "gcode", path: <file>}` | as after 1 | outcome `ok`. `gcode_config` of the file gives `printer_settings_id` X1C, `print_settings_id` Opt, `filament_settings_id` "MCP Print PLA", `layer_height` "0.16", `wall_loops` "3" and `filament_cost` "23": the selected presets, a user preset and an unsaved edit are what the G-code was made from. `gcode_heights` rise by 0.16 to 0.001 from each layer to the next, the first layer and the top one aside: the process's layer height is what the layers are printed at |
**Scenario: a preference changed in its dialog**
| # | Step | Checked |
|---|---|---|
| 1 | `preferences_get {keys: [auto_arrange, no_such_preference]}` | one item, `auto_arrange`, value true, its default; `unknown_keys` `[no_such_preference]` |
| 2 | `settings_set {values: {auto_arrange: false}}` | refused, `Unknown setting "auto_arrange" for the process settings`; no dialog open; `auto_arrange` reads true |
| 3 | `window_open {window: "preferences", tab: "advanced"}` | refused, "tab must be one of"; no dialog open |
| 4 | `window_open {window: "preferences", tab: "behaviour", key: "auto_arrange"}`, `widget_set_value {target: {name: "auto_arrange", within: "Preferences"}, value: false}`, then Close | the call is held by a dialog titled Preferences; the control's reply `checked` false; the job ends; `auto_arrange` reads false |
| 5 | the same with `tab: "general"` and `value: true` | the control is found although it is on another tab; `checked` true; `auto_arrange` reads true |
**To settle in review:**
- The A1 mini's filament (hidden presets, step 6). Selecting a printer that was hidden shows its model's default
filaments (`show_default_filaments()` in `PresetOps.cpp`), and the slot then takes one by the compatibility update,
which picks by the collection's order. The entry checks the property (a system filament ending ` @BBL A1M`) rather
than a name; naming it would tie the test to the profile's list order.
- An alias as a name (switching, row 9; plugin API, row 7). `"0.16mm Optimal"` is the alias of Opt and of the same
process for other printers. The tab's selector lists Opt by its full name, so the name matches no row and no hidden
preset. The operations layer then refuses it as `preset_incompatible`, saying "0.16mm Optimal" is not compatible
with the selected printer, because some presets that carry the alias are, though Opt, which is compatible, carries
it too. The fix, in `not_offered()` in `src/slic3r/GUI/Operations/PresetOps.cpp`: refuse as `preset_incompatible`
only when no compatible preset carries the name as its name or alias; when one does, the selector lists it under
another name, and the refusal is `preset_not_offered` with the `similar` names, which `similar_preset_names()`
ranks with Opt first (both words matched, and compatible). Row 9 expects the fixed refusal; row 10's name, which no
compatible preset carries, stays `preset_incompatible`. The plugin API raises `ValueError` for both codes.
- Printer switches with an edited process (switching, rows 16 to 19). The preference `remember_printer_config`, on by
default, makes a printer switch select again the process and filaments last used with the new printer
(`PresetBundle::update_selections()`), which reloads the process from its saved values. Transfer keeps the edit
through the process tab's cache, which is applied after that; Discard and closing the prompt lose it. The X1E was
last used with Std in rows 11, 13 and 14. Closing the prompt does not stop the switch at all: `Tab::select_preset()`
cancels only when the dependent preset does not fit the new printer. That is the app's own code, as on `main`, left
as it is: a prompt whose close does not cancel the switch is a bug for a fix of its own. Row 19 and plugin row 11
expect what the app does today.
- `preset_select` of the preset the tab edits, with unsaved changes (switching, row 7), asks the same question with
Transfer offered, since a process can always take a transfer (`Tab::can_transfer_changes_to()`).
- After a project with project presets is replaced by a new one (inside the project, step 4), the process is expected
to fall back to Std: `PresetBundle::reset_project_embedded_presets()` leaves no process selected and the
compatibility update picks the printer's default. After reopening it (step 5), the process the project was saved
with, "MCP Detached", is selected. The replay read neither.
- The process selected after deleting a selected preset with no parent (deleting, step 11) is the tab's next visible
preset, which depends on the collection's order; the entry checks only that it is a system process.
- The 0.6 nozzle's process and filament (nozzle diameter, step 1). The X1C 0.6 has never been used, so nothing is
remembered for it; the compatibility update takes its default process, "0.30mm Standard @BBL X1C 0.6 nozzle", and
the first shown filament that fits it. Its default filament, "Bambu PLA Basic @BBL X1C 0.6 nozzle", is not shown on
a data folder that installed only PLA, and PLA does not fit the 0.6 nozzle, so HS, which the hidden presets
scenario showed, is the one. Going back to 0.4 (step 2) brings back what the X1C was last used with.
- The layer heights of the slice (print, step 2): the first layer is printed at the process's first layer height and
the top one may be thinner to end at the cube's top, so both are left out of the 0.16 steps.
- How `gcode_config` writes a name (print, step 2): with quotes or without. The reader drops them, so the check holds
either way.
**Not checked:**
- Assigning filament presets to several slots, the sidebar's selector and the plugin API's filament editor: they belong
to `ops_assign_filament_preset_one_slot` and `_multi_slot`, which another area's test takes the place of.
- A hidden printer selected through the plugin API, and the mixed-colour slot's refusal through both routes: checked in
`test_operation_routes`.
- That a hidden printer, once selected, and its model's default filaments stay shown for the session: checked in
`test_install_filaments`. Installing and uninstalling printers and filaments: `test_install_printers` and
`test_install_filaments`.
- That the Developer mode action turns the preference on and off: checked in `test_every_action`; here a detached save
is refused and then made around it.
- That `preset_export` with a path is held by a dialog titled Export Preset Bundle: checked in `test_person_forms`;
here the dialog is driven to a written file and the file read.
- `preferences_set` and the Preferences dialog tab by tab: checked in `test_preferences`; this test changes one control
in the dialog only, as `presets.json` did.
- `preset_sync`: checked in `test_additions_refusals`.
- The undo snapshots of preset selections and imports, which `ops_import_presets` recorded through `ops_undo.py`: no
tool lists the undo history, and a preset's change is not in it (`settings_set`'s description).
- The keys the spiral vase dialog changes besides the four named (reverting, step 16): which ones depend on the
process's values. The selection reads them all with their values, against the reply's `changed`.
- The count of Bambu Lab PLA filaments (listing, step 1): it changes with the shipped profiles, so the list is checked
item by item instead.
- That no Template preset is listed, which `presets_and_plate_map` checked: `preset_list` leaves the Template vendor's
presets out before any filter, so no read through it can find one, and the check could not fail.
- The wall count and filament cost of the slice beyond the G-code's settings block (print, step 2): counting walls
needs the toolpaths, and the cost is the app's sum over the filament used.
- How the dialogs look: no screenshot is taken.
**Fixtures:** the test uses `tests/fixtures/mcp_import_pla.json` and `heightmap.png`, and writes its other files.
`tests/fixtures/presets_and_plate_map.py` has no other user and goes with `presets_and_plate_map.json`. Of
`tests/fixtures/ops_presets.py`, `test_operation_routes.py` uses `preset_api` alone; `arrange_presets` goes with
`ops_select_preset.json`, while `arrange_filaments`, `probe` and `drop_filament_edits` stay for the
`ops_assign_filament_preset_*` replays until they leave.
## `test_calibration`
`test_calibration.py` · Python · takes the place of `calibration.json`
**Tests:** `calibration_generate_test` for every test and method of the Calibration menu: the project it makes, the
parameters it uses, the presets and objects it changes, the warnings for values it rounds or the printer may not
take, and the refusals that leave the project and presets as they were; `preset_changes` "keep" and "discard",
including the filament tab on another slot's modified preset; and, through the exported G-code, that the temperature,
pressure advance and retraction towers change their value band by band. It runs on the harness's default printer,
the Bambu Lab X1 Carbon 0.4, whose extruder is a direct drive and whose firmware has no junction deviation, so the
pressure advance defaults are a direct drive's and cornering sweeps jerk.
**Reads:** `selection()` and `value()` as in `test_presets`, with `selection()` compared on the preset names and the
filament's unsaved keys and values only: the process and printer keys a test changes depend on the values the shipped
profiles already hold (see **Not checked**); the keys each test sets on purpose are read with `value()` instead.
`objects()` gives each object as `{name, height}` from `object_list`, the height being `bbox.size` z. `own(object,
key)` gives the object's own value of a process key from `settings_get {target: "object", object, keys: [key]}`.
`gcode_layers(path)` (new) gives the lines of an exported G-code file after its first `; Z_HEIGHT:` line, cut into
bands where the test says.
Each test's call is made with `discard_changes: true` and `preset_changes: "discard"` unless the step says otherwise.
Its reply's `project`, `params` and `names` are checked whole against the values the row writes out; `project` is
also read back from `app_state.project.name`, and `names` from `objects()`. "Sets" lists keys the test's code sets,
with the value it sets, written from the test's `Plater` function: each is read with `value()` after the call. "Every
entry" means each entry of a key with one per extruder or variant. Each row fixes the filament's changes whole,
from the code and the PLA profile: the reply's `presets_changed.filament.changes` has exactly those keys and values,
and, since a call with `preset_changes: "discard"` drops every edit first, the selection's filament brackets are those
keys and values too.
A slice is `plate_slice` followed by a check that it ended `ok`, then `project_export {format: "gcode", path}` to a
new file where the row reads the G-code. The input shaping tests are not sliced: the X1C's firmware flavour cannot
slice them.
**Scenario: the temperature tower, and what is refused**
| # | Step | Checked |
|---|---|---|
| 1 | start: `project_new {discard_changes: true, preset_changes: "discard"}` | selection `X1C \| Std \| PLA`, one filament slot, no objects |
| 2 | `calibration_generate_test {test: "temperature", start: 252, end: 232}`, without `discard_changes` or `preset_changes` | `project` "Nozzle temperature test"; `params` `{start: 250, end: 230, auto_scale: true}`; `warnings` exactly "start 252 °C rounded down to 250 °C, the tower's 5 °C blocks" and "end 232 °C rounded down to 230 °C, the tower's 5 °C blocks"; `names` `["temperature_tower.drc"]`, the tower 50 mm high to 0.01 (five 10 mm blocks), with its own `layer_height` "0.2"; `presets_changed.filament` names PLA and its `changes` are exactly `nozzle_temperature` and `nozzle_temperature_initial_layer`, both "250,250"; `result_keys` `{type: filament, keys: [nozzle_temperature, nozzle_temperature_initial_layer]}`; `modified.filament.keys` is those two keys; selection `X1C \| Std \| PLA[nozzle_temperature 250,250, nozzle_temperature_initial_layer 250,250]`; `app_state.project.dirty` is true |
| 3 | a slice | the `M104 S<t>` values in the layers, zeros and repeats in a row dropped, are exactly 250, 245, 240, 235, 230 |
| 4 | `{test: "max_volumetric", discard_changes: true}` | refused, saying "Presets are modified" and naming `preset_changes`; its details' `modified.filament.keys` are `[nozzle_temperature, nozzle_temperature_initial_layer]` |
| 5 | `{test: "temperature", step: 5}` | refused, "step does not apply to temperature", with details `takes` `[start, end, auto_scale, test_model]` |
| 6 | `{test: "pressure_advance", start: 0.01, end: 0.05, step: 0.051}` | refused, "pressure_advance needs start >= 0, step >= 0.001 and end >= start + step; got start 0.01, end 0.05, step 0.051" |
| 7 | `{test: "retraction", preset_changes: "discard"}`, without `discard_changes` | refused, `unsaved_changes` |
| — | after each of 4 to 7 | the project is still "Nozzle temperature test" with the one tower, 50 mm high, its own `layer_height` "0.2"; the selection is still `X1C \| Std \| PLA[nozzle_temperature 250,250, nozzle_temperature_initial_layer 250,250]` |
**Scenario: the other tests**
It starts with `{test: "temperature"}` at its defaults, which gives `params` `{start: 230, end: 190, auto_scale:
true}` and leaves the selection `X1C | Std | PLA[nozzle_temperature 230,230, nozzle_temperature_initial_layer
230,230]`. Each row is then one call, made after the one before.
| # | Call | Checked |
|---|---|---|
| 1 | `{test: "max_volumetric", end: 15}` | `project` "Max volumetric speed test"; `params` `{start: 5, end: 15, step: 0.5}`; `names` `["SpeedTestStructure.drc"]`, 22 mm high to 0.01; `discarded.filament` is `{name: PLA, keys: [nozzle_temperature, nozzle_temperature_initial_layer]}`, and `nozzle_temperature` reads "220,220" again; sets filament `filament_max_volumetric_speed` "200,200" and `slow_down_layer_time` "0", which are the filament's whole `changes`, and process `spiral_mode` "1"; `result_keys` `{type: filament, keys: [filament_max_volumetric_speed]}`; a slice |
| 2 | `{test: "pressure_advance", end: 0.06}` | `project` "Pressure Advance Test"; `params` `{method: tower, start: 0, end: 0.06, step: 0.002}`; `names` `["tower_with_seam.drc"]`; sets filament `slow_down_layer_time` "1", the filament's whole changes; `result_keys` `{type: filament, keys: [enable_pressure_advance, pressure_advance]}`; a slice, whose `M900 K<k>` values in the layers, repeats in a row dropped, are exactly 0, 0.002, 0.004 … 0.06, the 31 bands, each to 0.0001 |
| 3 | `{test: "pressure_advance", method: "line", print_numbers: false}` | `params` `{method: line, start: 0, end: 0.1, step: 0.002, print_numbers: false}`; `names` `["pressure_advance_test.drc"]`; sets process `wipe_inward` "0" and `retract_after_outer_wall` "0", and no filament key: the filament's changes are empty |
| 4 | `{test: "pressure_advance", method: "pattern", accelerations: [1000, 2000], speeds: [50, 100]}` | `params` `{method: pattern, start: 0, end: 0.08, step: 0.005, accelerations: [1000, 2000], speeds: [50, 100]}`; `names` `["pa_pattern_50_1000", "pa_pattern_100_1000", "pa_pattern_50_2000", "pa_pattern_100_2000"]`; sets filament `filament_retract_when_changing_layer` and `filament_wipe` 0 in every entry (the profile has nil), the filament's whole changes, and printer `wipe` and `retract_when_changing_layer` 0 in every entry; `result_keys` `{type: filament, keys: [enable_pressure_advance, pressure_advance, adaptive_pressure_advance, adaptive_pressure_advance_model]}`; a slice |
| 5 | `{test: "pressure_advance", method: "pattern"}` | `params` `{method: pattern, start: 0, end: 0.08, step: 0.005, accelerations: [a], speeds: [s]}`, where `a` and `s` are the first entries of the process's `outer_wall_acceleration` and `outer_wall_speed` read after the call, both above 0: the pattern's defaults are the process's; `names` `["pa_pattern_<s>_<a>"]`, the two as whole numbers; sets as row 4 |
| 6 | `{test: "flow_ratio"}` | `project` "Orca YOLO Flow Calibration"; `params` `{method: yolo, top_surface_pattern: archimedeanchords}`; `names` "flowrate_0", "flowrate_0.01" to "flowrate_0.05", "flowrate_m0.01" to "flowrate_m0.05", the 11 of `Orca-LinearFlow.3mf` in its order; sets process `layer_height` "0.2", and no filament key (rows 6 to 9): the filament's changes are empty; `result_keys` `{type: filament, keys: [filament_flow_ratio]}`; each object's own `print_flow_ratio` is `(0.98 + m) / 0.98` to 0.0001, `m` being the number its name ends in ("m" for minus) and 0.98 the filament's flow ratio, and its own `top_surface_pattern` is "archimedeanchords"; a slice |
| 7 | `{test: "flow_ratio", method: "yolo_perfectionist"}` | `project` "Orca YOLO Flow Calibration - Perfectionist version"; `params` `{method: yolo_perfectionist, top_surface_pattern: archimedeanchords}`; `names` the 16 of `Orca-LinearFlow_fine.3mf` in its order, "flowrate_0", "flowrate_0.005" to "flowrate_0.035" and "flowrate_m0.005" to "flowrate_m0.04"; flow ratios as in row 6 |
| 8 | `{test: "flow_ratio", method: "pass1"}` | `project` "Flowrate Test - Pass1"; `params` `{method: pass1, top_surface_pattern: archimedeanchords}`; `names` "flowrate_0", "flowrate_10", "flowrate_15", "flowrate_20", "flowrate_5", "flowrate_m10", "flowrate_m15", "flowrate_m20", "flowrate_m5", as `flowrate-test-pass1.3mf` holds them; each object's own `print_flow_ratio` is `1 + m / 100` to 0.0001 |
| 9 | `{test: "flow_ratio", method: "pass2", top_surface_pattern: "monotonic"}` | `project` "Flowrate Test - Pass2"; `params` `{method: pass2, top_surface_pattern: monotonic}`; `names` "flowrate_0", "flowrate_m1" to "flowrate_m9", as `flowrate-test-pass2.3mf` holds them; flow ratios as in row 8; each object's own `top_surface_pattern` is "monotonic" |
| 10 | `{test: "retraction", end: 1}` | `project` "Retraction"; `params` `{start: 0, end: 1, step: 0.1}`; `names` `["retraction_tower.drc"]`, with its own `layer_height` "0.2"; sets printer `use_firmware_retraction` "0", and no filament key: the filament's changes are empty; `result_keys` `{type: filament, keys: [filament_retraction_length]}`; a slice. Its layers are cut into bands at each `; Calib_Retraction_tower: Z_HEIGHT: <z>, length:<L>` line: the bands' lengths `L`, repeats in a row dropped, are exactly 0, 0.1 … 1, and in each band every deretraction (a `G1` with `E` and `F` alone and `E` above 0) restores exactly that band's `L`, to 0.001, the band of 0 having none: the retraction the tower sets is the one the printer performs |
| 11 | `{test: "vfa"}` | `project` "VFA test"; `params` `{start: 40, end: 200, step: 10, auto_scale: true, auto_adjust: true}`; `names` `["vfa.drc"]`, with its own `layer_height` "0.2"; no `adjusted`; sets filament `slow_down_layer_time` "0", the filament's whole changes, and process `spiral_mode` "1", `wall_loops` "1", `top_shell_layers` "0", `bottom_shell_layers` "1", `sparse_infill_density` "0%" and `enable_overhang_speed` 0 in every entry; `result_keys` `{type: printer, keys: [resonance_avoidance, min_resonance_avoidance_speed, max_resonance_avoidance_speed]}`; a slice |
| 12 | `{test: "vfa", end: 400, step: 20}` | `params` `{start: 40, end: 400, step: 20, auto_scale: true, auto_adjust: true}`; `adjusted.layer_height` is below 0.2, and the object's own `layer_height` reads that value: the tower prints thinner layers to stay within the filament's volumetric speed |
| 13 | `{test: "vfa", end: 400, auto_adjust: false}` | `params` `{start: 40, end: 400, step: 10, auto_scale: true, auto_adjust: false}`; no `adjusted`; one warning, starting "the end speed (400 mm/s) exceeds the filament's maximum volumetric speed (21 mm³/s)" and ending "(auto_adjust and auto_scale lower the layer height to reach it)"; the object's own `layer_height` is "0.2", half the nozzle, as without the warning |
| 14 | `{test: "input_shaping_freq", start: 20, end: 80}` | `project` "Input shaping Frequency test"; `params` `{start: 20, end: 80, start_y: 20, end_y: 80, damping: 0.15, shaper_type: "Default", test_model: "ringing_tower"}`; `names` `["ringing_tower.drc"]`; sets filament `slow_down_layer_time` "0", `slow_down_min_speed` "0", `slow_down_for_layer_cooling` "0", and `enable_pressure_advance` 1 and `pressure_advance` 0 in every entry (the test turns pressure advance on at 0 where the filament has it off, as the PLA does), the filament's whole changes; printer `machine_max_jerk_x` and `machine_max_jerk_y` "10" (the X1C's 9 raised to 10) and `input_shaping_emit` "0"; process `spiral_mode` "1", `wall_loops` "1", `top_shell_layers` "0", `bottom_shell_layers` "1", `sparse_infill_density` "0%", `enable_overhang_speed` 0 in every entry, `accel_to_decel_enable` "1", `accel_to_decel_factor` "100%", and `outer_wall_speed` in every entry the smaller of the printer's `machine_max_speed_x` and `machine_max_speed_y` first entries, `default_acceleration` and `outer_wall_acceleration` in every entry its `machine_max_acceleration_extruding` first entry, those three read from the printer; `result_keys` `{type: printer, keys: [input_shaping_emit, input_shaping_type, input_shaping_freq_x, input_shaping_freq_y, input_shaping_damp_x, input_shaping_damp_y]}` |
| 15 | `{test: "input_shaping_damp", freq_x: 48, freq_y: 42, test_model: "fast_tower"}` | `project` "Input shaping Damping test"; `params` `{freq_x: 48, freq_y: 42, start: 0, end: 0.4, shaper_type: "Default", test_model: "fast_tower"}`; `names` `["fast_tower_test.drc"]`; sets as row 14 |
| 16 | `{test: "cornering", test_model: "scv_v2", end: 25}` | `project` "Cornering test"; `params` `{start: 1, end: 25, test_model: "scv_v2"}`; `names` `["SCV-V2.drc"]`; `warnings` exactly "end 25 is above 20: high values may cause layer shifts"; sets printer `machine_max_jerk_x` and `machine_max_jerk_y` "25", `input_shaping_emit` "1" and `input_shaping_type` "Disable", and filament `slow_down_layer_time` "0", `slow_down_min_speed` "0", `slow_down_for_layer_cooling` "0", `filament_max_volumetric_speed` "200", and `enable_pressure_advance` 1 and `pressure_advance` 0 in every entry, the filament's whole changes; `result_keys` `{type: printer, keys: [machine_max_jerk_x, machine_max_jerk_y]}`; a slice |
**Scenario: keep and discard**
| # | Step | Selection after | Also checked |
|---|---|---|---|
| 1 | `project_new {discard_changes: true, preset_changes: "discard"}`, the Add filament action, `settings_set {type: filament, filament_slot: 2, values: {filament_cost: 21}}`, `preset_save {type: filament, name: "MCP Calib PLA", filament_slot: 2}`, `preset_select` of PLA in slot 1, then `settings_set {type: filament, filament_slot: 2, values: {filament_cost: 22}}` | `X1C \| Std \| PLA, MCP Calib PLA[filament_cost 22]` | the action's message "Added filament slot 2."; `value(filament, filament_cost, preset: "MCP Calib PLA")` is "21", the saved cost |
| 2 | `{test: "retraction", preset_changes: "keep"}` | as after 1 | refused, `The filament tab edits "MCP Calib PLA", which has unsaved changes, and the test prints with filament slot 1 ("Bambu PLA Basic @BBL X1C")`; `object_list` lists no objects; the saved cost still "21" |
| 3 | `{test: "retraction", preset_changes: "discard"}` | `X1C \| Std \| PLA, MCP Calib PLA` | `presets_changed.filament.name` PLA and `tab_switched_from` "MCP Calib PLA"; `discarded.filament` is `{name: "MCP Calib PLA", keys: [filament_cost]}`; `names` `["retraction_tower.drc"]`; `value(filament, filament_cost, slot: 2)` is "21" |
| 4 | `settings_set {type: filament, values: {slow_down_layer_time: 7}}`, then `{test: "retraction", preset_changes: "keep"}` | `X1C \| Std \| PLA[slow_down_layer_time 7], MCP Calib PLA` | `modified.filament.keys` is `[slow_down_layer_time]`; no `discarded`: the test ran with the edit, and the retraction test changes no filament setting |
| 5 | `project_new {discard_changes: true, preset_changes: "discard"}` | `X1C \| Std \| PLA, MCP Calib PLA` | `discarded.filament.keys` hold `slow_down_layer_time`; no `modified`; it reads "4" |
| 6 | `filament_delete {filament_slot: 2}`, then `preset_delete` of "MCP Calib PLA" | `X1C \| Std \| PLA` | `level` "success"; `deleted` "MCP Calib PLA"; `preset_list {type: filament}` lists PLA alone, not `modified` |
**To settle in review:**
- The towers' heights (temperature, step 2; other tests, row 1). `Plater::calib_temp()` keeps the blocks from
`(500 - end) / 5 + 1` down to `(500 - start) / 5` blocks of 10 mm and drops what is left on the bed, so 252 and 232,
rounded to 250 and 230, leave five blocks, 50 mm. The max volumetric structure is cut at `(end - start + 1) / step`
mm, 22 mm. Both assume the model is taller than the cut.
- The project is dirty after a test (temperature, step 2), which step 7's refusal needs: the test's objects are
added to a new project.
- The tower values in the G-code (temperature, step 3; other tests, rows 2 and 10). `interpolate_value_across_layers()`
splits the layers into `(end - start) / step + 1` equal bands and clamps the top layer into the last, so with many
more layers than bands every band appears once and the last is the end. The end G-code's `M104 S0` is dropped; the
start G-code sets its temperatures before the first layer, which the reader skips. The retraction tower's length is
set from the layer's height (`start + floor(z - 0.4) * step`) on a tower cut at `1.4 + (end - start) / step` mm, so
its last band is expected to be 1. A deretraction is expected to restore exactly the retracted length on the X1C,
whose `retract_restart_extra` is 0, and nothing else in the layers to have that shape.
- The objects' order in `names` for the flow ratio tests (other tests, rows 6 to 9) is expected to be the order the
shipped `resources/calib/filament_flow` model files hold them in; the replay matched only the first and the second.
- The VFA warning's maximum volumetric speed (other tests, row 13) is the filament's first entry, 21 mm³/s, for the
Direct Drive Standard extruder in use, and the VFA model's object is named after its file, "vfa.drc", as the others
are.
- Discarding on the test (keep and discard, step 3) leaves slot 2 on "MCP Calib PLA" without its edit; the replay read
only the reply.
**Not checked:**
- The speeds the max volumetric and VFA towers step per layer: the G-code gives a move's feed rate, which the reader
would have to tell from the brim's and travel moves by feature; the parameters and the presets they set are checked.
- The G-code of the input shaping tests: they are not sliced on the X1C (above).
- The process and printer keys a test's code sets beyond its row's "sets" list, and those two parts of the reply's
`presets_changed` as whole lists. Each row's list holds the keys the test is built on: the swept setting, and the
shells, walls, speeds, accelerations, jerk and cooling that would distort what it measures. The rest (VFA's
`timelapse_type` and `detect_thin_wall`, input shaping's `spiral_mode_smooth` and `bottom_surface_pattern`, and the
like) restate the function line by line, and which of them `presets_changed` lists depends on whether Std and the
X1C already hold the value. The filament's changes are fixed whole in every row.
- `presets_changed.filament.filament_slot`, which the reply always writes as 1; the filament's name is checked instead.
- The Calibration menu's dialogs, `calibration_generate_test {test}` alone, which opens them, and `silent: true`:
checked by the `actions_ask` replay (and the test that takes its place), and the menu's actions by
`test_every_action`'s `calib_*` rows.
**Fixtures:** none.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `presets`
`tests/presets.json` · replay, 207 steps, 209 expects, 19 optional
**Tests:** `preset_save` (user, inside the project, detached, the overwrite rule), dropping and reverting edits with `settings_set` (`reset_all`, `null`, `reset_to`), reading settings' meta, searches and comparisons with `settings_get`/`settings_list`, per-variant values, `changed` after the spiral vase dialog, the unsaved-changes prompt through `preset_select` and `project_new`, `preset_delete`, export through the Export Preset Bundle dialog and `preset_import`, Preferences against `preferences_get`, and selecting hidden presets.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Hidden presets: a not-installed filament is listed and selected by name; switching to the hidden A1 mini lands slot 1 on a filament matching `@BBL A1M$`.
- Meta and search: `seam_slope_type` description contains "scarf joint", `where` "Quality > Seam", label "Contour"; `unknown_keys` and the `type_of` map exact; the printer search for "ooze during long travel" ranks `retraction_length` first at "Extruder > Retraction".
- Saving: `preset_save` replies `saved`, `user`, `project`, `inherits`, `selected`, `filament_slots`; the saved preset is listed selected and unmodified, with `compatible_printers` naming the X1C 0.4; compare `:saved` total 0 and `:parent` total 2 with "22"; the overwrite rule is followed by a list showing "MCP Test PLA 2" still selected, and the overwrite save reads cost "23".
- Reset and revert: `reverted` lists exact (`sparse_infill_density`, then `["wall_loops"]`, then empty); a bad value leaves "6"; `null` reverts to "2"; `reset_to: parent` gives "15.99" and back to "23".
- Reading and comparing: `:saved` gives exactly the two edits with `left` "... (edited)" and `other` "15%"; named presets read "2" and "0.16" without being selected; compare against "0.16mm Optimal" exact; `fuzzy_skin` values and labels.
- Per-variant values: variants and active entry exact; a scalar writes "250,350", an index write "250,300", the filament "215,220", compared entry by entry; reset gives "220,220".
- Spiral vase: `changed` lists `spiral_mode` "1", `wall_loops` "1", `top_shell_layers` "0", density "0%".
- Project preset: inside-project save is `project` true, `user` false; detach outside Developer mode leaves none, inside it saves without `inherits`; after a 3MF save, new project and reopen it is listed again and the filament is still selected and unmodified.
- Prompts: the dialog title is "Transfer or discard changes"; the job and the `preset_changes` replies give `selected`, `modified/.../keys` and `discarded/.../keys` exactly, including the Simple-mode-hidden key discarded and the filament keeping its change; the filament-type transfer refusal leaves "MCP Test PLA" selected; `project_new` keeps or discards as asked.
- Delete: a system preset survives a refused delete; deletes reply `deleted`, `selected`, `filaments`, `discarded`; refusals for unsaved changes, a base with a child and an unselected printer each leave the preset listed.
- Export and import: the Info dialog reads "Export successful", the export job `level` is "success", imports reply exact messages ("Kept the existing presets: ...", "Imported presets: ..."), the JSON import inherits "Bambu PLA Basic @BBL X1C" with cost "24", and no "MCP " preset is left.
- Preferences: refusals leave no dialog open; the checkbox reply `checked` and `preferences_get` value are false, then true.
**Not checked:**
- The printer transfer refusal: the follow-up (`printer_notes` still unsaved) also holds if the transfer to the same printer were accepted.
- `settings_set` refusing the preference `auto_arrange`: the preference is not read before the dialog sets it to the same false.
- Loose: the search without a type checks only a key ending in `retraction_length`, a type matching `filament|printer` and that a value exists; `settings_list` by `where` checks only that a value and description exist; the A1 mini's filament by pattern.
- No refusal's reason is asserted; README defers them to `test_additions_refusals.py`, which I did not check for these cases.
- `app_wait {for: job}` for the export dialog and the two Preferences jobs have no expect; a wait that times out still passes (the following reads catch most consequences).
**Strength:** Strong — nearly every step's reply or read-back is matched to an exact preset name, key list or value; the gaps are two refusals the follow-ups cannot tell from success and a few pattern-matched searches.
### `presets_and_plate_map`
`tests/presets_and_plate_map.json` · replay, 21 steps, 29 expects, 0 optional
**Tests:** `preset_list` filters (vendor, filament type, source, `include_uninstalled`, `printer`) and fields, `nozzle_diameter` selecting the matching nozzle preset, and a single-extruder plate's filament grouping read and refused.
**Decides by:** Fails when a call errors, a fixture raises, or an expect misses.
- `listed()` reads every page: Bambu Lab PLA filaments are found, none fails the vendor/type filter or lacks `vendor`/`filament_type`, none is Template; with lower-case filter values the first item reads "Bambu Lab"/"PLA".
- Printers with `include_uninstalled` include the X1C 0.2 nozzle, every system printer has `vendor`, `printer_model` and `nozzle`, none is Template; the X1C 0.4 entry reads vendor "BBL", model, nozzle "0.4", selected.
- `fitting()`: some filaments fit the 0.2 nozzle preset that the selected printer does not list, and none of them is marked incompatible.
- `nozzle_diameter` 0.6 applies "0.6", selects the 0.6 nozzle preset with `printer_variant` "0.6"; 0.4 selects the 0.4 preset again.
- A saved filament is listed by `source: user`, every listed item is user and not project, and `source: system` finds none by its name.
- The plate's `filament_map_mode` is "Auto For Flush" with no offered modes and `filament_map` effective [1]; `refused()` shows `plate_set_settings` Manual raises with a message containing "this one has one".
- Fixture `presets_and_plate_map.py` asserts nothing; it returns counts and name lists. `refused()` turns any exception into `refused: true` (broad except); the message match keeps an unrelated error from passing.
**Not checked:**
- `fitting()` returns `only_selected` (0.4-only filaments that should drop out) but it is not matched; the check only shows the two lists differ somewhere.
- Lower-case filters are checked on the first item only; the Bambu PLA count is only > 0.
**Strength:** Strong — the filter checks hold for every listed item, and the nozzle switch and plate map are exact.
### `ops_select_preset`
`tests/ops_select_preset.json` · replay, 250 steps, 89 expects, 78 optional
**Tests:** Selecting a process (0.20mm Standard to 0.16mm Optimal) or printer preset (X1 Carbon to X1E) through `preset_select` and the plugin API's `process`/`printer` `begin_update(name)`: an ordinary selection, unsaved changes (each `preset_changes` value and none, the prompt answered each way), the preset already edited, a hidden printer, and the refusals (no such name, an alias, an incompatible preset, the slot form on the process editor).
**Decides by:** Fails when a non-optional call errors, a fixture raises, or an expect misses. Every expect sits on setup.
- Case setup (`arrange_presets`, 29 steps): no dialog open; printer and process tab names by regex, with ` (modified)` on the dirtied one. A prompt the previous case left open fails here.
- Setup: one filament slot.
- Implicit: non-optional `preset_select` calls must succeed without a prompt: the process selection with no changes, with `transfer` and `discard`; the hidden X1E selected twice; the printer with `discard`.
**Not checked:**
- No `probe()` after a call is asserted, so a `preset_select` that returns ok but leaves the old preset in the tab passes; the next `arrange_presets` resets the state either way.
- The plugin API route cannot fail (`preset_api` catches exceptions), including the hidden X1 it should select. `test_operation_routes.py` checks a hidden printer through the plugin API.
- Whether the prompt opens, and that the printer prompt offers no Transfer: `app_wait {for: dialog}` cannot fail, the answers are optional, and the printer `preset_changes: "transfer"` call is optional.
- The refusals and their codes and texts.
- The clean-case regex `^0.20mm Standard @BBL X1C` has no `$`, so it also matches a name with ` (modified)`.
**Strength:** Smoke — the tool route must succeed without a prompt, but which preset each call leaves selected is never asserted.
### `calibration`
`tests/calibration.json` · replay, 58 steps, 39 expects, 8 optional
**Tests:** `calibration_generate_test` for every test and method (temperature, max volumetric, pressure advance tower/line/pattern batch, the four flow-ratio passes, retraction, VFA with its auto-adjust, input shaping frequency and damping, cornering): the model it adds, the parameters used, the presets changed, rounding warnings, refusals that leave the project alone, and how `preset_changes` "keep" and "discard" treat modified presets, including the filament tab on another slot's preset.
**Decides by:** Fails when a non-optional call errors or one of its 87 matchers misses.
- Temperature: `/params` exactly `{start: 250, end: 230, auto_scale: true}` with two rounding warnings; one `temperature_tower.drc`; `result_keys` exact; `modified` lists `nozzle_temperature`.
- Refusals: after three optional refused calls, `object_list` still holds one temperature tower and the filament preset is still modified.
- Other tests: `/params` (whole object or field), `/names` and `/objects` exact; `presets_changed` `spiral_mode` = `"1"`; `result_keys`; warnings by substring; eight runs in all, the temperature one included, slice `ok`.
- VFA fit: `/adjusted` absent at defaults; `/adjusted/layer_height` < 0.2 at end 400; absent with a warning when `auto_adjust` is false.
- Presets: "keep" on slot 2's modified preset is refused (no objects after); "discard" switches the tab from "MCP Calib PLA" and discards `filament_cost`; "keep" keeps `slow_down_layer_time` 7, which `project_new` with "discard" drops back to `"4"`; the clean-up deletes the slot and the preset.
**Not checked:**
- The refused `temperature` call with `step` (an argument the test does not take): if accepted it would make the same single temperature tower with modified presets, so the read-back after it cannot tell.
- VFA's object layer height is checked as `ne "0.2"`; an object with no `layer_height` of its own reads null and passes.
- Slices check only `outcome: ok`; nothing reads whether the G-code steps temperature, speed, pressure advance or retraction per block.
- Several preset changes are `exists` only (`nozzle_temperature`, `filament_max_volumetric_speed`), and `/presets_changed/filament/filament_slot` = 1 is a constant the reply always writes.
- Pressure advance pattern defaults are `gt 0`, not the process's acceleration and speed.
**Strength:** Strong — parameters, model names and preset outcomes are compared exactly; one refusal and the G-code's calibration steps are not checked.

View file

@ -0,0 +1,280 @@
# Runtime, command line and harness
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_command_line`
`test_command_line.py` · Python, 10 checks
**Tests:** OrcaSlicer's own command line. Each case starts the app as the test's child on a fresh data folder (`launch: own`, `port-13694` lock, and the fixed port 13693 for a second window). It covers refused legacy options, `--run`'s exit codes and output folders for a replay and a script, `--run` refused beside a CLI action, `--mcp-port` opening the server, `--unrestricted-scripts` and `--cad` holding for one run only, `--run` beside a window already open, and single-instance hand-over per data folder.
**Decides by:** Exits 1 when any check prints FAIL. Each check collects problems from exit codes, stderr text, files on disk and a few MCP reads.
- `refused_options`: `--mcp-run`, `--mcp-run-out`, `--mcp-token` and `--no-mcp` each exit non-zero within 10 s, with "Invalid option" on stderr. The data folder holds only `OrcaSlicer.conf`.
- `run_invalid_file`: the exit code is exactly 2 for a missing `.json` and for a `.txt`.
- `run_replay_folders`, `run_script_output_folder`: each run exits 0. `result.json` is in `r.out`, or only in `--outputdir`. Exactly one `.png` lands in `--outputdir` or in `<datadir>/automation/out`, none in the other, and `<datadir>/mcp/out` does not exist.
- `run_refused_without_gui`: the exit code is -2 or 254, stderr has "--run cannot be combined with <option>", and the data folder holds only the conf and `result.json`.
- Serving (`mcp_port_opens_endpoint`, `cad_flag`, the window checks): `app_wait {for: ready}` is satisfied on the expected port, and `mcp/server.json` names this process's pid and that port.
- `unrestricted_scripts_flag`: exit 0 with the flag and exactly 1 without it. The conf's `python_scripts_unrestricted` is absent or false after exit.
- `cad_flag`: `tool_search {group: Design}` returns at least one name with `--cad`. Without it, it returns none, or the refusal "Unknown group: Design;" whose details leave Design out. `app_state` has no `cad_note`. File > Quit of the `--cad` run ends with exit code 0 (a kill or another code is a problem, since the conf is written as the app exits), and only then the conf's `enable_cad_feature` is read: absent or false.
- `run_beside_open_window`: the run beside the first window is given a replay whose one step is `app_state` expecting `/mcp/serving` eq false. The second process exits 0 and writes `result.json` in its `--outputdir`, and that `result.json` has `passed: true`. The first window serves on 13694, so a run that went into it would fail its expect; exit code 0, as opposed to -1 for a hand-over, shows the same from the other side. Then two `--run`s started together both exit 0 and write `result.json`.
- `window_per_data_folder`: a start with a model exits -1 or 255. Off Linux, the first window's `app_state.objects` reaches n within 30 s. Windows also tries the folder in upper case, the exe's path in upper case, the exe by a relative path and the folder's 8.3 name. A window on a second folder serves on 13693.
**Not checked:**
- Outside `cad_flag`, the exit code `App.quit()` returns is dropped, so a crash or hang on File > Quit fails no other check.
- `refused_options` accepts any non-zero code, and `run_invalid_file` any cause of exit 2. `run_refused_without_gui` says the refusal's reason goes to `result.json` but never reads it. `run_replay_folders` checks that `result.json` exists, not what it says.
- `unrestricted_scripts_flag` takes exit 1 without the flag as the refusal. Any other script failure also exits 1, but the same script passed with the flag.
- `run_beside_open_window` reads nothing in the first window after the run; what shows the run stayed out of it is the run's own `result.json` and exit code.
- On Linux, `window_per_data_folder` checks only the exit code, not that the first window loaded the model. The Windows-only spellings never run elsewhere, and the check stops at the first spelling that fails.
- `mcp_port_opens_endpoint` does not check whether `--mcp-port` writes `mcp_enabled` to the conf.
- The limits are fixed wall-clock times: 10 s for a refusal, 120 s for a run or for ready, 45 s to exit, 30 s for a hand-over. A slow first start (profile copy, virus scan) fails spuriously, but none of these limits can turn a failure into a pass.
**Strength:** Strong — exit codes, where files land and conf values are checked exactly, the conf only after a clean exit. The gaps are the Quit outcome outside `cad_flag` and Linux's exit-code-only hand-over.
## `test_runtime_lifecycle`
`test_runtime_lifecycle.py` · Python, 6 checks
**Tests:** How the automation runtime behaves while the app closes and while the server is toggled. File > Quit is clicked with a long `script_run` job, with a recording running, and with a call stuck in one uninterruptible `time.sleep`. Other checks cover a `--run` with the endpoint never opened, switching the server off and on from Preferences during a script, and the GUI instruments going off with the server. `launch: own` with the `port-13694` lock; the two checks whose job outlives its reply set `ORCA_MCP_REPLY_BUDGET_MS=4000` for their app.
**Decides by:** Exits 1 when any check prints FAIL.
- `exit_with_job_running`, `exit_with_recording`: after File > Quit the process is gone within 20 s with exit code 0. No line under `<datadir>/log` contains "did not return", and a missing log folder is a failure. `exit_with_job_running` also requires `script_run` to reply `status: running` once the 4 s budget is spent.
- `exit_with_recording`: the script gives no reply within 3 s and the `.mkv` appears within 10 s. After exit the file must parse as finished: a known Segment size that ends at the end of the file, a Duration above 0 and at least one Cluster.
- `exit_without_endpoint`: the process exits 0 within 60 s. `result.json` has `passed: true` for a replay that expects `/mcp/serving` eq false, and the log has no "did not return".
- `server_off_and_on_during_a_call`: the job ends `finished` with the result exactly `[false, true]`. `app_state.mcp.port` is 13694 before, and the same after.
- `exit_with_stuck_call`: exit 0 within 25 s of Quit, which is under the 30 s exit watchdog, and the log has a "did not return" line.
- `instruments_off_with_the_server`: while the server serves, the log has "Automation GUI instruments on" and not "... off". "... off" appears within 30 s of the switch.
**Not checked:**
- `server_off_and_on_during_a_call` reads `mcp.serving` from inside the app, through `orca.host.tools`. It never checks that the port stopped answering while off. The dropped-connection count is printed but not asserted, so a switch that flips the flag but leaves the listener open passes.
- The three "no 'did not return'" checks would still pass if the log wording changed. Only `exit_with_stuck_call`, which requires the line, catches a wording change, and only when it runs in the same pass.
- `exit_with_job_running` reads nothing about what became of the job beyond the exit code and the missing log line.
- `exit_with_recording` checks the container only: not the frames, and not whether Duration matches the time recorded.
- `instruments_off_with_the_server` swallows any error from the script and kills the app, so it says nothing about exit.
- The 20 s and 25 s exit limits and the 10 s wait for the video file are wall-clock, so a loaded machine fails spuriously. On a slow machine, `exit_with_recording`'s "no reply within 3 s" holds trivially, but the file checks after it still catch a recording that never ran.
**Strength:** Strong — exit codes, log lines and the recording's container are checked exactly. The server switch is checked only through the app's own report.
## `test_stdio_bridge`
`test_stdio_bridge.py` · Python, 19 checks (one printed only when a pid is found)
**Tests:** `orca-slicer --mcp-stdio` in four runs. Against the sweep-launched instance it covers the handshake, a notification, `tools/list`, `tools/call` in the 2025-06-18 and 2026-07-28 protocol eras, and errors; `ORCA_MCP_TOKEN` is removed, so the bridge must take the token from `mcp/server.json`. A second run against the same instance sends a 2026-07-28 request with no handshake at all. Offline (an empty datadir and a free port), the bridge answers from its own catalog without starting the app. On a fresh datadir, a tool call starts OrcaSlicer on the bridge's port.
**Decides by:** Exits 1 when any check prints FAIL. Every line the bridge writes to stdout is kept, in order, as one reply; checks read a reply by its JSON-RPC `id`, and the lines as a list.
- Online, the lines in: `initialize` (id 1), the `notifications/initialized` notification, `tools/list` (2), `app_state` (3), a malformed line, a `tools/call` of `app_state` whose `_meta` names 2026-07-28 (4), an unknown tool (5).
- "the notification gets no reply": the bridge writes exactly six lines, with the ids 1, 2, 3, null, 4 and 5 in that order. A reply to the notification would be a seventh line, or a second with id null.
- "malformed input is a parse error": the line with id null is the error -32700.
- `initialize` returns `protocolVersion` "2025-06-18". `tools/list` contains `app_state` and `widget_list`. `app_state` through the bridge has `ready: true`. "a 2026-07-28 request after a 2025-06-18 handshake is served": reply 4 has `resultType: "complete"`. An unknown tool gives -32602.
- Without a handshake: a bridge run whose only line is the 2026-07-28 `tools/call` of `app_state` (id 1). "a 2026-07-28 request is served without a handshake": the bridge writes exactly one line, id 1, with `resultType: "complete"` and content whose `app_state` has `ready: true`.
- Offline, the lines in: `initialize` (1), the notification, `tools/list` (2), `ping` (3), `resources/list` (4), a message with `"jsonrpc": 2` (id 5), `ping` (6).
- "offline: the notification gets no reply": exactly six lines, with the ids 1, 2, 3, 4, null and 6 in that order.
- "offline: a jsonrpc that is not a string is an invalid request": the line with id null is the error -32600.
- `initialize` returns the client's version. `tools/list` is exactly equal to the online list. `ping` returns `{}`. `resources/list` gives -32601. "offline: the bridge answers after a malformed message": the ping after the invalid request returns `{}`. The empty datadir stays empty.
- Launch: `app_state.mcp.port` and the discovery file's `port` both equal the bridge's port, and the started pid is gone within 10 s.
**Not checked:**
- The online `tools/list` check only requires two names. Full equality is checked only offline, against the online list.
- The bridge's exit code and stderr are not read, so a crash after it wrote its replies passes.
- The launch section does not wait for ready, by design, since a startup dialog may be up. "the started app stops" prints nothing when the discovery file names no pid, but the port checks fail in that case.
- The bridge waits up to 60 s for the app it starts, and each bridge run is capped at 120 s, so a slow first start fails spuriously.
**Strength:** Partial — every reply line is counted and matched to its request, error codes and the offline catalog are checked exactly, and the no-handshake request is sent with no handshake, but the bridge's exit code and stderr are not read, so a crash after its replies passes.
## `test_orca_mcp_attach`
`test_orca_mcp_attach.py` · Python, 18 checks (assert-based; stops at the first failure)
**Tests:** The harness client in `orca_mcp.py`, without the app (`launch: none`). It covers `default_datadir()` (a portable `data_dir`, the per-OS configuration folder, a symlinked binary), the refusals of `OrcaMcp.from_datadir()`, `call_command()` against a stubbed `call()`, the line `ORCA_MCP_CALL_LOG` gets per call, how `reply_budget_s()` reads its variable, and the conf `seed_datadir()` writes.
**Decides by:** A failed `assert`, or a missing `McpError`, raises and exits non-zero. Each passing group prints "ok - ...".
- "the asserts are live", before any other check: when Python runs with its asserts off (`sys.flags.optimize` above 0, from `-O` or `PYTHONOPTIMIZE`, which the runner passes on from its own environment), the test prints a FAIL line saying so and exits 1.
- `from_datadir()` is tried with no file, a file that is not JSON, one with no port, a stale port, an HTTP 401 and a 200 reply that is not JSON (the last two from a local stub server). Each error names the file and port, gives the "--mcp" advice and chains its cause; the stale port's cause is an `OSError`.
- `call_command()`: a `blocked_by_dialog` reply fails at once after one call, naming the dialog, with the prefix "extrude: ". A plain reply comes back whole from exactly `("tool_call", 600, {...})`, and a running job is followed with `app_wait`. Errors start with the command's name and chain the original.
- Call log: one JSONL line per call with `tool`, `ok` and `ms`. An HTTP 500 adds a second line with `ok: false`.
- `reply_budget_s()`: each of eight values gives exactly 45.0 or 2.0.
- `seed_datadir()`: `use_encrypted_token_file` is true, and `window_mainframe` is "12; 34; 1600; 900; 0" with the origin mocked. A reused conf parses back exactly as it was.
**Not checked:**
- It leaves out the parts of `orca_mcp.py` the sweep's verdicts and setup depend on: `run-replay`'s exit code from `passed`, `launch` (the session file, `wait_ready`, answering the certificate prompt), `stop`, `find_binary`, `app_env`, the headless and Xvfb display start, and `await_job`'s timeout.
- `from_datadir()` is tested only on refusals. The success path, a ping that answers, never runs.
- The symlink check prints "skip" and passes wherever `os.symlink` fails, which is the usual case on Windows without Developer Mode or admin rights.
- `work_area_origin()` is mocked. The real call is checked only for non-negative ints, and it returns (0, 0) off macOS.
- The `reply_budget_s()` table belongs to this test. The app's parser has its own table in `tests/automation/test_mcp_core.cpp`, and nothing checks that the two agree.
**Strength:** Strong — the functions it covers are checked by exact value and error text, and the test refuses to run with its asserts off. It covers the attach-and-call half of `orca_mcp.py`, not launch, stop or run-replay.
## `test_run_sweep`
`test_run_sweep.py` · Python, 14 checks (assert-based)
**Tests:** The building blocks of `run_sweep.py`, without the app (`launch: none`). It covers manifest entries and their validation, test discovery, ordering by history, picking around held locks, the launch, test and setup commands and their environments, the Linux display options, the timeout kill, recording a run that raises, `--history` and `-j`. It also checks that the shipped `sweep.json` lists exactly the tests on disk.
**Decides by:** A failed `assert` raises and exits non-zero.
- "the asserts are live", before any other check: when Python runs with its asserts off (`sys.flags.optimize` above 0, from `-O` or `PYTHONOPTIMIZE`, which the runner passes on from its own environment), the test prints a FAIL line saying so and exits 1.
- Manifest: `entry()` equals the defaults table exactly, and refuses an unknown key, an unknown launch kind, and `exclusive` or `locks` without `why`. `manifest_problems()` names an unlisted test and a missing file, `discover()` refuses two files with one stem, and the shipped manifest has no problems.
- Scheduling: `order()` returns `(["c","b","a"], ["d"])`, and `pick_next()` passes over a test whose lock is held.
- Commands: the argv of `launch_command` is exact, with `--cad` when asked and `--headless` only when the run asks. `launch_env` sets `GDK_BACKEND` to x11, to wayland, or not at all for headless and off Linux. `test_command` is exact for a replay and a script, and `setup_command` fills `{datadir}`. `test_env` sets the session file, `TMPDIR`, `TMP`, `TEMP` and the entry's variables.
- Timeout: `run_step` raises `TimeoutExpired` after 3 s, and the stand-in's child is gone within 10 s.
- Error and options: `guarded_run_test` records `exit: "error"` with a traceback, and `missing()` names a test with no record. History round-trips through a bare file name. `-j 0`, `-2` and `x` exit 2, and the option and session problems hold per platform.
**Not checked:**
- `main()` is never run. That leaves the worker pool, locks held across threads, exclusive tests running after the rest, and the final verdict untested: failing on a non-zero exit, an unrecorded test, a new macOS crash report or an interrupt. Writing history only for passes is untested too.
- `run_test`'s normal path is not run: the `setup_failed`, `launch_failed` and `timeout` labels, the stop after a launch (a failed one included), and the per-test folders. Nor are `Ports.take()`, `crash_reports()`, `--only`, `--skip` and `--list`.
- A replay passes when `orca_mcp.py run-replay` exits 0, which it does only when `passed` is true. That rule lives in `orca_mcp.py`, and neither harness test covers it.
- The timeout check runs only the host's branch: `taskkill /T` on Windows; elsewhere SIGINT, with the stand-in's own `finally` killing its child. The stand-in has 3 s to write its pid file, so on a slow machine a missing file, or an interrupt before its `try`, fails the check spuriously.
- The default `-j` is compared with a copy of the source's own formula.
**Strength:** Strong — the pieces it covers are pinned to exact values, and the test refuses to run with its asserts off. The scheduler and the verdict in `main()` are untested.
## `test_recovery_under_load`
`test_recovery_under_load.py` · Python, 2 checks
**Tests:** Preferences is opened as a running `action_run` job. Then 32 `app_wait {for: no_dialog}` calls take the server's 32 blocking slots, and 32 more connections sit idle (first variant) or half-sent (second variant), filling the 64-connection cap. A `dialog_answer` on a new connection must still close the dialog and release the waits.
**Decides by:** A variant fails when `action_run` does not reply `blocked_by_dialog`, the waits are not seen holding every blocking slot, `dialog_answer` returns `isError`, or fewer than 32 waits return `satisfied: true`. A socket error crashes the script, which also exits non-zero.
- Every blocking slot taken: `app_wait` and `app_state` are observation calls, which run on the request thread, are never jobs, and each take one of the server's 32 blocking slots (`inspect_tool`, `McpCore::run`, `blocking_slots` 32). After the 32 waits start, the test calls `app_state` on a connection of its own every 0.2 s, up to 10 s, until it replies `status: "pending"` with the note "Too many calls are waiting right now; try again shortly.", the reply an observation call gets when no slot is free. A variant whose waits have not taken every slot within the 10 s fails; this read takes the place of a fixed sleep.
- The holders: an idle holder sends a `ping` and reads its reply before the next one opens, so the server has accepted each of the 32. A half-sent holder sends part of a request's headers; the test gives the 32 of them 1 s.
- "recover with 32 blocked waits and 32 idle connections"
- "recover with 32 blocked waits and 32 half-sent requests"
**Not checked:**
- No tool reports the server's connections, so the half-sent holders are assumed accepted after 1 s. On a slow machine some may not have reached the server, and the half-sent variant then runs below the cap.
- At the cap, the server makes room by evicting the oldest idle connection; failing that, it accepts up to 8 more into an overflow reserve (`McpHttpServer.hpp`). The test cannot tell the two apart, so broken eviction still passes, and whether a holder was evicted is not read.
- When `dialog_answer` replies `running`, the follow-up `app_wait`'s error flag is dropped. That the dialog closed is inferred only from the 32 waits.
- If the server's connection cap grows, the holders no longer fill it and the test still passes. A larger blocking-slot count fails instead: the 32 waits leave a slot free, and `app_state` answers rather than replying `pending`.
**Strength:** Partial — the recovery is checked exactly and the blocked waits are seen holding every slot before the answer, but the connection cap is filled on trust in the half-sent variant.
## `test_worker_admission`
`test_worker_admission.py` · Python, 21 checks (7 per starter)
**Tests:** An arrange holds the UI job worker. It is started three ways: `object_arrange {rotate: true}`, `action_run obj_arrange`, and a click on the Arrange options panel's ImGui button. While it runs, changes and canvas input from MCP are refused and reads answer; `job_cancel` stops it, and a change is admitted afterwards. The bed is filled with copies of three cubes so the arrange takes long.
**Decides by:** Exits 1 when any check prints FAIL. Each starter gets the same seven checks:
- Refusals: "object_transform refused", "keyboard_press Delete refused" and "GL toolbar click refused" each need the call to raise with "Busy: job" in its text.
- "object_list answers": the call succeeds.
- Cancel: "job_cancel stops it" needs `was_running` and `job` to be truthy. "the call reports it cancelled" needs the starter's call to raise with "cancelled" in its text.
- "a change is admitted afterwards": `object_transform` succeeds.
**Not checked:**
- `time.sleep(2.0)` stands in for "the arrange is running". On a slow machine the arrange may not have started (the refusal checks fail); on a fast one it may already be done (the refusals and `job_cancel` fail). Both are spurious failures; neither can make it pass wrongly.
- Setup never checks that the bed was filled, or how many objects there are.
- No call is checked for its effect. Positions are never read, so neither the admitted `object_transform` nor whether the cancelled arrange left the objects in place is verified.
- `object_list` is checked only for not raising.
**Strength:** Strong — every refusal and the cancel are asserted for each starter. Only the effects on object positions go unread.
## `test_cancel_pending_slice`
`test_cancel_pending_slice.py` · Python, 6 checks
**Tests:** A `plate_slice` requested right after a `settings_set` first waits about 0.5 s for the update the change scheduled. A `job_cancel` sent during that wait must keep the slice from starting, and the plate stays unsliced. A slice made afterwards is the control.
**Decides by:** Exits 1 when any check prints FAIL.
- Start: after `project_import` of 3DBenchy and `view_set {tab: "prepare"}`, "the slice starts from Prepare, unsliced" reads `app_state.tab` as `prepare` and `plate_list` plate 0 `sliced: false`.
- "job_cancel reports the waiting slice": `was_running is True`.
- "the slice reports its plate cancelled": `status` `done` and `plates` exactly `[{index: 0, outcome: "cancelled"}]`.
- "the cancel came before the slice started": `app_state.tab` is still `prepare`. A slice that starts shows the Preview tab (`Ops::start_slice` selects it), and the call skips the start when the cancel count changed during its wait or before the start that follows it. A cancel that came after the slice started therefore fails this check instead of passing as an ordinary cancel. A cancel that lands after the wait ends but before the start is honoured the same way, and passes: it too is a cancel of a slice still waiting to start.
- "the plate stays unsliced": `plate_list` gives plate 0 `sliced: false`, and `project_export {format: gcode, path}` is refused with the code `plate_not_sliced` and writes no file at the path.
- Control, "a slice afterwards runs and exports": `plate_slice` gives plate 0 the outcome `ok`, `app_state.tab` is `preview`, `plate_list` gives plate 0 `sliced: true`, and the same `project_export` writes the file (it exists, larger than 0 bytes). This shows that the tab check sees a slice that starts, and that the export refusal was about the slice.
**Not checked:**
- The cancel goes out 0.1 s after the slice request starts on its thread. Too late, the slice starts and "the cancel came before the slice started" fails; too early, before the slice registered, the slice runs to `ok` and "the slice reports its plate cancelled" fails. Either is a spurious failure on a slow or loaded machine; neither passes.
- The scheduled update itself, after the cancel: only that it did not start a slice.
**Strength:** Strong — the cancelled outcome, the waiting case and the unsliced plate are each read exactly, with a control slice that shows the reads can see the opposite.
## `test_export_running_job`
`test_export_running_job.py` · Python, 12 checks
**Tests:** What `replay_export` does with a call whose job outlives its reply. A `replay_run` has one step that waits 3 s past the reply budget. An export taken while it runs leaves it out and names it in `left_out_running`. After it ends, it is exported as an `await: false` step that a later `app_wait` refers to, and that replay runs. A call blocked on Preferences stays in an export while the dialog is open. The sweep sets `ORCA_MCP_REPLY_BUDGET_MS=10000` for both the app and the test.
**Decides by:** Exits 1 when any check prints FAIL.
- While running: `replay_run` replies `status: running`. The export taken then has exactly the steps `["settings_set"]`, and `left_out_running` is exactly `[{tool: replay_run, job}]`.
- After: the job returns `passed: true`. The export's steps are exactly `["replay_run", "settings_set", "app_wait"]`. Step 0 has `await: false` and `save_as: "job1"`, step 2's `job` is `"${jobs.job1}"`, and there is no `left_out_running`.
- Dialog: opening Preferences with `action_run` replies `blocked_by_dialog`. An export with the dialog open has exactly `["action_run"]` and no `left_out_running`.
- Re-run: the exported file replays with `passed: true`.
**Not checked:**
- The exported steps' arguments are not compared: the inline replay and `out_dir` of `replay_run`, and `wall_loops: 3`.
- The docstring's "a job that fails after its reply is dropped" case is left to the C++ unit tests.
- Timing: between the 10 s reply and the job's end there are about 3 s for `settings_set` and the first export. On a loaded machine the job may end first, and the "leaves it out" checks fail spuriously. Preferences must also open within the 10 s budget for "Preferences blocks its call", as the docstring says. The test reads the budget from the same environment the app gets, so an app that ignored the cap would finish the replay before replying, which fails the test rather than passing it.
**Strength:** Strong — every export is compared with an exact list of steps, and the reference fields are checked by value.
## `test_action_replay_hidden`
`test_action_replay_hidden.py` · Python, 14 checks
**Tests:** That the Action Replay window and the Run Script panel stay out of reach of the GUI tools. Neither is listed by `widget_list` or picked by an untargeted `webview_run_javascript` or `keyboard_press`. While they are up, a window screenshot, an agent's `script_run`, the smoke replay and a nested inline replay still work.
**Decides by:** Exits 1 when any check prints FAIL.
- Action Replay is up: "Action Replay opens", within 10 s of `action_run open_action_replay`, `window_list` lists a window titled `Action Replay` with `hidden: true`; a wait that runs out fails it. The test then gives its page 1 s.
- Action Replay: the `widget_list` tree has no line of the role `window` or `dialog` titled `Action Replay`, and, the control, it words the main window as such a line: `window "<title>" (MainFrame)`. `window_screenshot` returns a `path`. Untargeted `webview_run_javascript "1 + 1"` gives the same outcome string as before the window opened; with two web views shown it would get the "Several web views are shown" refusal.
- "a key without a target never goes to Action Replay's web view": with Action Replay raised again on Prepare, `keyboard_press Escape`'s reply has no `page` (a key that reached a page replies with what the page did) and its `to` holds `canvas`: the focus left in a window the tools don't see is no target, so the key goes to the shown 3D view (`UiInspector::key_target`).
- Run Script panel shown: "the Run Script panel shows", within 10 s of the toggle, the 3D view's height in `widget_list` (its `canvas "OrcaSceneCanvas"` line) is less than before the toggle, as the panel docks under it. The test then gives its page 1 s.
- Run Script panel: the number of `webview` words in `widget_list` is unchanged, and untargeted JS on Prepare gives the same outcome as before. `keyboard_press`'s `to` contains "canvas", the screenshot returns a `path`, and `script_run` ends `finished`.
- Replays: `smoke_test.json` and a nested inline `replay_run` both return `passed: true`.
**Not checked:**
- `time.sleep(1.0)` stands in for each page having loaded. The windows are confirmed up and their web views exist with them, so the checks that count web views hold; whether a script could reach a page that has not loaded is not tried.
- The screenshots are checked only for a returned `path`; they are never compared.
**Strength:** Strong — the hiding checks run with each window confirmed up, the window absence has its control in the same tree, and the key's destination is read from the reply's own fields.
## `test_list_windows`
`test_list_windows.py` · Python, 16 checks (4 only when the Plugins window has a ref)
**Tests:** `window_list`. The main window comes first. The Plugins window, which doesn't block the app, is listed with a ref that `window_screenshot`, `widget_list` and `keyboard_press` take. Preferences is listed last as modal and is gone once closed. Action Replay is listed as hidden, with no ref.
**Decides by:** Exits 1 when any check prints FAIL.
- Page: `total == len(items)` and `offset == 0`.
- Main window: the first item has `kind: "main"`, a `ref`, `modal: false`, and width and height above 0.
- Plugins: it is found by title within 15 s, with `modal: false`, a `ref` and `web: true`. A screenshot by its ref has a `path`, a width above 0, and a size different from the main window's. `widget_list` by its ref has "Plugins" on the first line and no `MainFrame`. `keyboard_press Escape` by its ref removes it from the list within 10 s.
- Preferences: it has `modal: true` and a `ref`, is last in the list, and is absent after `dialog_answer close`.
- Action Replay: `hidden: true`, and no `ref` key.
**Not checked:**
- The Plugins screenshot is checked only for a size unlike the main window's. It is not compared with the size `window_list` gives for Plugins, and its pixels are never compared.
- "the modal dialog comes last" runs after Plugins is closed. If the list then holds only the main window and Preferences, "last" only means "not first"; I could not confirm what else the list holds at that point.
- Action Replay is left open at the end, and its other fields are not checked.
**Strength:** Strong — flags, refs, order and removal are checked by exact value. Only the screenshot is checked loosely.
## `test_ref_locator_export`
`test_ref_locator_export.py` · Python, 7 checks (4 only when the snapshot found the item they use)
**Tests:** That an ImGui ref taken from `widget_list` still works after its item's label changes, and that the exported session finds each item and passes. Two refs are tried. The Text gizmo's font button, whose label is the current font, is used for two picks. A Texture Displacement layer row "Layer 2" is clicked after the first layer is removed, when that row is "Layer 1".
**Reads:** A layer row is an item `widget_list` lists named exactly `Layer N` (its thumbnail is `Layer N image`), N its place in the list counted from 1; the open layer has no row. `object_list`'s `painted.texture` gives each layer's `slot`.
**Decides by:** Exits 1 when any check prints FAIL.
- Snapshot: `widget_list` lists a `Combo_Font` item and a `Layer 2` row. Opening the gizmo makes the first layer, slot 0, which the import textures, and `add_texture_layer()` takes the first free slot, so the two added are 1 and 2, slot 2 open; the layers are listed by slot, so the `Remove` of index 0 is slot 0's.
- Font: the first `widget_set_value` returns `selected == "HarmonyOS Sans SC"`. The second, through the same ref, returns a `selected` that starts with the label first shown.
- "the Remove leaves the second layer's row as Layer 1": after the `Remove` of index 0, `object_list` gives the slots `[1, 2]`, and `widget_list` lists a row `Layer 1` and none named `Layer 2` (slot 2 is open).
- "the old ref clicks the renamed row": after `widget_click` on the ref taken for `Layer 2`, `object_list` still gives the slots `[1, 2]` (the click removed nothing), and `widget_list` lists a row `Layer 2` and none named `Layer 1`. The click opened slot 1, the layer the ref was taken for, and slot 2 became the row. A ref that resolved to nothing, to the open layer or to a Remove button fails one of these.
- Replay: the exported session replays with `passed: true`.
**Not checked:**
- The exported replay has no expects, so `passed` means every exported call found a target and returned no error. A locator that resolves to the wrong existing item, such as the row's image button, still passes.
- A live click on the row's image button would also open slot 1 (a retextured layer becomes the active one), with the layer picker open; the picker is not looked for.
- `startswith(shown)` on the second pick is looser than the known label.
**Strength:** Partial — the live ref is read back by which layer it opened, but the exported replay is checked only by passing.
## The example replay
`smoke_test.json` is the example of the replay format, which `test_action_replay_hidden` runs as its input.
### `smoke_test`
`smoke_test.json` · replay, 17 steps, 5 expects, 0 optional
**Tests:** The server's main paths end to end: auto-answer rules, a new project, Benchy imported, a process setting written and read back, a slice, a G-code export, the Preferences dialog opened by an action and answered by the replay, and screenshots of the dialog, the Preview and the main window.
**Decides by:** Fails when a call errors or one of its 6 matchers misses.
- Import: `project_import` `/added` = 1.
- Setting: `settings_get wall_loops` `/items/0/value` = `"3"` after `settings_set`.
- Slice: `plate_slice` `/status` = `done`, `/plates/0/outcome` = `ok`.
- Dialog: `app_wait {for: dialog}` `/satisfied` = true; `widget_list` of the dialog for "splash" `/nodes` ≥ 1; `dialog_answer` must find a dialog titled "Preferences"; the action's job must then end without error.
**Not checked:**
- `project_export`: only that it does not error; the G-code file is never read, so neither its content nor `wall_loops = 3` in it is checked.
- `view_set {tab: preview, camera: iso}` has no expect; tab and camera are not read back.
- The three `window_screenshot` files are saved and never compared.
- The auto-answer rules: nothing shows a prompt was raised or answered.
**Strength:** Smoke — the setting round trip and the slice outcome are checked, but export, view and screenshots only have to not error.

View file

@ -0,0 +1,505 @@
# Slicing, layers and the Preview
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_slice_preview`
`test_slice_preview.py` · Python · takes the place of `slice_stats.json`, `preview.json`, `layers.json` and
`view_switches.json`, and of the slicing, Preview layer and plate index cases of the removed `ops_start_slice.json`,
`ops_show_layer_range.json` and `ops_select_plate.json`
**Tests:** Slicing and what a slice leaves: the plates `plate_slice` and the Slice and Preview and Slice All Plates
actions slice, with no objects, with a plate that fails validation and with two plates; the statistics a slice
reports, for one colour and two; the Preview's tables, legend and layers as `plate_slice_stats`, `view_set`, the Go to
layer action and `app_state` give them, on a plate the Preview shows and on one it has not shown, and on a G-code file
opened for viewing; height range modifiers, variable layer heights and a plate's layer G-codes, each shown to reach
the G-code and to be kept by a 3MF; every command that takes a plate index, given one the project lacks and one it
has; the display switches, the sidebar, the legend fold and the G-code window of `view_set`, shown on the 3D view and
kept in the app's configuration; and `app_state`'s account, network plug-in and configuration folder. It runs on the
harness's default printer, the Bambu Lab X1 Carbon 0.4 nozzle with 0.20mm Standard @BBL X1C (0.2 mm layers, a first
layer of 0.2 mm, 15 % grid sparse infill, the prime tower on, `machine_pause_gcode` `M400 U1`, layer heights 0.08 to
0.28 mm, no silent-mode estimate), on the sweep's fresh app and data folder. Its sweep entry sets `timeout_s` 1500: it
slices about thirty times, three of them a Benchy.
**Reads:**
- `plates()` as in `test_plates`, with each plate's `sliced` from `plate_list` added. `objects()` as in `test_plates`,
with each object's `filament` and the `offset` of its instance 0 (`object_list`'s `instances[0].offset`) added.
- `shown()` gives `app_state`'s `tab`, `plates.current` and `preview` (`plate`, `layers`, `z`, `layer_count`,
`view_type`), or `preview` null.
- `gcode(path)` (new) reads an exported G-code file. Its header: `total layer number`, `max_z_height`, `filament` (the
slots the print uses) and the `total estimated time` of the `model printing time` line, in seconds. Its layers, one
per `; CHANGE_LAYER` block in order, each with `z` (`; Z_HEIGHT:`), `height` (`; LAYER_HEIGHT:`), its tool lines (a
whole line `T0` or `T1`), the line after each `; PAUSE_PRINTING` and after each `; CUSTOM_GCODE`, and for each
feature type (`; FEATURE: Sparse infill`) the XY length in mm of its extruding `G1` moves. The X1C's start G-code,
which loads the first filament with a tool line, comes before layer 1 and is not read; its end G-code, read as part
of the last layer, holds no `T0` or `T1` line.
- `toolpaths_z(path)` (new) gives the lowest and highest vertex `z` of an OBJ that `project_export {format:
"toolpaths_obj"}` wrote.
- `capture()` (new) gives the PNG bytes and the width of `window_screenshot {target: "canvas", include_image: false}`
once two captures in a row are byte-identical; five tries without that fail the check, and so does a capture whose
reply has `approximate` or a `note`, such as a 3D view that came back blank.
- `conf(key)` (new) gives the `app` section's value of `key` in `<datadir>/OrcaSlicer.conf`, the datadir the session
file names, read until it holds the expected value or 5 s pass, since the app writes the file at an idle moment.
- `snapshots()` gives the undo snapshots taken since its last call, from `tests/fixtures/ops_undo.py`.
- `slots(n)` deletes filament slots with `filament_delete` until it is refused and adds them with `filament_add`
until the project has `n`; it checks `app_state.presets.filaments` has `n` entries.
At its start the test registers two auto-answer rules, `Spiral mode only works` → `yes` and `unsaved changes. Would
you like to save` → `No`, and `window_set {size: [1600, 900]}`. Every scenario starts with `project_new
{discard_changes: true}` and `view_set {tab: "prepare"}` and checks that `plates()` is `"" 0 *`, `shown()` has tab
`prepare` and `preview` null. The scenarios run in the order below.
The app applies a change of the model or of a plate's codes to the slicing state half a second after the call
(`schedule_background_process()`), and only then marks a plate's slice out of date. So a step that moves an object,
changes its ranges or settings, or edits layer G-codes, and whose row then reads `plates()` or refuses an export or
statistics for an out-of-date slice, calls `app_wait {for: "idle"}` first, which waits for that update; the wait must
be met.
In the tables a plate is written as in `test_plates`, with `S` on a plate whose slice is up to date: `"" 1 * S` ·
`"" 1` is a current sliced plate with one object, then an unsliced one. A slice's reply is written by its plates'
index and outcome, `[0 ok, 1 empty]`; `status` is `done` in every reply. Shown layers `1–25 (0.2–5.0)` are
`shown().preview.layers` `[1, 25]` and `z` `[0.2, 5.0]`; a `view_set` reply's `layers` `[first, last, count]` is written
`[1, 25, 100]`. "Layer n" of a G-code is its n-th layer. A cube is a 20 mm cube from `object_add_primitive {shape:
"cube", size: [20, 20, 20]}`, which slices to 100 layers of 0.2 mm, layer n at z 0.2·n; cube "left" is that call
with `name: "left"`, and a cube the rows do not name is named `Cube`. An `ok` plate in a slice's reply is also checked
for its `layers`: 100 on a plate of cubes alone, unless the row gives another count. A refusal is written with its
code, or in quotes with the words it must hold where it has none; after every refusal the row's state is read again
whole.
**Scenario: nothing to slice, and a slice that fails**
A Preview that holds no toolpaths of the current plate has no layers to show, whatever an earlier slice left in
its layer slider (the operations layer's fix under To settle).
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `view_set {layer_range: [2, 5]}` | `"" 0 *` | refused, `no_layers`; tab `preview`, `preview` null |
| 2 | `view_set {layer_z: 5.0}`, then `view_set {layer_percent: 50}` | `"" 0 *` | each refused, `no_layers`, in the words of step 1; tab `preview` |
| 3 | `view_set {tab: "prepare"}`, then the Slice and Preview action (`action_run`) | `"" 0 *` | `[0 empty]`, `ran` `orca_command:slice_and_preview:orca`; tab `preview` |
| 4 | the Slice All Plates action | `"" 0 *` | `[0 empty]` |
| 5 | `plate_slice`, then `plate_slice {plates: "all"}` | `"" 0 *` | `[0 empty]` each |
| 6 | `project_export {format: "gcode", path}` | `"" 0 *` | refused, `no_objects`; no file at the path |
| 7 | two cubes at `position` [90, 90, 0] and [150, 90, 0], then `plate_set_settings {plate: 0, values: {spiral_mode: true}}`, which the spiral rule answers | `"" 2 *` | (set up for the next step, whose error shows the setting took; `test_plates` checks the setting and its question) |
| 8 | `plate_slice` | `"" 2 *` | `[0 error]`, its `error` holding `Please select "By object" print sequence to print multiple objects in spiral vase mode.`; `app_state.slicing` false |
| 9 | the Slice and Preview action, then the Slice All Plates action | `"" 2 *` | `[0 error]` each, with that text |
| 10 | `project_export {format: "gcode", path}` | `"" 2 *` | refused, `slice_has_errors`; no file |
| 11 | `view_set {layer: 10}`, `{layer_range: [2, 5]}`, `{layer_z: 5.0}`, and the Go to layer action with `{percent: 50}` | `"" 2 *` | each refused, `no_layers`; tab `preview`, `preview` null |
**Scenario: slicing by plate and by route**
`snapshots()` is read just before steps 1, 3 and 7 to set its mark, and after them; the rows give what it lists. A
move takes the snapshot `Transform object`. Selecting a plate takes `select partplate!` snapshots, which these rows
do not count (a slice of another plate, Slice All and `plate_select` each select plates).
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 0 | cube "a", `plate_add` (which makes plate 1 current), cube "b" with `position` [x, y, 0] at plate 1's middle, its `origin` plus half its `size` from `plate_list`, then `plate_select {plate: 0}` | `"" 1 *` · `"" 1` | `objects()`: a on plate 0, b on plate 1 and none outside; b's `offset` x and y are that middle, to 0.001: an object placed by numbers lands where they say |
| 1 | `plate_slice` | `"" 1 * S` · `"" 1` | `[0 ok]` with `layers` 100; tab `preview`; snapshots: none, so a slice of the current plate takes none |
| 2 | `view_set {tab: "prepare"}`, `plate_slice {plates: 1}` | `"" 1 S` · `"" 1 * S` | `[1 ok]` with `layers` 100: the plate named is made current |
| 3 | `object_transform {object: 0, translate: [5, 0, 0]}`, `app_wait {for: "idle"}` | `"" 1` · `"" 1 * S` | a move makes its own plate's slice out of date, and no other's; snapshots: `Transform object` alone |
| 4 | `plate_select {plate: 0}`, then `project_export {format: "gcode", path}` | `"" 1 *` · `"" 1 S` | refused, `plate_not_sliced`; no file |
| 5 | `plate_slice_stats` | as after 4 | refused, "Plate 0 has no up-to-date slice" |
| 6 | `plate_slice {plates: "all"}` | `"" 1 S` · `"" 1 * S` | `[0 ok, 1 ok]`, each with `layers` 100; Slice All selects each plate in turn and leaves the last one current |
| 7 | `view_set {tab: "prepare"}`, `object_transform` of both cubes, `translate: [5, 0, 0]`, `app_wait {for: "idle"}`, then the Slice and Preview action | `"" 1` · `"" 1 * S` | `[1 ok]` with `layers` 100: the current plate alone; snapshots: `Transform object` twice and nothing else |
| 8 | the Slice All Plates action | `"" 1 S` · `"" 1 * S` | `[0 ok, 1 ok]`, each with `layers` 100 |
| 9 | `project_export {format: "gcode", path}` | as after 8 | written; `gcode()` gives `total layer number` 100 and 100 layers |
**Scenario: slice statistics, one colour and two**
`slots(2)`, then cube "left" at [90, 90, 0]: `"" 1 *`, left on filament 1.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `plate_slice` | `"" 1 * S` | `[0 ok]`: `layers` 100; `max_z` 20.0 to 0.001; `filament_changes` 0; no `extruder_changes`; `filaments` exactly two rows, slots 1 and 2; slot 1 `model_g` > 0, `support_g`, `flush_g` and `tower_g` 0, `g` = `model_g`; slot 2 `m`, `g`, `model_g`, `support_g`, `flush_g` and `tower_g` all 0; `filament_g` = slot 1's `g` |
| 2 | `project_export {format: "gcode", path}` | as after 1 | `gcode()`: header `total layer number` 100, `max_z_height` 20.00, `filament` `1`, `total estimated time` within 1 s of the reply's `time_s`; 100 layers, layer n at z 0.2·n with height 0.2; no tool line in any layer |
| 3 | cube "right" at [150, 90, 0], which is selected, then `keyboard_press {target: {name: "OrcaSceneCanvas"}, keys: "2"}` | `"" 2 *` | reply `to` `wxGLCanvas`; `objects()`: left on filament 1, right on filament 2 |
| 4 | `object_select {none: true}`, `plate_slice` | `"" 2 * S` | `[0 ok]`: `layers` 100; `filament_changes` 100; both slots' `model_g`, `flush_g` and `tower_g` > 0 and `support_g` 0; `filament_g` within 0.02 of the slots' `g` added up |
| 5 | `project_export {format: "gcode", path}` | as after 4 | `gcode()`: header `filament` `1,2`, `total layer number` 100, `total estimated time` within 1 s of step 4's `time_s`; each of the 100 layers holds exactly one tool line, and no two layers in a row hold the same one |
| 6 | `plate_slice_stats {include: ["objects"]}` | as after 4 | two rows: `left` with `object` 0 and `right` with `object` 1, each `instance` 0 and `g` > 0 |
**Scenario: the Preview's tables and legend**
`slots(1)`, cube "cube", `plate_slice`: `[0 ok]`, `"" 1 * S`. Then `view_set {view_type: "feature_type", legend:
{travel: false}, layer_range: [1, 100]}`, which replies `[1, 100, 100]`.
| # | Step | Also checked |
|---|---|---|
| 1 | `plate_slice_stats {include: ["features", "layers", "objects", "view"], limit: 5}` | `plate` 0; `summary.layers` 100, `filament_g` > 0, `travel_mm` > 0, `travel_time_s` > 0; `features`: `Outer wall` with `time_s` > 0, `percent` in (0, 100) and `g` > 0, `Travel` with `mm` > 0 and `time_s` within 0.5 of `summary.travel_time_s` (one travel time, rounded to 0.01 s and to the second), and every row's `percent` adding up to at most 101, each being a share of one print time rounded to 0.1; `layers`: `total` 100, `next_offset` 5, five items, item i with `layer` i+1, `z` 0.2·(i+1), `height` 0.2, `time_s` > 0 and `g` > 0; `objects`: one row, `name` `cube`, `object` 0, `instance` 0, `g` > 0; `view`: `view_type` `feature_type`, `time_mode` `normal`, `layers` [1, 100], `layer_count` 100, `legend.features` `Outer wall` and `Sparse infill` true, `legend.options.travel` false, `ranges.height` from at most 0.2 to at least 0.2, the top of `ranges.volumetric_flow_rate` and `ranges.layer_time_linear` > 0, the top of `ranges.speed` below 500 |
| 2 | `plate_slice_stats {include: ["layer_features"], offset: 99}` | one item: `layer` 100, `z` 20.0, `height` 0.2, `features.Top surface` > 0; no `next_offset`, no `features`, no `view` |
| 3 | `view_set {view_type: "feature_type", legend: {"Sparse infill": false, travel: true}, layer_z: 5.0}` | reply `legend` `{"Sparse infill": false, "travel": true}`, `layers` `[1, 25, 100]`, `z` [0.2, 5.0] |
| 4 | `plate_slice_stats {include: ["view"]}` | `legend.features` `Sparse infill` false and `Outer wall` true, `legend.options.travel` true, `layers` [1, 25]; the top of `ranges.speed` is 500, the travel speed: a travel shown counts in the ranges |
| 5 | `view_set {view_type: "feature_type", legend: {travel: false}}`, then `plate_slice_stats {include: ["view"]}` | `Sparse infill` true (a Line Type pick shows every feature type), travel false, the top of `ranges.speed` below 500 again |
| 6 | `view_set {layer: 5}` | `shown()`: tab `preview`, `preview` `plate` 0, `1–5 (0.2–1.0)`, `layer_count` 100, `view_type` `feature_type` |
| 7 | `view_set {view_type: "fan_speed"}` | `shown()` `view_type` `fan_speed`, `1–5`; `plate_slice_stats {include: ["view"]}` gives `view_type` `fan_speed`, `layers` [1, 5] and no `features` |
**Scenario: a plate the Preview has not shown, and a G-code file opened for viewing**
`slots(1)`, cube "a", `plate_add`, cube "b" on plate 1, then `plate_slice {plates: "all"}`: `[0 ok, 1 ok]`, `"" 1 S` ·
`"" 1 * S`.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `view_set {tab: "prepare"}`, `plate_select {plate: 0}`, `view_set {tab: "preview"}`, `app_wait {for: "idle"}` | `"" 1 * S` · `"" 1 S` | the wait is met; `shown()`: `preview` `plate` 0, `layer_count` 100 |
| 2 | `view_set {tab: "prepare"}`, `plate_select {plate: 1}` | `"" 1 S` · `"" 1 * S` | `shown()` `preview` null: the Preview still holds plate 0's toolpaths, which no read gives as plate 1's |
| 3 | `plate_slice_stats` | as after 2 | `plate` 1, `summary.layers` 100, `view` null, `note` holding "has not loaded this plate's toolpaths" |
| 4 | `plate_slice_stats {plate: 0}` | as after 2 | `plate` 0, `summary.layers` 100, `view` null, `note` holding "show plate 0 there" |
| 5 | `view_set {tab: "preview"}`, `app_wait {for: "idle"}` | as after 2 | `shown()` `preview` `plate` 1; `plate_slice_stats {include: ["view"]}` gives `view.layer_count` 100 and no `note` |
| 6 | `project_export {format: "gcode", path}` | as after 2 | `gcode()`: `total layer number` 100, `total estimated time` within 1 s of plate 1's `time_s` in the slice's reply |
| 7 | `project_open {path, discard_changes: true}` of that file, `app_wait {for: "idle"}` | `"" 0 *`, not sliced | the save rule's `uses` rises by 1; `shown()` `preview.layer_count` 100; `plate_slice_stats {include: ["features", "layers", "view"]}`: `summary.layers` 100, `summary.time_s` within 1 s of the file's `total estimated time`, `features.Outer wall.time_s` > 0, `layers.total` 100, `view.layer_count` 100. The plate shows the file's toolpaths without being sliced |
| 8 | `project_new {discard_changes: true}` | `"" 0 *` | `shown()` `preview` null |
**Scenario: the Preview's layers**
A cube, `plate_slice`: `[0 ok]`, `"" 1 * S`, shown `1–100 (0.2–20.0)`. After each step `shown()` gives tab `preview`
and the layers the row names; a reply of the Go to layer action is `view_set`'s, with `ran`.
| # | Step | Reply | Shown after |
|---|---|---|---|
| 1 | the Go to layer action, `{percent: 0}` | `[1, 1, 100]`, `z` [0.2, 0.2] | `1–1 (0.2–0.2)` |
| 2 | the same, `{percent: 50}` | `[1, 51, 100]` | `1–51 (0.2–10.2)`: the top is the layer `round(percent · 99 / 100) + 1` |
| 3 | the same, `{percent: 100}` | `[1, 100, 100]` | `1–100 (0.2–20.0)` |
| 4 | the same, `{percent: 25.5}` | `[1, 26, 100]` | `1–26 (0.2–5.2)` |
| 5 | the same, `{percent: 150}` | refused, "layer_percent must be <= 100" | as after 4 |
| 6 | the same, `{percent: -5}` | refused, "layer_percent must be >= 0" | as after 4 |
| 7 | the same, `{percent: "abc"}` | refused, "layer_percent must be of type number" | as after 4 |
| 8 | the same, with no `args` | refused, "takes exactly its percent" | as after 4 |
| 9 | `view_set {layer_range: [20, 60]}` | `[20, 60, 100]` | `20–60 (4.0–12.0)` |
| 10 | the Go to layer action, `{percent: 80}` | `[20, 80, 100]` | `20–80 (4.0–16.0)`: the bottom of the range stays |
| 11 | the same, `{percent: 10}` | `[11, 11, 100]` | `11–11 (2.2–2.2)`: a top below the bottom takes the bottom with it |
| 12 | `view_set {layer: 1}`, then `view_set {layer: 50}` | `[1, 50, 100]` | `1–50 (0.2–10.0)`: `layer` shows from layer 1 |
| 13 | `view_set {layer: 9999}` | `[1, 100, 100]` | `1–100 (0.2–20.0)` |
| 14 | `view_set {layer_range: [5, 20]}` | `[5, 20, 100]` | `5–20 (1.0–4.0)` |
| 15 | `view_set {layer_range: [5]}` | refused, "layer_range must be [first, last]" | as after 14 |
| 16 | `view_set {layer_z: 5.0}` | `[1, 25, 100]`, `z` [0.2, 5.0] | `1–25 (0.2–5.0)` |
| 17 | `view_set {layer_range: [20, 25]}`, then `project_export {format: "toolpaths_obj", path}` | `[20, 25, 100]` | `toolpaths_z()` within [3.6, 5.2], its highest at least 4.8: the toolpaths written are the layers shown |
| 18 | `view_set {layer_range: [1, 100]}`, then the same export to another path | `[1, 100, 100]` | `toolpaths_z()` from at most 0.2 to at least 19.8 |
| 19 | `view_set {tab: "prepare"}`, then `view_set {layer: 40}` | `[1, 40, 100]` | `1–40 (0.2–8.0)`; tab `preview` |
| 20 | `view_set {tab: "prepare"}`, then the Go to layer action, `{percent: 30}` | `[1, 31, 100]` | `1–31 (0.2–6.2)`; tab `preview` |
| 21 | `project_new {discard_changes: true}`, then `view_set {layer: 10}` and the Go to layer action, `{percent: 50}` | each refused, `no_layers` | `plates()` `"" 0 *`, read after `project_new` and again after the refusals; tab `preview`, `preview` null: the slider's layers of the cube's slice no longer count once the Preview holds no toolpaths of the current plate |
**Scenario: height range modifiers**
`slots(1)` and a cube. A first slice, `[0 ok]` with `layers` 100, and its export give the control: `gcode()` layer
30's `Sparse infill` length, L, greater than 0.
`object_list` shows the cube with no `layer_config_ranges`. Ranges are written `[min_z, max_z] {values}`, with the
values a range shows in `object_list`; after every step `object_list`'s `layer_config_ranges` is compared with the
row whole.
| # | Step | Ranges after | Also checked |
|---|---|---|---|
| 1 | `object_set_height_ranges {object: 0, ranges: [{min_z: 10, max_z: 20}, {min_z: 0, max_z: 10}]}` | `[0, 10] {layer_height "0.2", extruder "0"}` · `[10, 20] {layer_height "0.2", extruder "0"}` | reply `height` 20 to 0.01, its ranges the same, sorted, and no `warnings` |
| 2 | `settings_set {target: "height_range", object: 0, min_z: 0, max_z: 10, values: {sparse_infill_density: "40%"}}` | `[0, 10]` adds `sparse_infill_density "40%"` | reply `applied.sparse_infill_density` `"40%"`, `height_range` `{min_z: 0, max_z: 10}`; `settings_get {target: "object", object: 0, keys: ["sparse_infill_density"]}` value null: a range's setting is not the object's |
| 3 | the same for `[10, 20]`, `values: {layer_height: 0.1}` | `[0, 10] {layer_height "0.2", extruder "0", sparse_infill_density "40%"}` · `[10, 20] {layer_height "0.1", extruder "0"}` | reply `applied.layer_height` `"0.1"`, `height_range` `{min_z: 10, max_z: 20}` |
| 4 | `undo` | `[10, 20]` back to `layer_height "0.2"`, `[0, 10]` as after 3 | one step each |
| 5 | `redo`, then the ranges of step 1 again | as after 3 | the ranges a call names again keep their settings |
| 6 | `undo` | as after 4 | the same ranges took no undo step, so undo takes back step 3's |
| 7 | `redo`, `plate_slice` | as after 3 | `[0 ok]`, `layers` 150 ± 1 |
| 8 | `project_export {format: "gcode", path}` | as after 3 | `gcode()`: every layer up to z 10.0 has height 0.2, every layer from z 10.2 has height 0.1 (to 0.001), and as many layers as the slice reported; layer 30 (z 6.0) has at least 2 L of `Sparse infill`: 40 % where the object has 15 % |
| 9 | `object_set_height_ranges {object: 0, ranges: [{min_z: 0, max_z: 15}, {min_z: 12, max_z: 20}]}` | as after 3 | refused, "overlap" |
| 10 | `settings_set` on `[0, 10]`, `values: {layer_height: 0.5}` | as after 3 | refused, "layer_height 0.5 is outside this printer's 0.08-0.28" |
| 11 | the same, `values: {extruder: 9}` | as after 3 | refused, "Filament 9 does not exist" |
| 12 | the same, `values: {enable_support: true}` | as after 3 | refused, "not on a height range" |
| 13 | `object_set_height_ranges {object: 0, ranges: [{min_z: 5, max_z: 5}]}` | as after 3 | refused, "A height range needs 0 <= min_z < max_z" |
| 14 | `slots(2)`, then `settings_set` on `[10, 20]`, `values: {extruder: 2}` | `[10, 20]` holds `extruder "2"` | reply `applied.extruder` `"2"`, `height_range` `{min_z: 10, max_z: 20}` |
| 15 | `plate_slice`, `project_export {format: "gcode", path}` | as after 14 | `[0 ok]` with `layers` 150 ± 1, `filament_changes` 1 and slot 2's `model_g` > 0; `gcode()`: one tool line in all the layers, `T1`, in the first layer above 10 mm (z 10.1) |
| 16 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 14 | the ranges and their settings are kept in the project file |
| 17 | `object_set_height_ranges {object: 0, ranges: []}` | none | reply `layer_config_ranges` [] |
| 18 | `plate_slice`, `project_export {format: "gcode", path}` | none | `[0 ok]`, `layers` 100; `gcode()`: 100 layers of height 0.2, no tool line, layer 30's `Sparse infill` within 10 % of L |
**Scenario: variable layer height**
`slots(1)`, `object_add_handy_model {model: "3dbenchy"}` (48 mm high, 240 layers at 0.2 mm), `plate_slice`: `[0 ok]`
with `layers` 240. The Preview is shown. A profile is written `{points, min_height, max_height}` as `object_list`'s
`layer_height_profile` gives it, and `none` when the object has none; after every step `object_list` is compared with
the row.
| # | Step | Profile after | Also checked |
|---|---|---|---|
| 1 | `object_set_variable_layer_height {object: 0, action: "adaptive"}` | points P > 250, `min_height` < 0.2 and at least 0.08, `max_height` > 0.2 and at most 0.28 | reply `height` 48 to 0.01, no `warnings`; tab `prepare` |
| 2 | the same with `quality: 0` | more points than P | |
| 3 | the same with `quality: 1` | fewer points than P, `max_height` 0.28 | |
| 4 | `plate_slice`, `project_export {format: "gcode", path}` | as after 3 | `[0 ok]` with more than 245 `layers`; `gcode()`: as many layers as the slice reported, every height from 0.08 to 0.28 (to 0.001), more than one height, the last layer at z 48 ± 0.3: the slicer prints the profile, not 240 layers of 0.2 mm |
| 5 | `... {action: "smooth", radius: 10, keep_min: true}` | `max_height` < 0.28 | |
| 6 | `undo` | `max_height` 0.28 | smooth is one undo step |
| 7 | `redo`, then `... {action: "reset"}` | none | reply has no `layer_height_profile` |
| 8 | `... {action: "reset"}` again, then `undo` | `max_height` < 0.28 | the second reset changed nothing and took no step, so undo brings back step 5's profile |
| 9 | `... {action: "reset"}` | none | |
| 10 | `... {action: "smooth", quality: 0.3}` | none | refused, "quality goes with action adaptive" |
| 11 | `view_set {canvas: "assemble"}`, `... {action: "adaptive"}`, `view_set {canvas: "3d"}` | none | the adaptive call refused, "Leave the assemble view first" |
| 12 | `object_set_height_ranges {object: 0, ranges: [{min_z: 0, max_z: 20}, {min_z: 20, max_z: 48}]}`, `layer_height` 0.12 on the first and 0.28 on the second | none | `object_list` ranges `[0, 20] {layer_height "0.12"}` and `[20, 48] {layer_height "0.28"}` |
| 13 | `... {action: "smooth"}` | `min_height` 0.12, `max_height` 0.28 | reply `warnings` holding "decides its layer heights": smooth starts from the ranges' heights |
| 14 | `... {action: "adaptive", quality: 0}` | `min_height` 0.12 | the ranges stay: `[20, 48]` still `layer_height "0.28"` |
| 15 | `project_save` to a new file, `project_new`, `project_open` of the file | `min_height` 0.12, more than 100 points | the profile is kept in the project file |
| 16 | `plate_slice`, `project_export {format: "gcode", path}` | as after 15 | `[0 ok]` with at least 172 `layers` (48 mm at 0.28 mm at most); `gcode()`: as many layers as the slice reported, the lowest height 0.12 and the highest at most 0.28 (to 0.001) |
**Scenario: layer G-codes**
`slots(2)` and a cube. Codes are written `layer:type`, with `@z`, the custom G-code in quotes and the filament after
`F`: `26:pause@5.2` · `51:custom@10.2 "M104 S215"`. After every step `plate_list`'s `layer_gcode` for plate 0 is
compared with the row whole, and the reply's `layer_gcode` too where the call went through. `plate_list` gives a
code's `layer` only while the plate's slice is up to date, which after a code is added it no longer is, so its codes
are compared without `layer` except after step 14; the reply's codes always carry it.
| # | Step | Codes after | Also checked |
|---|---|---|---|
| 1 | `plate_set_custom_gcode {add: [{layer: 26, type: "pause"}]}` | none | refused, "has no up-to-date slice to place codes on"; tab `prepare`, `app_state.slicing` false: a refused call starts no slice |
| 2 | `plate_slice`, `view_set {tab: "prepare"}` | none | `[0 ok]` with `layers` 100 |
| 3 | `plate_set_custom_gcode {add: [{layer: 26, type: "pause"}, {z: 10.1, type: "custom", gcode: "M104 S215"}]}`, `app_wait {for: "idle"}` | `26:pause@5.2` · `51:custom@10.2 "M104 S215"` | reply `plate` 0, `layers` 100, `changed` true, `note` holding "slice it again"; tab `preview`; `app_state.project.dirty` true; `plates()` `"" 1 *`, not sliced: a code makes the slice out of date. A height takes the layer whose top is at or above it |
| 4 | `... {add: [{z: 5.2, type: "pause"}]}` | as after 3 | `changed` false: the plate stays editable while the Preview shows it |
| 5 | `... {remove: [{z: 5.2}], add: [{layer: 51, type: "custom", gcode: "M104 S220"}]}` | `51:custom@10.2 "M104 S220"` | `changed` true |
| 6 | `... {add: [{layer: 101, type: "pause"}]}` | as after 5 | refused, "layer must be 1..100" |
| 7 | `... {add: [{layer: 51, type: "pause"}]}` | as after 5 | refused, "layer 51 has a custom code; remove it first" |
| 8 | `... {remove: [{layer: 30}]}` | as after 5 | refused, "No code on layer 30" |
| 9 | `... {add: [{layer: 30, type: "change_filament", filament: 9}]}` | as after 5 | refused, "filament must be 1..2" |
| 10 | `... {plate: 1, add: [{layer: 30, type: "pause"}]}` | as after 5 | refused, "Plate 1 does not exist (the project has plate 0 only)" |
| 11 | `view_set {tab: "prepare"}`, `... {add: [{layer: 30, type: "pause"}]}` | as after 5 | refused, "has no up-to-date slice to place codes on"; tab `prepare`, `app_state.slicing` false |
| 12 | `plate_slice` (`[0 ok]` with `layers` 100), then `... {add: [{layer: 26, type: "pause"}, {layer: 76, type: "change_filament", filament: 2}]}` | `26:pause@5.2` · `51:custom@10.2 "M104 S220"` · `76:change_filament@15.2 F2` | the filament change's `color` is slot 2's, the second entry of `filament_colour` from `project_get_settings` |
| 13 | `project_save` to a new file, `project_new`, `project_open` of the file | as after 12 | the codes are kept in the project file; the plate is not sliced |
| 14 | `plate_slice`, `project_export {format: "gcode", path}` | as after 12, `plate_list` now giving `layer` 26, 51 and 76 | `[0 ok]` with `layers` 100; `gcode()`: layer 26 alone holds a `; PAUSE_PRINTING` line, followed by `M400 U1`; layer 51 alone a `; CUSTOM_GCODE` line, followed by `M104 S220`; layer 76 holds the only tool line, `T1` |
| 15 | `... {clear: true}` | none | `changed` true |
| 16 | `plate_slice`, `project_export {format: "gcode", path}` | none | `[0 ok]` with `layers` 100; `gcode()`: no `; PAUSE_PRINTING`, no `; CUSTOM_GCODE` and no tool line in any layer |
**Scenario: a plate index the project lacks, and one it has**
A cube on plate 0, then `plate_add` twice and `plate_select {plate: 1}`: `"" 1` · `"" 0 *` · `"" 0`. `snapshots()` is
read and lists the setup's snapshots, so the reader sees them. The cube's `offset` is read once from `object_list` as
O. Each refusal of steps 1 to 9 leaves `plates()` as at the start, the cube on plate 0 at O, tab `prepare` and no file
at the export's path. Those of plate 5 and -1 say "Plate 5 does not exist (the project has plates 0..2)", or
"Plate -1 ..." for -1.
| # | Step | Plates after | Also checked |
|---|---|---|---|
| 1 | `plate_slice {plates: 5}`, then `{plates: -1}` | `"" 1` · `"" 0 *` · `"" 0` | each refused, `no_such_plate` |
| 2 | `project_export {format: "stl", path, plates: 5}`, then `plates: -1` | as at the start | each refused, `no_such_plate` |
| 3 | `object_arrange {plates: 5}`, then `{plates: -1}` | as at the start | each refused, by its words |
| 4 | `plate_slice {plates: "abc"}`, `project_export {format: "stl", path, plates: "abc"}` and `object_arrange {plates: "abc"}` | as at the start | each refused, in the words `plates is "all", "current" or a plate index`: a string other than those two names no plate (the fix under To settle) |
| 5 | `plate_get_settings {plate: 5, keys: ["curr_bed_type"]}` | as at the start | refused, by its words |
| 6 | `object_list {plate: 5}` | as at the start | refused, by its words |
| 7 | `object_transform {object: 0, plate: 5}` | as at the start | refused, by its words and "action_run plate_add makes one" |
| 8 | `plate_slice_stats {plate: 5}` | as at the start | refused, by its words |
| 9 | `plate_set_custom_gcode {plate: 5, add: [{layer: 1, type: "pause"}]}` | as at the start | refused, by its words |
| 10 | `snapshots()` | as at the start | none: no refused call took an undo snapshot |
| 11 | `project_export {format: "stl", path, plates: 2}` | `"" 1` · `"" 0` · `"" 0 *` | written, `bytes` > 0: the plate named is made current |
| 12 | `plate_get_settings {plate: 0}` | as after 11 | reply `plate` 0: reading a plate leaves the current one |
| 13 | `object_list {plate: 0}` | as after 11 | `plates` lists plate 0 alone, holding the cube, and there is no `outside` |
| 14 | `object_arrange {plates: 0}` | `"" 1 *` · `"" 0` · `"" 0` | the plate arranged is made current; the cube inside plate 0's rectangle (`origin` and `size` from `plate_list`) |
| 15 | `plate_select {plate: 2}`, `plate_slice {plates: 0}` | `"" 1 * S` · `"" 0` · `"" 0` | `[0 ok]` with `layers` 100; tab `preview` |
| 16 | `object_arrange {plates: 2}` | as after 15 | refused, "Plate 2 has no objects to arrange"; tab `prepare`, which the call shows before it checks the plate |
| 17 | `object_transform {object: 0, plate: 2}`, `app_wait {for: "idle"}` | `"" 0 *` · `"" 0` · `"" 1` | the cube on plate 2, its `offset` its offset after 14 plus plate 2's `origin` less plate 0's (to 0.001); plate 0 stays current |
**Scenario: view switches**
A 30 mm sphere "ball" (`object_add_primitive {shape: "sphere", size: [30]}`), selected, and `view_set {camera:
"iso"}`. `app_state.view` is written as the switches that are on; at the start, those of a fresh configuration
folder: `gridlines`, `axes`, `navigator` and `gcode_window`, with `projection` `perspective`, `section.on` false,
`sidebar_collapsed` and `legend_collapsed` false. C0 is `capture()` at the start. After every step `app_state.view` is
compared with the row whole, and the reply gives the switch's value as the row does.
| # | Step | View after | Also checked |
|---|---|---|---|
| 1 | `view_set {labels: true}` | start + `labels` | `capture()` differs from C0; `conf("show_labels")` `true` |
| 2 | `view_set {labels: false}` | start | `capture()` is C0, byte for byte; `conf("show_labels")` `false` |
| 3 | the same, on then off, for `overhangs` (`show_overhang`), `outline` (`show_outline`) and `wireframe` (not kept) | as 1 and 2 for each | |
| 4 | `view_set {gridlines: false}`, then `{gridlines: true}` | start − `gridlines`, then start | as 1 and 2, the other way round: `conf("show_plate_gridlines")` `false`, then `true` |
| 5 | the same for `axes` (`show_axes`) and `navigator` (`show_3d_navigator`) | as 4 for each | |
| 6 | `view_set {gridlines: false, axes: false, navigator: false}` | start − all three | the reply gives all three false |
| 7 | `view_set {gridlines: true, axes: true, navigator: true}` | start | `capture()` is C0 |
| 8 | `view_set {projection: "orthographic"}` | start, `projection` `orthographic` | `app_state.camera.type` `ortho`; `capture()` differs from C0 |
| 9 | `view_set {projection: "perspective"}` | start | `app_state.camera.type` `perspective` |
| 10 | `view_set {section: {on: true}}` | start, `section.on` true | tab `prepare`; `capture()` differs from C0 |
| 11 | `view_set {section: {on: false}}` | start | `capture()` is C0 |
| 12 | `view_set {sidebar_collapsed: true}` | start, `sidebar_collapsed` true | `capture()` wider than C0 |
| 13 | `view_set {sidebar_collapsed: false}` | start | `capture()` as wide as C0 |
| 14 | `view_set {sidebar_width: W + 150}`, W being `app_state.view.sidebar_width` at the start, at least 390 | start, `sidebar_width` W + 150 | `capture()` narrower than C0 |
| 15 | `view_set {layout: "default"}` | start, `sidebar_width` D, at least 390 | `capture()` as wide as C0 |
| 16 | `view_set {sidebar_width: W + 150}`, then `{sidebar_width: "default"}` | start, `sidebar_width` D | the default width is the one the default layout gives |
| 17 | `plate_slice {preview: true}` | start | `[0 ok]` with `layers` 150 ± 1 (a 30 mm sphere); tab `preview`; C1 is `capture()` |
| 18 | `view_set {legend_collapsed: true}` | start, `legend_collapsed` true | `capture()` differs from C1 |
| 19 | `view_set {legend_collapsed: false}` | start | `capture()` is C1 |
| 20 | `view_set {gcode_window: false}`, then `{gcode_window: true}` | start − `gcode_window`, then start | `conf("show_gcode_window")` `false`, then `true` |
| 21 | `view_set {view_type: "speed", legend_collapsed: true}` | start, `legend_collapsed` true | a fold asked with a view type stays |
| 22 | `view_set {view_type: "feature_type"}` | start | a view type picked alone unfolds the legend |
**Scenario: the app's account, network plug-in and configuration folder**
The configuration folder is compared with the folder the app was launched on, on every platform. That takes the
place of the replay's check that it is not a person's own folder, which it built as `APPDATA` (or `~`) plus
`OrcaSlicer` and which could fail only on Windows.
| # | Step | Checked |
|---|---|---|
| 1 | `app_state` | `account` `{signed_in: false, bambu_signed_in: false}`; `network_plugin` `{installed: false, loaded: false, version: "", error: ""}`; `config_folder` the datadir the session file names, compared as normalised paths |
| 2 | `app_log {lines: 1}` | its `file` lies in the `log` folder of `config_folder` |
**To settle in review:**
- A layer asked of a Preview with none (nothing to slice, steps 1, 2 and 11; the layers, step 21) still shows the
Preview tab before it is refused, and an arrange refused for its plate (plate index, step 16) still shows Prepare.
Both are this branch's code (`view_set` in `McpToolsView.cpp` and `start_arrange()` in `McpToolsScene.cpp`, commit
d64e10f4dd, not on `main`) and both are its design, not a bug: a field of the Preview shows the Preview, as a
person's Go to layer pick does, and an arrangement runs on Prepare, as the toolbar's Arrange does. The rows expect
that tab.
- The layers of a Preview that holds no toolpaths of the current plate (the layers, step 21; nothing to slice, steps
1, 2 and 11). A bug in this branch's code, fixed when the test is written. `Ops::layer_count()` (`PlateOps.cpp`,
commit 0616068e26, not on `main`) trusts the Preview's layer slider once it has values, and the Preview hides its
sliders without clearing them when a plate has no layers (`Preview::load_print_as_fff()`, `main`'s code since
1555904bef, left as it is). So after the app's first slice, `view_set {layer}` and the Go to layer action on an
empty project, or on a plate whose slice failed, reply with the last print's layers while `app_state`'s `preview`
is null. The fix, in `Ops::layer_count()`: refuse with `no_layers` also unless the Preview's G-code viewer holds
the current plate's slice result (`has_data()`, and `last_result_id()` is the id of the plate's
`get_slice_result()`), the test `app_state`'s `preview` makes through `viewer_holds()`. The rows expect
`no_layers` in both places, so the first scenario no longer depends on running before any slice.
- The refusals of a plate index the project lacks carry the code `no_such_plate` from `plate_slice`, `project_export`
and the plate commands, but none from `object_arrange`, `plate_get_settings`, `object_list`, `object_transform`,
`plate_slice_stats` and `plate_set_custom_gcode`, whose text is the same. A refusal without a code is not a bug:
those are matched by their words.
- A `plates` string other than "all" taken as the current plate (plate index, step 4). A bug in this branch's code,
fixed when the test is written: `plate_slice`'s handler (`McpToolsScene.cpp`, commit 0616068e26) and
`project_export`'s (`McpToolsProject.cpp`, commits dc522e59e4 and 5e5571a99f), none on `main`, read `{plates:
"abc"}` as the current plate. The fix, in both handlers: refuse a string other than "all" and "current" with
`object_arrange`'s words, `plates is "all", "current" or a plate index` (`start_arrange()`, `McpToolsScene.cpp`),
before anything changes. The row expects that refusal from all three commands.
- The two-colour slice (statistics, step 4) changes filament once a layer: the tool order puts each layer's last
filament first on the next, so 100 changes and one tool line a layer. The replay this takes the place of checked
only "more than 100" on 128 layers.
- The top of the speed colour range with travel shown is 500, the X1C's `travel_speed` in mm/s; the colour ranges
count travel only while the legend shows it. With travel hidden, every extrusion speed is lower.
- The exported toolpaths' vertices lie within half a layer of the layers shown; the bounds allow a whole layer.
- A display switch turned back draws the 3D view as before it was changed, so the capture is byte-identical: every
check that a capture is C0 or C1 (view switches, steps 2, 3, 4, 5, 7, 11 and 19). If a switch leaves a trace (the
navigator's or another ImGui window's position), that check falls back to "differs from the capture taken with the
switch changed". The overhang highlight is visible from the iso view on the sphere's lower half, between its equator and about
55° below it.
- The start of the view switches: `AppConfig`'s defaults for a configuration folder the harness seeds without these
keys. The network plug-in's start: not installed on the sweep's fresh datadir, so neither loaded nor failed.
- The sidebar's default width is 39 em (`AuiMgr::sidebar_pane_info()`), which depends on the display's scale or font,
so it is checked as at least 390 px and as the width Reset Window Layout gives; on the sweep's fresh datadir it is
also the start width W.
- A G-code file opened for viewing gives the same estimate as the slice it was exported from, and the file's header
the slice's: the processor reads the file's moves as it read the slice's. Times are compared within 1 s, the
header giving whole seconds.
- `object_transform {plate}` moves an instance to another plate and leaves the current plate (plate index, step 17):
`transform_instance()` selects no plate.
- The layer 30 comparison of the height ranges: grid infill's length grows with its density, so 40 % is about 2.7
times 15 %; the check asks for twice.
**Not checked:**
- The tables' arithmetic (a slot's grams as its four uses, the totals, the shares of the print time, layer heights,
paging, the unique-name rule) and a height's layer: unit tests in `tests/slic3rutils/test_mcp_results.cpp`.
- `filament_m`, `filament_cost`, `prepare_time_s`, the travel time and the grams' values: they follow the filament profile and the
slicer's paths; they are checked as present and positive or as sums.
- The colour ranges other than speed and height: the tops of `volumetric_flow_rate` and `layer_time_linear` are
checked only above 0. Their values follow the slicer's flow and cooling; the speed range is the one with a value
the profile fixes, the travel speed.
- Adaptive and smoothed layer height profiles and their slices are checked by properties (more or fewer points by
quality, heights within the printer's 0.08 to 0.28 mm, the ranges' 0.12 and 0.28 kept, layer counts that differ
from the flat profile's), not exact point or layer counts, which follow the Benchy's mesh and the algorithm.
- The sidebar's default width itself: it is 39 em, and an em is 10 px times the display's scale on Windows and macOS
but a font's width on Linux, so the test checks it as at least 390 px and as what Reset Window Layout gives. A
change of the 39 em passes.
- A legend row hidden by a click and kept across view types until Line Type is picked, the view type written to the
configuration, captures after a layer or view type change, a height between two layer tops (`layer_z` 1.05), a
range given backwards, the one-layer mode, and `view_set`'s six refusals (legend before a slice, a height above the
top, `layer` with `layer_z`, an unknown row, a value that is not a boolean, silent mode): `test_set_view_preview`.
- `view_set {layer}` and the Go to layer action on a fresh app with no slice, in the same words, and the STL and
sliced 3MF exports of an empty project: `test_operation_routes`. A refused layer leaving the legend's fold and the
G-code window: `test_additions_refusals`.
- The journal steps of the Slice and Preview, Slice All Plates and Go to layer actions, and `plate_goto`:
`test_every_action`.
- `plate_select`'s, `plate_rename`'s, `plate_lock`'s, `plate_duplicate`'s and `plate_delete`'s refusals of a plate
the project lacks: `test_menu_items_refusals`. A rename making its plate current, and a plate's spiral mode
with its question: `test_plates`.
- How many `select partplate!` snapshots a plate selection takes (two when the plate changes, one from the plater
and one from the plate list): only snapshots the rows name are counted.
- A cancelled slice: `test_cancel_pending_slice`. A superseded slice (another slice or an edit while it runs) needs a
second caller timed against the slice, and is left out.
- Silent mode: the X1C has no silent-mode estimate, so `time_mode` cannot switch without another printer;
`test_set_view_preview` checks its refusal.
- The G-code window on screen: it shows only while the moves slider is off its end, which no tool sets. It is
checked through `app_state` and the configuration.
- The camera fields: `test_set_view_camera`. A sidebar floating in its own window: `test_sidebar_floating`.
- A layer G-code of `type: "template"`: the X1C's `template_custom_gcode` is empty. That the codes take no undo step:
an `undo` after one would take back the step before it, the cube's.
- The notifications in `plate_slice`'s reply: the validation error is checked through the plate's `error`.
- What the 3D view looks like: captures are compared only with each other.
## Replays this area replaces
Each leaves the sweep, with its entry, in the commit that adds the tests above.
### `slice_stats`
`tests/slice_stats.json` · replay, 19 steps, 4 expects, 0 optional
**Tests:** `plate_slice`'s statistics: layers, max Z, filament changes, total grams and each slot's model, support, flush and prime-tower grams, for one cube on filament 1 of two, then with a second cube put on filament 2 by the canvas's `2` key.
**Decides by:** Fails when a call errors or one of its 25 matchers misses.
- One colour: 128 layers; `max_z` in (25.5, 25.7); 0 filament changes; exactly two slot rows (slot 1, slot 2); slot 1 model > 0 with flush and tower 0; slot 2 g = 0.
- Key: `keyboard_press` to `OrcaSceneCanvas` `/to` = `wxGLCanvas`.
- Two colours: 128 layers; filament changes > 100; both slots' model, flush and tower grams > 0; slot 2 support = 0.
**Not checked:**
- The `2` key's effect is never read directly; it shows only through slot 2's model grams.
- The two-colour figures are lower bounds (`gt 100` changes where every layer changes, `gt 0` grams); `filament_g` and slot 1's support are not read in the second slice.
- The arrange step has no expect.
**Strength:** Strong — the one-colour breakdown is exact, and the two-colour slice fails if flush, tower or slot 2's model goes missing.
### `preview`
`tests/preview.json` · replay, 52 steps, 21 expects, 0 optional
**Tests:** `plate_slice_stats` and `app_state.preview` on a sliced 25.6 mm cube: the summary, feature and layer tables with paging, the object row, and the legend state as `view_set` changes rows, layer (by number and by height), view type and time mode; that nothing reports the selected plate's toolpaths while the Preview still holds another plate's; and the same reads on the cube's exported G-code opened for viewing.
**Decides by:** Fails when a call errors or one of its 80 matchers misses.
- Tables: 128 layers; layer 1 at z 0.2; layer 5 at z 1.0 with height 0.2; `next_offset` 5; the last page is layer 128 at z 25.6 with no `next_offset`; `include` filtering (`/features`, `/view` absent when not asked); `Outer wall` percent in (0, 100); times, grams and mm `gt 0`.
- Legend and view: view type, range [1, 128], `Sparse infill`/`travel` visibility after each change, feature rows shown again after Line Type is picked; `layer_z` 1.0 gives layer 5, 1.05 gives layer 6 at z 1.2.
- `app_state.preview`: plate, layers, z, layer count and view type follow `view_set`.
- Plates: both slice `ok`; plate 0 shown reports plate 0; plate 1 selected in Prepare gives `/preview` null and `plate_slice_stats` `/view` null with the "has not loaded this plate's toolpaths" note; once shown, plate 1 with no note.
- G-code view: 128 layers in `app_state` and the stats, with features and summary present.
**Not checked:**
- The G-code section's claim that its plate "is never marked sliced": no step reads `sliced`.
- `time_mode` is set to `normal`, the mode already shown, so switching modes is never exercised.
- Times, grams, travel and colour ranges are `gt 0`; only their presence is shown.
- `legend.png` is saved and never compared.
**Strength:** Strong — layer counts, heights, paging and legend state are compared exactly and read two ways.
### `layers`
`tests/layers.json` · replay, 112 steps, 128 expects, 14 optional
**Tests:** Height range modifiers (`object_set_height_ranges`, `settings_set` target `height_range`), variable layer height profiles (`object_set_variable_layer_height` adaptive, smooth, reset), and a plate's layer G-codes (`plate_set_custom_gcode`), each with undo, refusals, a slice and a 3MF round trip.
**Decides by:** Fails when a non-optional call errors or an expect misses.
- Height ranges: the reply's ranges sorted with `max_z`/`min_z` 10, `layer_height` "0.2", `extruder` "0", `/height` 20 ± 0.01 and no `/warnings`; `settings_set` `/applied` and `/height_range` exact; `object_list` holds "40%" and "0.1" and no third range; the object's own `sparse_infill_density` stays null.
- Undo: one undo reverts only the last range setting; the same ranges again keep their settings and add no undo step (the next undo reverts `layer_height` to "0.2").
- Slices: `plate_slice` `/status` "done" and outcome "ok"; the Preview's `/layers/2` (layer count) is 149–151 with the ranges and exactly 100 after `[]` removes them.
- Range refusals (optional overlap, 0.5 mm layer, filament 9, `enable_support`, empty range) are followed by `object_list` showing range 0 still ending at 10 at "0.2" with extruder "0", no `enable_support`, range 1 at "0.1", no range 2.
- Variable layer height: adaptive `points` > 250, `min_height` < 0.2, `max_height` > 0.2, tab back to "prepare"; quality 0 gives > 380 points, 1 < 320; sliced layer count > 245; smooth `max_height` < 0.28, undo restores exactly 0.28; reset removes the profile and a second reset adds no undo step (undo brings the smoothed profile back); refusals leave no profile; over ranges smooth gives min 0.12, max 0.28 and a warning containing "decides its layer heights".
- Layer G-codes: before a slice the optional call leaves tab "prepare" and nothing slicing; from Prepare the reply's plate, 100 layers, `changed`, and each code's type, layer, z and gcode are exact (pause at layer 26 z 5.2, custom at 51 z 10.2), with the "slice it again" note, and the app shows the Preview with the project dirty; the same code again gives `changed` false; remove plus add in one call; after five optional refusals a repeat call shows the list unchanged; a stale plate in Prepare leaves tab and slicing alone; a filament change at layer 76 z 15.2 filament 2; `clear` gives `[]`.
- 3MF round trips: reopened ranges keep "40%", "0.1" and extruder "2"; the profile keeps min 0.12 and > 100 points; reopened and resliced layer G-codes keep "M104 S220" and filament 2.
**Not checked:**
- Refusals that would change nothing if accepted cannot be told from success: removing at layer 30 where nothing is, and the code for plate 1, which the follow-up (plate 0 only) does not read. No refusal's reason is asserted.
- The range settings and layer G-codes never reach a checked slice result: 40 % infill, the extruder-2 range and the pause, custom and filament-change codes are only followed by an "ok" slice, not looked for in the G-code or Preview.
- Adaptive profiles and their slices are checked with bounds (point counts, layer count > 245), not exact values.
- The filament change's `color` is checked with `exists` only.
**Strength:** Strong — each edit, undo, refusal and 3MF reopen is read back with exact values; only the adaptive algorithm's counts are bounds.
### `view_switches`
`tests/view_switches.json` · replay, 67 steps, 60 expects, 0 optional
**Tests:** `view_set` outside the Design tab, each state read from its reply and from `app_state.view`: sidebar collapse and width, every Prepare display switch, projection and section view, and in the Preview the legend fold and the G-code window; a cube placed by numbers in the middle of plate 1; and `app_state`'s account, network plug-in and configuration folder.
**Decides by:** Fails when a call errors, an inline `script_run` raises, or one of its 81 matchers misses.
- Switches: `labels`, `overhangs`, `outline`, `wireframe`, `gridlines`, `axes` and `navigator` each true then false in the reply and `app_state`; three at once; projection orthographic (camera `ortho`) and back; `section/on`; `legend_collapsed`; `gcode_window`; a fold asked with a view type stays folded.
- Sidebar width (script): start > 100; start + 150 is reported and read back; `default` returns to the start width.
- Placement: after `plate_add` (origin and size > 0), the script's cube is the only object on plate 1 and not on plate 0; `plate_list` counts 1 and 1.
- App info: signed in to neither cloud; `network_plugin` fields exist; the log lies under `config_folder`, which is not the personal folder.
**Not checked:**
- `personal` is built as `APPDATA` (or `~`) plus `OrcaSlicer`, the real folder only on Windows; on macOS and Linux the `personal: false` check cannot fail.
- The `default` width is taken to be the start width, not a known default: it fails on a datadir that starts wider, and passes if the default itself changed.
- The placement script's x/y are not compared with the object's offset; only the plate it lands on.
- `network_plugin` fields are `exists` only.
- That picking a view type alone unfolds the legend is not tested; only that a fold asked with it is kept.
**Strength:** Strong — every switch is set both ways and read back from two sources.

View file

@ -0,0 +1,519 @@
# Windows, views, printers and web pages
The design of this area's sweep tests. The rules every entry follows, the grades and the table of all tests are
in [TESTS.md](../TESTS.md).
## `test_printer_extruders`
`test_printer_extruders.py` · Python, 29 checks
**Tests:** The test launches its own instances on fresh datadirs, with printers the sweep doesn't seed. On the Bambu
Lab H2D (two extruders) it checks four things. `settings_set` validates a whole call before any variant switch or
flow-type pick. A variant switch asks about unsaved printer changes unless `reset_all` is given. A plate's
`filament_map_mode` and `filament_map` round-trip through `plate_set_settings` and `plate_get_settings`. The second
extruder's `nozzle_volume_type` can be set. On the A1 mini, a flow type that its 0.2 nozzle preset doesn't offer is
refused. On the Eryone ER20, `extruders_count` 2 gives two extruders.
**Decides by:** Exits 1 when any check prints FAIL, or on an uncaught exception (an unexpected tool error). A
failed launch adds a FAIL "the app starts with the ...".
- Validation before change (H2D): three kinds of call must raise: an unparseable `printable_height`, another key
beside a variant switch, and a flow type the 0.2 preset lacks. After each one, `app_state.presets.printer` and
`nozzle_volume_type` must still equal the values read before. The "second call" and "extruder 2" refusals are
matched by message substring.
- Variant switch: `app_state.presets.printer` must become `Bambu Lab H2D 0.6 nozzle` with extruder 2 at
`High Flow`, then return exactly to the 0.4 state read before. With unsaved changes, the reply's `status` must be
`blocked_by_dialog`. After Discard, or with `reset_all` (then no `status`), the 0.6 preset is selected, no dialog
is open and `preset_list` marks nothing `modified`.
- Plate grouping:
- `filament_map_mode` starts as `Auto For Flush`, with `Manual` among the options offered.
- `applied`, the read-back `value` and `effective` all equal `Manual`, then `[2, 1]`.
- `[1, 3]` is refused naming "extruder 3", and the map stays `[2, 1]`.
- Setting the mode to null reads it back as `None`.
- Flow types and counts: `nozzle_volume_type` has the `variants` `extruder 1` and `extruder 2`. Setting index 1
gives `<first>,High Flow` in the reply and on read-back. `TPU High Flow` on extruder 1 and `extruders_count` 3
are refused, matched by message substring.
- A1 mini: the preset is `Bambu Lab A1 mini 0.4 nozzle`. A switch to 0.2 with a flow type is refused naming
"extruder 1" and "no nozzle flow type to pick", and the state is unchanged.
- ER20: the preset name is checked. `nozzle_diameter` is `0.4` before and `0.4,0.4` after, with two `variants`.
`applied` equals `{"extruders_count": 2}`.
**Not checked:**
- "a call with a value that does not parse changes nothing" passes on any error. The message isn't checked to name
`printable_height`, and "nothing changed" is judged only by the preset name and the flow types.
- "a variant switch with a flow type its preset offers sets both" checks only extruder 2's flow type, not
extruder 1's.
- The unsaved-changes dialog is answered with Discard without checking which dialog it is. The `printable_height`
of 300 that made the change is never read back.
- On the ER20, only `nozzle_diameter` is read back; no other per-extruder key is. Nothing checks that `reset_all`
takes it back to one extruder.
- Setup and clean-up calls have no check of their own: `project_new`, `filament_add`, the 0.4 restore at the end
of `unsaved_changes`, and the `reset_all` calls.
**Strength:** Strong — preset names, values and refusal texts are checked exactly, and each refusal is checked to
leave the state as it was.
## `test_project_open_settings`
`test_project_open_settings.py` · Python, 6 checks
**Tests:** The test seeds its own datadir with the preference `project_load_behaviour` = `load_geometry_only` and
launches its own instance. It checks that opening a saved project still loads the process settings saved with it
(`layer_height` 0.28), and that the preference stays as it was.
**Decides by:** Exits 1 when a check prints FAIL, when its own launch fails, or on an uncaught exception.
- Preference: `preferences_get` reads `project_load_behaviour` = `load_geometry_only`, both before and after the
open.
- Layer height: the process `layer_height` from `settings_get` is checked three times. It is 0.28 after
`settings_set`, not 0.28 after `project_new` drops the presets' changes, and 0.28 again after `project_open`.
- Open: the `names` in `project_open`'s reply has exactly one entry.
**Not checked:**
- "a new project prints with the preset's layer height" checks only `!= 0.28`, not the preset's known value.
- Only `layer_height` is checked. No other process, filament or printer setting saved in the project is read, and
nothing checks whether the process preset shows as modified after the open.
- The object's name isn't checked. Nor is whether the open asked anything: a job envelope would fail only because
its `names` is missing.
- `project_save`'s reply isn't checked; the later open implies the file was written.
**Strength:** Strong — the round-tripped layer height and the unchanged preference are checked exactly, though
only one setting is covered.
## `test_sidebar_floating`
`test_sidebar_floating.py` · Python, 4 checks
**Tests:** While the sidebar floats in its own window, `view_set {sidebar_width}` is refused and the width stays unchanged. The test launches its own instance twice on one fresh datadir. The first run saves `app.window_layout`. The test then marks the sidebar's AUI entry in that layout as floating, so the second run starts with it floating. On Linux both runs start as X11 clients (`GDK_BACKEND=x11`, through XWayland on a Wayland desktop), as the runner's own launches do by default, since a native Wayland app drops the saved floating state.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
- "the app starts" and "the window layout the first run saved has the sidebar": the first launch succeeds, and the `window_layout` in `OrcaSlicer.conf` has a `name=sidebar;` entry.
- "view_set of sidebar_width while the sidebar floats is refused": the call must raise, with "The sidebar floats in a window of its own" in the message.
- "and the sidebar's width stays as it was": `app_state.view.sidebar_width` equals the value read before.
**Not checked:**
- A native Wayland app is not tested: its saved floating state is dropped, and nothing checks that it starts docked.
- Nothing reads the state to confirm the sidebar really floats; only the refusal text suggests it. No docked control shows that `sidebar_width` is accepted when the sidebar isn't floating.
- The first run is stopped right after it reports ready, but the app writes its layout "at its next idle moment". A layout not yet written fails the second check, so this can flake but can't pass falsely.
**To settle in review:**
- That an X11 client is what a sweep on a Wayland desktop should test here. A `--wayland` sweep means native Wayland launches; this test could instead check there that the sidebar starts docked and `view_set {sidebar_width}` is taken. The proposal keeps one behaviour, the floating one, on every platform.
**Strength:** Strong — the refusal text and the unchanged width are checked exactly on every platform.
## `test_set_window`
`test_set_window.py` · Python, 40 checks on Windows and macOS (1 SKIP), 41 on Linux X11 including `--headless`,
31 on Linux Wayland (4 SKIP)
**Tests:** `window_set` on three kinds of window, plus the read side in `window_list` and `app_state.displays`:
- The main window: size, position, maximize, minimize and restore, a size given while maximized or after a
minimize from maximized, and a contradictory request.
- The modeless Plugins window, by its ref: size, position, and a stale ref once it has closed.
- The modal Preferences dialog: by `target: "dialog"` and by a `{label}` locator; it never minimizes; and it stays
above the main window in the stacking order.
**Decides by:** Exits 1 when any check fails or on an uncaught exception. SKIPs never fail it.
- Main-window size:
- Size 1400×900, then 1300×820: the reply's `size` and `state` and `window_list`'s width and height equal it.
- A size of 1300×850 given while maximized replies `normal` with that size.
- The flat `width`/`height` form replies 1500×950.
- Position, everywhere except Wayland:
- `app_state.window.position` equals [40, 30].
- A position plus a size equal to the work area in the first reply's `display` is echoed back.
- On Wayland instead:
- `app_state.window` must have no `position`.
- A `window_screenshot` of the main window (no image) must report a width and height equal to 1300×820 times the
reply's `scale`. Only that pixel size is compared.
- Minimize and restore, everywhere except Wayland:
- Minimize returns in under 5 s and replies `minimized`.
- Restore replies `normal`, and a canvas `window_screenshot` reports a width > 0.
- Maximized, minimized, then `normal`: the reply says `normal` with no `note`, and `window_list` still reads
`normal` 1 s later.
- Maximized, minimized, then a size: the reply says `normal` with that size.
- Contradiction: `state: maximized` together with a size raises, and the size in `window_list` is unchanged.
- Plugins window:
- It is listed with a `ref`.
- The reply's size is 900×700, or 900 by more than 700 with `size` listed in `adjusted`.
- "Plugins: the reply has the position": off Wayland the reply's position is [100, 100]; on Wayland, where no
position is given or known, the reply has no `position` (its fields are `window_list`'s entry, which has no
`x` or `y` there).
- `window_list`'s place and size equal the reply's.
- Escape closes it, and its ref then raises naming `window_list`.
- Preferences:
- It is listed.
- "dialog: window_set sizes the topmost modal dialog": `window_set {target: "dialog", size: [1000, 760]}` replies
`kind` `dialog` and the size 1000×760, or 1000 by more than 760 with `size` in `adjusted`; `window_list`'s
Preferences entry then has that width and height.
- "dialog: a {label} locator finds it": the `{label: "Preferences"}` call replies `title` `Preferences`. Off
Wayland it is given the position [60, 60], and the reply's `position` and `window_list`'s Preferences `x` and `y`
are 60 and 60, with the size from the call before. On Wayland it is given the size 1000×760 again, and
`window_list`'s width and height equal the reply's.
- `state: minimized` raises.
- It closes through `dialog_answer`.
- Stacking, on Linux X11 only, where libX11 opens the display: the main window is minimized, restored and raised.
In the X server's stacking order its title must then sit below `Preferences`.
- Read side:
- Every window with a ref has a valid `state` and a boolean `resizable`.
- `displays` is not empty and has exactly one `primary`.
- Each display has the keys `index x y width height scale`.
**Not checked:**
- SKIP paths by platform:
- Windows and macOS run everything except the stacking check, which is a SKIP because `x11_stacking` finds no
libX11 or display.
- Linux X11 runs all 41.
- Linux Wayland (`--wayland`) skips position, both minimize sections (9 checks) and stacking.
- Maximize is checked only by the reply's `state`; neither `window_list` nor the size is read. The minimize and
work-area checks also trust the reply alone.
- The work-area fill compares the reply with the work area the app reported in its own first reply. That makes it
self-referential, and `window_list` isn't read.
- "restore: the 3D view captures" only requires a reported width > 0; no pixels are compared.
- "a contradiction is refused" accepts any error text.
- Timing:
- "and window_list still reads it normal a second later" relies on a fixed 1 s sleep, so a later re-zoom would
be missed.
- "minimize: returns within 5 s" is a timing bound.
- Displays are checked for key presence only; their values aren't compared with the OS.
- The stacking check isn't gated by platform. On a Mac where `ctypes.util.find_library("X11")` succeeds and
`DISPLAY` is set (XQuartz), it would read XQuartz's stacking order, which lists no Cocoa windows, and fail. I
could not confirm whether any sweep machine hits this.
- The final restore to `WINDOW_SIZE` is unchecked.
**To settle in review:**
- That Preferences takes 1000×760: if its minimum height is above 760, the reply holds its minimum with `size` in
`adjusted`, which the check accepts as it does for Plugins.
**Strength:** Partial — main-window and dialog sizes and places are read back from `window_list`, but maximize,
minimize and the work-area fill trust the reply, and Wayland skips about a quarter of the test.
## `test_set_view_preview`
`test_set_view_preview.py` · Python, 21 checks (1 conditional)
**Tests:** `view_set` on the Preview of a sliced cube:
- A legend row hidden by a click stays hidden across view types, until Line Type is picked.
- The view type picked is written to `preview_last_view_type`.
- Canvas captures taken right after a layer or view-type change show the new state.
- `layer_z`, a range given backwards and the one-layer mode map to the right layers.
- Six refusals: legend rows before a slice, a height above the top layer, `layer` with `layer_z`, an unknown row,
a value that isn't a boolean, and silent mode when the print has no silent estimate.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
- Legend state: `plate_slice_stats.view.legend.features["Sparse infill"]` must be `False` after a `widget_click` on
its row, still `False` after `view_type=speed`, and `True` after `feature_type`.
- Config: `app.preview_last_view_type` in `OrcaSlicer.conf` must become `speed`, then `feature_type`. The file is
polled for up to 5 s.
- Captures: an inner `replay_run` makes 8 changes and saves two canvas captures to PNG after each one. The replay
must pass. Then two byte comparisons decide:
- "Settled": the two captures after each change must be byte-identical.
- "Every change shows": from the second change on, the first capture after a change must differ byte-wise from
the last capture before it.
- Layers:
- `layer_z=1.05` replies `layers` [1, 6, 128] and `z` [0.2, 1.2].
- The backwards range [60, 20] replies [60, 60, 128] and `z` [12.0, 12.0].
- In one-layer mode (`L`), [2, 5] replies [2, 5, 128] and `z` [0.4, 0.4], and `app_state.preview.layers` is
[2, 2].
- Leaving one-layer mode reads [1, 128].
- Refusals, matched by message substring:
- "slice first"
- "above the top layer (25.6 mm)"
- "not both"
- the print's rows "Sparse infill" and "travel"
- "true (show) or false (hide)"
- "no separate silent-mode estimate"
- After the refusals, `view_type` is still `feature_type` after the unknown-row one, and `time_mode=normal` echoes
`normal`.
**Not checked:**
- The capture comparison is only relative. It shows that a capture changed and then held still, not that it shows
the right layers or legend. Nothing is compared with a baseline.
- The first change (layers 1–40) is not checked for "shows".
- Byte equality between two PNGs needs pixel-identical frames, with no animation and no caret. The test assumes
this.
- "the legend reply gives each row's state" reads only the reply. `travel` shown and `Sparse infill` hidden are
not read back from `plate_slice_stats`.
- "silent mode without its own estimate is refused" runs only when the slice has no `silent_time_s`. Otherwise it
is dropped without a SKIP line.
- After the refusals, only `view_type` is checked as unchanged; layers and legend aren't, although the docstring
says a refused call changes nothing.
- The cube's slice outcome is not checked. The exact layer values that follow would catch a failed slice.
**Strength:** Strong — legend, layer and z values are exact, the config write is read from disk, and the captures
are compared with each other.
## `test_set_view_camera`
`test_set_view_camera.py` · Python, 35 checks
**Tests:** `view_set`'s camera fields (`look_at`, `zoom`, `camera`, `orbit`) and the `camera_state` it returns,
checked against `app_state.camera`. It covers four views: Prepare (including straight after `project_new`'s queued
fit), Preview, the Design tab's own camera, and the assemble view's first showing. It also covers zoom clamping,
`click_px_per_mm`, a fit after a resize on the Home tab, and a zoom given on Home while a fit is queued.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
- Prepare after `project_new`:
- The reply echoes `camera` `top`, and `camera_state` has zoom 3, `look_at` [50, 60, 0] and `elevation` 90.
- "prepare: the 3D view captures": `window_screenshot {target: "canvas"}` replies `source` `canvas`, a width and
height above 0, and no `approximate` key (a 3D view that comes back blank is marked `approximate`).
- After that capture forces a frame, `app_state.camera` still has zoom 3 and that `look_at`.
- "prepare: camera_state has a projection type": `type` is `perspective`, as the fresh data folder's
`use_perspective_camera` (on by default, with `auto_perspective` off) gives it.
- `click_px_per_mm`: zoom divided by `click_px_per_mm` lies in [1, 3].
- Clamping: `zoom=1000` gives 250, and `adjusted` == ["zoom"].
- Orbit: `camera=front, orbit=[30, 20]` gives `elevation` 20 and `azimuth` -60. `look_at` equals the one before,
and the reply echoes `orbit` and `camera`.
- Preview: the imported cube slices with `outcome` `ok`. Zoom 2 and `look_at` [0, 0, 0] appear in both the reply
and `app_state.camera`.
- Design (the sweep launches with `--cad`):
- The zoom is within 1e-3 of `250/1.4^15`.
- `look_at` is within 1e-3 of `describe_design`'s `modeling_origin`.
- The reply echoes the camera, and `app_state.camera` has the zoom.
- An orbit is accepted and keeps that zoom.
- Back on Prepare, the zoom is 2. That value was set on Preview, so this shows the two share a camera.
- Assemble: the call raises no error, and after a capture `app_state.camera` has zoom 4 and `look_at`
[10, 20, 0].
- Home:
- `app_state` has no `camera`.
- A zoom's reply has a `note`.
- After switching to Prepare and a capture, the zoom is not 3.
**Not checked:**
- The captures in assemble and on Home only force a frame; their replies are not read unless the call fails, and no
capture's pixels are compared.
- After the Design orbit, the resulting elevation and azimuth are not checked; only the kept zoom is.
- "resized on home: a fit on prepare uses the new size" compares two fits in a row with each other, not with the
zoom expected for a 1400×800 canvas. A fit that used a stale size both times would pass.
- "home: the fit replaces the zoom once the view draws" checks only `!= 3`, not the fit's zoom. The `note` is
checked for presence, not for its text.
- `click_px_per_mm` is checked against a range, not the display's known scale. Both values come from one
`app_state`.
**Strength:** Partial — Prepare, Preview, assemble and clamping values are exact, but the Design orbit, the resized
fit and the Home fit are checked loosely or only against each other.
## `test_speed_dial_open`
`test_speed_dial_open.py` · Python, 12 checks (plus 1 where KWin answers; the 3 focus checks SKIP where the pointer cannot be moved)
**Tests:** The app goes from Home to Prepare, Design and Preview by tab clicks. After each switch, the page's 3D
view (`OrcaSceneCanvas`) must hold the keyboard focus, Space sent with no target must open the Speed Dial, and
Escape must close it. Where KWin answers on D-Bus, it also checks that KWin draws no title bar on the dial. The
test runs exclusive in the sweep.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception, such as a tab missing from
`widget_list`.
- The pointer off the view: the 3D view also takes the focus when the pointer enters it, so before each tab click
the test moves the system pointer to the primary display's top-left corner, (0, 0), and reads the pointer's
position back from the system: (0, 0). The seeded main window opens at the work area's top left
(`seed_datadir()`), so that corner is its top bar or lies outside it, never in the 3D view below the tab bar. It moves the
pointer with `SetCursorPos` on Windows, `CGWarpMouseCursorPosition` on macOS and `XWarpPointer` on X11, each
through `ctypes`, and reads it with `GetCursorPos`, `CGEventGetLocation` and `XQueryPointer`. A pointer that does
not read back at (0, 0) fails the page's focus check.
- Per page:
- `app_state.tab` reaches the tab within 10 s.
- The first `[focused]` line in `widget_list` contains `name=OrcaSceneCanvas`.
- Within 10 s of Space, `window_list` shows a web dialog with no title.
- Within 10 s of Escape sent to the dial's ref, it is gone.
- On a native Wayland display, where an app can neither move the pointer nor read where it is, each focus check
prints SKIP with that reason instead of passing.
- KWin, on the first page only: KWin's frame height for the app's window with no caption must be at most the dial's
height in `window_list` + 2.
**Not checked:**
- The focus checks are not made on a native Wayland display.
- The wait for Home after the first click isn't checked. If that click did nothing, the page click is still judged
only by the final tab.
- Any web dialog with no title counts as the dial, and its content isn't checked. Escape is sent to the dial's
ref, so Escape through the keyboard focus isn't tested.
- The KWin title-bar check prints "skip", which isn't a counted check, in two cases:
- No KWin answers: Windows, macOS and GNOME.
- KWin's window runner doesn't list the dial. Per the code comment this covers X11 clients, so it includes the
default Linux sweep and `--headless`.
It runs only for a native Wayland app on KWin (`--wayland` on Plasma).
**To settle in review:**
- Moving the user's pointer during a sweep on a desktop: the test is exclusive in the sweep, so nothing else runs
meanwhile, but a person using the machine sees the pointer jump.
- That (0, 0) lies outside the 3D view on every sweep machine: the seeded `window_mainframe` puts the window at the
work area's top left, and the 3D view is below the tab bar in any case; with a monitor at negative coordinates,
(0, 0) is still the primary's corner.
**Strength:** Partial — opening and closing the dial are checked on every page, and the focus check is made with the
pointer off the view, but the KWin check almost never runs and native Wayland skips the focus checks.
## `test_send_gcode`
`test_send_gcode.py` · Python, 16 checks (1 conditional)
**Tests:** The `send_gcode` Speed Dial action (`orca_command:send_gcode:orca`), run against an OctoPrint stub host
inside the test process. It covers:
- Refusals for a printer on the Bambu network and for a printer with no print host.
- An upload through the action's dialog, with the file name set by `widget_set_value` and Upload pressed by
`dialog_answer`, tracked in `app_state.uploads`.
- The exported replay of that send, which uploads again.
- HTTP 500 replies, delayed and immediate, which must end as errors, with the queue's error dialog.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
- Discovery and refusals:
- `action_search "Send G-code"` lists the action's id.
- With `bbl_use_printhost` false, the action raises with "Print plate". This runs only when the printer is a
Bambu Lab one, as the sweep's seeded X1 Carbon is.
- With `print_host` "", the action raises with "no print host". If a dialog opens instead, the check fails.
- Upload answered 200:
- The row ends `completed` at progress 100 and was seen at (`uploading`, 99) during the stub's 3 s pause.
- The row has `filename` `mcp_send_ok.gcode` and the stub's port in `host`.
- The stub received exactly `{"filename": "mcp_send_ok.gcode", "print": "false"}`.
- Replay:
- The `replay_export` steps equal exactly `action_run, app_wait(dialog), widget_set_value, app_wait(dialog),
dialog_answer, app_wait`.
- `replay_run` passes, a new row completes, and the stub has 2 uploads.
- 500 after a pause:
- The row ends `error` with "HTTP 500" in `error`, never read `completed`, and was seen at (`uploading`, 99).
- An error dialog appears, and after `dialog_answer ok`, `app_state.dialogs` is empty.
- 500 at once: the row ends `error`.
**Not checked:**
- The uploaded file's content. The stub parses only the multipart `filename` and `print` fields, so an empty or
wrong body would pass.
- The replayed upload's file name. The stub answers the version check (`GET /api/version`), but nothing checks it
was made.
- The error dialog's text: only that some dialog opened and closed. For the immediate 500, neither the
"HTTP 500" text nor the dialog is checked; `close_error_dialog`'s result is ignored.
- The Bambu-network refusal runs only when the selected printer's name starts with "Bambu Lab".
- Row ids are assumed to be `count + 1`. Different numbering makes `follow` time out, which fails rather than
passes falsely.
- The (`uploading`, 99) checks rely on polling every 0.2 s during a 3 s pause.
**Strength:** Strong — row states, progress, the file name, the print flag and the exported steps are checked
exactly against an independent stub.
## `test_web_ui`
`test_web_ui.py` · Python, 230 checks (1 conditional)
**Tests:** The GUI tools on web pages, through the side-loaded `mcp_web_fixture` plugin. Before the launch, the
sweep's setup step copies `mcp_web_fixture.py` and an enabled `.install_state.json` into the datadir's
`orca_plugins`.
- What the plugin provides:
- One page with every kind of control, opened as a modal dialog and as a modeless window.
- A dock panel whose CSP forbids eval.
- A page among the main window's tabs.
- A thread that brings up the permission prompt.
- A configuration UI in the Plugins dialog's sandboxed frame.
- What it exercises:
- `widget_list` snapshots.
- `widget_click`, `widget_set_value`, `keyboard_press` and `mouse_gesture`, with their effects on the page.
- Locators into a shadow root, frames, by index, and as the journal records them.
- Refusals, the timeout contract and stale refs.
- Navigation and token redaction.
- `dialog_answer` and `dialog_auto_answer` on web dialogs and on the permission prompt.
- The web snapshot budget.
- The setup wizard's navigation.
**Decides by:** Exits 1 when any check prints FAIL or on an uncaught exception. `call()` turns most tool errors
into `{"error": ...}`, and the check that follows judges it.
- Snapshot:
- 19 needles must be listed, e.g. `spin "Count" = "3"` and `[options: Red | Green | Blue]`.
- The table cell is named `1 / 2` with value "91".
- The checked, unchecked and disabled markers are right, and the hidden element is absent.
- Actions:
- Each reply's `value`, `checked`, `clicked` or `done` must equal the expected value.
- The page's own `<pre id="log">` must hold 18 exact lines, e.g. `pad up 59,29 after 4 moves`,
`cap samples 5` and `f2 submitted by go-value`.
- The caret ends at positions [1, 3].
- Text editing works without `execCommand` or `Selection.modify` ("acd", "abd").
- Tab order is checked through `[focused]`.
- An emoji is typed and deleted whole.
- A form with an empty required field isn't submitted until the field is filled.
- Press bookkeeping: after each click, refusal, busy page, replay end and auto-answer, the count of `pad up`,
`dock up` or `frame up` lines must be exactly right.
- Refusals and the timeout contract:
- Error texts are matched by substring: "covered by (span#veil)", "outside the element", "file input",
"That is a web view", "No page element matches", "2 page elements match", "outcome is unknown",
"gone from the page", "page changed", "may not be the only match", and "page has no button" with
`page_buttons`.
- A click queued behind a busy page is never run: the count of `ok` lines stays the same.
- "and the panel's own page never saw that click": the dock panel's log, read from `widget_list`, is exactly
one ping (`label "ping"`, from the click "its page, whose CSP forbids eval, takes a click") before the refused
click and still exactly that after it. A log that is not found reads as no line, which fails.
- Page changes and navigation:
- `page.changed`, `added` and `partial` must match.
- `navigated` URLs must end with `#bottom`, `#top`, `#evaluated` and `#orca-token=REDACTED&view=2`.
- "and the snapshot shows no secret either": the dialog's `widget_list` snapshot answers, lists the page's
`Token link` (the link just clicked, so the snapshot is of that page), and holds no `fixture-secret`.
- The dock panel's script: "webview_run_javascript there runs, or names the page's Content-Security-Policy" takes
one outcome per platform. On Windows, whose WebView2 does not hold the injected script to the page's policy, the
reply's `result` is 1. On macOS and Linux the call is refused with text holding `Content-Security-Policy`.
- Dialogs:
- Closes report `closed`.
- During a close, 15 `widget_list` calls from a second client must all answer.
- The permission prompt's buttons are exactly ["Yes", "No"].
- An auto-answer rule answers an already open prompt, with `uses` 1.
- The submitted JSON shows up in the plugin's python log.
- `dialog_answer` cancel returns in under 8 s.
- Persistence, tabs and the journal:
- `orca_plugins/config.json` holds `{"speed": <random>, "enabled": true}`.
- Go to tab shows `plugin.mcp_web_fixture.MCP web fixture page`, both in the reply and in `app_state.tab`.
- The journal records the locators: `within`, `class: webview` and `index` 2.
- Setup wizard: Next navigates to a URL containing `/guide/21/`, the old ref goes stale, a reload replies
`navigated`, and close replies `closed`.
**Not checked:**
- "the blocked note says to answer it with dialog_answer" runs only when the thread action replies
`blocked_by_dialog`. Otherwise it is dropped without a word: whether the plugin's thread raises its prompt before
the call replies is a race in the fixture.
- Loose matchers:
- "the page keeps no more than the last round's unanswered request" accepts 0 or 1.
- "a down the page answers too late has no outcome" accepts any error.
- "a wheel turn on a scroller scrolls it" accepts any scrollTop above 0.
- "the Home page is listed too" is a heuristic: `homepage` appears and there are more than 20 `[d` refs.
- The journal and the logs are not checked for the token.
- Fixed sleeps stand in for synchronisation: 2 s to outlast a stall before the close section, and 11.5 s before
"a request with no deadline is given up after the tools' default".
- Timing: the `dialog_answer` checks use `elapsed < 8` bounds. "cancel ends a web dialog whose page is busy, after
the 3 s" has no lower bound.
- The `window_screenshot` of a page element is used only for its journal entry; the image is never looked at.
- The auto-answer to the fixture dialog (Submit) is judged by the dialog closing and the rule's use count. Nothing
checks that the plugin received the submit.
**To settle in review:**
- The dock panel's outcome on macOS and Linux. The code's comment says only that WebView2 is not held to the page's
policy; `webview_run_javascript` runs its code through `eval`, which a policy without `unsafe-eval` forbids where
the port holds injected scripts to it. The proposal, refused naming the policy on WKWebView and WebKitGTK, is to
confirm on each.
**Strength:** Strong — nearly every action is checked by an exact reply value and by the effect the page logged,
with exact counts of press releases.
## `test_webview_modal`
`test_webview_modal.py` · Python, 16 checks
**Tests:** Which web view `webview_run_javascript` runs in while modal dialogs are open:
- With no target or by locator, it runs in the topmost modal's page: Preset Bundle, the Export bundle dialog above
it, and Flushing volumes.
- It refuses the Home tab's web view behind a modal, and the bundle dialog's web view under the export dialog.
- A page that closes its own dialog replies `closed` at once.
- With no modal open, the Home web view takes scripts.
**Decides by:** Exits 1 when a check prints FAIL or on an uncaught exception.
- No modal: Home has a `webview` in `widget_list`, and `1 + 1` with no target returns 2.
- Preset Bundle:
- One dialog opens.
- The Home web view by ref is refused with "modal dialog is open".
- `document.title` with no target is "Preset Bundle".
- By `{class: webview, within: Preset Bundle}`, `close_btn` exists.
- Export dialog above it:
- Two dialogs are open.
- The bundle's web view by locator is refused with "is under".
- A run with no target has a `url` containing `ExportPresetDialog`.
- After `dialog_answer close`, one dialog is left.
- Close from the page: clicking `close_btn` replies `closed: true` in under 1.0 s, and no dialog is left.
- Flushing volumes:
- After clicks on "Add one filament" and "Flushing volumes", "the Flushing volumes dialog opens": `app_state.dialogs`
lists exactly one dialog, titled `Flushing volumes for filament change`.
- Its web view leaves `about:blank`: the test waits up to 5 s for `widget_list {target: "dialog"}` to show it at
`WipingDialog.html`, as it waits for the export dialog's.
- "its page takes a script": `typeof document.title` with no target returns "string", and the reply's `url`
holds `web/flush/WipingDialog.html`, the page the dialog loads.
- After `dialog_answer close`, no dialog is left.
**Not checked:**
- "without a modal, the only web view takes a script" doesn't check which web view ran it; neither `url` nor title
is read.
- "and does so within a second" is a 1.0 s wall-clock bound, tight for a loaded parallel sweep.
- The waits for the export and flushing dialogs' web views to leave `about:blank` have no check of their own; the
URL checks after them cover them.
- The added filament isn't checked; only that the Flushing volumes button opened its dialog.
**Strength:** Partial — targeting and refusals for Preset Bundle, Export and Flushing volumes are checked by title,
URL and message, but the no-modal case is not tied to the Home page.

View file

@ -1,103 +0,0 @@
// Records what the G-code export, project_export with format gcode and a path, does: with no objects, on a plate
// not sliced, with a plate index the project lacks, after a slice that ended with an error, a success, two exports
// started back to back, and while a slice runs (started by the slice_and_preview and slice_all actions, which return
// at once). Each case exports once, to a file named for it. A replay step returns once a short export has
// finished, so the two started back to back run one after the other; overlapping calls need two clients. Every
// call it records is optional, so a refusal is kept in result.json with its text, and each is followed by the
// reads that show what it left; the script_run steps (fixtures/ops_undo.py) list the undo snapshots taken since
// the last one. An stl export to a G-code's path with a plate the project lacks tells whether that file exists: it
// refuses with "exists" when it does, with the plate when not. Each case waits for idle first, since an export
// right after an edit is refused as slicing while the edit's background update is pending. Run it into a fresh
// --out directory (an export without overwrite refuses the file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_gcode.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops export_gcode",
"vars": {
"benchy": "${replay_dir}/../../../resources/handy_models/3DBenchy.drc",
"undo": "${replay_dir}/fixtures/ops_undo.py"
},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Spiral mode only works", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/empty.gcode"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A plate that is not sliced ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_list", "expect": {"/total": {"eq": 1}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/unsliced.gcode"}, "optional": true},
{"tool": "plate_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A plate index the project lacks ----
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/no_plate.gcode", "plates": 3}, "optional": true},
{"tool": "app_state"},
// ---- A slice that ended with an error: spiral vase on a plate with two objects ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": true}}},
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "error"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slice_error.gcode"}, "optional": true},
{"tool": "plate_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": null}}},
// ---- Success, and whether the file is there when the reply comes ----
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/ok.gcode"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/ok.gcode", "plates": 999}, "optional": true},
{"tool": "plate_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Two exports back to back ----
// A modal error would show in app_state; dialog_answer closes it if one opened.
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/twice_1.gcode"}, "await": false, "save_as": "twice_1", "optional": true},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/twice_2.gcode"}, "await": false, "save_as": "twice_2", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/twice_2.gcode", "plates": 999}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- While a slice runs: the slice_and_preview action, then slice_all, both return at once ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "project_import", "args": {"paths": ["${vars.benchy}"]}, "expect": {"/added": {"eq": 1}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slicing_preview.gcode"}, "optional": true},
{"tool": "app_state"},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list"},
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_all:orca"}},
{"tool": "project_export", "args": {"format": "gcode", "path": "${out_dir}/slicing_all.gcode"}, "optional": true},
{"tool": "app_state"},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list"},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/slicing_preview.gcode", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/slicing_all.gcode", "plates": 999}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,49 +0,0 @@
// Records what the model 3MF export, project_export with format 3mf and a path, does: with no objects and with
// one, each case exported once, to a file named for it. After each it reads whether the file is there (an stl
// export to the same path with a plate the project lacks refuses with "exists" when it is, with the plate when
// not; for the file written with no objects, once a cube is added), the project's name, file and unsaved state,
// the recent projects and the undo snapshots taken since the last read (fixtures/ops_undo.py), and last imports
// each file into an empty project to show what it holds. Every call it records is optional. Run it into a fresh
// --out directory (an export without overwrite refuses the file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_model_3mf.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops export_model_3mf",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "project_export", "args": {"format": "3mf", "path": "${out_dir}/empty.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- With an object ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.3mf", "plates": 999}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "3mf", "path": "${out_dir}/one_object.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/one_object.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- What the files hold: each imported as geometry into an empty project ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "project_import", "args": {"paths": ["${out_dir}/empty.3mf"]}, "await": false, "save_as": "import_empty", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.import_empty}"}, "optional": true},
{"tool": "project_import", "args": {"paths": ["${out_dir}/one_object.3mf"]}, "optional": true},
{"tool": "object_list"},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,83 +0,0 @@
// Records what the sliced-file export, project_export with format sliced_3mf and a path, does for the current
// plate, a plate index and all plates: with no objects, on a plate not sliced, sliced, and with one plate of two
// sliced, from either plate. Each case exports once, to a file named for it. After each it reads whether the file
// is there (an stl export to the same path with a plate the project lacks refuses with "exists" when it is, with
// the plate when not), the plates, the project and the undo snapshots taken since the last read
// (fixtures/ops_undo.py). Every call it records is optional. Run it into a fresh --out directory (an export
// without overwrite refuses the file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_sliced_3mf.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops export_sliced_3mf",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "project_export", "args": {"format": "sliced_3mf", "path": "${out_dir}/empty.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": "all", "path": "${out_dir}/empty_all.gcode.3mf"}, "optional": true},
{"tool": "app_state"},
// ---- A plate that is not sliced ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "sliced_3mf", "path": "${out_dir}/unsliced.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": "all", "path": "${out_dir}/unsliced_all.gcode.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty_all.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/unsliced.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/unsliced_all.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Sliced ----
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "sliced_3mf", "path": "${out_dir}/sliced.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/sliced.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": "all", "path": "${out_dir}/sliced_all.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/sliced_all.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "plate_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- One plate of two sliced: plate 0 sliced, plate 1 not ----
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "plate_select", "args": {"plate": 1}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_slice", "args": {"plates": 0}, "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list", "expect": {"/total": {"eq": 2}, "/items/0/sliced": {"eq": true}, "/items/1/sliced": {"eq": false}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// From plate 0: the current plate, all plates, and each plate by its index.
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "project_export", "args": {"format": "sliced_3mf", "path": "${out_dir}/half_current_0.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_current_0.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": "all", "path": "${out_dir}/half_all_from_0.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_all_from_0.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": 0, "path": "${out_dir}/half_plate_0.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_plate_0.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": 1, "path": "${out_dir}/half_plate_1.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_plate_1.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "plate_list"},
// From plate 1: the current plate and all plates.
{"tool": "plate_select", "args": {"plate": 1}},
{"tool": "project_export", "args": {"format": "sliced_3mf", "path": "${out_dir}/half_current_1.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_current_1.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "project_export", "args": {"format": "sliced_3mf", "plates": "all", "path": "${out_dir}/half_all_from_1.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/half_all_from_1.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "plate_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,50 +0,0 @@
// Records what the STL export, project_export with format stl and a path, does: with no objects and with two,
// each case exported once, to a file named for it. After each it reads whether the file is there (an stl export
// to the same path with a plate the project lacks refuses with "exists" when it is, with the plate when not; for
// the file written with no objects, once the objects are added), the project and the undo snapshots taken since
// the last read (fixtures/ops_undo.py), and last imports each file into an empty project to show what it holds.
// Every call it records is optional. Run it into a fresh --out directory (an export without overwrite refuses the
// file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_export_stl.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops export_stl",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.stl"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- With two objects ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.stl", "plates": 999}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/two_objects.stl"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/two_objects.stl", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- What the files hold ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "project_import", "args": {"paths": ["${out_dir}/empty.stl"]}, "await": false, "save_as": "import_empty", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.import_empty}"}, "optional": true},
{"tool": "project_import", "args": {"paths": ["${out_dir}/two_objects.stl"]}, "optional": true},
{"tool": "object_list"},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,121 +0,0 @@
// Records what a model import, project_import with paths, does: it adds the files' geometry as one undo step and
// loads no settings. The cases: an STL into an empty project and into one with a cylinder and an unsaved process
// change, a project .3mf saved here from a cube with wall_loops 5 into a project with a cylinder and
// top_shell_layers 7, and imports that load nothing (a path that does not exist, a PNG, a preset .json, each of
// the last two opening a warning and an error, which it answers). After each it reads the objects, the project's
// name and file, the selected presets and their unsaved keys, the recent projects (action_search) and the
// dialogs, then the undo snapshots taken since the last read (fixtures/ops_undo.py), and runs undo once to show
// what that step takes back. Last, File > Import (the import_file action) with a rule that answers its picker with
// a path: the picker is multi-select, which takes no path, so it is cancelled. Every call it records is optional.
// Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_models.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops import_models",
"vars": {
"stl": "${replay_dir}/../../../tests/data/test_stl/ASCII/20mmbox-LF.stl",
"png": "${replay_dir}/fixtures/heightmap.png",
"preset_json": "${replay_dir}/fixtures/mcp_import_pla.json",
"undo": "${replay_dir}/fixtures/ops_undo.py"
},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- The source project: a cube with wall_loops 5, saved ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "settings_set", "args": {"values": {"wall_loops": 5}}},
{"tool": "project_save", "args": {"path": "${out_dir}/src_project.3mf", "overwrite": true}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- An STL into an empty project ----
{"tool": "project_import", "args": {"paths": ["${vars.stl}"]}, "optional": true},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
// ---- An STL into a project with a cylinder and an unsaved process change ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_list", "expect": {"/total": {"eq": 1}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_import", "args": {"paths": ["${vars.stl}"]}, "optional": true},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
// ---- The project .3mf into a project with a cylinder and top_shell_layers 7 ----
// A dialog it opens is listed by app_state and cancelled.
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_import", "args": {"paths": ["${out_dir}/src_project.3mf"]}, "await": false, "save_as": "project_3mf", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "cancel"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.project_3mf}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "settings_get", "args": {"type": "filament", "compare": ":saved"}},
{"tool": "settings_get", "args": {"type": "printer", "compare": ":saved"}},
{"tool": "settings_get", "args": {"keys": ["wall_loops", "top_shell_layers"]}},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
{"tool": "settings_get", "args": {"keys": ["wall_loops", "top_shell_layers"]}},
// ---- Imports that load nothing, on a project with a cube ----
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_import", "args": {"paths": ["${out_dir}/missing.stl"]}, "optional": true},
{"tool": "project_import", "args": {"paths": ["${vars.png}"]}, "await": false, "save_as": "png", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.png}"}, "optional": true},
{"tool": "project_import", "args": {"paths": ["${vars.preset_json}"]}, "await": false, "save_as": "preset_json", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.preset_json}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
// ---- File > Import: the multi-select picker takes no path, so the rule cancels it ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Choose one or more files", "button": "ok", "path": "${vars.stl}"}]}},
{"tool": "action_run", "args": {"id": "orca_command:import_file:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.log_lines('multi-select', 1)"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}}
]
}

View file

@ -1,81 +0,0 @@
// Records what preset_import with a path does: one preset file (fixtures/mcp_import_pla.json) imported while
// absent, kept while it exists, and replaced with on_conflict overwrite; a filament exported first with the
// Export Preset Bundle dialog, as presets.json does, kept, imported once deleted, and replaced; and the refusals
// (a path that does not exist, a file that is no preset, a .json that holds no preset, an overwrite argument, an
// on_conflict it does not take). After each it reads the presets the import touched, the selected presets and
// the undo snapshots taken since the last read (fixtures/ops_undo.py). It deletes the presets it made at the
// end, so it reruns on the same datadir. Every call it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_import_presets.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops import_presets",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py",
"pla": "${replay_dir}/fixtures/mcp_import_pla.json",
"zip": "${out_dir}/Filament presets.zip"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "already exists", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "preset_select", "args": {"type": "filament", "name": "Bambu PLA Basic", "filament_slot": 1}},
{"tool": "preset_delete", "args": {"type": "filament", "name": "MCP Import PLA"}, "optional": true},
{"tool": "preset_delete", "args": {"type": "filament", "name": "MCP Ops Export PLA"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- One preset file: imported, kept, replaced ----
{"tool": "preset_import", "args": {"path": "${vars.pla}"}, "optional": true},
{"tool": "preset_list", "args": {"type": "filament", "query": "MCP Import PLA"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "preset_import", "args": {"path": "${vars.pla}"}, "optional": true},
{"tool": "preset_import", "args": {"path": "${vars.pla}", "on_conflict": "overwrite"}, "optional": true},
{"tool": "preset_list", "args": {"type": "filament", "query": "MCP Import PLA"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A filament exported with the Export Preset Bundle dialog ----
{"tool": "action_run", "args": {"id": "orca_command:toggle_developer_mode:orca"}},
{"tool": "preset_save", "args": {"type": "filament", "name": "MCP Ops Export PLA", "detach": true, "overwrite": true}},
{"tool": "action_run", "args": {"id": "orca_command:toggle_developer_mode:orca"}},
{"tool": "preset_export", "args": {"path": "${out_dir}"}, "await": false, "save_as": "export"},
{"tool": "widget_click", "args": {"target": {"label": "Filament presets(.zip)", "within": "Export Preset Bundle"}}},
{"tool": "widget_set_value", "args": {"target": {"name": "MCP Ops Export PLA", "within": "Export Preset Bundle"}, "value": true}},
{"tool": "dialog_answer", "args": {"dialog": {"title": "Export Preset Bundle"}, "button": "ok"}, "await": false, "save_as": "export_ok"},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "Info"}, "button": "ok"}},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.export_ok}"}},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.export}"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// kept while it exists, imported once deleted, replaced with on_conflict overwrite
{"tool": "preset_import", "args": {"path": "${vars.zip}"}, "optional": true},
{"tool": "app_state"},
{"tool": "preset_select", "args": {"type": "filament", "name": "Bambu PLA Basic", "filament_slot": 1}},
{"tool": "preset_delete", "args": {"type": "filament", "name": "MCP Ops Export PLA"}},
{"tool": "preset_import", "args": {"path": "${vars.zip}"}, "optional": true},
{"tool": "preset_list", "args": {"type": "filament", "query": "MCP Ops Export PLA"}},
{"tool": "app_state"},
{"tool": "preset_import", "args": {"path": "${vars.zip}", "on_conflict": "overwrite"}, "optional": true},
{"tool": "preset_list", "args": {"type": "filament", "query": "MCP Ops Export PLA"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Refusals: a missing path, a file that is no preset, a .json with no preset, an overwrite, an unknown on_conflict ----
{"tool": "preset_import", "args": {"path": "${out_dir}/missing.json"}, "optional": true},
{"tool": "preset_import", "args": {"path": "${replay_dir}/fixtures/heightmap.png"}, "optional": true},
{"tool": "preset_import", "args": {"path": "${replay_dir}/plates.json"}, "await": false, "save_as": "nopreset", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "dialog_answer", "args": {"button": "ok"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.nopreset}"}, "optional": true},
{"tool": "preset_import", "args": {"path": "${vars.pla}", "overwrite": true}, "optional": true},
{"tool": "preset_import", "args": {"path": "${vars.pla}", "on_conflict": "merge"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- The presets it made go ----
{"tool": "preset_select", "args": {"type": "filament", "name": "Bambu PLA Basic", "filament_slot": 1}},
{"tool": "preset_delete", "args": {"type": "filament", "name": "MCP Import PLA"}, "optional": true},
{"tool": "preset_delete", "args": {"type": "filament", "name": "MCP Ops Export PLA"}, "optional": true},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}}
]
}

View file

@ -1,112 +0,0 @@
// Records what a new project does through its two forms, the person's (the new_project action run with action_run)
// and the silent one (project_new called with arguments): on a clean project, with unsaved project changes (a
// cube; silent: true, then discard_changes) and with unsaved preset changes (top_shell_layers 7; the action's
// question answered Discard, then Transfer when it offers that, and preset_changes keep and discard). Each call starts from the
// Home tab, so the reads show the tab it leaves. The action runs with "await": false; app_state lists its
// question, which the replay answers by its title. After each it reads the objects, the project, the presets'
// unsaved keys and the undo snapshots taken since the last read (fixtures/ops_undo.py). Plugins get the
// NewProject event on both routes, which no replay can observe without a plugin. Every call it records is
// optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_new_project.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops new_project",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
// ---- A clean project: the action, then the command ----
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:new_project:orca"}, "await": false, "save_as": "clean_cmd", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "- Save"}, "button": "no"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.clean_cmd}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "project_new", "args": {"silent": true}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Unsaved project changes: the action asks ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:new_project:orca"}, "await": false, "save_as": "dirty_cmd", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "- Save"}, "button": "no"}, "optional": true},
{"tool": "app_state"},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.dirty_cmd}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- the command, without discard_changes, then with it ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"silent": true}, "optional": true},
{"tool": "app_state"},
{"tool": "project_new", "args": {"discard_changes": true}, "optional": true},
{"tool": "app_state"},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Unsaved preset changes, no objects: the action, answered Discard ----
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:new_project:orca"}, "await": false, "save_as": "presets_cmd", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "- Save"}, "button": "no"}, "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "unsaved changes"}, "button": "Discard"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.presets_cmd}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- answered Transfer ----
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:new_project:orca"}, "await": false, "save_as": "presets_cmd2", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"dialog": {"title": "- Save"}, "button": "no"}, "optional": true},
{"tool": "dialog_answer", "args": {"dialog": {"title": "unsaved changes"}, "button": "Transfer"}, "optional": true},
{"tool": "dialog_answer", "args": {"dialog": {"title": "unsaved changes"}, "button": "Discard"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.presets_cmd2}"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- the command: no discard_changes, then preset_changes keep (default) and discard ----
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "settings_set", "args": {"values": {"top_shell_layers": 7}}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"silent": true}, "optional": true},
{"tool": "app_state"},
{"tool": "project_new", "args": {"discard_changes": true}, "optional": true},
{"tool": "app_state"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "view_set", "args": {"tab": "home"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}, "optional": true},
{"tool": "app_state"},
{"tool": "settings_get", "args": {"type": "process", "compare": ":saved"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}}
]
}

View file

@ -1,58 +0,0 @@
// Records what saving the project under a name, project_save with a path, does: with no objects, to a .3mf path,
// to a .gcode.3mf path, into a folder that does not exist, and to a file that exists, without overwrite and then
// with it. After each it reads the project's name, file and unsaved state, the recent projects and the undo
// snapshots taken since the last read (fixtures/ops_undo.py), and whether the file is there: an stl export to the
// same path with a plate the project lacks refuses with "exists" when it is, with the plate when not (for the file
// saved with no objects, once a cube is added). Every call it records is optional. Run it into a fresh --out
// directory (a save without overwrite refuses the file of an earlier run):
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_save_project_as.json --out <new dir>
{
"orca_replay_version": "0.2.0",
"name": "ops save_project_as",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// ---- No objects (the probe comes once there is one) ----
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_save", "args": {"path": "${out_dir}/empty.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A .3mf path ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/empty.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/saved.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "action_search", "args": {"group": "Recent Projects"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A .gcode.3mf path ----
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.gcode.3mf"}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/saved.gcode.3mf", "plates": 999}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A folder that does not exist ----
{"tool": "project_save", "args": {"path": "${out_dir}/missing/saved.3mf"}, "optional": true},
{"tool": "app_state"},
// ---- A file that exists: without overwrite, then with it ----
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf"}, "optional": true},
{"tool": "app_state"},
{"tool": "project_save", "args": {"path": "${out_dir}/saved.3mf", "overwrite": true}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,93 +0,0 @@
// Records how a plate is selected: plate_select with a plate in range, past the last plate and negative
// (refused), not a number and not a whole number (refused), and its plate_goto action (plate 0), and each command
// that takes a plate index given one the project lacks (plate_slice, project_export, object_arrange,
// plate_rename and plate_get_settings, object_list, object_transform) and given one it has. After each it
// reads the current plate (app_state, plate_list) and the undo snapshots taken since the last read
// (fixtures/ops_undo.py). The project has three plates with a cube on the first. Every call it records is
// optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_select_plate.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops select_plate",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list", "expect": {"/total": {"eq": 3}}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- plate_select: in range, past the last, negative, not a number, not a whole number; the action ----
{"tool": "plate_select", "args": {"plate": 1}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_select", "args": {"plate": 2}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 0}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 3}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 7}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": -3}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 2}, "optional": true},
{"tool": "plate_select", "args": {"plate": "abc"}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 2}, "optional": true},
{"tool": "plate_select", "args": {"plate": 1.7}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_select", "args": {"plate": 2}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:plate_goto:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Commands given a plate the project lacks, from plate 1 ----
{"tool": "plate_select", "args": {"plate": 1}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_slice", "args": {"plates": 5}, "optional": true},
{"tool": "plate_slice", "args": {"plates": -1}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/noplate.stl", "plates": 5, "overwrite": true}, "optional": true},
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/noplate.stl", "plates": -1, "overwrite": true}, "optional": true},
{"tool": "object_arrange", "args": {"plates": 5}, "optional": true},
{"tool": "object_arrange", "args": {"plates": -1}, "optional": true},
{"tool": "plate_rename", "args": {"plate": 5, "name": "x"}, "optional": true},
{"tool": "plate_get_settings", "args": {"plate": 5, "keys": ["curr_bed_type"]}, "optional": true},
{"tool": "object_list", "args": {"plate": 5}, "optional": true},
{"tool": "object_transform", "args": {"object": 0, "plate": 5}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Commands given a plate the project has: which one is current afterwards ----
{"tool": "project_export", "args": {"format": "stl", "path": "${out_dir}/plate2.stl", "plates": 2, "overwrite": true}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_rename", "args": {"plate": 1, "name": "One"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_get_settings", "args": {"plate": 2, "keys": ["curr_bed_type"]}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_slice", "args": {"plates": 0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_arrange", "args": {"plates": 2}, "optional": true},
{"tool": "object_arrange", "args": {"plates": 0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_transform", "args": {"object": 0, "plate": 2}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,52 +0,0 @@
// Records the refusals of the send_gcode action (action_run), and nothing else: it never sets a print host, so
// nothing is ever sent. A Bambu network printer (the harness's X1 Carbon as it starts, then with
// bbl_use_printhost off) with no objects, on a plate not sliced and on a sliced one; then the same printer set
// to print through a host (bbl_use_printhost on, OctoPrint) with no host address, sliced, not sliced and with no
// objects. After each it reads the dialogs and uploads (app_state) and the undo snapshots taken since the
// last read (fixtures/ops_undo.py). It ends by discarding the printer changes. Every call it records is
// optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_send_gcode_to_host.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops send_gcode_to_host",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "settings_get", "args": {"type": "printer", "keys": ["bbl_use_printhost", "host_type", "print_host"]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A Bambu network printer: no objects, not sliced, sliced ----
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "settings_set", "args": {"type": "printer", "values": {"bbl_use_printhost": false}}},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Through a print host with no address: sliced, not sliced, no objects ----
{"tool": "settings_set", "args": {"type": "printer", "values": {"bbl_use_printhost": true, "host_type": "octoprint", "print_host": "", "use_3mf": false}}},
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "plate_list"},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list"},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "action_run", "args": {"id": "orca_command:send_gcode:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "settings_get", "args": {"type": "printer", "keys": ["bbl_use_printhost", "host_type", "print_host"]}}
]
}

View file

@ -1,118 +0,0 @@
// Records what object_set_instances with a count does: nothing selected, one object,
// two objects, one instance of an object, a part, counts of 1, 2 written as text, 0, negative, past 1000, a
// fraction and a word, an object with an instance that is not printable, a cut object, and its obj_set_instances
// action (it opens its dialog, which the replay cancels). After each it reads the objects' instances and the undo
// snapshots taken since the last read (fixtures/ops_undo.py), and once runs undo to show the change is one
// step. Every call it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_set_instance_count.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops set_instance_count",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_list", "expect": {"/total": {"eq": 1}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Nothing selected ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_set_instances", "args": {"count": 3}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- One object: 3, undone, then 1 ----
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_set_instances", "args": {"count": 3}, "optional": true},
{"tool": "object_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "object_set_instances", "args": {"count": 3}, "optional": true},
{"tool": "object_set_instances", "args": {"count": " 2 "}, "optional": true},
{"tool": "object_list"},
{"tool": "object_set_instances", "args": {"count": 1}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Counts it refuses ----
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "object_set_instances", "args": {"count": 0}, "optional": true},
{"tool": "object_set_instances", "args": {"count": -2}, "optional": true},
{"tool": "object_set_instances", "args": {"count": 1001}, "optional": true},
{"tool": "object_set_instances", "args": {"count": 2.5}, "optional": true},
{"tool": "object_set_instances", "args": {"count": "three"}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Two objects selected, one instance of an object, a part ----
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cylinder", "size": [20, 10]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "object_select", "args": {"objects": [0, 1]}},
{"tool": "object_set_instances", "args": {"count": 2}, "optional": true},
{"tool": "object_list"},
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "object_set_instances", "args": {"count": 2}, "optional": true},
{"tool": "object_select", "args": {"instances": [[0, 1]]}},
{"tool": "object_set_instances", "args": {"count": 4}, "optional": true},
{"tool": "object_list"},
{"tool": "part_add", "args": {"object": 1, "type": "modifier", "shape": "cube", "size": [5, 5, 5]}},
{"tool": "object_select", "args": {"parts": [[1, 1]]}},
{"tool": "object_set_instances", "args": {"count": 2}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- An instance that is not printable (the cylinder back to one instance, made not printable as the
// object list's Printable column does) ----
{"tool": "object_select", "args": {"objects": [1]}},
{"tool": "object_set_instances", "args": {"count": 1}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cylinder", "column": "Printable"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/1/instances/0/printable": {"eq": false}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_select", "args": {"objects": [1]}},
{"tool": "object_set_instances", "args": {"count": 2}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:obj_set_instances:orca"}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "widget_click", "args": {"target": {"row": "Plate 1>Cylinder", "column": "Printable"}}},
{"tool": "object_list", "expect": {"/plates/0/objects/1/instances/0/printable": {"eq": true}}},
// ---- The action: its dialog opens, and is cancelled ----
{"tool": "object_select", "args": {"objects": [1]}},
{"tool": "action_run", "args": {"id": "orca_command:obj_set_instances:orca"}, "await": false, "save_as": "dialog", "optional": true},
{"tool": "app_state"},
{"tool": "dialog_answer", "args": {"button": "cancel"}, "optional": true},
{"tool": "app_wait", "args": {"for": "job", "job": "${jobs.dialog}"}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A cut object: a cube cut at 10 mm with a connector, which keeps the halves linked ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "view_set", "args": {"tab": "prepare", "camera": "top"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "widget_click", "args": {"target": {"gizmo": "Cut"}}, "expect": {"/active": {"eq": true}}},
{"tool": "widget_set_value", "args": {"target": {"imgui_name": "move_Z"}, "value": 10}},
{"tool": "widget_click", "args": {"target": {"imgui": "Add connectors"}}},
{"tool": "mouse_gesture", "args": {"at": {"object": 0, "spot": "top"}, "check": "point"}},
{"tool": "widget_click", "args": {"target": {"imgui": "Confirm connectors"}}},
{"tool": "widget_click", "args": {"target": {"imgui": "Perform cut"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_list", "expect": {"/total": {"eq": 2}, "/plates/0/objects/0/parts/1": {"exists": true}}},
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_set_instances", "args": {"count": 2}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,80 +0,0 @@
// Records how a plate is locked through its three routes: the plate_toggle_lock action run with action_run (the
// current plate), plate_lock with locked, and a click on the plate's lock icon ({plate_icon: "lock", plate}).
// Each is run twice on plate 0, then on plate 1 while plate 0 is current; plate_lock also with a plate the
// project lacks. After each it reads the lock state and the current plate (plate_list) and the undo
// snapshots taken since the last read (fixtures/ops_undo.py), and last it locks through each route and runs undo
// once, to show that the lock is one undo step. Every call it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_set_plate_locked.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops set_plate_locked",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list", "expect": {"/total": {"eq": 2}, "/items/0/current": {"eq": true}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- The action, twice on plate 0 ----
{"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- plate_lock, locked true twice, then false, then a plate the project lacks ----
{"tool": "plate_lock", "args": {"plate": 0, "locked": true}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_lock", "args": {"plate": 0, "locked": true}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_lock", "args": {"plate": 0, "locked": false}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_lock", "args": {"plate": 5, "locked": true}, "optional": true},
{"tool": "plate_list"},
// ---- The lock icon, twice on plate 0 ----
{"tool": "widget_click", "args": {"target": {"plate_icon": "lock", "plate": 0}}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "widget_click", "args": {"target": {"plate_icon": "lock", "plate": 0}}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Plate 1 while plate 0 is current: plate_lock and the icon (the action has no plate) ----
{"tool": "plate_lock", "args": {"plate": 1, "locked": true}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "widget_click", "args": {"target": {"plate_icon": "lock", "plate": 1}}, "optional": true},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Undo after each route's lock ----
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}, "optional": true},
{"tool": "plate_list"},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "plate_list"},
{"tool": "plate_lock", "args": {"plate": 0, "locked": true}, "optional": true},
{"tool": "plate_list"},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "plate_list"},
{"tool": "widget_click", "args": {"target": {"plate_icon": "lock", "plate": 0}}, "optional": true},
{"tool": "plate_list"},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,122 +0,0 @@
// Records how the Preview's layers are set through its two routes, the go_to_layer action run with
// action_run and its percent (0, 50, 100, a fraction, and refused: past 100, negative, not a number, none)
// and view_set's layer, layer_range and layer_z (in range, past the top, a layer_z above it): on plates the
// Preview has no layers for (one with no objects, one whose slice fails validation: spiral vase with two
// objects), then on a sliced one. A plate that could slice is left out of the first part, since showing the
// Preview slices it while the call runs, so what the call finds depends on timing. After each it reads
// app_state's tab and preview, and at the end of each part the undo snapshots taken
// (fixtures/ops_undo.py). Every call it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_show_layer_range.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops show_layer_range",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Spiral mode only works", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
// The Preview's sliders keep the last slice's layers after a new project, so one known slice comes first:
// a 20 mm cube, 100 layers.
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "plate_slice", "expect": {"/plates/0/layers": {"eq": 100}}},
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 10}, "optional": true},
{"tool": "view_set", "args": {"layer_range": [2, 5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A plate whose slice fails validation ----
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": true}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 10}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "view_set", "args": {"layer_range": [2, 5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A sliced plate: the action ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_slice", "expect": {"/plates/0/outcome": {"eq": "ok"}}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 0}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 50}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 100}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 25.5}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 150}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": -5}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": "abc"}}, "optional": true},
{"tool": "app_state"},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 10}}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca"}, "optional": true},
{"tool": "app_state"},
// the action after view_set showed a range: does it keep the range's bottom?
{"tool": "view_set", "args": {"layer_range": [20, 60]}, "optional": true},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 80}}, "optional": true},
{"tool": "app_state"},
// from the Prepare tab
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "action_run", "args": {"id": "orca_command:go_to_layer:orca", "args": {"percent": 30}}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- A sliced plate: view_set ----
{"tool": "view_set", "args": {"layer": 1}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 50}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 100}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer": 9999}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [5, 20]}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [30, 10]}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_range": [5]}, "optional": true},
{"tool": "view_set", "args": {"layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"layer_z": 999}, "optional": true},
{"tool": "view_set", "args": {"layer": 3, "layer_z": 5.0}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "view_set", "args": {"layer": 40}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,79 +0,0 @@
// Records what an arrange does, object_arrange {} (Auto-Arrange's arguments; action_run of the obj_arrange action runs
// the same function) and object_arrange with one plate by index: with no objects, with two cubes on one spot, in the
// assemble view, with the Move gizmo open, and with the plate locked. After each it reads the objects' offsets,
// the tab, canvas and gizmo, and the undo snapshots taken since the last read (fixtures/ops_undo.py), and once
// runs undo to show what the arrange's step takes back. A person's pick of Auto-Arrange is checked by
// test_person_forms.py. An arrange running while another call comes needs two clients. Every call it records is
// optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_start_arrange.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops start_arrange",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "window_set", "args": {"size": [1600, 900]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "object_arrange", "args": {}, "optional": true},
{"tool": "object_arrange", "args": {"plates": 0}, "optional": true},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Two cubes on one spot: every plate, undone, then one plate ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "object_list", "expect": {"/total": {"eq": 2}, "/plates/0/objects/0/instances/0/offset/0": {"eq": 128.0},
"/plates/0/objects/1/instances/0/offset/0": {"eq": 128.0}}},
{"tool": "view_set", "args": {"tab": "preview"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_arrange", "args": {}, "optional": true},
{"tool": "object_list"},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:undo:orca"}},
{"tool": "object_list"},
{"tool": "object_arrange", "args": {"plates": 0}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- In the assemble view ----
{"tool": "view_set", "args": {"canvas": "assemble"}},
{"tool": "app_state"},
{"tool": "object_arrange", "args": {}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"canvas": "3d"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- With the Move gizmo open ----
{"tool": "object_select", "args": {"objects": [0]}},
{"tool": "widget_click", "args": {"target": {"gizmo": "Move"}}, "expect": {"/active": {"eq": true}}},
{"tool": "object_arrange", "args": {}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_state"},
{"tool": "widget_click", "args": {"target": {"gizmo": "Move"}}, "optional": true},
{"tool": "app_state"},
// ---- With the plate locked (the cubes back on one spot) ----
{"tool": "object_transform", "args": {"object": 0, "translate": [128, 128, 10], "mode": "absolute"}},
{"tool": "object_transform", "args": {"object": 1, "translate": [128, 128, 10], "mode": "absolute"}},
{"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}},
{"tool": "plate_list", "expect": {"/items/0/locked": {"eq": true}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_arrange", "args": {}, "optional": true},
{"tool": "object_list"},
{"tool": "object_arrange", "args": {"plates": 0}, "optional": true},
{"tool": "object_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:plate_toggle_lock:orca"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}

View file

@ -1,122 +0,0 @@
// Records what starting a slice does through its routes, the slice_and_preview and slice_all actions run with
// action_run (they return at once) and plate_slice (the current plate, all, an index): with no objects, on
// one plate, on two plates, and with objects that fail validation (spiral vase on a plate with two objects).
// Each call starts from the Prepare tab; after it, the replay waits for idle and reads the plates' slice state,
// the tab, the notifications and the undo snapshots taken since the last read (fixtures/ops_undo.py). Every call
// it records is optional. Run it with
// tools/mcp/orca_mcp.py run-replay tools/mcp/tests/ops_start_slice.json --out <dir>
{
"orca_replay_version": "0.2.0",
"name": "ops start_slice",
"vars": {"undo": "${replay_dir}/fixtures/ops_undo.py"},
"steps": [
{"tool": "app_wait", "args": {"for": "ready"}},
{"tool": "dialog_auto_answer", "args": {"rules": [{"match": "Spiral mode only works", "button": "yes"}]}},
{"tool": "project_new", "args": {"discard_changes": true, "preset_changes": "discard"}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- No objects ----
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "plate_slice", "args": {}, "optional": true},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "plate_slice", "args": {"plates": "all"}, "optional": true},
{"tool": "app_state"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- One plate ----
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "plate_slice", "args": {}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Two plates, a cube on each ----
{"tool": "action_run", "args": {"id": "orca_command:plate_add:orca"}},
{"tool": "plate_select", "args": {"plate": 1}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_list", "expect": {"/total": {"eq": 2}, "/items/1/objects": {"eq": 1}}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
{"tool": "app_state"},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "object_transform", "args": {"object": 0, "translate": [5, 0, 0]}},
{"tool": "object_transform", "args": {"object": 1, "translate": [5, 0, 0]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_slice", "args": {"plates": "all"}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "object_transform", "args": {"object": 1, "translate": [5, 0, 0]}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "plate_select", "args": {"plate": 0}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "plate_slice", "args": {"plates": 1}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
// ---- Objects that fail validation: spiral vase on a plate with two objects ----
{"tool": "project_new", "args": {"discard_changes": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_select", "args": {"none": true}},
{"tool": "object_add_primitive", "args": {"shape": "cube", "size": [20, 20, 20]}},
{"tool": "object_arrange", "args": {"plates": "all"}},
{"tool": "plate_set_settings", "args": {"plate": 0, "values": {"spiral_mode": true}}},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_and_preview:orca"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "action_run", "args": {"id": "orca_command:slice_all:orca"}, "optional": true},
{"tool": "app_wait", "args": {"for": "idle"}},
{"tool": "app_state"},
{"tool": "view_set", "args": {"tab": "prepare"}},
{"tool": "plate_slice", "args": {}, "optional": true},
{"tool": "app_state"},
{"tool": "plate_list"},
{"tool": "script_run", "args": {"filename": "${vars.undo}", "code": "import ops_undo\nresult = ops_undo.taken()"}},
{"tool": "project_new", "args": {"discard_changes": true}}
]
}