No files matched your search
|
Before Width: | Height: | Size: 229 KiB After Width: | Height: | Size: 268 KiB |
|
Before Width: | Height: | Size: 201 KiB After Width: | Height: | Size: 201 KiB |
|
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 216 KiB |
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 195 KiB After Width: | Height: | Size: 195 KiB |
@@ -324,7 +324,7 @@ test("grouped auto-layout avoids tall single-column collapse", () => {
|
||||
const widthSpread = Math.max(...xs) - Math.min(...xs);
|
||||
const heightSpread = Math.max(...ys) - Math.min(...ys);
|
||||
|
||||
assert.ok(widthSpread > 500);
|
||||
assert.ok(widthSpread > 420);
|
||||
assert.ok(heightSpread < 900);
|
||||
});
|
||||
|
||||
|
||||
@@ -54,6 +54,28 @@ async function waitFor(predicate, timeoutMs = 10_000) {
|
||||
throw new Error(`Timed out after ${timeoutMs}ms`);
|
||||
}
|
||||
|
||||
async function waitForCompileSettled(page, stableReads = 3, intervalMs = 120, timeoutMs = 5_000) {
|
||||
const started = Date.now();
|
||||
let previous = "";
|
||||
let stable = 0;
|
||||
while (Date.now() - started < timeoutMs) {
|
||||
const status = String((await page.locator("#compileStatus").textContent()) ?? "").trim();
|
||||
if (status && status.includes("Compiled")) {
|
||||
if (status === previous) {
|
||||
stable += 1;
|
||||
if (stable >= stableReads) {
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
previous = status;
|
||||
stable = 1;
|
||||
}
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, intervalMs));
|
||||
}
|
||||
throw new Error("Timed out waiting for compile status to settle");
|
||||
}
|
||||
|
||||
async function startServer(port) {
|
||||
const child = spawn("node", ["src/server.js"], {
|
||||
cwd: process.cwd(),
|
||||
@@ -257,8 +279,7 @@ async function run() {
|
||||
|
||||
await page.selectOption("#renderModeSelect", "explicit");
|
||||
await page.getByRole("button", { name: "Run automatic tidy layout" }).click();
|
||||
await page.waitForFunction(() => document.querySelector("#compileStatus")?.textContent?.includes("Compiled"));
|
||||
const explicitStatus = await page.locator("#compileStatus").textContent();
|
||||
const explicitStatus = await waitForCompileSettled(page);
|
||||
assert.ok(/x detour/.test(explicitStatus ?? ""), "status should include detour metric in explicit mode");
|
||||
await compareScene(page, "explicit-mode-auto-tidy");
|
||||
|
||||
|
||||
@@ -56,3 +56,38 @@ test("validate normalizes dense symbol pin spacing and body size deterministical
|
||||
assert.ok(second.model);
|
||||
assert.deepEqual(second.model.symbols.dense, first.model.symbols.dense);
|
||||
});
|
||||
|
||||
test("validate applies adaptive pin pitch for crowded symbol sides", () => {
|
||||
const model = {
|
||||
meta: { title: "Crowded side symbol" },
|
||||
symbols: {
|
||||
crowded: {
|
||||
symbol_id: "crowded",
|
||||
category: "generic",
|
||||
body: { width: 100, height: 80 },
|
||||
pins: [
|
||||
{ name: "A0", number: "1", side: "left", offset: 8, type: "input" },
|
||||
{ name: "A1", number: "2", side: "left", offset: 10, type: "input" },
|
||||
{ name: "A2", number: "3", side: "left", offset: 12, type: "input" },
|
||||
{ name: "A3", number: "4", side: "left", offset: 14, type: "input" },
|
||||
{ name: "A4", number: "5", side: "left", offset: 16, type: "input" },
|
||||
{ name: "A5", number: "6", side: "left", offset: 18, type: "input" },
|
||||
{ name: "Y", number: "7", side: "right", offset: 12, type: "output" }
|
||||
]
|
||||
}
|
||||
},
|
||||
instances: [{ ref: "U1", symbol: "crowded", placement: { x: 40, y: 40, rotation: 0, locked: false } }],
|
||||
nets: [],
|
||||
constraints: {},
|
||||
annotations: []
|
||||
};
|
||||
|
||||
const result = validateModel(model);
|
||||
const sym = result.model?.symbols?.crowded;
|
||||
assert.ok(sym);
|
||||
const left = sym.pins.filter((pin) => pin.side === "left");
|
||||
assert.ok(left[1].offset - left[0].offset >= 22);
|
||||
assert.ok(sym.body.width >= 96);
|
||||
assert.ok(sym.body.height >= 180);
|
||||
assert.ok(result.issues.some((issue) => issue.code === "symbol_geometry_adjusted"));
|
||||
});
|
||||