From c46d28891fee62ca2d3132da876af6411a41d9da Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Wed, 15 Apr 2026 15:45:50 +0200 Subject: feat: text / custom masks, fix preview pan, refactor selection --- .../migrations/__tests__/v26-to-v27.test.ts | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 apps/web/src/services/storage/migrations/__tests__/v26-to-v27.test.ts (limited to 'apps/web/src/services/storage/migrations/__tests__') diff --git a/apps/web/src/services/storage/migrations/__tests__/v26-to-v27.test.ts b/apps/web/src/services/storage/migrations/__tests__/v26-to-v27.test.ts new file mode 100644 index 00000000..730d958d --- /dev/null +++ b/apps/web/src/services/storage/migrations/__tests__/v26-to-v27.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, test } from "bun:test"; +import { transformProjectV26ToV27 } from "../transformers/v26-to-v27"; + +describe("V26 to V27 Migration", () => { + test("converts custom mask paths from JSON strings to typed point arrays", () => { + const result = transformProjectV26ToV27({ + project: { + id: "project-v26-custom-mask", + version: 26, + scenes: [ + { + id: "scene-1", + tracks: { + main: { + id: "track-1", + type: "video", + elements: [ + { + id: "element-1", + type: "image", + masks: [ + { + id: "mask-custom", + type: "custom", + params: { + path: JSON.stringify([ + { + id: "point-1", + x: 0, + y: 0, + inX: 0, + inY: 0, + outX: 0.1, + outY: 0, + }, + ]), + closed: false, + }, + }, + { + id: "mask-rectangle", + type: "rectangle", + params: { + width: 0.5, + }, + }, + ], + }, + ], + }, + overlay: [], + audio: [], + }, + }, + ], + }, + }); + + expect(result.skipped).toBe(false); + expect(result.project.version).toBe(27); + + const scenes = result.project.scenes as Array>; + const tracks = scenes[0].tracks as Record; + const mainTrack = tracks.main as Record; + const elements = mainTrack.elements as Array>; + const masks = elements[0].masks as Array>; + const customParams = masks[0].params as Record; + const rectangleParams = masks[1].params as Record; + + expect(customParams.path).toEqual([ + { + id: "point-1", + x: 0, + y: 0, + inX: 0, + inY: 0, + outX: 0.1, + outY: 0, + }, + ]); + expect(rectangleParams.width).toBe(0.5); + }); +}); -- cgit v1.3.1