fix(canvas): 视频设置 - 按渠道能力隐藏尺寸并联动分辨率宽高
This commit is contained in:
1 parent
6d77c250c1
commit
4b75504f75
15 files changed
+196
-50
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
|
||||
import { defaultModelCapabilityConfig } from "../src/lib/model-capabilities";
|
||||
import { formatVideoResolutionLabel, normalizeVideoResolution, videoResolutionComparisonKey, VIDEO_RESOLUTION_CAPABILITY_OPTIONS, VIDEO_RESOLUTION_OPTIONS } from "../src/lib/video-generation-options";
|
||||
import { formatVideoResolutionLabel, normalizeVideoResolution, videoDimensionsForRatioAndResolution, videoResolutionComparisonKey, VIDEO_RESOLUTION_CAPABILITY_OPTIONS, VIDEO_RESOLUTION_OPTIONS } from "../src/lib/video-generation-options";
|
||||
|
||||
describe("video generation resolution options", () => {
|
||||
test("统一档位包含 1440P 与 4K,并识别常见别名", () => {
|
||||
@@ -20,6 +20,15 @@ describe("video generation resolution options", () => {
|
||||
expect(formatVideoResolutionLabel("768p竖")).toBe("768P竖");
|
||||
});
|
||||
|
||||
test("根据当前比例和分辨率推导视频尺寸", () => {
|
||||
expect(videoDimensionsForRatioAndResolution("16:9", "720p")).toEqual({ width: 1280, height: 720 });
|
||||
expect(videoDimensionsForRatioAndResolution("16:9", "1080P")).toEqual({ width: 1920, height: 1080 });
|
||||
expect(videoDimensionsForRatioAndResolution("16:9", "4K")).toEqual({ width: 3840, height: 2160 });
|
||||
expect(videoDimensionsForRatioAndResolution("9:16", "1080p")).toEqual({ width: 1080, height: 1920 });
|
||||
expect(videoDimensionsForRatioAndResolution("1:1", "1440p")).toEqual({ width: 1440, height: 1440 });
|
||||
expect(videoDimensionsForRatioAndResolution("adaptive", "1080p")).toBeUndefined();
|
||||
});
|
||||
|
||||
test("按协议限制实际可选档位", () => {
|
||||
expect(defaultModelCapabilityConfig("newapi-channel-2").video?.resolutions).toEqual(["480p", "720p", "1080p", "1440p", "2160p"]);
|
||||
expect(defaultModelCapabilityConfig("volcengine-ark-video").video?.resolutions).toEqual(["480p", "720p", "1080p"]);
|
||||
|
||||
Reference in new issue
Block a user