diff --git a/test_suites/collection_edit/manifest.json b/test_suites/collection_edit/manifest.json index d0bef49..e6933a7 100644 --- a/test_suites/collection_edit/manifest.json +++ b/test_suites/collection_edit/manifest.json @@ -1,6 +1,6 @@ { "name": "Collection Edit Test", - "description": "Integration test of editing the running game's collection: the novel template is entered, its collection gets the editors mechanic, back to the menu and New game of the same game must switch the mod set in-process so the editors are loaded. Activated only by --itest=collection_edit (with --game=novel_template).", + "description": "Integration test of editing the running game's collection: the novel template is entered, its collection gets the dev_tools toolset (editors, scenario studio), back to the menu and New game of the same game must switch the mod set in-process so the editors are loaded. Activated only by --itest=collection_edit (with --game=novel_template).", "sources": [ "src/*.cs" ] diff --git a/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs b/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs index 592658d..35e2c4f 100644 --- a/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs +++ b/test_suites/collection_edit/src/CollectionEditTestDriverNode.cs @@ -19,11 +19,12 @@ namespace Mods.CollectionEditTest /// /// The novel template is entered; it matches its collection and the /// editors are not loaded. - /// The collection gets the editors mechanic (editor_tools), saved - /// the way the collection editor saves it (a user package with the same id): - /// the running game is now outdated. + /// The collection gets the developer toolset (dev_tools: editors, + /// the scenario studio, …), saved the way the collection editor saves it (a + /// user package with the same id): the running game is now outdated. /// Menu → Play → New game of the same game switches the mod set in - /// place: the editors are loaded and the game matches its collection again. + /// place: the editors and the studio are loaded, the studio's button is on + /// the game's toolbar and the game matches its collection again. /// /// A player's own package of the game is moved aside for the run and put /// back afterwards. Prints [TEST_RESULT] name=collection_edit. @@ -33,7 +34,9 @@ namespace Mods.CollectionEditTest public const string Flag = "--itest=collection_edit"; private const string GameId = "novel_template"; + private const string AddedToolset = "dev_tools"; private const string AddedMod = "editor_tools"; + private const string StudioMod = "scenario_studio"; private const float TimeoutSeconds = 240f; private readonly List failures = new(); @@ -132,6 +135,8 @@ namespace Mods.CollectionEditTest var reload = ModManager.Instance.LastReload; 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 game matches its edited collection", !GameCatalog.IsActiveOutdated()); Check($"entered a scene of '{GameId}' ('{enteredScenes[0]}')", true); Finish(); @@ -143,8 +148,8 @@ namespace Mods.CollectionEditTest } /// - /// Saves the game's collection with an extra editors mechanic as a user - /// package — what the collection editor does when the player adds one. + /// Saves the game's collection with the developer toolset included, as a + /// user package — what the collection editor does when the player adds it. /// private void AddEditorsToCollection() { @@ -152,8 +157,8 @@ namespace Mods.CollectionEditTest var source = GameCatalog.LoadCollections()[GameId]; var edited = JsonSerializer.Deserialize(JsonSerializer.Serialize(source)); edited.Package = source.Package; - edited.Mechanics ??= new List(); - edited.Mechanics.Add(new ModCollectionMechanic { Id = "editors", Name = "Editors", Mods = new List { AddedMod + ">=1" } }); + edited.Includes ??= new List(); + edited.Includes.Add(new ModCollectionInclude { Ref = AddedToolset + ">=1", Role = "tools" }); var user = ModCollectionStore.LoadUser().Where(c => !string.Equals(c.Id, GameId, StringComparison.OrdinalIgnoreCase)).ToList(); user.Add(edited); @@ -188,6 +193,9 @@ namespace Mods.CollectionEditTest } } + private bool HasToolbarButton(string tooltip) + => GetTree().Root.FindChildren("*", "Button", true, false).OfType