fix: show stale marker on the empty board
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
baaaeff917
commit
410eb82a02
2 files changed
+8
No files matched your search
@@ -68,6 +68,8 @@ def render_board(upcoming: list[Upcoming], now: datetime, fonts: dict, stale: bo
|
|||||||
|
|
||||||
if not upcoming:
|
if not upcoming:
|
||||||
d.text((W // 2, H // 2), "Žádné odjezdy", font=fonts["hero_stop"], fill=TEXT_DIM, anchor="mm")
|
d.text((W // 2, H // 2), "Žádné odjezdy", font=fonts["hero_stop"], fill=TEXT_DIM, anchor="mm")
|
||||||
|
if stale:
|
||||||
|
d.text((16, H - 12), "jízdní řád zastaralý", font=fonts["hero_small"], fill=ACCENT, anchor="lm")
|
||||||
return img
|
return img
|
||||||
|
|
||||||
first = upcoming[0]
|
first = upcoming[0]
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ def test_empty_board_shows_message_not_badge(fonts):
|
|||||||
assert img.tobytes() != blank.tobytes() # the "Žádné odjezdy" text was drawn
|
assert img.tobytes() != blank.tobytes() # the "Žádné odjezdy" text was drawn
|
||||||
|
|
||||||
|
|
||||||
|
def test_empty_board_stale_marker_appears(fonts):
|
||||||
|
fresh = board.render_board([], NOW, fonts, stale=False).tobytes()
|
||||||
|
stale = board.render_board([], NOW, fonts, stale=True).tobytes()
|
||||||
|
assert fresh != stale
|
||||||
|
|
||||||
|
|
||||||
def test_single_departure_and_overflow_do_not_crash(fonts):
|
def test_single_departure_and_overflow_do_not_crash(fonts):
|
||||||
assert board.render_board(FIVE[:1], NOW, fonts).size == (480, 320)
|
assert board.render_board(FIVE[:1], NOW, fonts).size == (480, 320)
|
||||||
many = FIVE * 3 # more than the board can show
|
many = FIVE * 3 # more than the board can show
|
||||||
|
|||||||
Reference in new issue
Block a user