Add a note text size option; document the printer cabled to stppi
CI / test (3.10) (push) Failing after 47s
CI / test (3.12) (push) Failing after 54s
CI / test (3.13) (push) Failing after 48s

- note --size 1|2|3 magnifies the text and wraps to 48/24/16 columns,
  then resets the printer to normal size
- Web page gets a Size menu defaulting to Large; the API validates it
- README/CLAUDE.md: the printer has no Wi-Fi (UB-E04 needs an adapter),
  so it is cabled to stppi's eth0 at 192.168.192.168

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-23 21:48:54 +01:00
co-authored by Claude Opus 5.5
parent f55b20fb82
commit 30d1b83817
7 changed files with 70 additions and 14 deletions
+15
View File
@@ -76,6 +76,21 @@ def test_note_prints(client, fake_printer):
assert fake_printer.calls[-2:] == [("cut", None), ("close", None)]
def test_note_size(client, fake_printer):
res = client.post("/api/note", headers=HEADERS, json={"text": "hello", "size": 3})
assert res.status_code == 200
assert ("set", {"custom_size": True, "width": 3, "height": 3}) in fake_printer.calls
@pytest.mark.parametrize("size", [0, 4])
def test_note_rejects_bad_size(client, fake_printer, size):
res = client.post("/api/note", headers=HEADERS, json={"text": "hi", "size": size})
assert res.status_code == 422
assert fake_printer.calls == []
@pytest.mark.parametrize("text", ["", " ", "x" * (receipt_web.MAX_NOTE_CHARS + 1)])
def test_note_rejects_empty_and_long(client, fake_printer, text):
res = client.post("/api/note", headers=HEADERS, json={"text": text})