test: capture final HUD polish feedback

This commit is contained in:
goose
2026-10-09 07:50:49 -04:00
parent 39fd70da88
commit ca90d790d9
3 changed files with 194 additions and 4 deletions
+20 -3
View File
@@ -19,19 +19,36 @@ func test_combat_routes_damage_feedback_and_exposes_current_target_summary() ->
var enemy_view := game.get_node("World/Enemies/Goblin") as ActorView
hud.refresh(state, [], game.get_run_state())
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
assert_string_contains(hud.combat_summary, "Gobelin")
assert_string_contains(hud.combat_summary, "PV")
assert_eq(hud.combat_summary.find("Target"), -1)
assert_eq(hud.combat_summary.find("HP"), -1)
game.submit_test_action(Vector2i.RIGHT)
await _wait_for_feedback()
assert_eq(player_view.last_damage, 2)
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
assert_string_contains(hud.combat_summary, "Gobelin")
assert_string_contains(hud.combat_summary, "PV")
assert_eq(hud.combat_summary.find("Target"), -1)
assert_eq(hud.combat_summary.find("HP"), -1)
game.submit_test_action(Vector2i.RIGHT)
await _wait_for_feedback()
game.submit_test_action(Vector2i.RIGHT)
await _wait_for_feedback()
assert_false(is_instance_valid(enemy_view))
assert_eq(hud.combat_summary, "No active target")
assert_eq(hud.combat_summary, "Aucune cible active")
assert_eq(hud.get_node("EnemyHealthLabel").text, "Aucune cible active")
assert_eq(_visible_text_occurrences(hud, "Aucune cible active"), 1, "The no-target state must have one visible string, never a duplicate")
assert_eq(_visible_text_occurrences(hud, "No active target"), 0, "The no-target state must never expose the English fallback")
assert_string_contains(hud.event_log.get_parsed_text(), "with mains nues")
func _visible_text_occurrences(hud: GameHud, needle: String) -> int:
var occurrences := 0
for node in hud.find_children("*", "Label", true, false):
var label := node as Label
if label != null and label.visible and label.text == needle:
occurrences += 1
return occurrences
func _wait_for_feedback() -> void:
await get_tree().create_timer(0.32).timeout