Files
odysseus/tests/test_editor_swatches_picker.py
T
pewdiepie-archdaemonandClaude Opus 5.5 5fac693c1c 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>
2026-10-15 11:57:35 +00:00

41 lines
1.7 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
PANELS = ROOT / "static/js/editor/panels/panels.js"
CSS = ROOT / "static/css/13-image-editor.css"
GALLERY = ROOT / "static/js/galleryEditor.js"
def test_swatches_panel_has_inline_picker():
src = PANELS.read_text(encoding="utf-8")
# The SWATCHES panel exposes an always-visible SV square + hue strip instead
# of only the click-to-open shared popover (never visible in a dock shot).
assert "ge-inline-picker" in src
assert "const sl = el('div', 'cp-sl');" in src
assert "const hue = el('div', 'cp-hue');" in src
# Local HSV<->hex math keeps the panel independent of colorPicker internals.
assert "function hexToHsv(" in src
assert "function hsvToHex(" in src
# Dragging the SV square / hue writes through to the document colour.
assert "startDrag('sl', sl)" in src
assert "startDrag('hue', hue)" in src
assert "_syncForeground(hex);" in src
# The picker follows the document colour when it changes elsewhere.
assert "setPickerFromColor(state.color || colorInput.value || '#000000');" in src
def test_inline_picker_css_reuses_shared_picker_classes():
css = CSS.read_text(encoding="utf-8")
assert ".ge-inline-picker {" in css
assert ".ge-inline-picker .cp-sl {" in css
# The swatch body wraps so the picker sits below the trigger + suggestions.
assert ".ge-swatch-body { flex-wrap: wrap; }" in css
def test_color_group_is_tall_enough_for_the_picker():
src = GALLERY.read_text(encoding="utf-8")
# The dock group clips to groupSize; the Color group now fits the picker so
# it is not scrolled out of view.
assert "groupSize: 268" in src