CHANGE -> CHANGE BACK

This commit is contained in:
scgbckbone 2025-06-03 11:19:54 +02:00 committed by doc-hex
parent 0a899727b5
commit efb445fbe3
3 changed files with 26 additions and 9 deletions

View File

@ -398,7 +398,7 @@ class Display:
y += 8
if is_addr and is_change:
self.text(x+4, y+8, "CHANGE", FontTiny)
self.text(x+4, y+8, "CHANGE BACK", FontTiny)
else:
# hand-positioned for known cases
# - sidebar = (text, #of char per line)

View File

@ -775,8 +775,11 @@ class Display:
self.text(-1, 0, idx_hint)
if is_addr and is_change:
for i, c in enumerate("CHANGE"):
self.text(0, i, c)
for i, c in enumerate("CHANGE", start=4):
self.text(1, i, c)
for i, c in enumerate("BACK", start=6):
self.text(-1, i, c)
# pass a max brightness flag here, which will be cleared after next show
self.show(max_bright=True)

View File

@ -619,21 +619,35 @@ def verify_qr_address(cap_screen_qr, cap_screen, is_q1):
# - insists on some spaces
full = cap_screen()
if is_q1:
full_split = full.split("\n")
if is_change:
for c, line in zip("CHANGE", full.split('\n')):
assert line.startswith(c)
for i, (c, line) in enumerate(zip("XXXXCHANGE", full_split)):
if i > 3:
assert line.startswith(c)
else:
assert not line.startswith(c)
for i, (c, line) in enumerate(zip("XXXXXXBACK", full_split)):
if i > 5:
assert line.endswith(c)
else:
assert not line.endswith(c)
elif is_change is False:
for c, line in zip("CHANGE", full.split('\n')):
for c, line in zip("XXXXCHANGE", full_split):
assert not line.startswith(c)
for c, line in zip("XXXXXXBACK", full_split):
assert not line.endswith(c)
txt = ''.join(l for l in full.split() if len(l)>4).replace('~', '')
else:
if is_change:
assert "CHANGE" in full
assert "CHANGE BACK" in full
elif is_change is False:
assert "CHANGE" not in full
assert "CHANGE BACK" not in full
txt = ''.join(full.split()).replace('CHANGE', '')
txt = ''.join(full.split("\n")).replace('CHANGE BACK', '')
if txt:
assert txt == qr