Any plugin could call OrcaSlicer's tools through orca.host.tools without a permission, so it could change your project, run post-processing scripts and answer permission prompts. It now needs the OrcaSlicer tools permission or full access, which it can declare as it loads or is asked for the first time it calls, like its other permissions. The Plugins dialog's Permissions tab has a switch for it, and turning it off ends what the plugin's calls left in force.
69 KiB
Commands, preferences, installs and plugins
The design of this area's sweep tests. The rules every entry follows and the grades are in TESTS.md.
test_speed_dial
test_speed_dial.py · Python
Tests: The Speed Dial's actions as action_list and action_run give them: that action_list lists every action of the command reference, tests/data/command_catalog.json, with its command, that a section no action is in is refused and settings are listed only when asked for, and that a few actions, run through action_run on the Generic Klipper Printer 0.4, each from a state rebuilt by calls, do what a person's pick does: their dialog answered as the row says, their effect read back, the reply naming the action, and the journal keeping an action_run step for it with the arguments its command journals. Each action it runs stands for one way an action runs, and is one whose command no other test runs where there is one:
calib_retraction: a person's form that opens a dialog, answered OK, which then makes the project (the Retraction calibration dialog, which no other test opens).add_handy_orcasliced_combo: a person's form that runs in place and loads several files.help_keyboard_shortcuts: an action that opens one of the app's windows.view_rear: an action whose fixed arguments choose what its command does (view_set {camera: "rear"}), read back exactly.go_to_tab: an action that collects a value, which the journal keeps ({"tab": "preview"}).take_screenshot: an action that writes a file (window_save_screenshot).sync_presets: a refused action, which journals nothing.go_to_layer: an action whose command's schema refuses the value it is given, whose refusal namestool_describefor the command.
An action is its command run with fixed arguments as a person's pick, and action_run runs every action the same way, so the test runs a few, not all. What each adds to its command is checked without running it: tests/slic3rutils/test_command_catalog.cpp ([CommandCatalog][SpeedDial]) checks that its fixed arguments and the value it collects fit its command's schema and that it is a person's form of its command, and the command reference holds the command each folds into. The commands themselves are checked through their tools in their areas' tests. The Speed Dial's own window, opened with Space and picked from by a click, is test_speed_dial_open's and test_menu_items_refusals'.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}. The setup check Start Recording's folder is the output folder points the folder Take Screenshot saves in at the output folder, through the Start Recording dialog. Before each row, empty() makes a new project with its changes discarded, shows Prepare's 3D view, deletes filament slots down to one and sets the expert mode, and the row's state builds on that: two_cubes adds two 20 mm cubes side by side and selects the first. The list checks read no state: the actions and their commands are the app's own. No action it runs takes the focus from another program, so it runs among the other tests on a job's data folder.
Leaves: Start Recording's folder, the output folder, which the runner deletes when the test passes, so that a later capture with no path goes to the default capture folder, as on a new data folder (folder_or_default(), RecordingDialog.cpp); and an empty project with one filament slot, in the expert mode, which the next test's start() sets back to Simple. Its picks are action_run calls, which leave the Speed Dial's usage counts as they were. It saves no preset and installs nothing.
Decides by: Exits 1 when any check fails.
- Setup:
starts from the Generic Klipper Printer;every action is listed with its command(action_list, read page by page, lists an item for each action of the reference, and itscommandequals the reference's);an unknown section is refused(action_list {section: "No such section"}, codeinvalid_argument) andthe refusal lists the sections there are(itssectionsholds "Slice & Export");include_settings lists the settings too(action_list {include_settings: true, limit: 200}has a largertotalthanaction_list {limit: 1}, and its page holds an id startingorca_setting: a setting's action has no section of its own in the order, so the settings come first);Start Recording's folder is the output folder. - Common to every row that runs but
sync_presetsandgo_to_layer:... its reply names the action it ran(ran==orca_command:<key>:orca), and... the journal keeps its action_run with the arguments its command journals, anaction_runstep of that id whose innerargsare{"tab": "preview"}forgo_to_tab, the value given for its input, and{}, noargs, for the others: the calibration action opens its test's dialog (the person's form), andcalibration_generate_testrewrites its journal entry (ActionContext::set_journal_args) only when it runs the test itself, with its parameters orsilent. calib_retraction, fromempty: the dialog titled "Retraction" answered OK; the project'snameis "Retraction" and it has at least 1 object.add_handy_orcasliced_combo, fromempty: the objects' names are exactly "Orca Head", "OrcaCube_v2.drc", "OrcaPlug_v2.drc", "Orca Belly" and "Orca Pedestal", in that order, and no dialog is open.help_keyboard_shortcuts, fromempty: a dialog whose title holds "Keyboard Shortcuts" opened; the test closes it.view_rear, fromtwo_cubesandview_set {camera: "top"}:app_state.cameraelevation0 andazimuth90, each to 2°.go_to_tab, fromtwo_cubes, given{"tab": "preview"}:app_state.tabispreview.take_screenshot, fromtwo_cubes: the reply'spathnames a file in the output folder, of more than 0 bytes.sync_presets, fromempty: refused,not_signed_in; noaction_runstep of its id in the journal.go_to_layer, fromempty: "a command action's arguments its schema refuses carry the tool_describe hint":action_run {id: "go_to_layer", args: {percent: -1}}, the value the action collects, whichview_set'slayer_percentminimum of 0 refuses, is refused with codeinvalid_argumentand itshintis "tool_describe {tool: "view_set"} gives its parameters"; thenapp_state.tabis still "prepare", andjournal_step()finds noaction_runstep for it.
Not checked:
- The other actions as actions: each is listed with its command here and checked in the catalog's unit test, and its command through its tool in its area's test, so an action whose command and arguments are right but whose run went wrong for it alone passes.
action_runruns every action by one code path, which the rows here take. - Commands no test runs, which the rows here leave out: the other eight calibration dialogs (
test_call_formsopens the temperature test's through its command), the nine other handy models, the size dialog ofadd_primitive_*, the other Help windows (Troubleshoot, Network Test, About, Check for Updates, Migrate Filament Presets, Tip of the Day), the 3D scene benchmark, Reset Window Layout, and the four actions that hand off to another program (open_wiki,open_youtube,install_plugin,help_open_config_folder), which open the browser or the file manager and would take the focus from every other app. - The screenshot is never opened: a blank one passes. The Keyboard Shortcuts window only shows that it opened.
- The calibration's project beyond its name and an object: the test's objects and the settings it changes are
test_presets' calibration scenarios'.
To settle in review:
- That a calibration action's journal step has the id alone, not
{"test": "<name>"}. The action runs its command's person form (NativeCommands::with_person_form()), which opens the test's dialog and journals nothing; onlycalibration_generate_test's own run, with parameters orsilent, callsset_journal_args, andActionContextputs the action's fixed arguments in the step only in place of such a rewrite. Both are this branch's code (Tools/PlateTools.cpp,McpPersonContext.hpp, not onmain). The step with the id alone replays the same, since the action suppliestest.
Strength: Partial — the handy model, the rear view and Go to tab have their effect read back exactly, the calibration loosely, the window only by its title and the screenshot by its file; every action is listed with its command, and the journal step is pinned exactly for every row that runs.
test_menu_items_refusals
test_menu_items_refusals.py · Python
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.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}. Each scenario then makes a new project and adds what it needs, and the checks read only that project, the notices its picks show and the auto-answer rules it sets, which last one session. A pick clicks the app's own row by its label, <title> from Orcaslicer, so an action of a plugin an earlier test left, which names its plugin there, is never picked, and the order the Speed Dial's usage counts give its rows changes nothing a pick reads. The undo fixture keeps its mark in the data folder (mcp/ops_undo_mark.txt); the test's first ops_undo.taken() call of each check sets it and its result is not read, so a mark another test left counts for nothing.
Leaves: its last scenario's unsaved project, a cube on the first of two plates, the second named second, with the auto-answer rule that cancels the Edit Plate Name dialog, both of which the next test's start() clears; the Speed Dial's usage counts (speed_dial.stats in OrcaSlicer.conf) raised for each action it picked, which order the Speed Dial's rows for the tests after it; the undo fixture's mark.
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.
- Start:
starts from the Generic Klipper Printer,presets()as written above. - Direct refusals: the error text holds a phrase and, where given, the details'
codeis 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_listtotal, names, part ids and types, selection,mirroredflags, plate list (name,locked,current) androtation_deg, all compared exactly with the state before. - Picks: each presses Space on the 3D view, waits up to 30 s for
window_listto list the Speed Dial (the shown web dialog with no title), then types the action's title in its search field and clicks its row. Once the app is idle (app_wait {for: idle}), the expected notice text is inapp_state.notifications, or an auto-answer rule'suseshas risen by exactly 1 (Rename, last-solid-part message, cut question, Auto-Drop, Edit Plate Name). A rule'susesis waited for up to 30 s to change, since the object list posts its messages (show_error()opens them fromCallAfter) and one can open after the app reads idle; that wait coversobject_delete {}on two solid parts too. The state is then read back, for example Assemble on instance rows giving[("other",1),("Assembly",2)]. The checks that a pick opened no dialog (Rename'susesunchanged) read once the app is idle. - 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). Both refusals' notices are regular ones (
menu_info()answers them as information), which fade about 10 s after they show, so the first can still be open at the second pick, and while it is open the same text pushed again only moves it to the end of the list (NotificationManager::activate_existing). So before the second pick of each pair, the test closes the earlier notice; one that has already faded leaves nothing to close.widget_listlists each notification as animgui_windownode for its ImGui window,!!Ntfctn<id>, with its text as atextnode 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, sowidget_listlists 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 withoutindexis 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_multilinewith more than 3 lines only). "the earlier notice is closed" then waits up to 30 s, failing when the time runs out, forapp_state.notificationsto 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'spartsandkept),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 snapshotreads the info-level log throughops_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:
- The notices the pairs share are regular notices, not error notices that never fade:
menu_info()(Tools/ObjectTools.cpp, from commits not onmain) answerstoo_few_objectsandone_object_onlyas information, as the menu items told them, since the person can select something else and pick again. So the first notice may fade before the second pick, and the close step then finds nothing; "the earlier notice is closed" still reads the text gone before the second pick, and that pick's own check reads it shown again. - Reaching the close button through a refusal's count is roundabout. Naming the button in the app (
record_named_itemon the close button inrender_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
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 filament slot, merging a slot into the mixed filament that mixes it with the question answered no ahead (break_mix: false), merging the mixed filament into a 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.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}; its one filament slot is the slot "the project has one filament slot" reads. The preset_sync refusal needs no account signed in and the filament_sync_ams refusals no printer connected, which hold in every data folder the sweep makes: a seeded folder keeps its login in its own token file (use_encrypted_token_file), no test signs in, and no test connects to a printer. The ZIP archive is written again on every run (refusals.zip, a name only this test uses, in mcp/filaments_and_files in the data folder). Its picks click the app's own row by its label, <title> from Orcaslicer, as test_menu_items_refusals's do, so a plugin's action never stands in for one.
Leaves: a project of two unsaved cubes, second and first, with 64 filament slots, the last a mixed filament of the first two (the app numbers mixed slots after the physical ones, so the mixed filament made as slot 3 is slot 64 once the slots are added), which the app keeps as its filaments for its next start. It leaves the mixed filament as a person who made it would keep it. There a test that deletes slots down to one with a plain filament_delete, which deletes the last physical slot, breaks the mix when slot 2 goes and is then refused at the one physical slot left (last_filament_slot), the broken mix still there; and the Add Mixed Filament button is hidden at the limit. So the tests after it set their slots with start(), which deletes the mixed slot first and leaves no mixed filament. Also refusals.zip in the data folder, the handy models' folder as the last folder opened (recent.last_opened_folder) and the Speed Dial's usage counts raised for its three picks.
Decides by: Exits 1 when any check fails.
- Start:
starts from the Generic Klipper Printer,presets()as written above. - Refusals: error text holds a phrase and the details'
codeis 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). - Filament slots: with one slot,
filament_delete {}is refused aslast_filament_slot("only filament slot"). With a second slot, added byadd_slot()inSLOT_COLOURS[1], andfilament_add_mixed {components: [1, 2], ratios: [50, 50]}, whose reply names slot 3, two refusals each leave the three slots:{filament_slot: 1, merge_into: 3, break_mix: false}asmixed_uses_slotwith "removes a filament that mixed filament mixes", Merge with's question answered no ahead; and{filament_slot: 3, merge_into: 1}asmixed_filament_slotwith "can be deleted but not merged". Deleting a filament a mix mixes is no refusal:test_filaments' mixed filaments. - Details:
entries==["cube.stl", "parts/block.stl"], andheight_ranges== the two ranges. - State left:
gcode_windowandlegend_collapsedunchanged, export folder empty,object_list.total0, part and range overrides unchanged,sidebar_collapsedunchanged, slot count 1/3/64. The slots up to 64 are added withfilament_additself, the command whose limit is checked, so their colours play no part. - Picks: each presses Space on the 3D view and waits up to 30 s for
window_listto list the Speed Dial (the shown web dialog with no title) before it types in the search field and clicks the row; then, once the app is idle, exact notice text innotifications("The project has no objects.", "No more filament slots can be added.", or containing "The Preview shows no toolpaths"), anddialogs==[]. - Height-range row:
widget_listrow shows "has settings" afterwall_loopsis 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" readsobject_listplate 0's names as["first", "second"].object_order {plate: 0, order: [1]}is refused asorder_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 tooandand the object's ranges stayfollow refusedsettings_getcalls, which only read; they would catch a refused read that changed something.- Refusals checked by text, with no code:
settings_set/settings_getoflayer_heighton a part, a nulllayer_heighton a range, a missing height range, filament settings withtarget object, and the sidebarview_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
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.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}. The three cubes of the arrange and select checks stand at x 60, 128 and 196, y 128, on the printer's 250 mm bed, and the one moved off goes to x -150, where no plate is. One stored value it reads as it finds it: the folder the app remembers for its last export (app.last_export_path in OrcaSlicer.conf), where the G-code picker starts, which earlier tests set. "nothing was written where the pickers start" lists only the files written there since the test began, so whichever folder an earlier test left, it holds only this test's writes; a folder that no longer exists is left out. Its picks click the app's own row by its label, <title> from Orcaslicer, so a plugin's action never stands in for one. A pick an earlier test made in the same app can have left its Started or Finished notice, a regular notice that fades about 10 s after it shows, and the picks here must show none of their own: before its first pick the test waits up to 30 s for none to show.
Leaves: Recent Projects' saved.3mf, in its own temporary folder, which the runner deletes when the test passes; the folder the app remembers for the last file opened (recent.last_opened_folder, the handy models' folder); the results of its two replays, orca_action_replay/replay-<time>/result.json in the temporary folder; the Speed Dial's usage counts raised for its picks; and the unsaved project of three cubes, sliced, which its last pick, Slice and Preview, left on the Preview tab.
Decides by: Exits 1 when any check fails.
- Start:
starts from the Generic Klipper Printer,presets()as written above. - Pickers: the save/export auto-answer rule's
usesrises 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 orlast_export_path. preset_export:statusblocked_by_dialogwith a dialog titled "Export Preset Bundle", an error after cancel, the folder empty, andsilentrefused.view_setbad tab: the error starts withNo tab has the id "no_such_page".and the payload containsno_such_tab.- Before the picks: "before the picks, no Started or Finished notice shows", waited for up to 30 s.
- Picks: each presses Space on the 3D view and waits up to 30 s for
window_listto list the Speed Dial (the shown web dialog with no title) before it types in the search field and clicks the row; its state is read once the app is idle. Camera elevation ≥ 85,tabstayspreview, 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.jobswith a job oftoolplate_slicenumbered above the newest before the pick; "and shows its Started or Finished notice" readsapp_state.notificationswith a notice containing "Started" or "Finished" (Started: <title>, thenFinished: <title>, fromPersonContext::submit()). - Arrange/select:
off_plate==[], noranfor direct calls,ran== the action id foraction_run, nolevel,outsideempty,objects==[0, 1, 2]. The journal step'stoolandargsare exact forobject_selectandaction_run(and containspacingforobject_arrange). The exported replays givepassedtrue with the state reproduced. The assemble-viewcanvasvalues and thegizmo_openrefusal are exact.
Not checked:
a cancelled Save Project As is an erroranda cancelled Export Preset Bundle is an erroraccept 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 silentpasses on any error containing "silent", which a schema rejection of the argument would also give.a pick of View: Top turns the camerachecks elevation only.object_arrange {} replies with the settings in force ...checks that asettingskey 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
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, a Browse answered with a folder that does not exist), Hide login side panel's live effect on the Home page, and preset sync / stealth mode with no account.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}; no check reads a preset. The baseline gives every preference a new data folder's value. The test then sets auto_arrange false and auto_calculate_flush "color change" in one preferences_set, away from the app's defaults so that the write the test checks puts them back to the defaults, and "the preferences start as written" reads back from preferences_get those two and the six its checks write from, at a new folder's values: opengl_fps_cap 0, enable_multi_machine false, backup_interval 10, hide_login_side_panel false, sync_user_preset false and stealth_mode false. The MCP switch and port are the launch's (--mcp, --mcp-port), which the data folder does not store. The two download folders are made in the test's own temporary folder on every run. The three checks of the dialog's downloads row read the folder in the row's label, which widget_list lists whole only up to 120 bytes (a longer label is cut to 117 bytes and "...", UiInspector.cpp), so they pass only where the folders' paths are at most 120 bytes long. That is a requirement of the test: on Windows run_sweep.py refuses an --out longer than 80 characters for a test that launches the app, and under its default --out, in the system's temporary folder, the paths are about 100.
Leaves: auto_arrange on and auto_calculate_flush "all", the app's defaults; opengl_fps_cap 45; enable_multi_machine, hide_login_side_panel, sync_user_preset and stealth_mode off; Auto backup off with a period of 37; and download_path the folder its Browse picked, in its own temporary folder, which the runner deletes when the test passes. The next test's start() puts each of them back to the baseline.
Decides by: Exits 1 when any check fails.
- Start:
starts from the Generic Klipper Printer,presets()as written above;the preferences start as written, the eight values above. - Dialog parity, per tab: the named controls' set == the keys
preferences_getlists, and each checkbox's and choice's shown value ==value. - Writes:
changedholds exactlyauto_arrangefalse → true,auto_calculate_flush"color change" → "all" andopengl_fps_cap0 → 45;preferences_getand the dialog show the written values;unchanged==["auto_arrange"]; andrestart_neededis true forenable_multi_machineonly. - Refusals: the text contains
preference_refused,no_such_choice,out_of_range(with "240"),not_a_preference,not_a_folderor "modal dialog is open", and the good key stays unchanged (auto_arrangetrue). - Backup timer: with the period first 10, the periods logged by
set_interval, read once the app is idle after each write, are exactly[0]for a write of 30 with Auto backup off, then[31]for a write of 31 with it on, then all 0 for a write of 37 that turns it off. - Downloads folder: stored value == folder, the dialog row label shows it, and the Browse pick shows and stores the browsed folder. Before that pick, with the dialog open, a rule answering Browse's picker with the folder that does not exist (
folder+ "-missing") is used once (app_state.auto_answer_rulesuses ==[1]), the row still showsfolder, andpreferences_get, which runs while the dialog is open, still readsfolder: a path the picker can't take cancels it. - Login panel: the computed
displayof#LeftBoardon the Home page, read withwebview_run_javascript. "the Home page shows its login side panel" waits up to 30 s forblock(the page shows the panel with jQuery'sshow(),home.js), then up to 30 s fornoneafter writing true, then up to 30 s forblockagain after writing false. A page with no#LeftBoardreadsmissing, which fails each of the three. - Sync/stealth: each written on and off again from off;
changednames the key,preferences_getand the dialog checkbox agree, and, in the log read once the app is idle after the write, 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_capanddownload_path. and writing <key> <value> starts no preset synclooks 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(opengl_fps_cap), nothing checks that the value stayed unchanged. - The Browse answered with a missing folder is checked by its effect, not by the reason the log gives ("folder not found").
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
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.
Starts from: a data folder of its own, not a job's: a new folder in its temporary folder (printers under --datadir when given), which it launches twice, seeded by orca_mcp.py launch --vendor BBL --printer "Bambu Lab X1 Carbon@0.4" --filament "Bambu PLA Basic @BBL X1C" with the Bambu Lab X1 Carbon 0.4 nozzle, Bambu PLA Basic @BBL X1C and no cache/wizard_profile_data.json. It keeps the X1 Carbon, not the default Generic Klipper Printer, because its checks of the Velo+'s filaments rest on the Bambu Lab profiles: every filament the folder holds names Bambu Lab printers alone (compatible_printers), so none fits the Velo+ and the reload installs the Velo+'s default filament, where the default printer's Generic PLA @System fits every printer and the reload would install nothing. orca_mcp.py stop returns once the first app has exited, so the second launch is the only app on the folder.
Leaves: nothing in a job's data folder; its own folder is removed at the end unless --datadir named it.
Decides by: Exits 1 when any check fails; a launch failure is a failed the app starts check.
- Models:
installed_nozzlesexact (["0.4"]for the X1C and the Velo+ after install,[]before),nozzlesinclude the expected sizes, and the cache file appears. - Install/uninstall:
added/removed== the preset name, andselectedmatchespreset_list's selected. The printer set is unchanged after refusals (no_such_modelwithsimilar,no_such_nozzlewithnozzles,last_printerwith 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_installedis not empty, equals the installed filamentspreset_listlists after the install minus those before (installed_filaments(), every filament whatever it fits), and holdsGoofoo ABS @System, the Velo+ model'sdefault_materials(Goofoo/machine/Goofoo Velo+.json), whichPresetBundle::load_installed_filaments()installs;filaments_uninstalledis absent. "and offers them for it": each name is inpreset_list {type: filament, printer: <Velo+ preset>}. - Transfer:
addedis the X1C's other 3 nozzles,layer_heightstays 0.12, the printer edit (240) moves to the newly selected preset while that preset's saved value is 250, andmodifiedlists both keys. - Dialog: the page's model list is waited for up to 40 s, then the tick's
ModelCheckBoxSelectedclass 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 @Systeminstalled 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_uninstalledis absent, nothing installed before is gone frompreset_list, andGeneric ABS @Systemis still installed. A reload swaps a @System filament only for a vendor whose bundle lists default filaments of its own (the vendor'sdefault_filaments, whichPresetBundle::apply_vendor_config()reads). Only an INI bundle fills that list (VendorProfilereads it from the INI'sdefault_filamentssection); the shipped JSON profiles never do, asprinter_install's description andapply_install_set()say, so none is swapped. A machine profile'sdefault_filament_profileis 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_uninstalledreports 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 vendoronly requires > 1 vendor and > 100 models.
To settle in review:
- That the Velo+'s install installs
Goofoo ABS @System. The evidence: the Velo+ model'sdefault_materialsisGoofoo ABS @System, whichload_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
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.
Starts from: a data folder of its own, not a job's: a new folder in its temporary folder (filaments under --datadir when given), which it launches twice, seeded by orca_mcp.py launch --vendor BBL --printer "Bambu Lab X1 Carbon@0.4" --filament "Bambu PLA Basic @BBL X1C" with the Bambu Lab X1 Carbon 0.4 nozzle and Bambu PLA Basic @BBL X1C in slot 1. It keeps the X1 Carbon, not the default Generic Klipper Printer, because its scenarios rest on Bambu Lab filaments that fit Bambu Lab printers alone: a printer of the seeded bundle (the A1 mini) that no installed filament fits, Bambu PLA Matte @BBL X1C fitting only the X1 Carbon's family, and the Bambu Lab candidate filament the folder has not installed. The default printer's Generic @System filaments fit every printer. orca_mcp.py stop returns once the first app has exited, so the second launch is the only app on the folder.
Leaves: nothing in a job's data folder; its own folder is removed at the end unless --datadir named it.
Decides by: Exits 1 when any check fails.
- Install:
installedcontains the candidate preset,preset_listoffers it, every installed name has thatalias,preset_selectputs it in slot 1 with noshown, a second install givesinstalled==[], andno_such_filamentcomes withsimilar. - Shown printer: the printer is not installed and nothing fits it; selecting it adds shown filaments;
filament_installgivesinstalled==[X1C_ONLY]with nofilaments_installed; the installed set == before plus that one; and after the restart none of the shown filaments are installed. - Defaults given back:
filaments_installedin 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'suninstalled(always present) equals the names asked minus thosefilaments_installedgives back, and none of them is installed afterwards (filament_uninstalllists underuninstalledonly the presets left uninstalled). After the restart the Velo+'s fitting set is unchanged. - Uninstall: the preset leaves
preset_listand readsinstalled: false;filament_in_usecomes 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_listreturns, so which filament is tested depends on the shipped profiles. after a restart the filaments offered for the second printer are what the uninstall repliedcompares againstpreset_listbefore the restart, not against the reply.
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
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.
Starts from: a data folder of its own, not a job's: a new folder in its temporary folder (d under --datadir when given), seeded by orca_mcp.py launch with the default printer, the Generic Klipper Printer 0.4, which no check reads. No plugin is installed there, which "no fixture plugin is installed yet" checks, so its whole-list checks (the Plugins window against plugin_list) read only the plugins it installs.
Leaves: nothing in a job's data folder; its own folder is removed at the end unless --datadir named it.
Decides by: Exits 1 when any check fails.
- Install:
level== "success", the row isinstalledwithsource"local", a reinstall givesplugin_installedwith "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,capabilitiesanderror. Before the install, every row there is (none, in a fresh folder) is held to the same fields. - Enable:
enabledandstatus"Activated", capability lists,changedtrue. Refusal codes are exact:plugin_not_enabled,empty_capability,no_such_capability(withcapabilities),no_such_plugin(withsimilar). - Reload:
reloaded== key,reinstalledfalse, stays enabled. - Uninstall:
uninstalled== key,unsubscribedfalse, the row and the file are gone, and a second uninstall givesno_such_plugin. - Refresh: the pick presses Space on the 3D view and waits up to 30 s for
window_listto list the Speed Dial (the shown web dialog with no title) before it types in the search field and clicks the row. "a person's pick of Refresh Plugins returns at once, starting the refresh in place, not as a job": the click replies without a job, within 30 s, a bound only a hang fails, andapp_state.jobsthen lists noplugin_refreshjob numbered above the newest before the click. The pick runs the menu item's form in place (MenuItems::refresh_plugins()), which starts the refresh off the UI thread and returns, where the call's form,plugin_refresh, runs as a job that waits for the refresh. Then "Plugins refreshed." appears within 60 s, and the log has exactly 1 "Rescanning plugins..." line since the pick.plugin_refreshreplies without a job and lists the side-loaded plugin, which was absent before. - Window:
{key: enabled}read from the page, once it lists as many rows asplugin_list(waited for up to 30 s), ==plugin_list's.
Not checked:
plugin_uninstallis tried again when the first try fails with "Failed to delete plugin folder", on any platform, every second for up to 30 s while it fails so. A regression that makes that first removal always fail passes if a later try succeeds.- That the Refresh Plugins pick returns before its refresh ends: the check reads that it ran the menu item's form, with no job, and bounds the click only by 30 s, so a menu item form that waited for the refresh on the UI thread, a cloud round trip, passes. Reading the refresh's notification absent at the click's reply would race the refresh, which only the cloud's answer times.
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_cachechecks 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
Tests: A plugin's side of the MCP tools, with mcp_tools_fixture side-loaded (enabled, 6 capabilities, thread and tools permissions), mcp_tools_ungranted, which has no permissions, mcp_tools_declaring, which asks for the tools as it loads, and mcp_tools_broken, whose get_default_config raises after it registered measure. Covers the fixture's measure operation through tool_list, tool_describe and tool_call, its six scripts, which action_list lists as its Speed Dial actions, 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. Covers the tools permission, which is asked for as the threading permission is: the fixture's calls need it; mcp_tools_ungranted's call without it is refused and asks the person in the "Plugin permission request" prompt, whose No is not remembered and whose Yes lets its next call through, while its list(), describe() and its offered operation work without it, and full access alone lets it call; mcp_tools_declaring, switched on, asks for the tools in its load's "Plugin permissions" prompt, whose No fails the load and whose Yes stores the grant; and the Permissions tab's OrcaSlicer tools switch, with no confirmation either way, withdraws the grant, refusing the fixture's next call, which asks again, and ending its auto-answer rule, and gives it back, after which the fixture records again. Also covers tool_list and tool_describe on the menu items with no argument form, a group and the Design commands, the Python API through script_list_api and script_describe_api, unloading via the Plugins dialog (operation and rule withdrawn), and a --run launch without MCP where the rule script still runs and the ungranted plugin's call is refused and asks, its prompt answered Yes by the replay's own auto-answer rule.
Starts from: a data folder of its own, not a job's: a new temporary folder with the four plugins side-loaded into it before the first launch, orca_mcp.py launch --cad on a port nothing listens on, which seeds it with the default printer, the Generic Klipper Printer 0.4; no check reads a preset. Its plugins are the only ones there. The --run launch starts the binary on the same folder, after the first app has stopped (orca_mcp.py stop returns once it has exited) and the fixture's install state has been written enabled again.
The fixture's install state grants threading and tools: true; the fixture declares no permissions, so no load prompt comes up for it. Its sixth capability, "MCP tools fixture record", calls recording_start {save_path: <storage>/fixture.mkv, overwrite: true, max_seconds: 1} and, when the reply is a job envelope (status "running"), app_wait {for: "job", job}, and records that final result, so ok true means the recording started; the recording is fixture.mkv, or fixture.mp4 where ffmpeg encodes it. mcp_tools_declaring is side-loaded disabled, with an install state that has no permissions, so it loads only when the test switches it on with plugin_enable, which loads it on a worker thread: its request waits in the prompt queue and the UI thread shows it (drain_runtime_prompts()). It asks for the tools with orca.request_permissions(tools=True) and for nothing else. Its one Script capability, "MCP tools declaring call", calls app_state and records to out_declaring.json in its storage folder {ok, code, call}: whether the call succeeded, a ToolError's details["code"] or null, and app_state's ready or the error text. mcp_tools_ungranted is side-loaded enabled with an install state that has no permissions and declares nothing. Its one Script capability, "MCP tools ungranted call", records to out_ungranted.json in its storage folder {listed, described, ok, error_type, code, call}: whether orca.host.tools.list() holds app_state, orca.host.tools.describe("app_state")["key"], whether calling app_state succeeded, the exception's class name or null, a ToolError's details["code"] or null, and app_state's ready or the error text. It offers the operation echo, which returns its arguments and calls no tool. A call it makes without the grant is refused at once and queues its runtime prompt, titled "Plugin permission request", which the UI thread shows when the queue reaches it (drain_runtime_prompts()), so the prompt may open before or after the script records its outcome.
Leaves: nothing in a job's data folder; its own folder is removed at the end.
Decides by: Exits 1 when any check fails, or 1 at once if a launch fails.
- Operation:
tool_list {group: "plugins"}listsplugin.mcp_tools_fixture.measure;tool_describeof it hasgroup"Plugins",descriptionstarting "Offered by a plugin.", a parameter nameda,listedfalse andaccess.open_worldtrue (plugin code reaches what its grants allow);tool_callresult =={"twice": 4}; absent fromtools/list; and within 30 s of the unticktool_list {group: "plugins"}no longer lists it andtool_describeof it is refused with codeinvalid_argumentand text starting "Unknown tool: plugin.mcp_tools_fixture.measure". - Speed Dial actions: within 30 s of the launch,
action_list {section: "MCP Tools Fixture"}(the fixture's display name, which its script actions' section is) lists exactly the idsplugin_script_action:<capability>:mcp_tools_fixtureof its six capabilities. - Fixture scripts (outcome JSON read from the plugin's storage folder, waited for up to 60 s, since a script runs on its own after
action_runhas replied):callandthread=={"ok": true, "result": true},rule=={"ok": true, "result": "plugin"}(both with MCP and under--run),exportgivesokfalse with "agent's session", and a separate script'shandle.update(5)returns true. - Progress dialog: "the plugin opens a progress dialog and keeps its handle": the
handlescript's outcome hasoktrue, andwindow_listlists a window titledMCP tools fixture, the title the script givescreate_progress_dialog. - Menu items and groups:
tool_listlistssettings_toggle_developer_modeandscript_toggle_panel, each withdoesequal to thedescriptiontool_describegives it;tool_describe {tool: "script_toggle_panel"}giveslistedfalse and no parameters;tool_list {group: "objects"}gives no items and a note naming tools/list; an unknown group is refused with codeinvalid_argument, naming "Design". - Python API:
script_list_api {within: "orca.host.TriangleMesh"}listsorca.host.TriangleMesh.face_normals, andscript_describe_api {name: "orca.host.TriangleMesh.face_normals"}gives a non-emptydoc. - Design commands: "the Design tab is on (launch --cad)" reads
app_state.design_tabtrue, and thentool_list {group: "design"}listssolid_extrudewith heading "Solid". - A menu item's command: with Prepare shown, "tool_call runs a menu item's command" calls
script_toggle_paneland waits up to 30 s for the 3D view's height inwidget_list(itsname=OrcaSceneCanvasline) to be less than before the call, as the Run Script panel docks under it; "and a second call hides it" waits up to 30 s for it to be greater than after the first call. - Events and journal:
new_projects.txtgains exactly 1 line perproject_newand pernew_projectaction, each waited for up to 30 s. Before therulescript runs, the agent callsdialog_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 onedialog_auto_answerstep, the agent's, withrules[]; 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 formcp_tools_brokenwith anerrorholding "this fixture's load fails here on purpose" (a row'serroris the plugin's own,PluginOps). "and offers none of its operations":tool_describe {tool: "plugin.mcp_tools_broken.measure"}is refused with codeinvalid_argumentand text starting "Unknown tool: plugin.mcp_tools_broken.measure". - Ungranted plugin, three runs of its script, each after its
out_ungranted.jsonis removed. In runs 1 and 2 the test waits for both the outcome file (up to 60 s) and the prompt:app_wait {for: "dialog", timeout_s: 30}, then a dialog titled "Plugin permission request" inapp_state.dialogs(up to 30 s more). Run 1: the outcome haslistedtrue,described"app_state",okfalse,error_type"ToolError",code"tools_not_allowed" andcallcontaining "not allowed to call OrcaSlicer's tools" and "request_permissions(tools=True)"; exactly one dialog titled "Plugin permission request" is open, its message containing "OrcaSlicer's tools";dialog_answer {button: "no", dialog: {title: "Plugin permission request"}}is not refused, within 30 s no permission prompt is open (no dialog titled "Plugin permission request" or "Plugin permissions"), and the install state holds nopermissions.toolstrue. Run 2: the same outcome and the same one prompt (a No is not remembered); the samedialog_answerwithbutton: "yes": within 30 s the install state holdspermissions.toolstrue. Run 3: the outcome hasoktrue andcalltrue, andapp_state.dialogsis empty after it. The test then writes the install state back without permissions for the legs after;tool_call {tool: "plugin.mcp_tools_ungranted.echo", args: {"a": 1}}returns{"a": 1}, with no permission prompt open after it. - Full access alone: the test rewrites the ungranted plugin's install state with
permissions: {full_access: true}and notools; its script then recordsoktrue andcalltrue, with no permission prompt open after it. The install state is written back without permissions. - Load-time prompt, before the Plugins dialog is first opened (
plugin_enableis refused while a modal dialog is open). Each leg callsplugin_enable {plugin: "mcp_tools_declaring", enabled: true}, thenapp_wait {for: "dialog", timeout_s: 30}, andapp_state.dialogsholds exactly one dialog titled "Plugin permissions", its message containing "OrcaSlicer's tools";dialog_answer {dialog: {title: "Plugin permissions"}}answers it and is not refused, the load's job is followed for up to 45 s (app_wait {for: "job"}) when the reply was a job envelope, and within 30 s no permission prompt is open. Leg 1,button: "no": the load fails (the job's result is an error with codenot_loaded, orplugin_list's row for the plugin hasenabledfalse and astatusother than "Loading"), and the install state holds nopermissions.toolstrue. Leg 2, afterplugin_enablefalse,button: "yes": the load ends without error, the install state holdspermissions.toolstrue, and the plugin's script recordsoktrue andcalltrue, with no permission prompt open after it. - Tools switch, after the
rulescript has set the fixture's rule, whose match the test reads inapp_state.auto_answer_rules:action_run orca_command:open_plugins:orca;widget_clickwith{css, within: "Plugins"}ondiv.plugin-row[data-plugin-key="mcp_tools_fixture"] span.plugin-name-text(the row's name, which the page lists as an element) selects it, on#permissionsTabshows its Permissions tab, ondetails.permission-group[data-group="process"] > summaryopens the Execution group. The switch is read withwebview_run_javascripton the Plugins page's web view (found bywidget_list {query: "PluginsDialog/index.html"}), giving{checked, disabled}of#permission-tools-toggle; the install state is read from the fixture's.install_state.json. Control first:{checked: true, disabled: false}and the install state holdspermissions.toolstrue. Click 1, onlabel.permission-thread-toggle:has(#permission-tools-toggle)(the label class of every yes/no permission's switch): within 30 s the install state holdsfalseand the switch reads{checked: false, disabled: false}, with no permission prompt open (app_state.dialogslists the Plugins dialog itself, and no dialog titled "Plugin permissions" or "Plugin permission request"); within 30 s the rule's match is gone fromapp_state.auto_answer_rules; thecallscript recordsokfalse with "not allowed to call OrcaSlicer's tools", and its prompt is waited for as in the ungranted leg (theapp_waitreturns at once while the Plugins dialog is open, so the title is what is waited for): exactly one dialog titled "Plugin permission request", its message containing "OrcaSlicer's tools";dialog_answer {button: "no", dialog: {title: "Plugin permission request"}}is not refused, within 30 s no permission prompt is open, and the install state still holdsfalse. Full access, with the switch off: a click onlabel.permission-placeholder:has(#permissionFullAccess)opens one dialog titled "Full access", waited for as the prompt is, its message (its whitespace collapsed, as the dialog wraps it) containing "OrcaSlicer tools";dialog_answer {button: "yes", dialog: {title: "Full access"}}is not refused, within 30 s the confirmation is closed and the install state holdsfull_accesstrue withtoolsstillfalse; therulescript then records{"ok": true, "result": "plugin"}, the rule's match is inauto_answer_rules, and no permission prompt is open. A second click on the same label opens no dialog: within 30 s the install state holdsfull_accessfalse and the tools switch reads{checked: false, disabled: false}, with neither the confirmation nor a permission prompt open; within 30 s the rule's match is gone; thecallscript recordsokfalse with "not allowed to call OrcaSlicer's tools" and exactly one "Plugin permission request" prompt naming OrcaSlicer's tools opens, whose No is not refused and closes it within 30 s. Click 2, on the same label, opens no dialog: within 30 s the install state holdstrueand the switch reads{checked: true, disabled: false}, with no permission prompt open; thecallscript records{"ok": true, "result": true}, with no permission prompt open after it;fixture.mkvandfixture.mp4are removed, therecordscript recordsoktrue with a final result whosestatusis not "running", and within 30 s one of them exists with a size above 0. Then therulescript runs again, so the unload that follows has a plugin rule to see end; the unload opens the dialog again withaction_run, which raises the open one. - Rule lifetime: the rule's match is in
auto_answer_ruleswhile the plugin is loaded and holds the tools permission, gone within 30 s of the switch turned off, set again under full access alone and gone within 30 s of full access turned off, and, set again once the switch is on, gone within 30 s of the untick. - Without MCP: before the
--runlaunch, the ungranted plugin's install state is written without permissions andout_ungranted.jsonis removed. The replay's steps aredialog_auto_answer {rules: [{match: "^Plugin permission request", button: "yes"}]},action_runof the fixture'srulescript and ofplugin_script_action:MCP tools ungranted call:mcp_tools_ungranted,app_wait {for: "dialog", timeout_s: 30}andapp_wait {for: "no_dialog", timeout_s: 30}. The waits keep the replay running while the prompt opens and the rule answers it, since the refused call queues the request and posts its drain before the script returns; the rule's scope is the replay's, so it ends with it. After the run,out_ungranted.jsonrecordsokfalse andcode"tools_not_allowed", and the install state holdspermissions.toolstrue. Only a Yes to the runtime prompt writes it, and with the MCP server off nothing but the replay's rule can answer, so the refusal and the queued prompt both happened without the endpoint. A prompt that came too late for the rule leaves the grant unsaved, so the leg fails rather than passing.
Not checked:
- The manual's fields past the operation's
group,description, parameteraandlisted, and past the menu item'slistedand parameters: the unit tests read every command's manual. - The progress dialog's gauge:
handle.update(5)returns true, but the gauge is not read. - The
--runlaunch's exit code is ignored, and only the rule and the ungranted scripts run there. A script runs on its own afteraction_runreplies (PluginScriptAction::run()), and a replay has no step that waits for a file: the replay's two waits, which last until the prompt has been answered (up to 60 s), are what give the scripts time to record their outcomes before the run ends. - The prompt a load on the UI thread shows at once (
request_permissions()'s inline branch):plugin_enableloads on a worker thread, whose request goes through the queue. The prompts' text is read only for naming OrcaSlicer's tools, and their tip checkbox is left alone. - A call made while the tools prompt is already open or waiting, which is refused without a second prompt (the queue's
Duplicate): the prompt queue's unit tests cover that for every runtime prompt. - A withdrawal landing between the worker's ask (
request_tools_permission()) and the call's admission on the UI thread, which the admission's own check (plugin_may_call_tools()) refuses: the sweep cannot place a withdrawal there, and the admission needs a running app. No test covers that check, so removing it, or moving it afterbegin_plugin_scope(), fails nothing: an accepted gap, since a test would need a seam in production code that nothing else uses. - The full-access confirmation's text past naming OrcaSlicer tools, and its No: the Tools switch leg answers it Yes, and the Full access alone leg writes the install state.
- A plugin-owned
script_runacross a revocation, a recording or held press ending at the switch-off (only the rule is read; the same scope end ends all three), and a late effect of a call in flight at the switch-off: the unit tests cover child calls of a plugin-owned job and drive the withdrawn guard andrequire_owner_scope()directly. No test reaches the three UI closures that callrequire_owner_scope()with the scope gone, since that needs the withdrawal to land between a call's job thread and its UI closure. - The Run Script panel's
.pyfiles: the panel is hidden from automation and opens its files through a file picker, so how it reads and saves them is left to the unit tests ofdecode_python_source()andencode_python_source().
Strength: Partial — the fixture's operation, its listing and manual, script outcomes, events, journal, failed load, the tools permission's refusal and runtime prompt, load-time prompt, withdrawal and restore, and unload are each checked exactly, with controls for the journal's absence and the switch's starting state, but the --run launch's exit code is not read.
test_operation_routes
test_operation_routes.py · Python
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.
Starts from: start(client), which "starts from the Generic Klipper Printer" compares with {printer: "MyKlipper 0.4 nozzle", process: "0.20mm Standard @MyKlipper", filaments: ["Generic PLA @System"]}. Its one filament slot is what the mixed-slot pair needs: the pair adds a second slot with add_slot() in SLOT_COLOURS[1], and the Add Mixed Filament button shows only below the 64-slot limit, which an earlier test can leave (test_additions_refusals does). Its new project is what the layer pair needs, a Preview with no layers: a new project clears the Preview's toolpaths (Plater::priv::reset() calls reset_gcode_toolpaths()), so a slice an earlier test left shows no layers there. The hidden printer is the first printer preset_list {include_uninstalled} lists with installed: false, one of the Generic Klipper Printer's other nozzles first (MyKlipper 0.2 nozzle on a folder that installed only the 0.4), since its process and filament suit the one selected. A printer once shown stays shown, and preset_list lists it without installed: false, until the app restarts, so where an earlier test in the same app showed it, the test picks the next one still hidden; the Custom bundle alone has 14 printers a seeded folder does not install. On a folder where an earlier test installed or showed every MyKlipper nozzle it is another printer, and the check reads whichever it picked.
Leaves: an empty project with the two filament slots of the mixed-slot pair, the mixed one deleted again, and the Generic Klipper Printer selected again: the data folder remembers the printer selected, which the app selects when it next starts, before any test's start(), and the hidden printer is not installed there. The hidden printer it showed is shown for that session alone. Its files are in its own temporary folder.
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.
- Start:
starts from the Generic Klipper Printer,presets()as written above. - Empty project: "project_save refuses a .gcode.3mf name" (code
sliced_file_name), the text containssliced_3mf, and no file. The.3mfexport is written;stlandsliced_3mfare refused withno_objectsand write no file. - Layers: the action and
view_set {layer: 1}both refuse withno_layers, and "in the same words (layer)" compares the texts exactly. - Arrange from the assemble view: no refusal and
off_plateeq[], the offsets changed, and the selection'scanvasis3dafterwards. - Arrange with the Move gizmo: both cubes are first moved to the bed's centre with
object_transform {object: i, position: [125, 125, 10]}, and "the cubes are back on one spot" reads both instance offsets fromobject_listas x 125 and y 125. Then the gizmo opens (active),object_arrangeis not refused, and "object_arrange arranges with the Move gizmo open" readsobject_listagain: 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: with a second slot added (
add_slot()),filament_list's third row ismixed;preset_selectrefuses withmixed_filament_slot; the plugin API raisesValueErrorwith a message equal topreset_select's text. - Hidden printer: a printer listed with
installed: falseexists; after the plugin API'sbegin_update(name), nothing raised and, once the app is idle,app_state.presets.printerequals 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_selectof 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 againstview_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.