From 27a41444ce92edf76904b87ea9fd90d0d5a9bdf7 Mon Sep 17 00:00:00 2001 From: iisaev Date: Sat, 24 Oct 2026 12:56:11 +0200 Subject: [PATCH] Screenshot of the character editor --- test_suites/edit/src/CharacterEditorTestDriver.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test_suites/edit/src/CharacterEditorTestDriver.cs b/test_suites/edit/src/CharacterEditorTestDriver.cs index 7d6f8ae..1e56e85 100644 --- a/test_suites/edit/src/CharacterEditorTestDriver.cs +++ b/test_suites/edit/src/CharacterEditorTestDriver.cs @@ -8,6 +8,7 @@ using Cthangover.Core.Mods; using Cthangover.Core.Mods.Resolvers; using Cthangover.Core.Utils; using Cthangover.Mods.Interface.Tool; +using Cthangover.Mods.Interface.View; using Cthangover.Mods.Rpg; using Cthangover.Tools.RpgEditor; using Cthangover.Tools.Services; @@ -40,11 +41,13 @@ namespace Cthangover.Tools.CharactersEditor.Tests private int passed; private int step; private double elapsed; + private readonly string shotsDir; private CharacterEditorWindow window; - /// Creates the driver; is unused (no screenshots). + /// Creates the driver; with it saves a shot of the list and form. public CharacterEditorTestDriver(string shotsDir) { + this.shotsDir = shotsDir; Name = "CharacterEditorTestDriver"; var timer = new Timer { WaitTime = TickSeconds, Autostart = true }; AddChild(timer); @@ -110,6 +113,8 @@ namespace Cthangover.Tools.CharactersEditor.Tests step++; return; case 2: + // The list's portraits are fitted into the panel (FilteredList.FitIcons). + Shot("editor"); try { Press("tools/common/save"); @@ -198,6 +203,14 @@ namespace Cthangover.Tools.CharactersEditor.Tests GameLogger.Log("TEST", $"[FAIL] {what}", LogLevel.Error); } + private void Shot(string name) + { + if (string.IsNullOrEmpty(shotsDir) || DisplayServer.GetName() == "headless") + return; + DirAccess.MakeDirRecursiveAbsolute(shotsDir); + ViewportCapture.SavePng(GetViewport(), shotsDir.TrimEnd('/') + "/characters_editor_" + name + ".png"); + } + private void Finish() { step = -1;