From 5975f4fb93270ad9c2466584a4fd9f691fffaee7 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 13 Apr 2026 21:28:38 +0200 Subject: [PATCH] Update viewport focus test to include Path selection --- tests/unit/viewport-focus.test.ts | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/unit/viewport-focus.test.ts b/tests/unit/viewport-focus.test.ts index 6549119b..04154f60 100644 --- a/tests/unit/viewport-focus.test.ts +++ b/tests/unit/viewport-focus.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from "vitest"; import { createBoxBrush } from "../../src/document/brushes"; +import { createScenePath } from "../../src/document/paths"; import { createEmptySceneDocument } from "../../src/document/scene-document"; import { createPointLightEntity, createPlayerStartEntity, createSpotLightEntity, createTriggerVolumeEntity } from "../../src/entities/entity-instances"; import { resolveViewportFocusTarget } from "../../src/viewport-three/viewport-focus"; @@ -166,6 +167,50 @@ describe("resolveViewportFocusTarget", () => { }); }); + it("frames the selected Path around its authored point bounds", () => { + const path = createScenePath({ + id: "path-focus", + points: [ + { + id: "point-a", + position: { + x: -2, + y: 0, + z: 1 + } + }, + { + id: "point-b", + position: { + x: 4, + y: 2, + z: 3 + } + } + ] + }); + const document = { + ...createEmptySceneDocument(), + paths: { + [path.id]: path + } + }; + + const focusTarget = resolveViewportFocusTarget(document, { + kind: "paths", + ids: [path.id] + }); + + expect(focusTarget).toEqual({ + center: { + x: 1, + y: 1, + z: 2 + }, + radius: Math.hypot(6, 2, 2) * 0.5 + }); + }); + it("frames the selected Spot Light helper", () => { const spotLight = createSpotLightEntity({ id: "entity-spot-light-main",