参考所有分组:完善OPFS参数备份桥接
结论:按 LinuxCNC rs274ngc_pre.cc save_parameters()/restore_parameters() 语义,补齐浏览器 OPFS 参数文件 .bak 持久化;未扩展 smoke 解析行为。 验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-web-wasm-node-smoke.sh;./test-web-wasm-browser-smoke.sh。
This commit is contained in:
@@ -28,6 +28,20 @@ export async function runBrowserAppOpfsSections(context) {
|
||||
const savedParameterFile = new TextDecoder().decode(await appSimulator.fs.opfs.readFile("parameters/rs274ngc.var"));
|
||||
expectIncludes(savedParameterFile, "5161\t1.000000",
|
||||
"app frame did not persist LinuxCNC parameter state into OPFS");
|
||||
await appSimulator.fs.opfs.removeFile("parameters/rs274ngc.var.bak");
|
||||
parseAppFrameProgram(appFrame, "G21 G90\nG0 X2\nG28.1\nM30\n");
|
||||
await waitFor(
|
||||
() => appFrame.contentDocument?.querySelector("#axisX")?.value === "2.000",
|
||||
"app frame did not parse second program for parameter backup coverage",
|
||||
);
|
||||
// LinuxCNC source basis: rs274ngc_pre.cc save_parameters()
|
||||
// preserves the previous parameter file as filename + ".bak".
|
||||
const updatedParameterFile = new TextDecoder().decode(await appSimulator.fs.opfs.readFile("parameters/rs274ngc.var"));
|
||||
expectIncludes(updatedParameterFile, "5161\t2.000000",
|
||||
"app frame did not replace LinuxCNC parameter state after second parse");
|
||||
const savedParameterBackup = new TextDecoder().decode(await appSimulator.fs.opfs.readFile("parameters/rs274ngc.var.bak"));
|
||||
expectIncludes(savedParameterBackup, "5161\t1.000000",
|
||||
"app frame did not persist LinuxCNC parameter backup into OPFS");
|
||||
} finally {
|
||||
await disposeAppFrame(appFrame);
|
||||
}
|
||||
@@ -38,7 +52,7 @@ export async function runBrowserAppOpfsSections(context) {
|
||||
await waitForAppControls(restoredAppFrame, "restored app frame did not load CNC controls");
|
||||
await waitFor(() => {
|
||||
const restoredInput = restoredAppFrame.contentDocument?.querySelector("#programInput");
|
||||
return restoredInput?.value === "G21 G90\nG0 X1\nG28.1\nM30\n";
|
||||
return restoredInput?.value === "G21 G90\nG0 X2\nG28.1\nM30\n";
|
||||
}, "app frame did not restore current program from OPFS after reload");
|
||||
await waitForAppAlarm(
|
||||
restoredAppFrame,
|
||||
@@ -48,7 +62,7 @@ export async function runBrowserAppOpfsSections(context) {
|
||||
await getAppFrameSimulator(restoredAppFrame, "restored app frame did not create OPFS simulator workspace");
|
||||
parseAppFrameProgram(
|
||||
restoredAppFrame,
|
||||
"G21 G90\nF100\nO10 if [#5161 EQ 1]\nG1 X12\nO10 endif\nM30\n",
|
||||
"G21 G90\nF100\nO10 if [#5161 EQ 2]\nG1 X12\nO10 endif\nM30\n",
|
||||
);
|
||||
await waitForAppAlarm(
|
||||
restoredAppFrame,
|
||||
|
||||
Reference in New Issue
Block a user