29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
|
|
const {
|
|
clmmResolutionFromParamsV2,
|
|
clmmSizeFromParamsV2,
|
|
} = require("../electron/lib/canvas.js");
|
|
|
|
test("keeps Seedance 2K and 4K resolutions for upstream capability negotiation", () => {
|
|
assert.equal(clmmResolutionFromParamsV2({ resolution: "2K" }), "2k");
|
|
assert.equal(clmmResolutionFromParamsV2({ resolution: "4k" }), "4k");
|
|
assert.equal(clmmResolutionFromParamsV2({ resolution: "unsupported" }), "720p");
|
|
});
|
|
|
|
test("derives standard 2K and 4K video sizes from aspect ratio", () => {
|
|
assert.equal(clmmSizeFromParamsV2({ ratio: "16:9" }, "2k"), "2560x1440");
|
|
assert.equal(clmmSizeFromParamsV2({ ratio: "9:16" }, "2k"), "1440x2560");
|
|
assert.equal(clmmSizeFromParamsV2({ ratio: "1:1" }, "4k"), "2160x2160");
|
|
});
|
|
|
|
test("exposes 2K and 4K only on the Seedance video control", () => {
|
|
const source = fs.readFileSync(path.resolve(__dirname, "../renderer/app.js"), "utf8");
|
|
assert.match(source, /value="2k">2K(需上游支持)/);
|
|
assert.match(source, /value="4k">4K(需上游支持)/);
|
|
assert.match(source, /const resolutionOptions = isGrok/);
|
|
});
|