From 07d7d10fc51a405e56109efc88ebb48a14633762 Mon Sep 17 00:00:00 2001 From: iisaev Date: Wed, 21 Oct 2026 07:45:36 +0200 Subject: [PATCH] collection_edit reads the studio button key from its UI entry The suite does not depend on scenario_studio, so the hard-coded studio/title key was an undeclared resource use (resource_atlas error). --- .../src/CollectionEditTestDriverNode.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs b/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs index 35e2c4f..85c8099 100644 --- a/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs +++ b/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs @@ -9,6 +9,7 @@ using Cthangover.Core.Games; using Cthangover.Core.Mods; using Cthangover.Core.Mods.HotReload; using Cthangover.Core.Scenes; +using Cthangover.Core.UI; using Cthangover.Core.Utils; using Godot; @@ -136,7 +137,7 @@ namespace Mods.CollectionEditTest Check("New game after the edit switched the mod set", reload?.Applied == true && reload.Plan?.Load.Contains(AddedMod) == true); Check($"'{AddedMod}' is loaded after the edit", EditorsLoaded); Check($"'{StudioMod}' is loaded after the edit", ModRegistry.Instance.Mods.ContainsKey(StudioMod)); - Check("the studio's button is on the game's toolbar", HasToolbarButton(TranslationServer.Translate("studio/title").ToString())); + Check("the studio's button is on the game's toolbar", HasToolbarButton(StudioButtonTooltip())); Check("the game matches its edited collection", !GameCatalog.IsActiveOutdated()); Check($"entered a scene of '{GameId}' ('{enteredScenes[0]}')", true); Finish(); @@ -193,6 +194,17 @@ namespace Mods.CollectionEditTest } } + /// + /// Tooltip of the studio's toolbar button, read from the panel entry the studio + /// registered: the suite does not depend on the studio (it is added by the edit), + /// so its locale key must not be hard-coded here. + /// + private static string StudioButtonTooltip() + { + var locale = UiRegistry.PanelEntries.FirstOrDefault(e => e.ModId == StudioMod && e.Button != null)?.Button.Locale; + return locale == null ? null : TranslationServer.Translate(locale).ToString(); + } + private bool HasToolbarButton(string tooltip) => GetTree().Root.FindChildren("*", "Button", true, false).OfType