Owner review 2026-11-23 of every widget: - A widget card is its main settings (the row and what needs room under it: pictures, a gallery's pictures or folder, weather details and place, a countdown's start and end, reviews' stars and author, a scrolling text's speed, a shape's colours and border, QR caption), then "Text and colours" (new LookFields.jsx: text colour, plate, font, style, size, weight, highlight, shadow, QR colours; a logo's / gallery's border), then More settings (opacity, rotation, animation, fit, typing, blink, QR logo; shadow / border only where there is no Text and colours). - Date format / separator and clock 12/24 / separator are main settings. - Alignment only where it lines something up; the TV now aligns the lines of a text, the hours (centre: days and times meet in the middle), contact rows, Wi-Fi (code left / right / above), the weather's column / card / list / hourly, reviews (stars too), a countdown, a QR caption. - Text and message: a 2-line textarea in its own row; Enter makes new lines (the TV sizes by the longest line and the number of lines). - Gallery: a title above or below the pictures (title_position). - A widget's box may reach 400 % of the slide (a logo zoomed in past the slide's edges saved again). - "Auto" stays "Auto" in Greek; scrolling text Left / Right; reviews' stars choice no longer clipped; countdown "When it ends" hint as an info tip (fields level). Calibration: an edge may go past the recognised window (down to -2000 px); the dialog's rows are centred, "Each click moves" sits above its choice, the window size is labelled "Recognised resolution" with what it means; the TV asks for its screen answer on every calibrate event and while calibrating (the outline shows the first time), the dialog sends "on" again after 1.5 s. NumberInput takes a leading minus when min < 0. E2E: waits for the Add-a-slide dialog to go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
74 lines
5.3 KiB
Python
74 lines
5.3 KiB
Python
"""Slide shapes and a screen's picture (6R.13, owner 2026-11-22): custom shapes for playlists and
|
|
library slides, a screen's picture area (insets) and fit, calibrating told to that screen only,
|
|
the window size a screen reports."""
|
|
from tests.test_live import err, owner_h, pair # noqa: F401 (fixtures)
|
|
from tests.test_signage import playlist, screens, sent, slide # noqa: F401 (fixtures + helpers)
|
|
|
|
|
|
def test_custom_shapes_for_playlists_and_library_slides(client, owner_h):
|
|
p = playlist(client, owner_h, aspect="21:9")
|
|
assert (p["orientation"], p["aspect"]) == ("landscape", "21:9")
|
|
r = client.put(f"/api/signage/playlists/{p['id']}", headers=owner_h, json={"aspect": "10:16"})
|
|
assert (r.json()["orientation"], r.json()["aspect"]) == ("portrait", "10:16")
|
|
# the plain shapes are landscape / portrait; picking one drops a custom shape
|
|
r = client.put(f"/api/signage/playlists/{p['id']}", headers=owner_h, json={"aspect": "16:9"})
|
|
assert (r.json()["orientation"], r.json()["aspect"]) == ("landscape", None)
|
|
client.put(f"/api/signage/playlists/{p['id']}", headers=owner_h, json={"aspect": "32:9"})
|
|
r = client.put(f"/api/signage/playlists/{p['id']}", headers=owner_h, json={"orientation": "portrait"})
|
|
assert (r.json()["orientation"], r.json()["aspect"]) == ("portrait", None)
|
|
for bad in ("21x9", "9:1", "0:5"):
|
|
assert client.put(f"/api/signage/playlists/{p['id']}", headers=owner_h, json={"aspect": bad}).status_code == 422
|
|
dup = client.post(f"/api/signage/playlists/{p['id']}/duplicate", headers=owner_h).json()
|
|
assert dup["orientation"] == "portrait"
|
|
s = client.post("/api/signage/library", headers=owner_h, json={"name": "Wide", "kind": "text", "aspect": "16:10"}).json()
|
|
assert (s["orientation"], s["aspect"]) == ("landscape", "16:10")
|
|
r = client.put(f"/api/signage/library/{s['id']}", headers=owner_h, json={"aspect": None, "orientation": "portrait"})
|
|
assert (r.json()["orientation"], r.json()["aspect"]) == ("portrait", None)
|
|
|
|
|
|
def test_a_screens_picture_area_and_calibration(client, owner_h, screens, sent):
|
|
tv, other = screens[1], screens[2]
|
|
p = playlist(client, owner_h, aspect="21:9")
|
|
slide(client, owner_h, p["id"], "text", content={"title": "Wide"})
|
|
client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"playlist_id": p["id"]})
|
|
got = client.get("/api/signage/screen", headers=tv["h"]).json()
|
|
assert got["playlist"]["aspect"] == "21:9" and got["screen"]["fit"] == "keep" and got["screen"]["calibrating"] is False
|
|
# the TV reports its window; the manager sees it
|
|
assert client.post("/api/signage/screen/viewport", headers=tv["h"], json={"width": 2560, "height": 1080, "ratio": 1}).status_code == 200
|
|
one = next(s for s in client.get("/api/signage/screens", headers=owner_h).json() if s["id"] == tv["id"])
|
|
assert one["viewport"] == {"width": 2560, "height": 1080, "ratio": 1.0} and one["area"] == {"left": 0, "top": 0, "right": 0, "bottom": 0}
|
|
# calibrating: only that TV hears it, with its area; every change of the insets follows at once
|
|
sent.clear()
|
|
r = client.post(f"/api/signage/screens/{tv['id']}/calibrate", headers=owner_h, json={"on": True})
|
|
assert r.json()["calibrating"] is True and sent == [("signage.calibrate", [tv["id"]])]
|
|
sent.clear()
|
|
r = client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"area_left": 320, "area_right": 320, "fit": "stretch"})
|
|
assert r.json()["area"] == {"left": 320, "top": 0, "right": 320, "bottom": 0} and r.json()["fit"] == "stretch"
|
|
assert sent[0] == ("signage.calibrate", [tv["id"]]) and ("signage.changed", [tv["id"]]) in sent
|
|
scr = client.get("/api/signage/screen", headers=tv["h"]).json()["screen"]
|
|
assert scr["area"]["left"] == 320 and scr["calibrating"] is True
|
|
sent.clear()
|
|
client.post(f"/api/signage/screens/{tv['id']}/calibrate", headers=owner_h, json={"on": False})
|
|
assert sent == [("signage.calibrate", [tv["id"]])]
|
|
sent.clear()
|
|
client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"area_top": 5})
|
|
assert ("signage.calibrate", [tv["id"]]) not in sent
|
|
# limits; not a screen
|
|
assert client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"area_left": 5000}).status_code == 422
|
|
# owner 2026-11-23: an edge may reach past the window the TV reported (its real picture is larger)
|
|
r = client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"area_left": -60, "area_top": 0})
|
|
assert r.status_code == 200 and r.json()["area"]["left"] == -60
|
|
assert client.put(f"/api/signage/screens/{tv['id']}", headers=owner_h, json={"area_left": -2001}).status_code == 422
|
|
assert err(client.post("/api/signage/screens/99999/calibrate", headers=owner_h, json={"on": True})) == "signage.not_a_screen"
|
|
# a screen can't calibrate itself or report for another
|
|
assert client.post(f"/api/signage/screens/{other['id']}/calibrate", headers=tv["h"], json={"on": True}).status_code in (401, 403)
|
|
|
|
|
|
def test_calibration_ends_by_itself(client, owner_h, screens, monkeypatch):
|
|
import routers.signage as sg
|
|
tv = screens[1]
|
|
client.post(f"/api/signage/screens/{tv['id']}/calibrate", headers=owner_h, json={"on": True})
|
|
assert sg.calibrating(tv["id"]) is True
|
|
sg._calibrating[tv["id"]] -= sg.CALIBRATE_S + 1
|
|
assert client.get("/api/signage/screen", headers=tv["h"]).json()["screen"]["calibrating"] is False
|