using AcDream.App.Rendering; using AcDream.App.Tests.Rendering; using AcDream.App.Tests.Rendering.Gpu; using AcDream.App.UI; using AcDream.Content; using AcDream.Core.Items; using DatReaderWriter; using DatReaderWriter.DBObjs; using DatReaderWriter.Options; using Xunit; namespace AcDream.App.Tests.UI; /// /// Owner direction 2026-09-06 (Smoke-plugin removal + /// docs/plans/2026-09-06-plugin-shelf-and-dat-icons.md follow-up): /// MossTankPlugin's shelf descriptor now sets a real /// IconSurfaceId instead of relying solely on the "MT" text /// fallback. Mirrors the /// /// installed-DAT gate convention: + /// [Trait("Lane", "InstalledDat")], Assert.Fail with the /// standard message when no DAT is configured (see docs/release-gate.md). /// [Trait("Lane", "InstalledDat")] public sealed class MossTankIconInstalledDatTests { /// The id MossTankPlugin.cs sets as its shelf descriptor's /// IconSurfaceId. private const uint MossTankShelfIconId = 0x06002C41u; [Fact] public void MossTankShelfIconId_IsARealInstalledRenderSurface() { string? datDir = InstalledDatTestPath.Resolve(); if (datDir is null) { Assert.Fail( "Lane=InstalledDat requires an installed retail DAT directory; see docs/release-gate.md."); return; } using var dats = new DatCollection(datDir, DatAccessType.Read); using var adapter = new DatCollectionAdapter(dats); // The RenderSurface must exist in Portal or HighRes — the same two // databases RetailMarkupIconResolver.ResolveDid probes before ever // touching TextureCache. bool existsInPortal = adapter.Portal.TryGet(MossTankShelfIconId, out _); bool existsInHighRes = adapter.HighRes.TryGet(MossTankShelfIconId, out _); Assert.True( existsInPortal || existsInHighRes, $"expected 0x{MossTankShelfIconId:X8} to be a real installed RenderSurface (Portal or HighRes)"); var device = new RecordingGpuDevice(); using var cache = new TextureCache(device, adapter); var icons = new IconComposer(adapter, cache); var objects = new ClientObjectTable(); var resolver = new RetailMarkupIconResolver(adapter, icons, objects); (uint tex, int w, int h) = resolver.ResolveDid(MossTankShelfIconId); Assert.NotEqual(0u, tex); Assert.True(w > 0 && h > 0); } }