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_21000006.json, then commit it. Mirrors how vitals_2100006C.json was made. /// 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, 0x21000006u); 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_21000006.json"); }