test(scenes): Update culture tree proof test to robustly handle data loading and vocabulary initialization

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-26 08:14:55 -07:00
parent 9a4658faa0
commit d49b4c0fa6

View file

@ -25,10 +25,16 @@ func _ready() -> void:
if not env_name.is_empty():
_screenshot_name = env_name
# Required by every proof scene — without it DataLoader has no data and
# both `get_all_culture()` and `get_all_techs()` come back empty,
# leaving the rendered tree blank.
DataLoader.load_theme("age-of-dwarves")
# Ensure DataLoader is populated before TurnManager.get_culture_web()
# tries to build from `get_all_culture()`. Idempotent — every other
# proof scene calls this for the same reason.
if DataLoader.get_all_culture().is_empty():
DataLoader.load_theme("age-of-dwarves")
# Vocabulary lookup falls back to title-casing the key when the
# vocabulary dict is empty — meaning the title bar would render
# "Culture Tree Close Mark" instead of "X". Load the dwarf pack.
if not ThemeVocabulary.has_key("culture_tree"):
ThemeVocabulary.load_vocabulary("age-of-dwarves")
await get_tree().process_frame
_setup_game_state()
@ -45,13 +51,10 @@ func _setup_game_state() -> void:
"num_players": 1,
})
var player: RefCounted = GameState.create_player("Dwarf King", "dwarf")
# Real tradition ids from public/resources/culture/*.json. Two T1 picks
# already done; mid-research on a T2 entry so the progress bar is
# visible on its card.
(player as PlayerScript).add_tradition("ancestor_veneration")
(player as PlayerScript).add_tradition("oral_tradition")
(player as PlayerScript).researching_tradition = "epic_poetry"
(player as PlayerScript).culture_research_progress = 14 # cost 35 → ~40 %
(player as PlayerScript).add_tradition("ancestor_song")
(player as PlayerScript).add_tradition("clan_chronicle")
(player as PlayerScript).researching_tradition = "rite_of_remembering"
(player as PlayerScript).culture_research_progress = 12
GameState.current_player_index = 0
var cw: CultureWebScript = TurnManager.get_culture_web()