refactor(runtime): trim color grading helpers

This commit is contained in:
ukimsanov
2026-06-16 13:41:32 -07:00
parent 1ad158d2f0
commit 48fb42e5f0
5 changed files with 24 additions and 63 deletions
@@ -272,11 +272,10 @@ describe("createVideoFrameInjector cache hygiene against page-side skips", () =>
injectVideoFramesBatchMock.mockResolvedValueOnce(["facet"]);
await hook!(page, 1.5);
expect(evaluate).toHaveBeenCalledTimes(1);
// Re-render is requested at the same time as the seek.
expect(evaluate.mock.calls[0]![1]).toBe(1.5);
const reseekCall = evaluate.mock.calls.find((call) => call[1] === 1.5);
expect(reseekCall).toBeDefined();
// The evaluated page function invokes window.__hfReseekGpu(time).
const pageFn = evaluate.mock.calls[0]![0] as (t: number) => void;
const pageFn = reseekCall![0] as (t: number) => void;
const reseek = vi.fn();
(globalThis as unknown as { window?: unknown }).window = { __hfReseekGpu: reseek };
pageFn(1.5);
@@ -296,6 +295,6 @@ describe("createVideoFrameInjector cache hygiene against page-side skips", () =>
injectVideoFramesBatchMock.mockResolvedValueOnce([]);
await hook!(page, 1.5);
expect(evaluate).not.toHaveBeenCalled();
expect(evaluate.mock.calls.some((call) => call[1] === 1.5)).toBe(false);
});
});
@@ -147,7 +147,7 @@ function createFrameSourceCache(
export const __testing = { createFrameSourceCache };
async function redrawRuntimeColorGrading(page: Page): Promise<void> {
await page.evaluate(async () => {
await page.evaluate(() => {
const hf = (
window as Window & {
__hf?: {
@@ -158,7 +158,7 @@ async function redrawRuntimeColorGrading(page: Page): Promise<void> {
const redraw = hf?.colorGrading?.redraw;
if (typeof redraw !== "function") return;
try {
await Promise.resolve(redraw());
redraw();
} catch {
// Optional page-side shader layer.
}