- 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]>
42 lines
931 B
Python
42 lines
931 B
Python
"""Shared test fakes."""
|
|
|
|
import argparse
|
|
|
|
|
|
class FakePrinter:
|
|
"""Records escpos calls instead of talking to hardware."""
|
|
|
|
def __init__(self):
|
|
self.calls = []
|
|
|
|
def textln(self, text=""):
|
|
self.calls.append(("textln", text))
|
|
|
|
def image(self, img, **kwargs):
|
|
self.calls.append(("image", img))
|
|
|
|
def qr(self, content, **kwargs):
|
|
self.calls.append(("qr", content))
|
|
|
|
def set(self, **kwargs):
|
|
self.calls.append(("set", kwargs))
|
|
|
|
def cut(self):
|
|
self.calls.append(("cut", None))
|
|
|
|
def close(self):
|
|
self.calls.append(("close", None))
|
|
|
|
|
|
def make_args(**overrides):
|
|
defaults = {
|
|
"usb": True, # avoids the network setup script in tests
|
|
"ip": "192.168.192.168",
|
|
"port": 9100,
|
|
"timestamp": False,
|
|
"message": None,
|
|
"name": None,
|
|
}
|
|
defaults.update(overrides)
|
|
return argparse.Namespace(**defaults)
|