From fe5162a3e86fe63677c3be547750b1ac30337614 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Tue, 22 Sep 2026 09:28:32 +0800 Subject: feat(desktop): P26 HUD 常驻元素半透明底色 + 1px 描边(昼/夜可读) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/LivingVillage.Desktop.Tests/P16UiTests.fs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/LivingVillage.Desktop.Tests/P16UiTests.fs') 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 "钱币") + [] + 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(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(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 菜单截图帧表 ---- [] -- cgit v1.2.3