summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-22 00:41:41 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-22 00:41:41 +0800
commit55575af708bc1602f820f7f705bfc01898347082 (patch)
tree9c136379f7260bdcd1b3306558fd308efec7696e /src/LivingVillage.Desktop.Tests
parent14dd456a028b126f9d8f4a308d0a056d5134c445 (diff)
downloadliving-village-55575af708bc1602f820f7f705bfc01898347082.tar.gz
feat(desktop): P17 街边中式细节物(石灯笼/水缸/摊贩摊位)图集扩展 28 格
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
-rw-r--r--src/LivingVillage.Desktop.Tests/PrototypeTests.fs31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
index 88f6016..25f4d02 100644
--- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
+++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
@@ -473,8 +473,9 @@ type PrototypeTests () =
Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 2 } : TilePosition), sprintf "missing ridge tile dx=%d" dx)
Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 1 } : TilePosition), sprintf "missing eave tile dx=%d" dx)
Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y } : TilePosition), sprintf "missing wall tile dx=%d" dx)
- // 12 house + 3 bridge + 3 bamboo + 2 garden + 2x2 willow + 2 shrub + 2 flowers + 2 reeds + 1 bench + 2 lanterns.
- Assert.AreEqual<int>(33, footprint.Count)
+ // 12 house + 3 bridge + 3 bamboo + 2 garden + 2x2 willow + 2 shrub + 2 flowers + 2 reeds
+ // + 1 bench + 2 lanterns + 2 stone lanterns + 1 water vat + 1 market stall (P17).
+ Assert.AreEqual<int>(37, footprint.Count)
[<TestMethod>]
member _.VegetationAndRiversidePropsDecorateTheScene () =
@@ -489,13 +490,20 @@ type PrototypeTests () =
Assert.AreEqual<int>(2, count VillageArt.ReedCluster)
Assert.AreEqual<int>(1, count VillageArt.StoneBench)
Assert.AreEqual<int>(2, count VillageArt.RiverLantern)
+ Assert.AreEqual<int>(2, count VillageArt.StoneLantern)
+ Assert.AreEqual<int>(1, count VillageArt.WaterVat)
+ Assert.AreEqual<int>(1, count VillageArt.MarketStall)
- // Reeds must root in water; lanterns stand on the bank path.
+ // Reeds must root in water; lanterns and P17 street details stand on the paved bank path.
for prop in plan.Props do
let tile = VillageArt.worldTile plan prop.Position
match prop.Kind with
| VillageArt.ReedCluster -> Assert.IsTrue(grounds.Contains(prop.Position), "reeds must sit on water tiles")
- | VillageArt.RiverLantern -> Assert.IsTrue(plan.Grounds |> List.contains (prop.Position, VillageArt.StonePath), "lanterns must stand on the bank path")
+ | VillageArt.RiverLantern
+ | VillageArt.StoneLantern
+ | VillageArt.WaterVat
+ | VillageArt.MarketStall ->
+ Assert.IsTrue(plan.Grounds |> List.contains (prop.Position, VillageArt.StonePath), "street details must stand on the bank path")
| _ -> ()
[<TestMethod>]
@@ -1019,6 +1027,21 @@ type PrototypeTests () =
Assert.AreEqual<string list>([], missing, sprintf "Missing Jiangnan PNG assets: %s" (String.concat ", " missing))
+ // The baked world atlas must match the 28-slot layout the renderer indexes into
+ // (P17 added 石灯笼/水缸/摊贩摊位 as slots 25..27).
+ Assert.AreEqual<int>(28, VillageArt.worldTileCount)
+ let worldPath = Path.Combine(AppContext.BaseDirectory, "Assets/jiangnan-world.png")
+ let header = File.ReadAllBytes worldPath
+ let be32 offset =
+ (int header.[offset] <<< 24)
+ ||| (int header.[offset + 1] <<< 16)
+ ||| (int header.[offset + 2] <<< 8)
+ ||| int header.[offset + 3]
+ let atlasWidth : int = be32 16
+ let atlasHeight : int = be32 20
+ Assert.IsTrue((atlasWidth = VillageArt.worldAtlasWidth), "world atlas width must match 28 x 32px slots")
+ Assert.IsTrue((atlasHeight = VillageArt.worldAtlasHeight), "world atlas height must stay 32px")
+
[<TestMethod>]
member _.CjkGlyphManifestIsUniqueAndMatchesAtlasGrid () =
// 防复发:图集用字增长时,清单必须非空、每行恰 1 个字符、字符唯一,