mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-16 20:02:20 +02:00
Photoshop-parity editor client: layers, selection/masking, brushes,
smart filters, LUT import, Quick Edit, mobile gestures, workspaces,
batch operations, and the service-worker versioning (v978->v1006).
Source: vendor/photocraft (ad1cff44) photo-editor client files, merged
onto upstream/dev (a8c147b2). Conflict resolution documented in
pr_work/A_conflicts.md; editor files taken from vendor/photocraft
(upstream's editor is an earlier snapshot of the same feature).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.0 KiB
JavaScript
49 lines
2.0 KiB
JavaScript
const { test, expect } = require('@playwright/test');
|
|
const { selectTool } = require('./helpers.js');
|
|
const { openBlankEditor } = require('./helpers.js');
|
|
|
|
test('brush cursor matches the rendered brush diameter and replaces the crosshair', async ({ page }) => {
|
|
await openBlankEditor(page, { width: 400, height: 300 });
|
|
await selectTool(page, 'brush');
|
|
|
|
await page.evaluate(async () => {
|
|
const { state } = await import('/static/js/editor/state.js');
|
|
state.brushSize = 80;
|
|
});
|
|
|
|
const canvas = page.locator('.ge-main-canvas');
|
|
const canvasBox = await canvas.boundingBox();
|
|
await page.mouse.move(canvasBox.x + canvasBox.width / 2, canvasBox.y + canvasBox.height / 2);
|
|
|
|
const cursor = page.locator('.ge-brush-cursor');
|
|
await expect(cursor).toBeVisible();
|
|
await expect(canvas).toHaveCSS('cursor', 'none');
|
|
|
|
const measurements = await page.evaluate(() => {
|
|
const canvasEl = document.querySelector('.ge-main-canvas');
|
|
const cursorEl = document.querySelector('.ge-brush-cursor');
|
|
const canvasRect = canvasEl.getBoundingClientRect();
|
|
const cursorRect = cursorEl.getBoundingClientRect();
|
|
return {
|
|
expectedWidth: 80 * canvasRect.width / canvasEl.width,
|
|
expectedHeight: 80 * canvasRect.height / canvasEl.height,
|
|
cursorWidth: cursorRect.width,
|
|
cursorHeight: cursorRect.height,
|
|
cursorZ: Number(getComputedStyle(cursorEl).zIndex),
|
|
galleryZ: Number(getComputedStyle(document.getElementById('gallery-modal')).zIndex || 0),
|
|
};
|
|
});
|
|
|
|
expect(measurements.cursorWidth).toBeCloseTo(measurements.expectedWidth, 1);
|
|
expect(measurements.cursorHeight).toBeCloseTo(measurements.expectedHeight, 1);
|
|
expect(measurements.cursorZ).toBeGreaterThan(measurements.galleryZ);
|
|
|
|
await page.evaluate(async () => {
|
|
const { state } = await import('/static/js/editor/state.js');
|
|
state.brushSize = 160;
|
|
});
|
|
await page.mouse.move(canvasBox.x + canvasBox.width / 2 + 1, canvasBox.y + canvasBox.height / 2);
|
|
await expect.poll(async () => (await cursor.boundingBox()).width)
|
|
.toBeCloseTo(measurements.expectedWidth * 2, 1);
|
|
});
|