diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 09:28:32 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 09:28:32 +0800 |
| commit | fe5162a3e86fe63677c3be547750b1ac30337614 (patch) | |
| tree | 767e2abd668b78e22ac21fda98510b52ace7a699 /src/LivingVillage.Desktop.Tests/P16UiTests.fs | |
| parent | ebe7f80bcf54189cc51a15bf17b99293b6ff57a3 (diff) | |
| download | living-village-fe5162a3e86fe63677c3be547750b1ac30337614.tar.gz | |
feat(desktop): P26 HUD 常驻元素半透明底色 + 1px 描边(昼/夜可读)
Diffstat (limited to 'src/LivingVillage.Desktop.Tests/P16UiTests.fs')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/P16UiTests.fs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/P16UiTests.fs b/src/LivingVillage.Desktop.Tests/P16UiTests.fs index 2e474ac..b68bbd3 100644 --- a/src/LivingVillage.Desktop.Tests/P16UiTests.fs +++ b/src/LivingVillage.Desktop.Tests/P16UiTests.fs @@ -128,6 +128,27 @@ type P16HudTests () = Assert.IsTrue(ChineseText.requiredUiLabels |> List.contains "体力") Assert.IsTrue(ChineseText.requiredUiLabels |> List.contains "钱币") + [<TestMethod>] + member _.HudPersistentSegmentsGetBackdropAndOutlineInBothPeriods () = + // P26:白天/夜景两套调色板都要有半透明底色 + 不透明深色描边,保证常驻元素可读。 + for mode in [ Day; Night ] do + let palette = HudLayout.palette mode + Assert.IsTrue(palette.SegmentBackdrop.A > 0uy, "segment backdrop must be translucent, not opaque") + Assert.IsTrue(palette.SegmentBackdrop.A < 255uy, "segment backdrop must keep the scene visible") + Assert.AreEqual<byte>(255uy, palette.Outline.A) + Assert.IsTrue(palette.Outline.R < 40uy && palette.Outline.G < 40uy && palette.Outline.B < 40uy) + let outlineSum = int palette.Outline.R + int palette.Outline.G + int palette.Outline.B + let valueSum = int palette.Value.R + int palette.Value.G + int palette.Value.B + Assert.IsTrue(outlineSum < valueSum, "outline must contrast with the bright value text") + Assert.AreEqual<int>(4, HudLayout.textOutlineOffsets.Length) + for (dx, dy) in HudLayout.textOutlineOffsets do + Assert.IsTrue(dx <> 0 || dy <> 0, "outline offset must be non-zero") + let placed = HudLayout.layout (HudLayout.segments world SimulationControl.initial) + for (x, width, _) in placed do + let rect = HudLayout.segmentBackdrop x width + Assert.IsTrue(rect.X <= x && rect.X + rect.Width >= x + width, "backdrop must cover the segment text") + Assert.IsTrue(rect.Y >= 0 && rect.Y + rect.Height <= HudLayout.barHeight, "backdrop must stay inside the bar") + // ---- P16-FIX 菜单截图帧表 ---- [<TestClass>] |
