using System; using System.IO; using System.Runtime.CompilerServices; using System.Text.Json; using AcDream.App.UI.Layout; using DatReaderWriter; using DatReaderWriter.Options; namespace AcDream.App.Tests.UI.Layout; /// /// One-off generator for the committed chat golden fixture. Skipped by default — /// run manually with the real dats present (set ACDREAM_DAT_DIR) to regenerate /// chat_2100006f.json, then commit it. Mirrors how vitals_2100006C.json was made. /// /// /// Campaign CH slice CH6a swapped the imported main-chat LayoutDesc from the /// wrong 0x21000006 (a different, unrelated chat layout whose root /// 0x1000000E and 800px resize bar 0x1000000F appear nowhere in /// the EoR gameplay UI) to retail's actual main chat window, /// 0x2100006F (window element 0x10000601, layout root /// 0x10000600, authored 410x100 — see /// docs/research/2026-08-09-chat-retail-window-shell.md §2.1 and §5). The old /// chat_21000006.json fixture is retired with it. /// /// public class ChatLayoutFixtureGenerator { [Fact(Skip = "manual: regenerates the committed chat fixture; needs the real dats (ACDREAM_DAT_DIR)")] public void GenerateChatFixture() { var datDir = Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR") ?? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Documents", "Asheron's Call"); using var dats = new DatCollection(datDir, DatAccessType.Read); var info = LayoutImporter.ImportInfos(dats, 0x2100006Fu); Assert.NotNull(info); var json = JsonSerializer.Serialize(info, new JsonSerializerOptions { IncludeFields = true, WriteIndented = true, }); File.WriteAllText(FixturePath(), json); } // Resolve the SOURCE fixtures dir (not bin/) from this file's compile-time path. private static string FixturePath([CallerFilePath] string thisFile = "") => Path.Combine(Path.GetDirectoryName(thisFile)!, "fixtures", "chat_2100006f.json"); }