summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/retime/__tests__/resolve.test.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-03-27 00:55:15 +0100
committerMaze Winther <mazewinther@gmail.com>2026-03-29 15:56:48 +0200
commit4d127a038bf768eded68aae3cfa5c1b12241bdac (patch)
tree16bbb801caf6770546cff4fdb37b6408ec9ead98 /apps/web/src/lib/retime/__tests__/resolve.test.ts
parent82817cb50cb0487350573d6129130aec705f924b (diff)
downloadopencut-4d127a038bf768eded68aae3cfa5c1b12241bdac.tar.gz
chore: normalize line endings
Diffstat (limited to 'apps/web/src/lib/retime/__tests__/resolve.test.ts')
-rw-r--r--apps/web/src/lib/retime/__tests__/resolve.test.ts122
1 files changed, 61 insertions, 61 deletions
diff --git a/apps/web/src/lib/retime/__tests__/resolve.test.ts b/apps/web/src/lib/retime/__tests__/resolve.test.ts
index 4fcf6249..2fbd6675 100644
--- a/apps/web/src/lib/retime/__tests__/resolve.test.ts
+++ b/apps/web/src/lib/retime/__tests__/resolve.test.ts
@@ -1,61 +1,61 @@
-import { describe, expect, test } from "bun:test";
-import {
- getClipTimeAtSourceTime,
- getEffectiveRateAt,
- getSourceTimeAtClipTime,
- getTimelineDurationForSourceSpan,
-} from "@/lib/retime";
-import type { RetimeConfig } from "@/lib/timeline";
-
-const twoX: RetimeConfig = { rate: 2 };
-const halfX: RetimeConfig = { rate: 0.5 };
-
-describe("retime resolve", () => {
- test("maps clip time to source time at 2x speed", () => {
- expect(getSourceTimeAtClipTime({ clipTime: 5, retime: twoX })).toBe(10);
- });
-
- test("maps clip time to source time at 0.5x speed", () => {
- expect(getSourceTimeAtClipTime({ clipTime: 4, retime: halfX })).toBe(2);
- });
-
- test("returns clip time unchanged when no retime", () => {
- expect(getSourceTimeAtClipTime({ clipTime: 7 })).toBe(7);
- });
-
- test("inverts source time back to clip time at 2x speed", () => {
- expect(getClipTimeAtSourceTime({ sourceTime: 10, retime: twoX })).toBe(5);
- });
-
- test("returns effective rate", () => {
- expect(getEffectiveRateAt({ retime: twoX })).toBe(2);
- expect(getEffectiveRateAt({})).toBe(1);
- });
-
- test("derives timeline duration for a visible source span", () => {
- expect(
- getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: twoX }),
- ).toBe(5);
- expect(
- getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: halfX }),
- ).toBe(20);
- });
-
- test("clamps invalid rates to 1", () => {
- expect(getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: 0 } })).toBe(
- 5,
- );
- expect(
- getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: -1 } }),
- ).toBe(5);
- });
-
- test("caps retime rates above 5x", () => {
- expect(getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: 100 } })).toBe(
- 25,
- );
- expect(
- getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: { rate: 100 } }),
- ).toBe(2);
- });
-});
+import { describe, expect, test } from "bun:test";
+import {
+ getClipTimeAtSourceTime,
+ getEffectiveRateAt,
+ getSourceTimeAtClipTime,
+ getTimelineDurationForSourceSpan,
+} from "@/lib/retime";
+import type { RetimeConfig } from "@/lib/timeline";
+
+const twoX: RetimeConfig = { rate: 2 };
+const halfX: RetimeConfig = { rate: 0.5 };
+
+describe("retime resolve", () => {
+ test("maps clip time to source time at 2x speed", () => {
+ expect(getSourceTimeAtClipTime({ clipTime: 5, retime: twoX })).toBe(10);
+ });
+
+ test("maps clip time to source time at 0.5x speed", () => {
+ expect(getSourceTimeAtClipTime({ clipTime: 4, retime: halfX })).toBe(2);
+ });
+
+ test("returns clip time unchanged when no retime", () => {
+ expect(getSourceTimeAtClipTime({ clipTime: 7 })).toBe(7);
+ });
+
+ test("inverts source time back to clip time at 2x speed", () => {
+ expect(getClipTimeAtSourceTime({ sourceTime: 10, retime: twoX })).toBe(5);
+ });
+
+ test("returns effective rate", () => {
+ expect(getEffectiveRateAt({ retime: twoX })).toBe(2);
+ expect(getEffectiveRateAt({})).toBe(1);
+ });
+
+ test("derives timeline duration for a visible source span", () => {
+ expect(
+ getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: twoX }),
+ ).toBe(5);
+ expect(
+ getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: halfX }),
+ ).toBe(20);
+ });
+
+ test("clamps invalid rates to 1", () => {
+ expect(getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: 0 } })).toBe(
+ 5,
+ );
+ expect(
+ getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: -1 } }),
+ ).toBe(5);
+ });
+
+ test("caps retime rates above 5x", () => {
+ expect(getSourceTimeAtClipTime({ clipTime: 5, retime: { rate: 100 } })).toBe(
+ 25,
+ );
+ expect(
+ getTimelineDurationForSourceSpan({ sourceSpan: 10, retime: { rate: 100 } }),
+ ).toBe(2);
+ });
+});