mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-03 04:07:03 +00:00
Carry the runtime's blur through the render pipeline and the Studio render panel. - engine: installPageMotionBlur sets the page-side off switch and the render's device scale before any author script runs; CaptureOptions.pageMotionBlur lets a caller stand the page blur down. - producer: a composition that asks for data-motion-blur on the root the runtime would pick forces screenshot capture, because html-in-canvas needs a real paint; the probe session carries the request's pageMotionBlur like every other session. - studio-server and Studio: the render panel sends previewMotionBlur, the render route turns "off" into pageMotionBlur once, and the Studio dev server and the CLI server both receive the final value. - mover scan: a large element that is see-through while it moves (a sweep, a light leak) is no mover, including a large image or canvas with alpha; the scan skips elements moved by a 3D individual transform property. - cli snapshot injects video frames before the seek settles, matching the engine's order. Folded review fixes: R1, R2, R3 (scan half), R7, R16, R18, T3 (render adapters). Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { mkdtempSync, rmSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import type { ViteDevServer } from "vite";
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { createProjectSignatureCache, createViteAdapter } from "./vite.adapter";
|
|
|
|
const mocks = vi.hoisted(() => ({
|
|
createRenderJob: vi.fn(() => ({ id: "job", perfSummary: undefined })),
|
|
executeRenderJob: vi.fn(async () => {}),
|
|
}));
|
|
|
|
vi.mock("@hyperframes/producer", () => mocks);
|
|
|
|
const roots: string[] = [];
|
|
afterEach(() => {
|
|
vi.clearAllMocks();
|
|
for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true });
|
|
});
|
|
|
|
function startRender(extra: Record<string, unknown>) {
|
|
const root = mkdtempSync(join(tmpdir(), "hf-vite-render-"));
|
|
roots.push(root);
|
|
const adapter = createViteAdapter(
|
|
root,
|
|
{} as ViteDevServer,
|
|
createProjectSignatureCache({ compute: () => "test" }),
|
|
{ historyRoot: join(root, "history") },
|
|
);
|
|
adapter.startRender({
|
|
project: { dir: root, id: "p", title: "p" },
|
|
outputPath: join(root, "out.mp4"),
|
|
format: "mp4",
|
|
fps: { num: 30, den: 1 },
|
|
quality: "draft",
|
|
jobId: "job",
|
|
...extra,
|
|
} as never);
|
|
return vi.waitFor(() => expect(mocks.createRenderJob).toHaveBeenCalledTimes(1), {
|
|
timeout: 10_000,
|
|
});
|
|
}
|
|
|
|
describe("Studio dev server render jobs", { timeout: 30_000 }, () => {
|
|
it("hands the route's pageMotionBlur to the job, so a preview that could not blur renders unblurred", async () => {
|
|
await startRender({ pageMotionBlur: "off" });
|
|
expect(mocks.createRenderJob).toHaveBeenCalledWith(
|
|
expect.objectContaining({ pageMotionBlur: "off" }),
|
|
);
|
|
});
|
|
|
|
it("leaves the job's blur to the composition when the route sends none", async () => {
|
|
await startRender({});
|
|
expect(mocks.createRenderJob.mock.calls[0]?.[0]).not.toHaveProperty("pageMotionBlur");
|
|
});
|
|
});
|