From 2df1eb7eed99183a1514a2fdc4dcb19b00fec092 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 18 May 2026 16:21:06 +0200 Subject: [PATCH] auto-git: [change] src/viewport-three/viewport-host.ts [change] tests/domain/build-runtime-scene.test.ts [change] tests/domain/custom-material.command.test.ts [change] tests/domain/delete-project-asset.test.ts [change] tests/domain/scene-document-validation.test.ts [change] tests/serialization/project-document-json.test.ts [change] tests/serialization/project-package.test.ts [change] tests/serialization/scene-document-json.test.ts [change] tests/unit/whitebox-material-inspector.integration.test.tsx --- src/viewport-three/viewport-host.ts | 115 ++++++++---- tests/domain/build-runtime-scene.test.ts | 170 +++++++++++------- tests/domain/custom-material.command.test.ts | 5 +- tests/domain/delete-project-asset.test.ts | 4 +- .../domain/scene-document-validation.test.ts | 4 +- .../project-document-json.test.ts | 12 +- tests/serialization/project-package.test.ts | 8 +- .../serialization/scene-document-json.test.ts | 39 ++-- ...ox-material-inspector.integration.test.tsx | 35 ++-- 9 files changed, 226 insertions(+), 166 deletions(-) diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index 16be102c..3dffbe4f 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -971,7 +971,9 @@ export function resolveViewportWorldState(options: { }): ViewportResolvedWorldState { const world = options.currentSimulationScene?.world ?? options.currentWorld; const timeSettings = - options.currentSimulationScene?.time ?? options.currentDocument?.time ?? null; + options.currentSimulationScene?.time ?? + options.currentDocument?.time ?? + null; if (world === null) { return { @@ -1528,10 +1530,7 @@ export class ViewportHost { this.terrainGridResizeOverlayGroup.add(visual.group); } - applyRendererRenderCategory( - this.terrainGridResizeOverlayGroup, - "overlay" - ); + applyRendererRenderCategory(this.terrainGridResizeOverlayGroup, "overlay"); this.scene.add(this.terrainGridResizeOverlayGroup); this.scene.add(this.pathGroup); this.scene.add(this.entityGroup); @@ -2790,17 +2789,13 @@ export class ViewportHost { } private applyWorld() { - const { - world, - timeSettings, - resolvedTime, - resolvedWorld - } = resolveViewportWorldState({ - currentWorld: this.currentWorld, - currentDocument: this.currentDocument, - currentSimulationScene: this.currentSimulationScene, - currentSimulationClock: this.currentSimulationClock - }); + const { world, timeSettings, resolvedTime, resolvedWorld } = + resolveViewportWorldState({ + currentWorld: this.currentWorld, + currentDocument: this.currentDocument, + currentSimulationScene: this.currentSimulationScene, + currentSimulationClock: this.currentSimulationClock + }); if (world === null) { return; @@ -7705,7 +7700,10 @@ export class ViewportHost { color: materialDef === null ? fallbackColor - : Number.parseInt(materialDef.swatchColorHex.replace("#", ""), 16), + : Number.parseInt( + materialDef.swatchColorHex.replace("#", ""), + 16 + ), wireframe: true, side: DoubleSide }) @@ -7773,7 +7771,9 @@ export class ViewportHost { ); } - private createRoadJunctionMaterial(junction: SplineCorridorJunction): Material { + private createRoadJunctionMaterial( + junction: SplineCorridorJunction + ): Material { return this.createRoadGeneratedMaterial( junction.materialId, PATH_JUNCTION_PREVIEW_COLOR @@ -7802,7 +7802,10 @@ export class ViewportHost { const meshes: Array> = []; if (surfaceGeometry !== null) { - const mesh = new Mesh(surfaceGeometry, this.createRoadSurfaceMaterial(path)); + const mesh = new Mesh( + surfaceGeometry, + this.createRoadSurfaceMaterial(path) + ); mesh.castShadow = false; mesh.receiveShadow = true; mesh.userData.pathId = path.id; @@ -7825,7 +7828,10 @@ export class ViewportHost { } const edge = path.road.edges[side]; - const edgeMesh = new Mesh(edgeGeometry, this.createRoadEdgeMaterial(edge)); + const edgeMesh = new Mesh( + edgeGeometry, + this.createRoadEdgeMaterial(edge) + ); edgeMesh.castShadow = false; edgeMesh.receiveShadow = true; edgeMesh.userData.pathId = path.id; @@ -7851,7 +7857,10 @@ export class ViewportHost { const meshes: Array> = []; if (geometry !== null) { - const mesh = new Mesh(geometry, this.createRoadJunctionMaterial(junction)); + const mesh = new Mesh( + geometry, + this.createRoadJunctionMaterial(junction) + ); mesh.castShadow = false; mesh.receiveShadow = true; mesh.userData.splineCorridorJunctionId = junction.id; @@ -7872,7 +7881,10 @@ export class ViewportHost { }); if (edgeGeometry !== null) { - const edgeMesh = new Mesh(edgeGeometry, this.createRoadEdgeMaterial(edge)); + const edgeMesh = new Mesh( + edgeGeometry, + this.createRoadEdgeMaterial(edge) + ); edgeMesh.castShadow = false; edgeMesh.receiveShadow = true; edgeMesh.userData.splineCorridorJunctionId = junction.id; @@ -7937,7 +7949,10 @@ export class ViewportHost { for (const mesh of renderObjects.meshes) { this.roadSurfaceGroup.add(mesh); } - this.roadSurfaceRenderObjects.set(`junction:${junction.id}`, renderObjects); + this.roadSurfaceRenderObjects.set( + `junction:${junction.id}`, + renderObjects + ); } this.applyShadowState(); @@ -8199,7 +8214,8 @@ export class ViewportHost { resolvedPath.segments[0]!.start.z ), ...resolvedPath.segments.map( - (segment) => new Vector3(segment.end.x, segment.end.y, segment.end.z) + (segment) => + new Vector3(segment.end.x, segment.end.y, segment.end.z) ) ]; @@ -8234,7 +8250,9 @@ export class ViewportHost { return mesh; } - private createPathSegmentMeshes(path: ScenePath): PathRenderObjects["segments"] { + private createPathSegmentMeshes( + path: ScenePath + ): PathRenderObjects["segments"] { const resolvedPath = resolveScenePath(path, { terrains: this.getPathTerrainGlueTerrains() }); @@ -8373,7 +8391,11 @@ export class ViewportHost { segment.start.y, segment.start.z ); - const endCenter = new Vector3(segment.end.x, segment.end.y, segment.end.z); + const endCenter = new Vector3( + segment.end.x, + segment.end.y, + segment.end.z + ); const leftStart = this.resolvePathRoadPreviewPoint( path, startCenter.clone().add(perpendicular), @@ -8550,7 +8572,11 @@ export class ViewportHost { }) ); - marker.position.set(options.center.x, options.center.y + 0.08, options.center.z); + marker.position.set( + options.center.x, + options.center.y + 0.08, + options.center.z + ); marker.rotation.x = Math.PI * 0.5; marker.renderOrder = PATH_RENDER_ORDER + 4; marker.userData.nonPickable = true; @@ -8689,7 +8715,8 @@ export class ViewportHost { const resolvedPointPositions = this.createResolvedPathPointPositionMap(path); const pointMeshes = path.points.map((point) => { - const pointPosition = resolvedPointPositions.get(point.id) ?? point.position; + const pointPosition = + resolvedPointPositions.get(point.id) ?? point.position; const outlineMesh = new Mesh( new SphereGeometry(PATH_POINT_OUTLINE_RADIUS, 16, 12), new MeshBasicMaterial({ @@ -8824,7 +8851,8 @@ export class ViewportHost { continue; } - const pointPosition = resolvedPointPositions.get(point.id) ?? point.position; + const pointPosition = + resolvedPointPositions.get(point.id) ?? point.position; pointMesh.outlineMesh.position.set( pointPosition.x, @@ -11546,7 +11574,10 @@ export class ViewportHost { return null; } - const hits = this.raycaster.intersectObjects(renderObjects.pickMeshes, true); + const hits = this.raycaster.intersectObjects( + renderObjects.pickMeshes, + true + ); const width = getTerrainFootprintWidth(terrain); const depth = getTerrainFootprintDepth(terrain); @@ -11660,8 +11691,12 @@ export class ViewportHost { ? terrain.position.z : terrain.position.z + depth * alpha; const height = - sampleDocumentTerrainHeightAtWorldPosition(terrain, worldX, worldZ, true) ?? - 0; + sampleDocumentTerrainHeightAtWorldPosition( + terrain, + worldX, + worldZ, + true + ) ?? 0; return new Vector3( worldX, @@ -11781,7 +11816,10 @@ export class ViewportHost { const arrowEnd = midpoint.clone().addScaledVector(direction, arrowLength); const shaftEnd = arrowEnd .clone() - .addScaledVector(direction, -TERRAIN_GRID_RESIZE_ARROW_HEAD_LENGTH * 0.72); + .addScaledVector( + direction, + -TERRAIN_GRID_RESIZE_ARROW_HEAD_LENGTH * 0.72 + ); const shaftLength = Math.max(0.1, arrowStart.distanceTo(shaftEnd)); const shaftCenter = arrowStart.clone().add(shaftEnd).multiplyScalar(0.5); @@ -11796,8 +11834,10 @@ export class ViewportHost { visual.pickShaft.scale.set(1, shaftLength, 1); const previousArrowGeometry = visual.line.geometry; - visual.line.geometry = - new BufferGeometry().setFromPoints([arrowStart, arrowEnd]); + visual.line.geometry = new BufferGeometry().setFromPoints([ + arrowStart, + arrowEnd + ]); previousArrowGeometry.dispose(); visual.headOutline.position .copy(arrowEnd) @@ -11984,7 +12024,7 @@ export class ViewportHost { this.hasTerrainGridResizeChanged( activeDrag.baseTerrain, finalPreviewTerrain - ); + ); this.activeTerrainGridResizeDrag = null; this.terrainGridResizeHover = null; @@ -12041,8 +12081,7 @@ export class ViewportHost { } const targetTerrainId = this.currentTerrainBrushState.terrainId; - const raycastObjects = - this.getTerrainBrushRaycastObjects(targetTerrainId); + const raycastObjects = this.getTerrainBrushRaycastObjects(targetTerrainId); if (raycastObjects.length === 0) { return null; diff --git a/tests/domain/build-runtime-scene.test.ts b/tests/domain/build-runtime-scene.test.ts index 1ee5bdc2..d0cf2efc 100644 --- a/tests/domain/build-runtime-scene.test.ts +++ b/tests/domain/build-runtime-scene.test.ts @@ -280,7 +280,9 @@ describe("buildRuntimeSceneFromDocument", () => { }); const runtimeScene = buildRuntimeSceneFromDocument({ - ...createEmptySceneDocument({ name: "Mapped Rail Camera Rig Runtime Scene" }), + ...createEmptySceneDocument({ + name: "Mapped Rail Camera Rig Runtime Scene" + }), paths: { [path.id]: path }, @@ -683,7 +685,9 @@ describe("buildRuntimeSceneFromDocument", () => { expect(runtimeScene.time).not.toBe(document.time); expect(runtimeScene.world).toEqual(document.world); expect(runtimeScene.world).not.toBe(document.world); - expect(runtimeScene.world.sunLight.direction).not.toBe(document.world.sunLight.direction); + expect(runtimeScene.world.sunLight.direction).not.toBe( + document.world.sunLight.direction + ); expect(runtimeScene.brushes).toHaveLength(1); expect(runtimeScene.modelInstances).toEqual([ { @@ -832,7 +836,9 @@ describe("buildRuntimeSceneFromDocument", () => { y: 0, z: 0 }); - expect(runtimeScene.brushes[0].faces.posY.material?.id).toBe("starter-concrete-checker"); + expect(runtimeScene.brushes[0].faces.posY.material?.id).toBe( + "starter-concrete-checker" + ); expect(runtimeScene.colliders).toHaveLength(2); expect(runtimeScene.colliders[0]).toMatchObject({ kind: "trimesh", @@ -863,7 +869,9 @@ describe("buildRuntimeSceneFromDocument", () => { }); const brushCollider = runtimeScene.colliders[0]; if (brushCollider.kind !== "trimesh") { - throw new Error(`Expected a trimesh brush collider, received ${brushCollider.kind}.`); + throw new Error( + `Expected a trimesh brush collider, received ${brushCollider.kind}.` + ); } expect(Array.from(brushCollider.vertices)).toHaveLength(24); expect(Array.from(brushCollider.indices)).toHaveLength(36); @@ -905,8 +913,7 @@ describe("buildRuntimeSceneFromDocument", () => { allowLookInputTargetSwitch: playerStart.allowLookInputTargetSwitch, targetButtonCyclesActiveTarget: playerStart.targetButtonCyclesActiveTarget, - invertMouseCameraHorizontal: - playerStart.invertMouseCameraHorizontal, + invertMouseCameraHorizontal: playerStart.invertMouseCameraHorizontal, movement: { templateKind: "default", moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED, @@ -1377,28 +1384,30 @@ describe("buildRuntimeSceneFromDocument", () => { [overnightNpc.id]: overnightNpc } }; - document.scheduler.routines["routine-daytime"] = createProjectScheduleRoutine({ - id: "routine-daytime", - title: "Day Shift", - target: createActorControlTargetRef(daytimeNpc.actorId), - startHour: 9, - endHour: 17, - effect: createSetActorPresenceControlEffect({ + document.scheduler.routines["routine-daytime"] = + createProjectScheduleRoutine({ + id: "routine-daytime", + title: "Day Shift", target: createActorControlTargetRef(daytimeNpc.actorId), - active: true - }) - }); - document.scheduler.routines["routine-overnight"] = createProjectScheduleRoutine({ - id: "routine-overnight", - title: "Night Shift", - target: createActorControlTargetRef(overnightNpc.actorId), - startHour: 22, - endHour: 2, - effect: createSetActorPresenceControlEffect({ + startHour: 9, + endHour: 17, + effect: createSetActorPresenceControlEffect({ + target: createActorControlTargetRef(daytimeNpc.actorId), + active: true + }) + }); + document.scheduler.routines["routine-overnight"] = + createProjectScheduleRoutine({ + id: "routine-overnight", + title: "Night Shift", target: createActorControlTargetRef(overnightNpc.actorId), - active: true - }) - }); + startHour: 22, + endHour: 2, + effect: createSetActorPresenceControlEffect({ + target: createActorControlTargetRef(overnightNpc.actorId), + active: true + }) + }); const daytimeRuntimeScene = buildRuntimeSceneFromDocument(document, { runtimeClock: { @@ -1625,9 +1634,12 @@ describe("buildRuntimeSceneFromDocument", () => { it("blocks first-person runtime builds when PlayerStart is missing", () => { expect(() => - buildRuntimeSceneFromDocument(createEmptySceneDocument({ name: "Missing Player Start" }), { - navigationMode: "firstPerson" - }) + buildRuntimeSceneFromDocument( + createEmptySceneDocument({ name: "Missing Player Start" }), + { + navigationMode: "firstPerson" + } + ) ).toThrow("First-person run requires an authored Player Start"); }); @@ -1765,7 +1777,9 @@ describe("buildRuntimeSceneFromDocument", () => { ); expect(runtimeScene.playerStart?.entityId).toBe(enabledPlayerStart.id); - expect(runtimeScene.brushes.map((brush) => brush.id)).toEqual([hiddenBrush.id]); + expect(runtimeScene.brushes.map((brush) => brush.id)).toEqual([ + hiddenBrush.id + ]); expect(runtimeScene.brushes[0]?.visible).toBe(false); expect(runtimeScene.modelInstances).toEqual([ expect.objectContaining({ @@ -1856,7 +1870,10 @@ describe("buildRuntimeSceneFromDocument", () => { z: 8 } }); - const { asset, loadedAsset } = createFixtureLoadedModelAssetFromGeometry("asset-runtime-collider", new BoxGeometry(1, 2, 1)); + const { asset, loadedAsset } = createFixtureLoadedModelAssetFromGeometry( + "asset-runtime-collider", + new BoxGeometry(1, 2, 1) + ); const modelInstance = createModelInstance({ id: "model-instance-runtime-collider", assetId: asset.id, @@ -1944,7 +1961,9 @@ describe("buildRuntimeSceneFromDocument", () => { runtimeScene.colliders[0] === undefined || runtimeScene.colliders[0].source !== "terrain" ) { - throw new Error("Expected the runtime collider to be an authored terrain heightfield."); + throw new Error( + "Expected the runtime collider to be an authored terrain heightfield." + ); } expect(Array.from(runtimeScene.colliders[0].heights)).toEqual( @@ -2142,13 +2161,13 @@ describe("buildRuntimeSceneFromDocument", () => { }) }) ]); - expect(runtimeScene.splineCorridorClipIntervalsByPath.get(pathA.id)).toEqual( - [ - expect.objectContaining({ - junctionId: junction.id - }) - ] - ); + expect( + runtimeScene.splineCorridorClipIntervalsByPath.get(pathA.id) + ).toEqual([ + expect.objectContaining({ + junctionId: junction.id + }) + ]); }); it("adds spline corridor box colliders for collision-enabled edges and repeaters", () => { @@ -2249,7 +2268,10 @@ describe("buildRuntimeSceneFromDocument", () => { it("adds static-simple imported-model colliders as compound box pieces", () => { const wallGeometry = new PlaneGeometry(4, 4, 4, 4); wallGeometry.rotateY(Math.PI * 0.5); - const { asset, loadedAsset } = createFixtureLoadedModelAssetFromGeometry("asset-runtime-static-simple", wallGeometry); + const { asset, loadedAsset } = createFixtureLoadedModelAssetFromGeometry( + "asset-runtime-static-simple", + wallGeometry + ); const modelInstance = createModelInstance({ id: "model-instance-runtime-static-simple", assetId: asset.id, @@ -2266,7 +2288,9 @@ describe("buildRuntimeSceneFromDocument", () => { const runtimeScene = buildRuntimeSceneFromDocument( { - ...createEmptySceneDocument({ name: "Imported Static Simple Collider Scene" }), + ...createEmptySceneDocument({ + name: "Imported Static Simple Collider Scene" + }), assets: { [asset.id]: asset }, @@ -2292,11 +2316,18 @@ describe("buildRuntimeSceneFromDocument", () => { decomposition: "surface-voxel-boxes" }); - if (runtimeScene.colliders[0].source !== "modelInstance" || runtimeScene.colliders[0].kind !== "compound") { - throw new Error("Expected the runtime collider to be a generated compound model collider."); + if ( + runtimeScene.colliders[0].source !== "modelInstance" || + runtimeScene.colliders[0].kind !== "compound" + ) { + throw new Error( + "Expected the runtime collider to be a generated compound model collider." + ); } - expect(runtimeScene.colliders[0].pieces.every((piece) => piece.kind === "box")).toBe(true); + expect( + runtimeScene.colliders[0].pieces.every((piece) => piece.kind === "box") + ).toBe(true); }); it("preserves rotated whitebox box transforms for runner rendering and collision bounds", () => { @@ -2537,31 +2568,32 @@ describe("buildRuntimeSceneFromDocument", () => { document.assets[asset.id] = asset; document.entities[npc.id] = npc; document.paths[path.id] = path; - document.scheduler.routines["routine-patrol"] = createProjectScheduleRoutine({ - id: "routine-patrol", - title: "Patrolling", - target: actorTarget, - startHour: 9, - endHour: 13, - effects: [ - createSetActorPresenceControlEffect({ - target: actorTarget, - active: true - }), - createPlayActorAnimationControlEffect({ - target: actorTarget, - clipName: "Walk", - loop: true - }), - createFollowActorPathControlEffect({ - target: actorTarget, - pathId: path.id, - speed: 2, - loop: false, - progressMode: "deriveFromTime" - }) - ] - }); + document.scheduler.routines["routine-patrol"] = + createProjectScheduleRoutine({ + id: "routine-patrol", + title: "Patrolling", + target: actorTarget, + startHour: 9, + endHour: 13, + effects: [ + createSetActorPresenceControlEffect({ + target: actorTarget, + active: true + }), + createPlayActorAnimationControlEffect({ + target: actorTarget, + clipName: "Walk", + loop: true + }), + createFollowActorPathControlEffect({ + target: actorTarget, + pathId: path.id, + speed: 2, + loop: false, + progressMode: "deriveFromTime" + }) + ] + }); const runtimeScene = buildRuntimeSceneFromDocument(document, { runtimeClock: { diff --git a/tests/domain/custom-material.command.test.ts b/tests/domain/custom-material.command.test.ts index 6d8c5508..a351a63c 100644 --- a/tests/domain/custom-material.command.test.ts +++ b/tests/domain/custom-material.command.test.ts @@ -9,10 +9,7 @@ import { createProjectAssetStorageKey, type ImageAssetRecord } from "../../src/assets/project-assets"; -import { - BOX_FACE_IDS, - type WhiteboxFaceId -} from "../../src/document/brushes"; +import { BOX_FACE_IDS, type WhiteboxFaceId } from "../../src/document/brushes"; import { createCustomMaterialDef } from "../../src/materials/starter-material-library"; function createImageAsset(id: string): ImageAssetRecord { diff --git a/tests/domain/delete-project-asset.test.ts b/tests/domain/delete-project-asset.test.ts index d72ed57c..0456938c 100644 --- a/tests/domain/delete-project-asset.test.ts +++ b/tests/domain/delete-project-asset.test.ts @@ -318,7 +318,9 @@ describe("deleteProjectAssetFromProjectDocument", () => { ); const nextScene = nextProjectDocument.scenes[fixture.sceneId]; - expect(nextProjectDocument.foliagePrototypes[foliagePrototype.id]).toBeUndefined(); + expect( + nextProjectDocument.foliagePrototypes[foliagePrototype.id] + ).toBeUndefined(); expect(nextScene.foliageLayers[foliageLayer.id]?.prototypeIds).toEqual([ bundledPrototype.id ]); diff --git a/tests/domain/scene-document-validation.test.ts b/tests/domain/scene-document-validation.test.ts index 4fc38cde..fe96905e 100644 --- a/tests/domain/scene-document-validation.test.ts +++ b/tests/domain/scene-document-validation.test.ts @@ -140,9 +140,7 @@ describe("validateSceneDocument", () => { id: "asset-invalid-material-map-hdr", sourceName: "studio.hdr", mimeType: "image/vnd.radiance", - storageKey: createProjectAssetStorageKey( - "asset-invalid-material-map-hdr" - ) + storageKey: createProjectAssetStorageKey("asset-invalid-material-map-hdr") }; const audioAsset: AudioAssetRecord = { id: "asset-invalid-material-map-audio", diff --git a/tests/serialization/project-document-json.test.ts b/tests/serialization/project-document-json.test.ts index 327fea61..ca0faa24 100644 --- a/tests/serialization/project-document-json.test.ts +++ b/tests/serialization/project-document-json.test.ts @@ -218,9 +218,9 @@ describe("project document JSON", () => { document.scenes[document.activeSceneId]!.foliageLayers[layer.id] = layer; - expect(parseProjectDocumentJson(serializeProjectDocument(document))).toEqual( - document - ); + expect( + parseProjectDocumentJson(serializeProjectDocument(document)) + ).toEqual(document); }); it("round-trips terrain foliage masks in project scenes", () => { @@ -256,9 +256,9 @@ describe("project document JSON", () => { scene.foliageLayers[layer.id] = layer; scene.terrains[terrain.id] = terrain; - expect(parseProjectDocumentJson(serializeProjectDocument(document))).toEqual( - document - ); + expect( + parseProjectDocumentJson(serializeProjectDocument(document)) + ).toEqual(document); }); it("round-trips NPC dialogue references in project scenes", () => { diff --git a/tests/serialization/project-package.test.ts b/tests/serialization/project-package.test.ts index 01d46abb..2f4d0798 100644 --- a/tests/serialization/project-package.test.ts +++ b/tests/serialization/project-package.test.ts @@ -316,9 +316,7 @@ describe("project package serialization", () => { kind: "image", sourceName: "custom-material-map.png", mimeType: "image/png", - storageKey: createProjectAssetStorageKey( - "asset-image-material-package" - ), + storageKey: createProjectAssetStorageKey("asset-image-material-package"), byteLength: 4, metadata: { kind: "image", @@ -373,7 +371,9 @@ describe("project package serialization", () => { "assets/asset-image-material-package/custom-material-map.png" ]) ); - await expect(restoredStorage.getAsset(imageAsset.storageKey)).resolves.toEqual({ + await expect( + restoredStorage.getAsset(imageAsset.storageKey) + ).resolves.toEqual({ files: { [imageAsset.sourceName]: { bytes: expect.any(ArrayBuffer), diff --git a/tests/serialization/scene-document-json.test.ts b/tests/serialization/scene-document-json.test.ts index 01223906..b04778a9 100644 --- a/tests/serialization/scene-document-json.test.ts +++ b/tests/serialization/scene-document-json.test.ts @@ -186,22 +186,7 @@ describe("scene document JSON", () => { } ], paintWeights: [ - 0.2, - 0.3, - 0.1, - 0, - 0.4, - 0.1, - 0, - 0, - 0, - 0.5, - 0, - 0, - 0.25, - 0.25, - 0.25, - 0 + 0.2, 0.3, 0.1, 0, 0.4, 0.1, 0, 0, 0, 0.5, 0, 0, 0.25, 0.25, 0.25, 0 ] }); const document = createEmptySceneDocument({ @@ -1073,9 +1058,9 @@ describe("scene document JSON", () => { expect( migratedDocument.paths[path.id]?.road.edges.right.collisionEnabled ).toBe(false); - expect(migratedDocument.paths[path.id]?.repeaters[0]?.collisionEnabled).toBe( - false - ); + expect( + migratedDocument.paths[path.id]?.repeaters[0]?.collisionEnabled + ).toBe(false); expect(SPLINE_CORRIDOR_COLLISION_SCENE_DOCUMENT_VERSION).toBe(106); }); @@ -1175,7 +1160,8 @@ describe("scene document JSON", () => { splineCorridorJunctions: Record; }; - legacyDocument.version = SPLINE_CORRIDOR_JUNCTION_EDGE_SCENE_DOCUMENT_VERSION; + legacyDocument.version = + SPLINE_CORRIDOR_JUNCTION_EDGE_SCENE_DOCUMENT_VERSION; delete legacyDocument.splineCorridorJunctions[junction.id]?.shapeMode; const migratedDocument = migrateSceneDocument(legacyDocument); @@ -3276,12 +3262,13 @@ describe("scene document JSON", () => { document.brushes[targetBrush.id] = targetBrush; document.entities[linkedNpc.id] = linkedNpc; document.entities[silentNpc.id] = silentNpc; - document.interactionLinks["link-npc-toggle"] = createToggleVisibilityInteractionLink({ - id: "link-npc-toggle", - sourceEntityId: linkedNpc.id, - trigger: "click", - targetBrushId: targetBrush.id - }); + document.interactionLinks["link-npc-toggle"] = + createToggleVisibilityInteractionLink({ + id: "link-npc-toggle", + sourceEntityId: linkedNpc.id, + trigger: "click", + targetBrushId: targetBrush.id + }); const legacyDocument = JSON.parse( serializeSceneDocument(document) diff --git a/tests/unit/whitebox-material-inspector.integration.test.tsx b/tests/unit/whitebox-material-inspector.integration.test.tsx index 5d40a9a4..c2e9b254 100644 --- a/tests/unit/whitebox-material-inspector.integration.test.tsx +++ b/tests/unit/whitebox-material-inspector.integration.test.tsx @@ -143,18 +143,19 @@ describe("whitebox material inspector", () => { .mockImplementation(() => undefined); const { container, store, brush } = await renderMaterialInspectorFixture(); - expect( - container.querySelector(".material-browser button") - ).toHaveAttribute("data-testid", "material-button-default-whitebox"); - expect(screen.getByTestId("material-button-default-whitebox")).toHaveTextContent( - "Default Whitebox" + expect(container.querySelector(".material-browser button")).toHaveAttribute( + "data-testid", + "material-button-default-whitebox" ); + expect( + screen.getByTestId("material-button-default-whitebox") + ).toHaveTextContent("Default Whitebox"); fireEvent.click(screen.getByTestId("create-custom-material")); - const customMaterial = Object.values(store.getState().document.materials).find( - (material) => material.kind === "custom" - ); + const customMaterial = Object.values( + store.getState().document.materials + ).find((material) => material.kind === "custom"); expect(customMaterial).toBeDefined(); expect( @@ -186,19 +187,23 @@ describe("whitebox material inspector", () => { throw new Error("Expected a custom material to be created."); } - expect(store.getState().document.materials[editedMaterialId]).toMatchObject({ - kind: "custom", - albedoColorHex: "#224466", - roughness: 0.37, - metallic: 0.58 - }); + expect(store.getState().document.materials[editedMaterialId]).toMatchObject( + { + kind: "custom", + albedoColorHex: "#224466", + roughness: 0.37, + metallic: 0.58 + } + ); const exportedProject = store.exportDocumentJson(); const reloadedStore = createEditorStore(); reloadedStore.importDocumentJson(exportedProject); - expect(reloadedStore.getState().document.materials[editedMaterialId]).toMatchObject({ + expect( + reloadedStore.getState().document.materials[editedMaterialId] + ).toMatchObject({ kind: "custom", albedoColorHex: "#224466", roughness: 0.37,