diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 09:26:53 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 09:26:53 +0800 |
| commit | ebe7f80bcf54189cc51a15bf17b99293b6ff57a3 (patch) | |
| tree | 89fc4406662c2ff6bc39fbef8e806731709eecf2 /src/LivingVillage.Desktop.Tests | |
| parent | dbce686019230c7a1105f5cc4b7b258698201128 (diff) | |
| download | living-village-ebe7f80bcf54189cc51a15bf17b99293b6ff57a3.tar.gz | |
feat(desktop): P26 夜晚冷月光 veil(纯渲染层)+ 灯笼光晕径向无方斑回归
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/DesktopTests.fs | 24 | ||||
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 22 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/DesktopTests.fs b/src/LivingVillage.Desktop.Tests/DesktopTests.fs index b78f4e0..7e4a849 100644 --- a/src/LivingVillage.Desktop.Tests/DesktopTests.fs +++ b/src/LivingVillage.Desktop.Tests/DesktopTests.fs @@ -160,6 +160,30 @@ type DesktopTests () = Assert.IsTrue(noon.Background.B > noon.Background.R) [<TestMethod>] + member _.MoonlightVeilIsCoolAndOnlyAtNight () = + let noonTick = 12L * Sim.ticksPerDay / 24L + let midnightTick = 0L + let deepNightTick = 23L * Sim.ticksPerDay / 24L + Assert.IsTrue(M6Presentation.moonlightVeilAlpha noonTick = 0, "daytime must have no moonlight") + + let moon = M6Presentation.moonlightVeilAlpha midnightTick + Assert.IsTrue(moon > 0, "deep night must get a cool moonlight wash") + Assert.AreEqual<int>(moon, M6Presentation.moonlightVeilAlpha deepNightTick) + Assert.IsTrue(moon <= 72, "moonlight veil stays a low alpha so the scene is not washed out") + + let r, g, b = M6Presentation.moonlightRgb + Assert.IsTrue(b > g && g > r, "moonlight must be cool: blue-dominant channels") + + // Dusk is owned by the warm golden veil, so moonlight is suppressed there. + let duskTick = M6Presentation.startTickForHour 20.75 + Assert.IsTrue(M6Presentation.moonlightVeilAlpha duskTick < moon, "dusk is warmed, not moonlit") + + // Premultiplied premultiply of this colour never saturates to white. + let veiled = VillageArt.premultiply r g b moon + Assert.IsTrue(int veiled.B <= int veiled.A) + Assert.IsTrue(int (max veiled.R (max veiled.G veiled.B)) < 250) + + [<TestMethod>] member _.DaylightAutoplayBootstrapStartsAtDawnAndPreservesDefaultStart () = let dawnTick = 6L * Sim.ticksPerDay / 24L let daylightWorld = WorldBootstrap.initialWorldForDaylight true 42UL Sim.npcCount diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index dd4e7b3..bc3425a 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -641,6 +641,28 @@ type PrototypeTests () = Assert.IsFalse(covers (centerX - radius - 5) centerY) [<TestMethod>] + member _.LanternGlowIsRadialWithoutSquareCorners () = + // P26 复核:光晕为同心圆叠加,逐像素累积 alpha;边缘/四角不得出现方斑。 + let centerX, centerY, radius, rings, peakAlpha = 80, 80, 40, 6, 140 + let layers = VillageArt.lanternGlowLayers centerX centerY radius rings 255 214 150 peakAlpha + let size = radius * 2 + 3 + let origin = centerX - radius - 1 + let alpha = Array2D.zeroCreate<int> size size + for (rect, color) in layers do + for y in rect.Y .. rect.Y + rect.Height - 1 do + for x in rect.X .. rect.X + rect.Width - 1 do + alpha.[y - origin, x - origin] <- alpha.[y - origin, x - origin] + int color.A + let center = alpha.[radius + 1, radius + 1] + Assert.IsTrue(center > 0, "the core must be lit") + let corner = [ (0, 0); (size - 1, 0); (0, size - 1); (size - 1, size - 1) ] + for (cx, cy) in corner do + Assert.IsTrue(alpha.[cy, cx] = 0, "glow corner must stay empty: no square patch") + // Radial falloff along the centre row: alpha never rises as distance from the core grows. + let row = [ for dx in 0 .. radius -> alpha.[radius + 1, radius + 1 + dx] ] + Assert.IsTrue(row |> List.pairwise |> List.forall (fun (a, b) -> a >= b), "glow must fade radially, not form a flat block") + Assert.IsTrue(row.[0] = center && row.[radius] < center, "core is brightest, rim is dimmer") + + [<TestMethod>] member _.CharacterFeetSitOnTheTileGroundLine () = Assert.AreEqual<int>(16, VillageArt.characterFeetOffset) let destination = VillageArt.characterDestination { X = 100.0f; Y = 200.0f } (Vector2(0.0f, 0.0f)) |
