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>
45 lines
1.9 KiB
JavaScript
45 lines
1.9 KiB
JavaScript
const { test, expect } = require('@playwright/test');
|
|
const { selectTool } = require('./helpers.js');
|
|
const { dragOnCanvas, editorState, openBlankEditor } = require('./helpers.js');
|
|
|
|
async function mainCanvasHash(page) {
|
|
return page.evaluate(() => {
|
|
const canvas = document.querySelector('.ge-main-canvas');
|
|
const data = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height).data;
|
|
let hash = 2166136261;
|
|
for (let index = 0; index < data.length; index += 4) {
|
|
hash ^= data[index];
|
|
hash = Math.imul(hash, 16777619);
|
|
hash ^= data[index + 1];
|
|
hash = Math.imul(hash, 16777619);
|
|
hash ^= data[index + 2];
|
|
hash = Math.imul(hash, 16777619);
|
|
hash ^= data[index + 3];
|
|
hash = Math.imul(hash, 16777619);
|
|
}
|
|
return hash >>> 0;
|
|
});
|
|
}
|
|
|
|
test('before compare is visual-only and toggles back to the edited document', async ({ page }) => {
|
|
await openBlankEditor(page, { width: 240, height: 180 }, 'Compare mode E2E');
|
|
await expect(page.locator('#ge-compare-btn')).toBeVisible();
|
|
await expect.poll(async () => (await editorState(page)).documentRenderReady).toBe(true);
|
|
|
|
const baselineHash = await mainCanvasHash(page);
|
|
await selectTool(page, 'brush');
|
|
await dragOnCanvas(page, { x: 0.2, y: 0.3 }, { x: 0.8, y: 0.7 });
|
|
const editedState = await editorState(page);
|
|
const editedHash = await mainCanvasHash(page);
|
|
expect(editedHash).not.toBe(baselineHash);
|
|
|
|
await page.locator('#ge-compare-btn').click();
|
|
await expect(page.locator('#ge-compare-btn')).toHaveAttribute('aria-pressed', 'true');
|
|
expect(await mainCanvasHash(page)).toBe(baselineHash);
|
|
expect((await editorState(page)).layers).toEqual(editedState.layers);
|
|
|
|
await page.locator('#ge-compare-btn').click();
|
|
await expect(page.locator('#ge-compare-btn')).toHaveAttribute('aria-pressed', 'false');
|
|
expect(await mainCanvasHash(page)).toBe(editedHash);
|
|
});
|