diff --git a/board.py b/board.py index b87adfe..5688a53 100644 --- a/board.py +++ b/board.py @@ -68,6 +68,8 @@ def render_board(upcoming: list[Upcoming], now: datetime, fonts: dict, stale: bo if not upcoming: 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 first = upcoming[0] diff --git a/tests/test_board.py b/tests/test_board.py index 49523df..b5f7688 100644 --- a/tests/test_board.py +++ b/tests/test_board.py @@ -63,6 +63,12 @@ def test_empty_board_shows_message_not_badge(fonts): 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): assert board.render_board(FIVE[:1], NOW, fonts).size == (480, 320) many = FIVE * 3 # more than the board can show