28 lines
1.4 KiB
GDScript
28 lines
1.4 KiB
GDScript
extends GutTest
|
|
|
|
const GameScene = preload("res://scenes/Game.tscn")
|
|
const GameEvent = preload("res://scripts/domain/run/game_event.gd")
|
|
|
|
func test_hud_localizes_current_structured_journal_events_without_using_the_english_source_message() -> void:
|
|
var game := GameScene.instantiate() as Game
|
|
add_child_autofree(game)
|
|
await get_tree().process_frame
|
|
var hud := game.get_node("HUD") as GameHud
|
|
var state := game.get_game_state()
|
|
var events: Array[GameEvent] = [
|
|
GameEvent.new(1, 0, &"game_started", {"player_name": "Ariane"}, "Ariane begins a new run."),
|
|
GameEvent.new(2, 0, &"moved", {"to": Vector2i(6, 8)}, "You move to (6, 8)."),
|
|
GameEvent.new(3, 0, &"companion_moved", {}, "Your companion follows."),
|
|
GameEvent.new(4, 0, &"episode_published", {"number": 7}, "Episode 7 published."),
|
|
]
|
|
|
|
hud.refresh(state, events, game.get_run_state())
|
|
|
|
var journal_text := hud.event_log.get_parsed_text()
|
|
assert_string_contains(journal_text, "Ariane commence une nouvelle aventure.")
|
|
assert_string_contains(journal_text, "Vous vous déplacez vers (6, 8).")
|
|
assert_string_contains(journal_text, "Votre familier vous suit.")
|
|
assert_string_contains(journal_text, "Épisode 7 publié.")
|
|
for english_source: String in ["Ariane begins a new run.", "You move to (6, 8).", "Your companion follows.", "Episode 7 published."]:
|
|
assert_eq(journal_text.find(english_source), -1, "GameHud must localize %s from structured event data, not reuse its source message" % english_source)
|