Fix native island material rendering

This commit is contained in:
que01 committed 2026-09-29 12:04:29 +08:00
1 parent b6d30787cd
commit c1277af16a
4 files changed
+28 -3

No files matched your search

+15 -1
View File
@@ -31,7 +31,7 @@ from osmassets.geom import (
sample_tree_row,
signed_polygon_area,
)
from osmassets.catalog import ROAD_LAYERS
from osmassets.catalog import MATERIALS, ROAD_LAYERS
from osmassets.native_road_manifest import CONTRACT, load as load_native_road_manifest
from osmassets.osm import Projector, parse_height, parse_osm, tags
@@ -40,6 +40,13 @@ SQUARE = [(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)]
class RoadLayerCatalogTest(unittest.TestCase):
def test_native_island_material_is_registered(self):
material = MATERIALS["native_island_green"]
self.assertEqual(material["kind"], "solid")
self.assertEqual(material["color"], (0.0382, 0.4793, 0.1441))
self.assertGreater(material["color"][1], material["color"][0])
self.assertGreater(material["color"][1], material["color"][2])
def test_intersection_and_road_asphalt_share_the_same_colour(self):
layers = {layer["id"]: layer for layer in ROAD_LAYERS}
self.assertEqual(layers["road_surface"]["color"],
@@ -105,6 +112,13 @@ class NativeRoadManifestTest(unittest.TestCase):
with self.assertRaisesRegex(RuntimeError, "semantic"):
load_native_road_manifest(self.root.name)
def test_split_overlay_has_a_separate_z_layer(self):
native_roads = os.path.join(os.path.dirname(os.path.abspath(__file__)),
"..", "osmassets", "native_roads.py")
with open(native_roads, encoding="utf-8") as handle:
source = handle.read()
self.assertIn('0.001 if "match" in case else 0.0', source)
self.write_manifest([{"source": "center_lines", "role": "marking",
"materialLayer": "center_lines", "splitBy": {
"prop": "color", "cases": [