summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-22 01:21:46 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-22 01:21:46 +0800
commita67e9262caca67f1078f77ed2f274a46e284c6c8 (patch)
tree5c68b39069fb3c7a8fc73b1f9f27b0bda0c16df4 /src/LivingVillage.Desktop.Tests
parent8fad58bd62155da653251ab7457cd54ebba0b279 (diff)
downloadliving-village-a67e9262caca67f1078f77ed2f274a46e284c6c8.tar.gz
fix(desktop): P17-FIX 起时钩子在 sample/autoplay 路径生效(resolveStartTick 纯函数 + 回归 + 重拍证据)
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
-rw-r--r--src/LivingVillage.Desktop.Tests/PrototypeTests.fs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
index 4d2c895..b250824 100644
--- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
+++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
@@ -902,6 +902,20 @@ type PrototypeTests () =
Assert.AreEqual<int64>(6L * ticksPerHour, M6Presentation.startTickForHour 6.0)
[<TestMethod>]
+ member _.StartTickResolutionHonoursEvidenceHourThenDaylightThenMidnight () =
+ let ticksPerHour = Sim.ticksPerDay / 24L
+
+ // P17-FIX: the evidence hour must win on the sample/autoplay path too, otherwise
+ // StartNewGame re-created the world at 00:00 and dusk/day shots were actually night.
+ Assert.AreEqual<int64>(M6Presentation.startTickForHour 20.75, M6Presentation.resolveStartTick (Some 20.75) false)
+ Assert.AreEqual<int64>(int64 20 * ticksPerHour + ticksPerHour * 3L / 4L, M6Presentation.resolveStartTick (Some 20.75) false)
+ // Explicit hour overrides the daylight bootstrap.
+ Assert.AreEqual<int64>(12L * ticksPerHour, M6Presentation.resolveStartTick (Some 12.0) true)
+ // No override: daylight -> 6:00, otherwise midnight.
+ Assert.AreEqual<int64>(6L * ticksPerHour, M6Presentation.resolveStartTick None true)
+ Assert.AreEqual<int64>(0L, M6Presentation.resolveStartTick None false)
+
+ [<TestMethod>]
member _.TitleEntranceProgressIsDeterministicAndCompleteAfterTwoSeconds () =
// 120 frames at the fixed 60Hz step = 2s entrance, pure function of frame count.
Assert.AreEqual<float32>(1.0f, TitleScreen.entranceProgress 0L)