diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-04-06 01:23:47 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-04-06 01:23:47 +0200 |
| commit | fcc09e80e253831a163e2e4941542e0b34f80740 (patch) | |
| tree | 4cc7aafd0756bb3fa23dfd41080237e462b5ecf2 /apps/web/src/lib/timeline/audio-separation/__tests__ | |
| parent | c56d6f8188cc1c0e72d75611269a8bda7b79e727 (diff) | |
| parent | dedb13546a16235e7d6649961d0c9b235f62aa34 (diff) | |
| download | opencut-fcc09e80e253831a163e2e4941542e0b34f80740.tar.gz | |
Merge branch 'temp'
Diffstat (limited to 'apps/web/src/lib/timeline/audio-separation/__tests__')
| -rw-r--r-- | apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts b/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts index 1946f1e0..f2b17d1a 100644 --- a/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts +++ b/apps/web/src/lib/timeline/audio-separation/__tests__/index.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test"; +import { upsertElementKeyframe } from "@/lib/animation"; import type { UploadAudioElement, VideoElement } from "@/lib/timeline"; import { buildSeparatedAudioElement, @@ -25,32 +26,7 @@ describe("audio separation", () => { volume: -6, muted: true, retime: { rate: 1.25, maintainPitch: true }, - animations: { - channels: { - volume: { - valueKind: "number", - keyframes: [ - { - id: "volume-keyframe", - time: 2, - value: -12, - interpolation: "linear", - }, - ], - }, - opacity: { - valueKind: "number", - keyframes: [ - { - id: "opacity-keyframe", - time: 1, - value: 0.5, - interpolation: "linear", - }, - ], - }, - }, - }, + animations: buildAnimations(), }); const separatedAudioElement = buildSeparatedAudioElement({ @@ -71,11 +47,14 @@ describe("audio separation", () => { muted: true, retime: { rate: 1.25, maintainPitch: true }, }); - expect(Object.keys(separatedAudioElement.animations?.channels ?? {})).toEqual([ + expect(Object.keys(separatedAudioElement.animations?.bindings ?? {})).toEqual([ "volume", ]); + expect(Object.keys(separatedAudioElement.animations?.channels ?? {})).toEqual([ + "volume:value", + ]); expect( - separatedAudioElement.animations?.channels.volume?.keyframes[0]?.id, + separatedAudioElement.animations?.channels["volume:value"]?.keys[0]?.id, ).not.toBe("volume-keyframe"); }); @@ -143,3 +122,23 @@ function buildAudioElement( ...overrides, } satisfies UploadAudioElement; } + +function buildAnimations() { + const withVolume = upsertElementKeyframe({ + animations: undefined, + propertyPath: "volume", + time: 2, + value: -12, + interpolation: "linear", + keyframeId: "volume-keyframe", + }); + + return upsertElementKeyframe({ + animations: withVolume, + propertyPath: "opacity", + time: 1, + value: 0.5, + interpolation: "linear", + keyframeId: "opacity-keyframe", + }); +} |
