From 4fcb3b1f29dcb3d690cb3259e7a72e4b2ed3599b Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 14 Apr 2026 13:56:00 +0200 Subject: [PATCH] Add tests for actor scheduler animation and follow-path effects --- .../domain/scene-document-validation.test.ts | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/tests/domain/scene-document-validation.test.ts b/tests/domain/scene-document-validation.test.ts index 621deb41..911ebd1a 100644 --- a/tests/domain/scene-document-validation.test.ts +++ b/tests/domain/scene-document-validation.test.ts @@ -4,7 +4,9 @@ import { createBoxBrush } from "../../src/document/brushes"; import { createActiveSceneControlTargetRef, createActorControlTargetRef, + createFollowActorPathControlEffect, createLightControlTargetRef, + createPlayActorAnimationControlEffect, createSetActorPresenceControlEffect, createSetAmbientLightColorControlEffect, createSetLightIntensityControlEffect, @@ -213,6 +215,71 @@ describe("validateSceneDocument", () => { expect(validation.errors).toEqual([]); }); + it("accepts actor scheduler animation and follow-path effects when the actor has one bound NPC usage", () => { + const actorTarget = createActorControlTargetRef("actor-patroller"); + const npcModelAsset = { + id: "asset-model-patroller", + kind: "model" as const, + sourceName: "patroller.glb", + mimeType: "model/gltf-binary", + storageKey: createProjectAssetStorageKey("asset-model-patroller"), + byteLength: 1024, + metadata: { + kind: "model" as const, + format: "glb" as const, + sceneName: null, + nodeCount: 1, + meshCount: 1, + materialNames: [], + textureNames: [], + animationNames: ["Walk"], + boundingBox: null, + warnings: [] + } + } satisfies ModelAssetRecord; + const npc = createNpcEntity({ + id: "entity-npc-patroller", + actorId: actorTarget.actorId, + modelAssetId: npcModelAsset.id + }); + const path = createScenePath({ + id: "path-patrol" + }); + const document = createEmptySceneDocument(); + document.assets[npcModelAsset.id] = npcModelAsset; + 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" + }) + ] + }); + + const validation = validateSceneDocument(document); + + expect(validation.errors).toEqual([]); + }); + it("detects invalid box sizes and missing material references", () => { const brush = createBoxBrush({ id: "brush-invalid"