From 7ce72c95c1f0060340b4727d8aae1020eb8d4060 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Fri, 3 Apr 2026 01:37:50 +0200 Subject: [PATCH] Add viewport layout and camera state tests in editor-store.test.ts --- tests/domain/editor-store.test.ts | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/domain/editor-store.test.ts b/tests/domain/editor-store.test.ts index 0d7767d0..57546b37 100644 --- a/tests/domain/editor-store.test.ts +++ b/tests/domain/editor-store.test.ts @@ -70,6 +70,23 @@ describe("EditorStore", () => { const writerStore = createEditorStore({ storage }); writerStore.executeCommand(createSetSceneNameCommand("Draft Scene")); + writerStore.setViewportLayoutMode("quad"); + writerStore.setActiveViewportPanel("bottomRight"); + writerStore.setViewportPanelViewMode("topLeft", "top"); + writerStore.setViewportPanelDisplayMode("topLeft", "authoring"); + writerStore.setViewportPanelCameraState("topLeft", { + target: { + x: 6, + y: 2, + z: -4 + }, + perspectiveOrbit: { + radius: 18, + theta: 0.9, + phi: 1.1 + }, + orthographicZoom: 2.25 + }); expect(writerStore.saveDraft()).toEqual({ status: "saved", message: "Local draft saved." @@ -85,6 +102,25 @@ describe("EditorStore", () => { message: "Local draft loaded." }); expect(readerStore.getState().document.name).toBe("Draft Scene"); + expect(readerStore.getState().viewportLayoutMode).toBe("quad"); + expect(readerStore.getState().activeViewportPanelId).toBe("bottomRight"); + expect(readerStore.getState().viewportPanels.topLeft).toMatchObject({ + viewMode: "top", + displayMode: "authoring", + cameraState: { + target: { + x: 6, + y: 2, + z: -4 + }, + perspectiveOrbit: { + radius: 18, + theta: 0.9, + phi: 1.1 + }, + orthographicZoom: 2.25 + } + }); }); it("fails gracefully when storage access throws", () => {