diff --git a/tests/unit/viewport-canvas.test.tsx b/tests/unit/viewport-canvas.test.tsx index b2a1d64b..5f6fc5a7 100644 --- a/tests/unit/viewport-canvas.test.tsx +++ b/tests/unit/viewport-canvas.test.tsx @@ -7,6 +7,8 @@ import { type TransformSessionState } from "../../src/core/transform-session"; import { createEmptySceneDocument } from "../../src/document/scene-document"; +import { createRuntimeClockState } from "../../src/runtime-three/runtime-project-time"; +import { buildRuntimeSceneFromDocument } from "../../src/runtime-three/runtime-scene-build"; import { ViewportCanvas } from "../../src/viewport-three/ViewportCanvas"; import { createDefaultViewportPanelCameraState, @@ -232,4 +234,53 @@ describe("ViewportCanvas", () => { ).toHaveBeenCalledTimes(1); }); }); + + it("pushes editor simulation scene state into the viewport host", async () => { + const sceneDocument = createEmptySceneDocument(); + const editorSimulationScene = buildRuntimeSceneFromDocument(sceneDocument); + const editorSimulationClock = createRuntimeClockState(sceneDocument.time); + + render( + true)} + onCameraStateChange={vi.fn()} + onToolPreviewChange={vi.fn()} + onTransformSessionChange={vi.fn()} + onTransformCommit={vi.fn()} + onTransformCancel={vi.fn()} + /> + ); + + await waitFor(() => { + expect(viewportHostInstances).toHaveLength(1); + expect(viewportHostInstances[0].updateSimulation).toHaveBeenCalledWith( + editorSimulationScene, + editorSimulationClock + ); + }); + }); });