fix(ui): keep spell components in authored foreground

Install examination formula icons as the template root UIRegion image, matching retail ClearImage/SetImage behavior while retaining the authored missing-component overlay. Add the real DAT template fixture and conformance coverage.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-24 08:08:29 +02:00
parent d4ce64f56b
commit 2c3da8e153
14 changed files with 231 additions and 34 deletions

View file

@ -0,0 +1,35 @@
using AcDream.App.UI;
using AcDream.App.UI.Layout;
namespace AcDream.App.Tests.UI.Layout;
public sealed class SpellExamineComponentTemplateFactoryTests
{
[Theory]
[InlineData(true, false)]
[InlineData(false, true)]
public void Create_InstallsIconOnRetailRootAndKeepsMissingOverlayAboveIt(
bool owned,
bool missingVisible)
{
ElementInfo template =
FixtureLoader.LoadExaminationComponentTemplateInfos();
var factory = new SpellExamineComponentTemplateFactory(
template,
did => (did + 1_000u, 32, 32),
defaultFont: null);
UiDatElement root = Assert.IsType<UiDatElement>(
factory.Create(0xABCDu, owned));
UiDatElement missing = Assert.IsType<UiDatElement>(
Assert.Single(root.Children));
Assert.Equal(SpellExamineComponentTemplateFactory.TemplateId, root.ElementId);
Assert.Equal(0xABCDu, root.RuntimeImageTexture);
Assert.Empty(root.Children.OfType<UiTextureElement>());
Assert.Equal(
SpellExamineComponentTemplateFactory.MissingOverlayId,
missing.ElementId);
Assert.Equal(missingVisible, missing.Visible);
}
}