using RioJoy.Core.Overlay; using RioJoy.Overlay; using SkiaSharp; using Xunit; namespace RioJoy.Core.Tests.Overlay; public class ProfileWallpaperGeneratorTests { [Fact] public void Generate_WritesWallpaperPng_AtCanvasSize() { string templatePath = TestRepo.CustomBackground("regions.json"); OverlayTemplate template = OverlayTemplateStore.Load(templatePath); string templateDir = Path.GetDirectoryName(templatePath)!; var labels = new Dictionary { ["a-00"] = "DEMO", ["b-00"] = "FIRE" }; string outPath = Path.Combine(Path.GetTempPath(), $"riojoy-wp-{Guid.NewGuid():N}.png"); try { string written = new ProfileWallpaperGenerator().Generate(template, templateDir, labels, outPath); Assert.Equal(outPath, written); Assert.True(File.Exists(outPath)); using SKBitmap bmp = SKBitmap.Decode(outPath); Assert.Equal(template.Width, bmp.Width); Assert.Equal(template.Height, bmp.Height); } finally { if (File.Exists(outPath)) File.Delete(outPath); } } [Fact] public void Generate_WithoutBaseImagePath_Throws() { var template = new OverlayTemplate { Width = 10, Height = 10 }; // BaseImagePath null Assert.Throws(() => new ProfileWallpaperGenerator().Generate( template, ".", new Dictionary(), Path.Combine(Path.GetTempPath(), $"x-{Guid.NewGuid():N}.png"))); } }