mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-17 04:12: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,40 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
EDITOR = ROOT / "static/js/galleryEditor.js"
|
||||
|
||||
|
||||
def _selection_block(src):
|
||||
start = src.index("// --- Selection commands (deterministic, no model call) ---")
|
||||
end = src.index("if (/\\bsubject\\b|\\bperson\\b|\\bpeople\\b/.test(p)) {", start)
|
||||
return src[start:end]
|
||||
|
||||
|
||||
def test_cut_and_delete_selection_are_deterministic_local_ops():
|
||||
src = EDITOR.read_text(encoding="utf-8")
|
||||
block = _selection_block(src)
|
||||
assert "if (/\\bcut\\b/.test(p)) {" in block
|
||||
assert "await _runQuickControlOp('selection.copy', { cut: true });" in block
|
||||
assert "if (/\\bdelete\\b/.test(p)) {" in block
|
||||
assert "await _runQuickControlOp('selection.delete', {});" in block
|
||||
|
||||
|
||||
def test_fill_selection_uses_the_marquee_not_a_centre_flood():
|
||||
src = EDITOR.read_text(encoding="utf-8")
|
||||
fill_start = src.index("if (/\\bfill\\b|\\bflood\\s*fill\\b|\\bpaint\\s*bucket\\b/.test(p) && (fillWith || _fillFgBg)) {")
|
||||
fill_block = src[fill_start:src.index("// --- Selection commands", fill_start)]
|
||||
sel_branch = fill_block.index("if (/\\bselection\\b|\\bselected\\b/.test(p) && state.wandMask) {")
|
||||
sky_branch = fill_block.index("if (/\\bsky\\b/.test(p)) {")
|
||||
assert sel_branch < sky_branch
|
||||
assert "await _runQuickControlOp('selection.fill', { color });" in fill_block
|
||||
assert "await _runQuickControlOp('selection.sky', {});" in fill_block
|
||||
|
||||
|
||||
def test_cut_and_delete_come_after_contract_and_before_subject():
|
||||
src = EDITOR.read_text(encoding="utf-8")
|
||||
contract = src.index("if (/\\bcontract\\b|\\bshrink\\b|\\btighten\\b|\\breduce\\b/.test(p)) {")
|
||||
cut = src.index("if (/\\bcut\\b/.test(p)) {")
|
||||
delete = src.index("if (/\\bdelete\\b/.test(p)) {")
|
||||
subject = src.index("if (/\\bsubject\\b|\\bperson\\b|\\bpeople\\b/.test(p)) {", delete)
|
||||
assert contract < cut < delete < subject
|
||||
Reference in New Issue
Block a user