Improve fit/focus viewport behavior and add viewport QA coverage
No files matched your search
|
Before Width: | Height: | Size: 229 KiB After Width: | Height: | Size: 230 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 255 KiB |
|
Before Width: | Height: | Size: 170 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 164 KiB After Width: | Height: | Size: 165 KiB |
@@ -127,6 +127,11 @@ function parseStatusMetrics(statusText) {
|
||||
};
|
||||
}
|
||||
|
||||
function parseZoomPercent(text) {
|
||||
const m = /(\d+)%/.exec(String(text ?? ""));
|
||||
return m ? Number(m[1]) : NaN;
|
||||
}
|
||||
|
||||
async function run() {
|
||||
await ensureDirs();
|
||||
const port = await getFreePort();
|
||||
@@ -143,6 +148,12 @@ async function run() {
|
||||
|
||||
await page.getByRole("button", { name: /Instance U2, symbol dac_i2s/ }).click();
|
||||
await expectText(page, "#selectedSummary", /U2 \(dac_i2s\)/);
|
||||
const preFocusZoom = parseZoomPercent(await page.locator("#zoomResetBtn").textContent());
|
||||
await page.getByRole("button", { name: "Focus current selection" }).click();
|
||||
const postFocusZoom = parseZoomPercent(await page.locator("#zoomResetBtn").textContent());
|
||||
assert.ok(Number.isFinite(preFocusZoom) && Number.isFinite(postFocusZoom), "zoom label should remain parseable");
|
||||
assert.ok(postFocusZoom >= preFocusZoom, `focus should not zoom out selected view (${preFocusZoom}% -> ${postFocusZoom}%)`);
|
||||
await page.getByRole("button", { name: "Reset view" }).click();
|
||||
await compareScene(page, "selected-u2");
|
||||
|
||||
await page.locator("#canvasViewport").click({ position: { x: 40, y: 40 } });
|
||||
@@ -200,6 +211,12 @@ async function run() {
|
||||
assert.ok(metrics.crossings <= 2, `dense analog crossings too high: ${metrics.crossings}`);
|
||||
assert.ok(metrics.overlaps <= 2, `dense analog overlaps too high: ${metrics.overlaps}`);
|
||||
await compareScene(page, "dense-analog");
|
||||
|
||||
await page.setViewportSize({ width: 1280, height: 720 });
|
||||
await page.getByRole("button", { name: "Fit schematic to viewport" }).click();
|
||||
await expectText(page, "#compileStatus", /Compiled/);
|
||||
assert.ok(await page.locator("#applyJsonBtn").isVisible(), "Apply JSON button should remain visible at laptop viewport");
|
||||
await compareScene(page, "laptop-viewport");
|
||||
} finally {
|
||||
await page.close().catch(() => {});
|
||||
await browser.close().catch(() => {});
|
||||
|
||||