diff --git a/tests/unit/transform-foundation.integration.test.tsx b/tests/unit/transform-foundation.integration.test.tsx index b13a42c5..df252fe8 100644 --- a/tests/unit/transform-foundation.integration.test.tsx +++ b/tests/unit/transform-foundation.integration.test.tsx @@ -10,6 +10,7 @@ import type { ActiveTransformSession, TransformSessionState } from "../../src/co import { createBoxBrush } from "../../src/document/brushes"; import { createEmptySceneDocument } from "../../src/document/scene-document"; import { createPlayerStartEntity } from "../../src/entities/entity-instances"; +import type { ViewportPanelCameraState } from "../../src/viewport-three/viewport-layout"; const { MockViewportHost, viewportHostInstances } = vi.hoisted(() => { const viewportHostInstances: Array<{ @@ -249,6 +250,18 @@ function commitTransform(viewportHost: ReturnType }); } +function emitCameraStateChange(viewportHost: ReturnType, cameraState: ViewportPanelCameraState) { + const handler = viewportHost.setCameraStateChangeHandler.mock.calls.at(-1)?.[0] as ((cameraState: ViewportPanelCameraState) => void) | undefined; + + if (handler === undefined) { + throw new Error("Camera state change handler was not registered."); + } + + act(() => { + handler(cameraState); + }); +} + describe("transform foundation integration", () => { beforeEach(() => { viewportHostInstances.length = 0;