Files
olivv-cs-ComfyUI-FunPack/app/ui/shell/frame_grid.test.js
T
digital-garbageandClaude Sonnet 5.5 30d1aa14a9 MiniMax H3-Image saves a PNG picture; Length and FPS are not offered and are set to 1
A pipeline with no length or rate input hides those controls in the Project and Scene panels. A preset can carry project numbers it goes with.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 03:27:51 +02:00

28 lines
1.9 KiB
JavaScript

import test from "node:test";
import assert from "node:assert/strict";
import { gridOf, learnGrid, offersLength } from "./frame_grid.js";
test("the frame grid is read from the model's own length input: H3 17k+5, LTX 8k+1, a plain count none", async () => {
const slots = [{ id: "r2v", node: "H3Node", roles: [{ at: "project.video", input: "length", drives: "frames" }] },
{ id: "cam", node: "Plain", roles: [{ at: "project.video", input: "length", drives: "frames" }] }];
const api = { describeNodes: async () => ({ nodes: { H3Node: { widgets: [{ name: "length", min: 5, step: 17 }] }, Plain: { widgets: [{ name: "length", min: 1, step: 1 }] } } }) };
assert.equal(gridOf(slots), null, "not described yet: no grid, nothing snaps");
assert.equal(await learnGrid(api, slots), true);
assert.deepEqual(gridOf(slots), { step: 17, base: 5, fps: null }, "the strictest input wins");
assert.equal(await learnGrid(api, slots), false, "asked once");
const ltx = [{ node: "LtxNode", roles: [{ drives: "frames", input: "length" }] }];
await learnGrid({ describeNodes: async () => ({ nodes: { LtxNode: { widgets: [{ name: "length", min: 1, step: 8 }] } } }) }, ltx);
assert.deepEqual(gridOf(ltx), { step: 8, base: 1, fps: null });
});
test("Length and FPS are offered when a pipeline takes them, or is not known yet, and not for one that holds a picture for a fixed time", () => {
const length = { id: "r", roles: [{ at: "project.video", input: "length", drives: "frames" }] };
const rate = { id: "s", roles: [{ at: "project.video", input: "fps", drives: "fps" }] };
const size = { id: "a", roles: [{ at: "project.video", input: "width" }] };
assert.equal(offersLength([size, length]), true);
assert.equal(offersLength([size, rate]), true);
assert.equal(offersLength([size, { id: "x" }]), false);
assert.equal(offersLength([]), true);
assert.equal(offersLength(undefined), true);
});