summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests/AssetPackTests.fs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LivingVillage.Desktop.Tests/AssetPackTests.fs')
-rw-r--r--src/LivingVillage.Desktop.Tests/AssetPackTests.fs32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/LivingVillage.Desktop.Tests/AssetPackTests.fs b/src/LivingVillage.Desktop.Tests/AssetPackTests.fs
index fc235d0..46513f9 100644
--- a/src/LivingVillage.Desktop.Tests/AssetPackTests.fs
+++ b/src/LivingVillage.Desktop.Tests/AssetPackTests.fs
@@ -36,11 +36,41 @@ type AssetPackTests () =
Assert.AreEqual<int>(cc0TileAtlasHeight, height)
Assert.AreEqual<int>(0, width % Sim.tilePixels)
Assert.AreEqual<int>(0, height % Sim.tilePixels)
- Assert.AreEqual<int>(4, width / Sim.tilePixels)
+ Assert.AreEqual<int>(cc0TileCount, width / Sim.tilePixels)
+ Assert.AreEqual<int>(cc0TileAtlasWidth, width)
Assert.AreEqual<int>(2, Sim.tilePixels / cc0TileSourcePixels)
Assert.AreEqual<int>(0, Sim.tilePixels % cc0TileSourcePixels)
[<TestMethod>]
+ member _.Cc0StructureTileIndicesFitTheAtlasAndWaterHasTwoPhases () =
+ // Every P34 self-drawn structure cell must sit inside the 12-tile atlas band.
+ let indices =
+ [ cc0TileIndexWaterA
+ cc0TileIndexWaterB
+ cc0TileIndexRoofRidge
+ cc0TileIndexRoofEave
+ cc0TileIndexWallWood
+ cc0TileIndexWallWindow
+ cc0TileIndexRailing
+ cc0TileIndexDoor ]
+ for index in indices do
+ Assert.IsTrue(index >= 0 && index < cc0TileCount, sprintf "cc0 tile index %d out of atlas" index)
+ let width, _ = pngDimensions (assetPath cc0TileAtlasRelativePath)
+ Assert.IsTrue(width >= (List.max indices + 1) * Sim.tilePixels, "atlas must cover every structure index")
+ // Two-phase water: phase depends only on tick/tile, always in {A, B}, and both
+ // phases appear across a row of tiles in one frame.
+ Assert.AreEqual<int>(2, cc0WaterFrameCount)
+ let phases =
+ [ for tileX in 0 .. 15 -> cc0WaterTileIndexAt 0L tileX 0 ]
+ |> Set.ofList
+ Assert.IsTrue((phases = Set.ofList [ cc0TileIndexWaterA; cc0TileIndexWaterB ]),
+ "one frame must show both water phases across the river")
+ for tileX in 0 .. 15 do
+ for tileY in 0 .. 15 do
+ let index = cc0WaterTileIndexAt 12345L tileX tileY
+ Assert.IsTrue(index = cc0TileIndexWaterA || index = cc0TileIndexWaterB)
+
+ [<TestMethod>]
member _.Cc0CharacterAtlasIsIntegerMultipleOfTheCellGrid () =
let width, height = pngDimensions (assetPath cc0CharacterAtlasRelativePath)
Assert.AreEqual<int>(cc0CharacterAtlasWidth, width)