From 447c21c7f968580c27aec4527a78cc7d3a0d5c45 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 12 May 2026 23:39:01 +0200 Subject: [PATCH] Add test case for building terrain-glued runtime paths --- tests/domain/build-runtime-scene.test.ts | 72 ++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tests/domain/build-runtime-scene.test.ts b/tests/domain/build-runtime-scene.test.ts index 7ae956b4..2d66458e 100644 --- a/tests/domain/build-runtime-scene.test.ts +++ b/tests/domain/build-runtime-scene.test.ts @@ -1846,6 +1846,78 @@ describe("buildRuntimeSceneFromDocument", () => { expect(runtimeScene.sceneBounds?.max.y).toBe(2); }); + it("builds terrain-glued runtime paths from enabled terrain heights", () => { + const terrain = createTerrain({ + id: "terrain-runtime-path-glue", + position: { + x: 0, + y: 4, + z: 0 + }, + sampleCountX: 3, + sampleCountZ: 2, + cellSize: 1, + heights: [0, 1, 2, 0, 1, 2] + }); + const path = createScenePath({ + id: "path-runtime-glued", + glueToTerrain: true, + terrainOffset: 0.5, + points: [ + { + id: "path-point-a", + position: { + x: 0, + y: 20, + z: 0 + } + }, + { + id: "path-point-b", + position: { + x: 2, + y: 20, + z: 0 + } + } + ] + }); + + const runtimeScene = buildRuntimeSceneFromDocument({ + ...createEmptySceneDocument({ name: "Runtime Terrain Glue Path Scene" }), + terrains: { + [terrain.id]: terrain + }, + paths: { + [path.id]: path + } + }); + + expect(runtimeScene.paths[0]).toMatchObject({ + id: path.id, + glueToTerrain: true, + terrainOffset: 0.5, + points: [ + { + pointId: "path-point-a", + position: { + x: 0, + y: 4.5, + z: 0 + } + }, + { + pointId: "path-point-b", + position: { + x: 2, + y: 6.5, + z: 0 + } + } + ] + }); + }); + it("includes authored foliage layers, prototypes, and terrain masks for derived rendering", () => { const bundledPrototype = BUNDLED_FOLIAGE_PROTOTYPES[0]!; const layer = createFoliageLayer({