拆分仿真测试程序目录

结论:将内置 G-code 测试程序从 simulation-app.js 移入 runtime/ui/simulation/programs/,建立一程序一模块的目录化程序库,并保持页面 API 与验证 gate 兼容。
This commit is contained in:
2026-06-16 22:03:06 +08:00
parent db83ad29f3
commit 163a68ff42
12 changed files with 193 additions and 95 deletions

View File

@@ -1844,3 +1844,46 @@ real_simulation_programs_node_smoke=ok
- Program execution 仍通过 `createLinuxCncInterpSdk()` / LinuxCNC WASM
- Preview、DRO、G-code active line 和 playback 都来自 LinuxCNC-produced canonical motion event
- 禁用的 manual/spindle/coolant/jog 控件只显示 blocked/readiness 状态,不伪造机器动作。
八十三、2026-06-16 继续执行记录:仿真测试程序目录化
用户要求把程序移动到新目录,方便后续新增其它测试程序。本批把 simulation 内置 G-code 程序
从 `simulation-app.js` 拆出,建立独立程序库目录。
本批新增/调整:
- 新增目录:
- `runtime/ui/simulation/programs/`
- 每个测试程序独立一个模块:
- `square-linear.js`
- `pocket-z.js`
- `incremental-loop.js`
- `arc-g2-g3.js`
- `drill-g81.js`
- 新增 `runtime/ui/simulation/programs/index.js` 统一导出:
- `SIMULATION_TEST_PROGRAMS`
- `DEFAULT_SIMULATION_PROGRAM_ID`
- `DEFAULT_SIMULATION_PROGRAM`
- `getSimulationTestPrograms()`
- `getSimulationTestProgram(programId)`
- `simulation-app.js` 改为从 `programs/index.js` 导入并 re-export保持原有页面/API/test import
兼容;
- `verify_real_simulation_programs.mjs` 新增目录化校验:
- `programs/*.js` 文件数必须等于程序数量;
- simulation-app re-export 必须与 directory-backed inventory 一致;
- 默认程序和 ID 唯一性保持不变;
- README、AXIS-style implementation docs、PROJECT_COMPLETION_TRACKER 同步记录程序目录约定。
后续新增测试程序规则:
1. 在 `runtime/ui/simulation/programs/` 新增一个 `*.js` 模块;
2. 模块导出 `{ id, label, category, text, expectedMotionTypes }`
3. 在 `programs/index.js` 导入并加入 `SIMULATION_TEST_PROGRAMS`
4. 跑 `wasm-port/tests/ui/node/verify_real_simulation_programs.sh` 和
`SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_real_simulation_browser.sh`。
本批仍保持 LinuxCNC 语义边界:
- 程序目录只保存 G-code fixture text 和 expected LinuxCNC canonical motion type 断言;
- 执行仍通过 LinuxCNC-backed WASM SDK
- JS 没有新增 G-code 解释、planner 或 machine semantics。