test: define final character HUD contracts
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -15,5 +15,5 @@ func test_current_game_event_and_hud_remain_available_with_attributes_domain_loa
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
assert_eq(state.enemies[&"goblin"].hit_points, 3)
|
||||
assert_true(game.get_run_state().recent_events(2).any(func(event: GameEvent) -> bool: return event.kind == &"melee"))
|
||||
assert_true(hud.player_health_label.text.contains("PV du joueur :"))
|
||||
assert_eq(hud.player_health_label.text, "PV : %d/%d" % [state.player.hit_points, state.player.max_hit_points])
|
||||
assert_true(hud.event_log.get_parsed_text().contains("Vous frappez le gobelin"))
|
||||
|
||||
@@ -30,10 +30,26 @@ func test_real_character_input_opens_panel_and_allocates_level_up_points_without
|
||||
assert_eq(xp_bar.max_value, 200.0)
|
||||
assert_eq(xp_label.text, "Niveau 2 — XP 0/200")
|
||||
|
||||
await _dispatch_key(KEY_P)
|
||||
var panel := game.get_node("HUD/CharacterPanel") as PanelContainer
|
||||
assert_true(panel.visible)
|
||||
assert_string_contains((panel.get_node("Body") as RichTextLabel).get_parsed_text(), "Level 2")
|
||||
game.get_run_state().player_name = "Dame Ysabel"
|
||||
await _dispatch_key(KEY_P)
|
||||
assert_false(panel.visible, "P must no longer open the character sheet")
|
||||
await _dispatch_key(KEY_C)
|
||||
assert_true(panel.visible, "The physical C key opens the character sheet")
|
||||
var sheet_text := (panel.get_node("Body") as RichTextLabel).get_parsed_text()
|
||||
assert_string_contains(sheet_text, "Nom : Dame Ysabel")
|
||||
assert_string_contains(sheet_text, "Titre : Bleu du Donjon")
|
||||
assert_string_contains(sheet_text, "Vous n'avez encore rien prouve.")
|
||||
assert_string_contains(sheet_text, "Niveau 2")
|
||||
assert_string_contains(sheet_text, "XP")
|
||||
assert_string_contains(sheet_text, "Points d’attribut")
|
||||
assert_string_contains(sheet_text, "Points de compétence")
|
||||
for attribute_name: String in ["Force", "Agilité", "Endurance", "Perception", "Intelligence", "Volonté", "Charisme", "Chance"]:
|
||||
assert_string_contains(sheet_text, attribute_name, "The sheet must list %s" % attribute_name)
|
||||
for skill_name: String in ["Compétences principales", "Corps à corps", "Distance", "Esquive"]:
|
||||
assert_string_contains(sheet_text, skill_name, "The sheet must list %s" % skill_name)
|
||||
assert_string_contains(sheet_text, "A / S")
|
||||
assert_string_contains(sheet_text, "Échap")
|
||||
await _dispatch_key(KEY_A)
|
||||
assert_eq(state.player.progression.attribute_points, 0)
|
||||
assert_eq(game.get_dialogue_player().attributes.get_attribute(&"str_"), 5)
|
||||
|
||||
@@ -20,7 +20,7 @@ func test_real_merchant_interaction_opens_shop_and_purchase_updates_inventory_an
|
||||
game.get_run_state().gold = 100
|
||||
var no_events: Array[GameEvent] = []
|
||||
game.get_node("HUD").refresh(state, no_events, game.get_run_state())
|
||||
assert_eq((game.get_node("HUD/GoldLabel") as Label).text, "Or : 100")
|
||||
assert_eq((game.get_node("HUD/GoldLabel") as Label).text, "100")
|
||||
|
||||
await _dispatch_key(KEY_E)
|
||||
var dialogue_entries := game.get_node("HUD/DialoguePanel/Layout/Entries") as RichTextLabel
|
||||
|
||||
Reference in New Issue
Block a user