diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-29 06:12:57 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-29 06:12:57 +0800 |
| commit | ec49a835361fd0f6d92a41204dcc9547073b46ee (patch) | |
| tree | e487c692e327484bfc813db2f65cb6a43a13b4cc /src/LivingVillage.Desktop.Tests | |
| parent | 166fbeb4efd1c36c5c8289defdf480c89835d540 (diff) | |
| download | living-village-ec49a835361fd0f6d92a41204dcc9547073b46ee.tar.gz | |
p64: 整改桥梁栏杆可辨(深墨栏体/亮扶手/望柱)与内景四角布局(Hermes vision 复核)
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs b/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs index 9000a04..714168a 100644 --- a/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs +++ b/src/LivingVillage.Desktop.Tests/P64EvidenceTests.fs @@ -15,6 +15,9 @@ type P64EvidenceTests () = let samplePlan () = VillageArt.sampleRenderPlan () + let rectsOverlap (a: Microsoft.Xna.Framework.Rectangle) (b: Microsoft.Xna.Framework.Rectangle) = + a.X < b.X + b.Width && b.X < a.X + a.Width && a.Y < b.Y + b.Height && b.Y < a.Y + a.Height + [<TestMethod>] member _.OverviewUpperBandIsDenselyPopulated () = let plan = samplePlan () @@ -54,3 +57,27 @@ type P64EvidenceTests () = Assert.AreEqual<int>(8, plan.Interior.Elements.Length) for kind in [ VillageArt.Chair; VillageArt.Stool; VillageArt.BedFoot; VillageArt.Teapot ] do Assert.IsTrue(kinds |> List.contains kind, sprintf "内景缺少 %A" kind) + + /// P64 整改:家具分布全屋四角、两两不重叠、不压中央通道。red→green 门。 + [<TestMethod>] + member _.InteriorFurnitureIsSpreadAcrossRoomAndNonOverlapping () = + let plan = samplePlan () + let layout = VillageArt.interiorLayout 1280 720 + let placed = + plan.Interior.Elements + |> List.map (fun element -> element.Kind, VillageArt.interiorElementScreenRect layout element) + for i in 0 .. placed.Length - 2 do + for j in i + 1 .. placed.Length - 1 do + let (kindA, a) = placed.[i] + let (kindB, b) = placed.[j] + Assert.IsFalse(rectsOverlap a b, sprintf "内景家具 %A 与 %A 重叠" kindA kindB) + let midX = layout.RoomX + layout.RoomWidth / 2 + let midY = layout.RoomY + layout.RoomHeight / 2 + let quadrant (r: Microsoft.Xna.Framework.Rectangle) = + (r.X + r.Width / 2 < midX, r.Y + r.Height / 2 < midY) + let quads = placed |> List.map (fun (_, r) -> quadrant r) |> List.distinct + Assert.IsTrue(quads.Length >= 4, "家具须分布在四个象限(四角/沿墙)") + // 中央通道(房间中心点)不得被家具矩形覆盖。 + for kind, r in placed do + let coversCenter = r.X <= midX && midX < r.X + r.Width && r.Y <= midY && midY < r.Y + r.Height + Assert.IsFalse(coversCenter, sprintf "%A 压住中央通道" kind) |
