summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/retime/__tests__
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__
parent82817cb50cb0487350573d6129130aec705f924b (diff)
downloadopencut-4d127a038bf768eded68aae3cfa5c1b12241bdac.tar.gz
chore: normalize line endings
Diffstat (limited to 'apps/web/src/lib/retime/__tests__')
-rw-r--r--apps/web/src/lib/retime/__tests__/resolve.test.ts122
-rw-r--r--apps/web/src/lib/retime/__tests__/split.test.ts62
2 files changed, 92 insertions, 92 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);
+ });
+});
diff --git a/apps/web/src/lib/retime/__tests__/split.test.ts b/apps/web/src/lib/retime/__tests__/split.test.ts
index 0ce532a1..a00eadac 100644
--- a/apps/web/src/lib/retime/__tests__/split.test.ts
+++ b/apps/web/src/lib/retime/__tests__/split.test.ts
@@ -1,31 +1,31 @@
-import { describe, expect, test } from "bun:test";
-import {
- getSourceSpanAtClipTime,
- splitRetimeAtClipTime,
-} from "@/lib/retime";
-import type { RetimeConfig } from "@/lib/timeline";
-
-describe("retime split", () => {
- test("measures source span at a clip time", () => {
- const retime: RetimeConfig = { rate: 2 };
- expect(getSourceSpanAtClipTime({ clipTime: 5, retime })).toBe(10);
- });
-
- test("returns zero for non-positive clip time", () => {
- expect(getSourceSpanAtClipTime({ clipTime: 0 })).toBe(0);
- expect(getSourceSpanAtClipTime({ clipTime: -1 })).toBe(0);
- });
-
- test("passes the same retime to both halves when splitting", () => {
- const retime: RetimeConfig = { rate: 1.5 };
- const result = splitRetimeAtClipTime({ retime, splitClipTime: 3 });
- expect(result.left).toBe(retime);
- expect(result.right).toBe(retime);
- });
-
- test("returns undefined on both sides when no retime", () => {
- const result = splitRetimeAtClipTime({ splitClipTime: 3 });
- expect(result.left).toBeUndefined();
- expect(result.right).toBeUndefined();
- });
-});
+import { describe, expect, test } from "bun:test";
+import {
+ getSourceSpanAtClipTime,
+ splitRetimeAtClipTime,
+} from "@/lib/retime";
+import type { RetimeConfig } from "@/lib/timeline";
+
+describe("retime split", () => {
+ test("measures source span at a clip time", () => {
+ const retime: RetimeConfig = { rate: 2 };
+ expect(getSourceSpanAtClipTime({ clipTime: 5, retime })).toBe(10);
+ });
+
+ test("returns zero for non-positive clip time", () => {
+ expect(getSourceSpanAtClipTime({ clipTime: 0 })).toBe(0);
+ expect(getSourceSpanAtClipTime({ clipTime: -1 })).toBe(0);
+ });
+
+ test("passes the same retime to both halves when splitting", () => {
+ const retime: RetimeConfig = { rate: 1.5 };
+ const result = splitRetimeAtClipTime({ retime, splitClipTime: 3 });
+ expect(result.left).toBe(retime);
+ expect(result.right).toBe(retime);
+ });
+
+ test("returns undefined on both sides when no retime", () => {
+ const result = splitRetimeAtClipTime({ splitClipTime: 3 });
+ expect(result.left).toBeUndefined();
+ expect(result.right).toBeUndefined();
+ });
+});