diff options
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/DesktopTests.fs | 2 | ||||
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/LivingVillage.Desktop.Tests/DesktopTests.fs b/src/LivingVillage.Desktop.Tests/DesktopTests.fs index 526d1af..e9713e5 100644 --- a/src/LivingVillage.Desktop.Tests/DesktopTests.fs +++ b/src/LivingVillage.Desktop.Tests/DesktopTests.fs @@ -102,7 +102,7 @@ type DesktopTests () = let renderPlan = VillageArt.sampleRenderPlan () let blockedTiles = (renderPlan.Grounds |> List.map (fun (tile, _) -> VillageArt.worldTile renderPlan tile)) - @ (renderPlan.Props |> List.map (fun prop -> VillageArt.worldTile renderPlan prop.Position)) + @ VillageArt.planFootprint renderPlan |> List.map (fun tile -> tile.X, tile.Y) |> Set.ofList let sceneTileOf (position: Vec2) : TilePosition = diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index a403223..06b3250 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -291,6 +291,20 @@ type PrototypeTests () = Assert.AreEqual<int>(4, first.Interior.Elements.Length) [<TestMethod>] + member _.HouseFacadeCoversRoofEaveAndWalledDoorRow () = + let plan = VillageArt.sampleRenderPlan () + let footprint = VillageArt.planFootprint plan |> Set.ofList + let door = scene.Homes |> List.head |> fun home -> VillageArt.worldTile plan home.Door + + // The enterable home must present a full facade: ridge, eave, and a walled row with the door. + for dx in -2 .. 1 do + Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 2 } : TilePosition), sprintf "missing ridge tile dx=%d" dx) + Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y - 1 } : TilePosition), sprintf "missing eave tile dx=%d" dx) + Assert.IsTrue(footprint.Contains({ X = door.X + dx; Y = door.Y } : TilePosition), sprintf "missing wall tile dx=%d" dx) + // 12 house tiles + 2 bridge + 3 bamboo + 2 garden. + Assert.AreEqual<int>(19, footprint.Count) + + [<TestMethod>] member _.FacingUsesTheActualMovementOrTargetVector () = Assert.AreEqual<VillageArt.FacingDirection>(VillageArt.EastFacing, VillageArt.directionFromVector { X = 1.0f; Y = 0.1f }) Assert.AreEqual<VillageArt.FacingDirection>(VillageArt.WestFacing, VillageArt.directionFromVector { X = -1.0f; Y = 0.1f }) |
