test(extract): Begehbarkeitsmaske je Ebene ohne Land darunter prüfen

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Haiku 4.5 committed 2026-09-13 10:44:18 +02:00
1 parent 2f38e8f445
commit 40fc38059a
1 file changed
+26
+26
View File
@@ -83,3 +83,29 @@ def test_debug_overview_still_draws_palms(tmp_path):
stats = overview.render(src, dst)
assert stats["palmen"] == 1
assert Image.open(dst).getpixel((100, 100)) == overview.PALM # 200 m bei 0,5 px/m
def test_walkable_mask_marks_roads_bridges_and_surfaces_without_land(tmp_path):
"""Jede begehbare Ebene für sich, ohne Land darunter: sonst verdeckt das Land einen Fehler."""
src = tmp_path / "chunks"
src.mkdir()
chunk = {
"chunk": [0, 0],
"origin": [SLICE["x0"], -SLICE["y1"]],
"land": [],
"surfaces": [{"poly": [_ring(0, 0, 40, 40)], "kind": "sand"}],
"roads": [{"poly": [_ring(100, 0, 120, 40)], "bridge": False},
{"poly": [_ring(200, 0, 220, 40)], "bridge": True}],
"centerlines": [],
"buildings": [],
"palms": [],
}
(src / "chunk_0_0.json").write_text(json.dumps(chunk))
(src / "manifest.json").write_text('{"slice": "vice-a"}\n')
dst = tmp_path / "out"
overview.render_map(src, dst)
mask = Image.open(dst / "map-walkable.png")
assert mask.getpixel((5, 5)) == overview.WALKABLE # Sand bei 20 m / 20 m
assert mask.getpixel((27, 5)) == overview.WALKABLE # Straße bei 110 m / 20 m
assert mask.getpixel((52, 5)) == overview.WALKABLE # Brücke bei 210 m / 20 m
assert mask.getpixel((40, 5)) == overview.BLOCKED # Wasser bei 160 m / 20 m