fix(ui): Landeplatz nur auf ganzem Kollisionsboden, Trackpad-Zoom, Fokus und Ladefehler der Minimap
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e702517662
commit
dd5ced505b
9 files changed
+263
-54
No files matched your search
@@ -85,8 +85,8 @@ def test_debug_overview_still_draws_palms(tmp_path):
|
||||
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."""
|
||||
def test_walkable_mask_counts_only_ground_with_collision(tmp_path):
|
||||
"""Straßen und Beläge sind reine Auflagen: ohne Landplatte darunter trägt nur eine Brücke."""
|
||||
src = tmp_path / "chunks"
|
||||
src.mkdir()
|
||||
chunk = {
|
||||
@@ -105,7 +105,48 @@ def test_walkable_mask_marks_roads_bridges_and_surfaces_without_land(tmp_path):
|
||||
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((5, 5)) == overview.BLOCKED # Sand ohne Land bei 20 m / 20 m: keine Kollision
|
||||
assert mask.getpixel((27, 5)) == overview.BLOCKED # Straße ohne Land bei 110 m / 20 m: keine Kollision
|
||||
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
|
||||
|
||||
|
||||
def test_walkable_mask_blocks_pixels_that_are_only_partly_free(tmp_path):
|
||||
"""Ein 4-m-Pixel, den Wasser oder ein Gebäude auch nur anschneidet, ist kein Landeplatz."""
|
||||
src = tmp_path / "chunks"
|
||||
src.mkdir()
|
||||
chunk = {
|
||||
"chunk": [0, 0],
|
||||
"origin": [SLICE["x0"], -SLICE["y1"]],
|
||||
"land": [[_ring(0, 0, 102, 250)]], # Küste bei x = 102 m, mitten in Pixel 25
|
||||
"surfaces": [],
|
||||
"roads": [],
|
||||
"centerlines": [],
|
||||
"buildings": [{"poly": [_ring(38, 40, 50, 50)], "height": 8.0, "source": "district", "speculative": False}],
|
||||
"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((24, 30)) == overview.WALKABLE # 96..100 m: ganz Land
|
||||
assert mask.getpixel((25, 30)) == overview.BLOCKED # 100..104 m: halb Wasser
|
||||
assert mask.getpixel((9, 11)) == overview.BLOCKED # 36..40 m: das Gebäude beginnt bei 38 m
|
||||
assert mask.getpixel((8, 11)) == overview.WALKABLE # 32..36 m: frei
|
||||
|
||||
|
||||
def test_committed_map_files_match_the_committed_chunks(tmp_path):
|
||||
"""Kartenbild, Maske und map.json müssen aus genau den ausgelieferten Chunks stammen.
|
||||
|
||||
Ändert ein Pipeline-Lauf die Chunks, ohne dass overview.py läuft, zeigte die Minimap eine alte
|
||||
Welt und landete nach einer alten Maske. Die Laufzeitprüfung über manifest_sha256 bemerkt das
|
||||
erst im Browser, dieser Test schon beim Testlauf.
|
||||
"""
|
||||
shipped = Path(overview.__file__).resolve().parents[2] / "public" / "data" / "vice-a"
|
||||
overview.render_map(shipped, tmp_path)
|
||||
for name in ("map.png", "map-walkable.png"):
|
||||
fresh, committed = Image.open(tmp_path / name), Image.open(shipped / name)
|
||||
assert (fresh.size, fresh.mode) == (committed.size, committed.mode), name
|
||||
assert fresh.tobytes() == committed.tobytes(), f"{name} ist veraltet: cd tools/extract && uv run python overview.py"
|
||||
assert json.loads((tmp_path / "map.json").read_text()) == json.loads((shipped / "map.json").read_text())
|
||||
Reference in new issue
Block a user