test: define final character HUD contracts

This commit is contained in:
goose
2026-10-09 12:21:45 -04:00
parent 78f4744c3f
commit c410f830e3
7 changed files with 193 additions and 91 deletions
+19 -1
View File
@@ -36,7 +36,25 @@ func test_real_hit_unlocks_reward_toast_journal_claim_and_title_refresh() -> voi
assert_string_contains((game.get_node("HUD/AchievementToast") as Label).text, "Premier coup")
assert_true(game.get_run_state().recent_events(game.get_run_state().log.size()).any(func(event: GameEvent) -> bool: return event.kind == &"achievement_unlocked"))
assert_eq(game.get_run_state().current_title_id, &"striker")
assert_string_contains((game.get_node("HUD/TitleLabel") as Label).text, "Frappeur")
var permanent_title := game.get_node_or_null("HUD/TitleLabel") as Label
var notification := game.get_node_or_null("HUD/TitleNotificationLabel") as Label
var notification_timer := game.get_node_or_null("HUD/TitleNotificationTimer") as Timer
assert_not_null(permanent_title)
assert_not_null(notification, "HUD requires a separate temporary TitleNotificationLabel")
assert_not_null(notification_timer, "HUD requires TitleNotificationTimer")
if permanent_title != null:
assert_eq(permanent_title.text, "Étage 0", "The permanent TopBar title remains the current floor")
if notification == null or notification_timer == null:
return
assert_true(notification.visible, "A newly earned title needs a temporary notification")
assert_eq(notification.text, "Frappeur")
assert_true(notification_timer.one_shot)
assert_eq(notification_timer.wait_time, 5.0)
notification_timer.timeout.emit()
await get_tree().process_frame
assert_false(notification.visible, "The title notification disappears at timeout")
if permanent_title != null:
assert_eq(permanent_title.text, "Étage 0")
await _dispatch_key(KEY_L)
assert_true(panel.visible)