fix: localize active HUD journal events
This commit is contained in:
@@ -16,4 +16,4 @@ func test_current_game_event_and_hud_remain_available_with_attributes_domain_loa
|
||||
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_true(hud.event_log.get_parsed_text().contains("You strike the goblin"))
|
||||
assert_true(hud.event_log.get_parsed_text().contains("Vous frappez le gobelin"))
|
||||
|
||||
@@ -39,7 +39,8 @@ func test_real_game_scene_completes_adjacent_bump_combat_and_defeat_route() -> v
|
||||
assert_eq(first_melee[1].kind, &"enemy_melee")
|
||||
assert_eq(state.player.cell, Vector2i(4, 7))
|
||||
assert_eq(enemy.cell, Vector2i(5, 7))
|
||||
assert_string_contains(hud.event_log.get_parsed_text(), "with mains nues")
|
||||
assert_string_contains(hud.event_log.get_parsed_text(), "Vous frappez le gobelin avec mains nues")
|
||||
assert_eq(hud.event_log.get_parsed_text().find("You"), -1)
|
||||
|
||||
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(lethal_melee[0].kind, &"melee")
|
||||
|
||||
@@ -58,4 +58,4 @@ func test_real_game_enemy_detects_approaches_attacks_and_dies_with_feedback() ->
|
||||
assert_false(state.enemies.has(&"goblin"))
|
||||
await get_tree().create_timer(1.2).timeout
|
||||
assert_eq(game.get_node("World/Enemies").get_child_count(), 0)
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated")
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "Le gobelin est vaincu.")
|
||||
|
||||
@@ -34,7 +34,7 @@ func test_real_game_resolves_damage_and_death_before_a3_feedback_and_journals_st
|
||||
assert_true(loot_event.payload.has("gold"))
|
||||
await _wait_for_feedback(observed)
|
||||
assert_eq(observed.map(func(event: GameEvent) -> StringName: return event.kind), [&"attack_started", &"attack_hit", &"damage_dealt", &"actor_died", &"xp_granted", &"loot_dropped"])
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated")
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "Le gobelin succombe.")
|
||||
|
||||
func _wait_for_feedback(observed: Array[GameEvent]) -> void:
|
||||
var deadline := Time.get_ticks_msec() + 2500
|
||||
|
||||
@@ -71,7 +71,7 @@ func test_live_enemy_attack_is_intercepted_in_support_and_companion_death_leaves
|
||||
assert_eq(state.player.hit_points, state.player.max_hit_points)
|
||||
assert_false(companion.is_alive())
|
||||
assert_not_null(game.get_node_or_null("World/Companion"))
|
||||
assert_string_contains((game.get_node("HUD/EventLog") as RichTextLabel).get_parsed_text(), "companion")
|
||||
assert_string_contains((game.get_node("HUD/EventLog") as RichTextLabel).get_parsed_text(), "Votre familier tombe")
|
||||
|
||||
func _dispatch_key(keycode: Key) -> void:
|
||||
Input.parse_input_event(_key_event(keycode, true))
|
||||
|
||||
@@ -13,9 +13,7 @@ func test_real_input_event_records_one_action_turn_and_hud_renders_its_run_state
|
||||
var run := game.get_run_state()
|
||||
var events := run.recent_events(2)
|
||||
var event_log := game.get_node("HUD/EventLog") as RichTextLabel
|
||||
var expected_hud_text := "Vous vous déplacez vers (3, 7).\n"
|
||||
for event in events.slice(1):
|
||||
expected_hud_text += event.message + "\n"
|
||||
var expected_hud_text := "Vous vous déplacez vers (3, 7).\nLe gobelin se déplace.\n"
|
||||
|
||||
# One input resolves movement plus an enemy response. They are one player action,
|
||||
# so their journal events share action turn 1 and are present exactly once.
|
||||
@@ -25,7 +23,8 @@ func test_real_input_event_records_one_action_turn_and_hud_renders_its_run_state
|
||||
assert_eq(run.current_turn, 1)
|
||||
assert_eq(event_log.get_parsed_text(), expected_hud_text)
|
||||
assert_string_contains(event_log.get_parsed_text(), "Vous vous déplacez vers (3, 7).")
|
||||
assert_string_contains(event_log.get_parsed_text(), events[1].message)
|
||||
assert_string_contains(event_log.get_parsed_text(), "Le gobelin se déplace.")
|
||||
assert_eq(event_log.get_parsed_text().find(events[1].message), -1)
|
||||
|
||||
func _key_event(keycode: Key) -> InputEventKey:
|
||||
var event := InputEventKey.new()
|
||||
|
||||
Reference in New Issue
Block a user