mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-19 21:32:24 +02:00
feat(photo-editor): Ajax Image Editor client (Photoshop-parity tools)
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c74f475679
commit
5fac693c1c
@@ -0,0 +1,71 @@
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def read(rel):
|
||||
return (ROOT / rel).read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_psd_module_has_layered_codec():
|
||||
src = read("static/js/editor/psd.js")
|
||||
for token in [
|
||||
"export function encodeLayeredPsd(",
|
||||
"export function decodeLayeredPsd(",
|
||||
"blendRgbaInto",
|
||||
"rgbaToPlanes",
|
||||
]:
|
||||
assert token in src
|
||||
|
||||
|
||||
def test_psd_module_reads_and_writes_psb_version_2():
|
||||
src = read("static/js/editor/psd.js")
|
||||
for token in [
|
||||
"version !== 1 && version !== 2",
|
||||
"const psb = version === 2;",
|
||||
"const longLen = psb ? 8 : 4;",
|
||||
"readSection(view, bytes, offset, psb)",
|
||||
"psb = false",
|
||||
"writeUint16(view, 4, psb ? 2 : 1)",
|
||||
"setBigUint64",
|
||||
]:
|
||||
assert token in src
|
||||
|
||||
|
||||
def test_gallery_uses_psb_for_large_documents():
|
||||
src = read("static/js/galleryEditor.js")
|
||||
assert "state.imgWidth > 30000 || state.imgHeight > 30000" in src
|
||||
assert "layers: descriptors, psb" in src
|
||||
assert "edited-image.psb" in src
|
||||
|
||||
|
||||
def test_topbar_file_menu_exports_layered_psd():
|
||||
src = read("static/js/editor/build/topbar.js")
|
||||
assert 'data-file-action="export-psd"' in src
|
||||
|
||||
|
||||
def test_wire_extra_menus_dispatches_export_psd():
|
||||
src = read("static/js/editor/wire-extra-menus.js")
|
||||
assert "action === 'export-psd'" in src
|
||||
assert "exportLayeredPsd" in src
|
||||
|
||||
|
||||
def test_gallery_exports_layered_psd():
|
||||
src = read("static/js/galleryEditor.js")
|
||||
for token in [
|
||||
"_blendKeyFor",
|
||||
"_exportLayeredPsd",
|
||||
"_encodeLayeredPsd",
|
||||
"exportLayeredPsd: () => _exportLayeredPsd()",
|
||||
]:
|
||||
assert token in src
|
||||
|
||||
|
||||
def test_import_handles_layered_psd():
|
||||
src = read("static/js/editor/wire-import.js")
|
||||
for token in [
|
||||
"decodeLayeredPsd",
|
||||
"handleImportedLayers",
|
||||
"PSD_BLEND",
|
||||
]:
|
||||
assert token in src
|
||||
Reference in New Issue
Block a user