From d49b4c0fa676ce8db8175350d45b46c97a8c9abd Mon Sep 17 00:00:00 2001 From: autocommit Date: Sun, 26 Apr 2026 08:14:55 -0700 Subject: [PATCH] =?UTF-8?q?test(scenes):=20=E2=9C=85=20Update=20culture=20?= =?UTF-8?q?tree=20proof=20test=20to=20robustly=20handle=20data=20loading?= =?UTF-8?q?=20and=20vocabulary=20initialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- .../engine/scenes/tests/culture_tree_proof.gd | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/game/engine/scenes/tests/culture_tree_proof.gd b/src/game/engine/scenes/tests/culture_tree_proof.gd index 382a4503..a3e16c69 100644 --- a/src/game/engine/scenes/tests/culture_tree_proof.gd +++ b/src/game/engine/scenes/tests/culture_tree_proof.gd @@ -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()