summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop.Tests
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 11:48:37 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 11:48:37 +0800
commitac4fd29899e2fed8cb53d771325994ed481eae6b (patch)
treec0efc4a77fd909eb77936f3fd5412cad5418aefd /src/LivingVillage.Desktop.Tests
parentb13b28521f4b286d9a750848c7940546cf50adf3 (diff)
downloadliving-village-ac4fd29899e2fed8cb53d771325994ed481eae6b.tar.gz
feat(desktop): P 键暂停帮助页
P 键改为打开暂停帮助页(完整键位说明),打开时暂停模拟并保留原控制状态,返回游戏时精确恢复(速度/暂停原状);常驻 HUD 不放全键位清单。MenuState 新增 enterPauseHelp/exitPauseHelp 纯函数与回归测试。
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
-rw-r--r--src/LivingVillage.Desktop.Tests/PrototypeTests.fs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
index f1f4aed..524573f 100644
--- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
+++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs
@@ -203,6 +203,22 @@ type PrototypeTests () =
Assert.IsTrue(first.Tiles |> List.exists (fun tile -> tile.Kind = (VillageArt.StonePaving)))
[<TestMethod>]
+ member _.PauseHelpOpensFromPlayingAndRestoresSimulationControl () =
+ let original = { Paused = false; Speed = TwoX }
+ let state = { MenuState.create original true with Page = Playing }
+
+ let helpState, pausedControl = MenuState.enterPauseHelp original state
+ Assert.AreEqual<MenuPage>(Controls, helpState.Page)
+ Assert.AreEqual<MenuPage>(Playing, helpState.ReturnPage)
+ Assert.IsTrue(pausedControl.Paused)
+ Assert.AreEqual<SimulationSpeed>(TwoX, pausedControl.Speed)
+
+ let backState, restoredControl = MenuState.exitPauseHelp original helpState
+ Assert.AreEqual<MenuPage>(Playing, backState.Page)
+ Assert.IsFalse(restoredControl.Paused)
+ Assert.AreEqual<SimulationControl>(original, restoredControl)
+
+ [<TestMethod>]
member _.CornerStatusShowsDayMoneyAndEnergyFromRealData () =
let world = Sim.initialWorldN 42UL 0
let lines = M5Interaction.cornerStatusLines world