Add a note text size option; document the printer cabled to stppi
- 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:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user