完善 gmoccapy XYZAB 参考功能
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { access, readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
const repoRoot = new URL("../../..", import.meta.url).pathname.replace(/\/$/, "");
|
||||
const manifestPath = join(repoRoot, "web-rtcp-5axis-sim-plan/app/src/ui-reference/gmoccapy-button-icons.json");
|
||||
const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
|
||||
|
||||
assert.equal(manifest.schema, "web-rtcp-5axis-gmoccapy-button-icons-v1");
|
||||
assert.equal(manifest.semanticBoundary, "gmoccapy_button_icon_asset_reference_only_not_control_semantics");
|
||||
assert.equal(manifest.generatedFrom.csv, "work/working3/gmoccapy_button_icons/button_icon_inventory.csv");
|
||||
assert.equal(manifest.rowCount, 211);
|
||||
assert.equal(manifest.entries.length, 211);
|
||||
assert.equal(manifest.copiedIconCount, 112);
|
||||
|
||||
const entriesByButton = new Map();
|
||||
for (const entry of manifest.entries) {
|
||||
if (!entriesByButton.has(entry.buttonId)) entriesByButton.set(entry.buttonId, []);
|
||||
entriesByButton.get(entry.buttonId).push(entry);
|
||||
if (entry.projectAsset) {
|
||||
await access(join(repoRoot, "web-rtcp-5axis-sim-plan", entry.projectAsset.replace(/^app\//, "app/")));
|
||||
}
|
||||
}
|
||||
|
||||
const coreButtons = [
|
||||
"tbtn_estop",
|
||||
"tbtn_on",
|
||||
"rbt_manual",
|
||||
"rbt_mdi",
|
||||
"rbt_auto",
|
||||
"tbtn_setup",
|
||||
"tbtn_user_tabs",
|
||||
"btn_homing",
|
||||
"btn_tool",
|
||||
"btn_touch",
|
||||
"btn_load",
|
||||
"btn_reload",
|
||||
"btn_run",
|
||||
"btn_stop",
|
||||
"tbtn_pause",
|
||||
"btn_step",
|
||||
"ref_all",
|
||||
"home_axis_x",
|
||||
"home_axis_y",
|
||||
"home_axis_z",
|
||||
"home_axis_a",
|
||||
"home_axis_b",
|
||||
"touch_x",
|
||||
"touch_y",
|
||||
"touch_z",
|
||||
"touch_a",
|
||||
"touch_b",
|
||||
"rbt_forward",
|
||||
"rbt_reverse",
|
||||
"rbt_stop",
|
||||
"tbtn_flood",
|
||||
"tbtn_mist",
|
||||
"btn_zoom_in",
|
||||
"btn_zoom_out",
|
||||
"rbt_view_x",
|
||||
"rbt_view_y",
|
||||
"rbt_view_z",
|
||||
"rbt_view_p",
|
||||
"tbtn_view_tool_path",
|
||||
"tbtn_view_dimension",
|
||||
];
|
||||
|
||||
for (const buttonId of coreButtons) {
|
||||
const entries = entriesByButton.get(buttonId) || [];
|
||||
assert.equal(entries.length > 0, true, `${buttonId} missing from manifest`);
|
||||
assert.equal(entries.some((entry) => entry.projectAsset || entry.sourceType === "none"), true, `${buttonId} lacks asset/fallback`);
|
||||
}
|
||||
|
||||
assert.equal(entriesByButton.get("rbt_auto").some((entry) => entry.stateOrVariant === "active" && entry.iconName === "mode_auto_active"), true);
|
||||
assert.equal(entriesByButton.get("rbt_auto").some((entry) => entry.iconName === "mode_auto_inactive"), true);
|
||||
assert.equal(entriesByButton.get("tbtn_estop").some((entry) => entry.iconName === "main_switch_on"), true);
|
||||
assert.equal(entriesByButton.get("tbtn_estop").some((entry) => entry.iconName === "main_switch_off"), true);
|
||||
assert.equal(entriesByButton.get("tbtn_flood").some((entry) => entry.iconName === "coolant_flood_active"), true);
|
||||
assert.equal(entriesByButton.get("tbtn_mist").some((entry) => entry.iconName === "coolant_mist_inactive"), true);
|
||||
|
||||
const copiedAssets = new Set(manifest.entries.map((entry) => entry.projectAsset).filter(Boolean));
|
||||
assert.equal(copiedAssets.size, 112);
|
||||
|
||||
console.log("gmoccapy_icon_manifest_smoke=ok");
|
||||
Reference in New Issue
Block a user