diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-21 12:05:26 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-21 12:05:26 +0800 |
| commit | 2851a030db0f0bc5892305fb189a41c97c13578d (patch) | |
| tree | dbb834c31ad43777fd43f39c00f58449cb753388 /src/LivingVillage.Desktop.Tests | |
| parent | 3812e78ba39764b3844d52ee7382b1350960ecb9 (diff) | |
| download | living-village-2851a030db0f0bc5892305fb189a41c97c13578d.tar.gz | |
fix(desktop): 标题菜单光标与文字分列不再叠印
根因:页面标题行(panelY+24)与首行内容(MenuTopY)同为 y=320 造成两串文字叠印。修复:TitleScreen 布局新增 HeadingY/FirstItemY 分层与独立光标列(CursorX/CursorWidth/TextX),selectionRects 纯函数返回光标与文字矩形,回归测试断言逐行矩形不相交且标题行净空≥32px;渲染改为光标、文字分别绘制。
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index 524573f..c85287f 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -246,6 +246,22 @@ type PrototypeTests () = Assert.IsTrue(ChineseText.requiredUiLabels |> List.contains "精力") [<TestMethod>] + member _.TitleScreenSelectionCursorAndLabelNeverOverprint () = + let layout = TitleScreen.layout 1280 720 + + // Heading must sit fully above the first menu row (no same-line overprint). + Assert.IsTrue(layout.FirstItemY - layout.HeadingY >= 32, sprintf "heading clearance %d" (layout.FirstItemY - layout.HeadingY)) + + // Every menu row: cursor rectangle and label rectangle must be disjoint. + for rowIndex in 0 .. 5 do + let cursor, label = TitleScreen.selectionRects layout rowIndex + Assert.IsTrue(TitleScreen.rectsDisjoint cursor label, sprintf "row %d cursor overlaps label" rowIndex) + Assert.AreEqual<int>(cursor.Y, label.Y) + + // Cursor column leaves real clearance: label starts beyond cursor + margin. + Assert.IsTrue(layout.TextX >= layout.CursorX + layout.CursorWidth) + + [<TestMethod>] member _.TitleScreenLayoutIsDeterministicAndLayered () = let first = TitleScreen.layout 1280 720 let second = TitleScreen.layout 1280 720 |
