From d85cce460fd7fbb8854fb11ba547be1baf576de7 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Tue, 22 Sep 2026 00:08:15 +0800 Subject: feat(desktop): P16 启动画面淡入(Esc/空格跳过)+ 开始界面收敛三项(开始/读档/退出)+ CJK 补字 238 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LivingVillage.Desktop.Tests/P16UiTests.fs | 66 +++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/LivingVillage.Desktop.Tests/P16UiTests.fs (limited to 'src/LivingVillage.Desktop.Tests/P16UiTests.fs') diff --git a/src/LivingVillage.Desktop.Tests/P16UiTests.fs b/src/LivingVillage.Desktop.Tests/P16UiTests.fs new file mode 100644 index 0000000..0bfdb62 --- /dev/null +++ b/src/LivingVillage.Desktop.Tests/P16UiTests.fs @@ -0,0 +1,66 @@ +namespace LivingVillage.Desktop.Tests + +open Microsoft.VisualStudio.TestTools.UnitTesting +open LivingVillage.Kernel +open LivingVillage.Desktop + +// ---- P16 启动画面 / 开始界面 ---- + +[] +type P16LaunchTests () = + + [] + member _.LaunchRevealAndVeilAreDeterministicAndComplete () = + Assert.AreEqual(0.0f, LaunchScreen.revealProgress 0L) + Assert.AreEqual(1.0f, LaunchScreen.revealProgress LaunchScreen.fadeInFrames) + Assert.AreEqual(1.0f, LaunchScreen.revealProgress 1000L) + Assert.AreEqual(1.0f, LaunchScreen.veilAlpha 0L) + Assert.AreEqual(0.0f, LaunchScreen.veilAlpha LaunchScreen.durationFrames) + Assert.IsTrue(LaunchScreen.veilAlpha 30L > LaunchScreen.veilAlpha 90L, "veil must decrease monotonically") + Assert.IsFalse(LaunchScreen.isComplete (LaunchScreen.durationFrames - 1L)) + Assert.IsTrue(LaunchScreen.isComplete LaunchScreen.durationFrames) + + [] + member _.LaunchSkipIsEscOrSpaceAndTextUsesTheAtlasPath () = + Assert.IsTrue(LaunchScreen.skipRequested true false) + Assert.IsTrue(LaunchScreen.skipRequested false true) + Assert.IsFalse(LaunchScreen.skipRequested false false) + Assert.IsTrue(PixelText.isRenderable LaunchScreen.title) + Assert.IsTrue(PixelText.isRenderable LaunchScreen.skipHint) + Assert.IsTrue(PixelText.isRenderable LaunchScreen.subtitle) + Assert.IsTrue(ChineseText.requiredUiLabels |> List.contains LaunchScreen.skipHint) + +[] +type P16StartMenuTests () = + + [] + member _.StartMenuIsExactlyThreeItemsWithChineseLabels () = + let state = MenuState.create SimulationControl.initial false + + Assert.AreEqual(3, MenuState.items state |> List.length) + Assert.AreEqual([ "开始"; "读档"; "退出" ], MenuState.items state |> List.map MenuState.itemLabel) + + [] + member _.StartMenuNavigationSelectsEachItemAndWraps () = + let state = MenuState.create SimulationControl.initial false + let down1 = MenuState.move Down state + let down2 = MenuState.move Down down1 + let wrap = MenuState.move Down down2 + + Assert.AreEqual(NewGameItem, MenuState.selectedItem state) + Assert.AreEqual(LoadItem, MenuState.selectedItem down1) + Assert.AreEqual(ExitItem, MenuState.selectedItem down2) + Assert.AreEqual(NewGameItem, MenuState.selectedItem wrap) + + Assert.AreEqual(StartNewGame, MenuState.update Confirm state |> snd) + Assert.AreEqual(LoadGame, MenuState.update Confirm down1 |> snd) + Assert.AreEqual(ExitGame, MenuState.update Confirm down2 |> snd) + + [] + member _.ReturningToMenuOffersContinueAsTheFirstOfThreeItems () = + let playing = MenuState.create SimulationControl.initial true |> MenuState.enterGame + let main = MenuState.openMain playing + + Assert.AreEqual([ ContinueItem; LoadItem; ExitItem ], MenuState.items main) + Assert.AreEqual([ "继续"; "读档"; "退出" ], MenuState.items main |> List.map MenuState.itemLabel) + Assert.AreEqual(ContinueGame, MenuState.update Confirm main |> snd) -- cgit v1.2.3