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>
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
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);
|
|
}
|
|
}
|