Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions src/cli/loadCliProject.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { describe, expect, it, vi } from "vitest";
import { PROJECT_VERSION } from "@/components/video-editor/projectPersistence";
import { getEditorSettings } from "@/lib/ai-edition/store/editorSettings";
import { loadCliProject } from "./loadCliProject";

const loadProjectFileFromPath = vi.fn();
vi.mock("@/native", () => ({
nativeBridgeClient: {
project: { loadProjectFileFromPath: (p: string) => loadProjectFileFromPath(p) },
},
}));

// `legacyProjectEditor` has its own tests in exportProject.test.ts; this one guards the loader
// actually using it, so a v2 export cannot drop the keys again behind a green helper test.
describe("loadCliProject", () => {
it("carries render settings the normalizer does not know into the exported document (#1467)", async () => {
loadProjectFileFromPath.mockResolvedValue({
success: true,
project: {
version: PROJECT_VERSION,
media: { screenVideoPath: "/recordings/screen.mp4" },
editor: { cursorModel3d: true, cursorClickSound: true, audioGainDb: -3 },
},
});
vi.stubGlobal("window", {
electronAPI: { getCurrentRecordingSession: async () => ({ session: null }) },
});
// The probe's <video>: answers with metadata as soon as it is given a source.
vi.stubGlobal("document", {
createElement: () => {
const video = {
videoWidth: 1920,
videoHeight: 1080,
duration: 12,
onloadedmetadata: null as null | (() => void),
removeAttribute: vi.fn(),
load: vi.fn(),
set src(_: string) {
queueMicrotask(() => video.onloadedmetadata?.());
},
};
return video;
},
});
try {
const { document } = await loadCliProject("/projects/demo.openscreen");
const settings = getEditorSettings(document);
expect(settings.cursor.model3d).toBe(true);
expect(settings.cursor.clickSound).toBe(true);
expect(settings.audioGainDb).toBe(-3);
} finally {
vi.unstubAllGlobals();
}
});
});
Loading