fix(POSTV1-editor): 修复多选拖动与底图调整
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run

This commit is contained in:
suyx
2026-08-06 10:53:38 +08:00
parent 51d613f459
commit 83fe57f319
8 changed files with 310 additions and 14 deletions
+37 -1
View File
@@ -28,7 +28,8 @@ const session = {
user: { creator_name: "Canvas User", role: "user", social_id: "@canvas_user", status: "active", user_id: "00000000-0000-4000-8000-000000000501" },
};
const stickerRoot = process.env.DADA_STATIC_STICKER_ROOT ?? join(homedir(), "Desktop", "贴纸素材");
const stickerRoot = process.env.DADA_STATIC_STICKER_ROOT
?? join(homedir(), "Desktop", "sticker_web_replication_assets", "sticker_normal");
const originalStickerFixtures: Readonly<Record<string, string>> = {
STK001: join(stickerRoot, "sticker_part1", "01af6384c2a962d17f55736f9895b505.png"),
STK002: join(stickerRoot, "sticker_part2", "011db0fb6ac4184e4a708374003bce66.png"),
@@ -133,6 +134,41 @@ test("TDD-WP4-CAN-001 keeps fifty elements editable and blocks the fifty-first",
if (process.env.DADA_EVIDENCE_DIR_EDITOR_ELEMENTS) await page.screenshot({ fullPage: true, path: resolve(process.env.DADA_EVIDENCE_DIR_EDITOR_ELEMENTS, "TDD-WP4-CAN-001-fifty-elements", "fifty-elements.png") });
});
test("TDD-WP4-CAN-001 drags distant multi-selected objects as one group", async ({ page }) => {
const projectId = uuid(519);
const backend = {
canvas: canvas([sticker(1, { x: 0.2, y: 0.2 }, 0), sticker(2, { x: 0.8, y: 0.8 }, 1)]),
saves: 0,
version: 5,
};
await routeEditor(page, projectId, backend);
await page.goto(`${webUrl}/app/projects/${projectId}/editor`);
const stage = page.getByLabel("编辑画布");
const bounds = await stage.boundingBox();
if (!bounds) throw new Error("Canvas bounds unavailable.");
const point = (x: number, y: number) => ({ x: bounds.x + bounds.width * x, y: bounds.y + bounds.height * y });
await page.getByRole("button", { name: "多选模式" }).click();
await page.mouse.click(point(0.2, 0.2).x, point(0.2, 0.2).y);
await page.mouse.click(point(0.8, 0.8).x, point(0.8, 0.8).y);
await expect(page.getByRole("heading", { name: "已选 2 个对象" })).toBeVisible();
await page.mouse.move(point(0.2, 0.2).x, point(0.2, 0.2).y);
await page.mouse.down();
await page.mouse.move(point(0.3, 0.3).x, point(0.3, 0.3).y, { steps: 4 });
await page.mouse.up();
await expect.poll(() => backend.saves, { timeout: 4_000 }).toBeGreaterThan(0);
const [first, second] = backend.canvas.elements.map(({ position }) => position);
expect(first?.x).toBeCloseTo(0.3, 6);
expect(first?.y).toBeCloseTo(0.3, 6);
expect(second?.x).toBeCloseTo(0.9, 6);
expect(second?.y).toBeCloseTo(0.9, 6);
expect((first?.x ?? 0) - 0.2).toBeCloseTo((second?.x ?? 0) - 0.8, 10);
expect((first?.y ?? 0) - 0.2).toBeCloseTo((second?.y ?? 0) - 0.8, 10);
await expect(page.getByRole("heading", { name: "已选 2 个对象" })).toBeVisible();
});
test("TDD-WP4-STK-001 transforms, cycles, selects and reopens ordinary stickers", async ({ page }) => {
const projectId = uuid(520);
const backend = { canvas: canvas([sticker(1, { x: 0.5, y: 0.5 }, 0), sticker(2, { x: 0.5, y: 0.5 }, 1)]), saves: 0, version: 5 };