Skip to content

Commit cdbbdbb

Browse files
author
DavidQ
committed
Fix point rounding behavior wire Snap Angle and constrain snap icon color handling - PR_26133_082-rounding-checkbox-snap-angle-and-shape-tool-behavior
1 parent 7686786 commit cdbbdbb

3 files changed

Lines changed: 262 additions & 116 deletions

File tree

tests/playwright/tools/WorkspaceManagerV2.spec.mjs

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
22452245
expect(shapeGeometryOrder.noPointStyleHeading).toBe(true);
22462246
expect(shapeGeometryOrder.summaryItems).toEqual([
22472247
"Rectangle Geometry",
2248+
"Point Rounding",
22482249
"Group",
22492250
"None"
22502251
]);
@@ -4028,27 +4029,31 @@ test.describe("Workspace Manager V2 bootstrap", () => {
40284029
sectionGap: Number.parseFloat(getComputedStyle(list.closest(".object-vector-studio-v2__edit-panel--polygon")).gap)
40294030
}));
40304031
expect(polygonPointListLayout).toEqual({ headingMarginBottom: 0, headingMarginTop: 0, listGap: 5, maxHeight: "none", overflowY: "visible", sectionGap: 5 });
4031-
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-side-action]")).toHaveText(["Add Point"]);
4032+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-side-action]")).toHaveCount(0);
40324033
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails")).not.toContainText("Delete Point(s)");
40334034
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-round='true']")).toHaveCount(4);
4035+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-add='true']")).toHaveCount(4);
40344036
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-delete='true']")).toHaveCount(4);
40354037
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-select='true']")).toHaveCount(0);
40364038
await expect.poll(() => page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__polygon-point-field").evaluateAll((rows) => rows.map((row) => row.querySelectorAll("input[type='checkbox']").length))).toEqual([1, 1, 1, 1]);
40374039
const polygonPointRowLayoutState = await page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__polygon-point-field").first().evaluate((row) => {
4038-
const actions = row.querySelector(".object-vector-studio-v2__polygon-point-actions");
4040+
const header = row.parentElement.querySelector(".object-vector-studio-v2__polygon-point-header");
4041+
const headerCells = Array.from(header.children, (cell) => cell.textContent.trim());
40394042
return {
4040-
actionCellLast: row.lastElementChild === actions,
4041-
actionJustify: getComputedStyle(actions).justifyContent,
4043+
addAfterRound: row.children[4]?.matches("[data-polygon-point-add='true']") === true,
40424044
columnCount: getComputedStyle(row).gridTemplateColumns.split(" ").length,
4043-
deleteAfterRound: actions?.lastElementChild?.matches("[data-polygon-point-delete='true']") === true,
4044-
roundCheckboxes: actions?.querySelectorAll("[data-polygon-point-round='true']").length || 0
4045+
deleteAfterAdd: row.children[5]?.matches("[data-polygon-point-delete='true']") === true,
4046+
headerCells,
4047+
roundCheckboxColumn: row.children[3]?.querySelector("[data-polygon-point-round='true']") !== null,
4048+
roundCheckboxes: row.querySelectorAll("[data-polygon-point-round='true']").length
40454049
};
40464050
});
40474051
expect(polygonPointRowLayoutState).toEqual({
4048-
actionCellLast: true,
4049-
actionJustify: "flex-end",
4050-
columnCount: 4,
4051-
deleteAfterRound: true,
4052+
addAfterRound: true,
4053+
columnCount: 6,
4054+
deleteAfterAdd: true,
4055+
headerCells: ["", "", "", "Round", "+", "Trash"],
4056+
roundCheckboxColumn: true,
40524057
roundCheckboxes: 1
40534058
});
40544059
await page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-round='true'][data-polygon-point-index='1']").check();
@@ -4070,8 +4075,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
40704075
pointRounding: [false, true, false, false],
40714076
strokeLinejoin: "miter"
40724077
});
4073-
await page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__polygon-point-label").nth(1).click();
4074-
await page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-side-action='add']").click();
4078+
await page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-add='true'][data-polygon-point-index='1']").click();
40754079
await expect.poll(() => page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__polygon-point-field").evaluateAll((rows) => rows.map((row) => ({
40764080
label: row.querySelector(".object-vector-studio-v2__polygon-point-label").textContent.trim(),
40774081
rounded: row.querySelector("[data-polygon-point-round='true']").checked,
@@ -4081,12 +4085,13 @@ test.describe("Workspace Manager V2 bootstrap", () => {
40814085
})))).toEqual([
40824086
{ label: "Point 1", rounded: false, x: "0", y: "-18", selected: false },
40834087
{ label: "Point 2", rounded: true, x: "14", y: "16", selected: false },
4084-
{ label: "Point 3", rounded: false, x: "7", y: "12", selected: false },
4088+
{ label: "Point 3", rounded: true, x: "14", y: "16", selected: false },
40854089
{ label: "Point 4", rounded: false, x: "0", y: "8", selected: false },
40864090
{ label: "Point 5", rounded: false, x: "-14", y: "16", selected: false }
40874091
]);
4088-
await expect(page.locator("#statusLog")).toHaveValue(/OK Added point to shape row 0\./);
4092+
await expect(page.locator("#statusLog")).toHaveValue(/OK Added copied point after point 2 for shape row 0\./);
40894093
await expect.poll(() => page.evaluate(() => window.__objectVectorStudioV2App.selectedShape().geometry.points.length)).toBe(5);
4094+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-add='true']")).toHaveCount(5);
40904095
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-delete='true']")).toHaveCount(5);
40914096
await expect.poll(() => page.evaluate(() => window.__objectVectorStudioV2App.schemaService.validatePayload(window.__objectVectorStudioV2App.currentPayload).ok)).toBe(true);
40924097
await page.locator("#objectVectorStudioV2ShapeGeometryDetails [data-polygon-point-delete='true'][data-polygon-point-index='2']").click();
@@ -4425,6 +4430,49 @@ test.describe("Workspace Manager V2 bootstrap", () => {
44254430
shapeIndex: 4,
44264431
wideFields: ["r"]
44274432
});
4433+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-round='true']")).toHaveCount(2);
4434+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-add='true']")).toHaveCount(0);
4435+
await expect(page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-delete='true']")).toHaveCount(0);
4436+
await page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-round='true'][data-polygon-point-index='0']").check();
4437+
await expect(page.locator("#statusLog")).toHaveValue(/OK Updated point 1 rounding to round for shape row 4\./);
4438+
const arcStartRoundedState = await page.locator("#objectVectorStudioV2RenderSurface [data-shape-index='4']").evaluate((shape) => {
4439+
const markers = Array.from(document.querySelectorAll("#objectVectorStudioV2RenderSurface [data-point-style-caps='arc'] [data-point-style-cap]")).map((marker) => ({
4440+
id: marker.dataset.pointStyleCap,
4441+
style: marker.dataset.pointStyle
4442+
}));
4443+
return {
4444+
end: shape.dataset.endPointStyle,
4445+
markers,
4446+
pointRounding: window.__objectVectorStudioV2App.selectedShape().style.pointRounding,
4447+
start: shape.dataset.startPointStyle,
4448+
strokeLinecap: shape.getAttribute("stroke-linecap")
4449+
};
4450+
});
4451+
expect(arcStartRoundedState).toEqual({
4452+
end: "square",
4453+
markers: [
4454+
{ id: "start", style: "round" },
4455+
{ id: "end", style: "square" }
4456+
],
4457+
pointRounding: [true, false],
4458+
start: "round",
4459+
strokeLinecap: "butt"
4460+
});
4461+
await page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-round='true'][data-polygon-point-index='1']").check();
4462+
await page.locator("#objectVectorStudioV2ShapeGeometryDetails .object-vector-studio-v2__point-rounding-list [data-polygon-point-round='true'][data-polygon-point-index='0']").uncheck();
4463+
await expect(page.locator("#statusLog")).toHaveValue(/OK Updated point 1 rounding to square for shape row 4\./);
4464+
const arcEndRoundedState = await page.locator("#objectVectorStudioV2RenderSurface [data-shape-index='4']").evaluate((shape) => ({
4465+
end: shape.dataset.endPointStyle,
4466+
pointRounding: window.__objectVectorStudioV2App.selectedShape().style.pointRounding,
4467+
start: shape.dataset.startPointStyle,
4468+
strokeLinecap: shape.getAttribute("stroke-linecap")
4469+
}));
4470+
expect(arcEndRoundedState).toEqual({
4471+
end: "round",
4472+
pointRounding: [false, true],
4473+
start: "square",
4474+
strokeLinecap: "butt"
4475+
});
44284476
await expectGeometryLayout({
44294477
heading: "Text Geometry",
44304478
order: ["x", "y", "fontSize", "text"],

0 commit comments

Comments
 (0)