summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-29 10:38:53 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-29 10:38:53 +0800
commit328760853c15c44d1de915d6c88e0dfd7ddc5af6 (patch)
treeaa1e570378cfe92b0c4e9f125141a43d0ba89663 /src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs
parent46073814a67598c1a4122d1cb5abaaeb38c94e6d (diff)
downloadliving-village-328760853c15c44d1de915d6c88e0dfd7ddc5af6.tar.gz
p72: 角色行走四向动画帧提升(6 走 + 2 待机)
CharacterArt 运行时点阵图集从 4 走 + 2 待机扩为 6 走(新增左右低过渡步 4/5,由 1/2 镜像)+ 2 待机,格数 *8、图集 5120x48;VillageArt 帧循环 %6、characterSourceRectangle *8、characterAtlasWidth 5120。同步 P45/Prototype 帧断言、新增 P72 帧表完整性回归、脚本与素材重新生成、维护说明动画语义。白天正午村庄行走实跑证据落 docs/evidence/p72-*。Desktop 343/343、Kernel 120/120、digest 与 p70 一致。
Diffstat (limited to 'src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs')
-rw-r--r--src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs b/src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs
new file mode 100644
index 0000000..781d22c
--- /dev/null
+++ b/src/LivingVillage.Desktop.Tests/P72CharacterWalkTests.fs
@@ -0,0 +1,40 @@
+namespace LivingVillage.Desktop.Tests
+
+open Microsoft.VisualStudio.TestTools.UnitTesting
+open LivingVillage.Desktop
+
+/// P72 回归:角色行走帧表完整性——四向各 8 格(6 走 + 2 待机),
+/// 六张行走帧两两可见区分(含左右过渡步),且与待机帧不同。
+[<TestClass>]
+type P72CharacterWalkTests () =
+
+ let letters variant direction frame = CharacterArt.frameLetters variant direction frame
+
+ let cellDiff (a: string list) (b: string list) : int =
+ List.zip a b
+ |> List.sumBy (fun (ra, rb) -> Seq.zip ra rb |> Seq.filter (fun (x, y) -> x <> y) |> Seq.length)
+
+ [<TestMethod>]
+ member _.WalkFrameTableHasSixDistinctPosesPerDirection () =
+ Assert.AreEqual<int>(8, CharacterArt.frameCount)
+ Assert.AreEqual<int>(6, CharacterArt.walkFrameCount)
+ Assert.AreEqual<int>(2, CharacterArt.idleFrameCount)
+ for variant in 0 .. CharacterArt.variantCount - 1 do
+ for direction in 0 .. CharacterArt.directionCount - 1 do
+ let walk = [ 0 .. CharacterArt.walkFrameCount - 1 ] |> List.map (letters variant direction)
+ // 6 张行走帧两两必须有可见差异(不允许重复姿态)。
+ for i in 0 .. walk.Length - 1 do
+ for j in i + 1 .. walk.Length - 1 do
+ Assert.IsTrue(
+ cellDiff walk.[i] walk.[j] >= 4,
+ sprintf "v%d d%d 走帧 %d 与 %d 姿态重复" variant direction i j)
+ // 行走与待机必须不同。
+ let idle = letters variant direction CharacterArt.walkFrameCount
+ Assert.IsTrue(cellDiff walk.[0] idle >= 4, "行走帧与待机帧相同")
+
+ [<TestMethod>]
+ member _.AtlasStridePlacesSixWalkThenTwoIdleCells () =
+ Assert.AreEqual<int>(5120, CharacterArt.atlasWidth)
+ Assert.AreEqual<int>(5120, VillageArt.characterAtlasWidth)
+ let stride = VillageArt.characterAtlasWidth / 32 / (5 * 4)
+ Assert.AreEqual<int>(8, stride)