fix(canvas): 图片生成 - 合并局部重绘、规格校验与模型导入修复

This commit is contained in:
ddCat committed 2026-09-09 23:10:35 +08:00
commit 05fd5cde03
19 files changed
+162 -59

No files matched your search

+2 -1
View File
@@ -1387,7 +1387,8 @@ test("remote provider keeps Create resolution semantics and still creates one Ba
},
);
expect(backendInput?.input.config).toMatchObject({ vquality: "720", quality: "auto" });
expect(backendInput?.input.config).toMatchObject({ vquality: "720" });
expect(backendInput?.input.config.quality).toBeUndefined();
expect(localCalls).toBe(0);
});
+16 -2
View File
@@ -42,6 +42,17 @@ describe("统一图片分辨率与宽高比", () => {
}
});
test("固定比例编辑器包含 4:5 和 5:4 三档尺寸", () => {
expect(IMAGE_RATIOS).toContain("4:5");
expect(IMAGE_RATIOS).toContain("5:4");
expect(imagePresetForRatio("1k", "4:5").size).toBe("1024x1280");
expect(imagePresetForRatio("2k", "4:5").size).toBe("1792x2240");
expect(imagePresetForRatio("4k", "4:5").size).toBe("2560x3200");
expect(imagePresetForRatio("1k", "5:4").size).toBe("1280x1024");
expect(imagePresetForRatio("2k", "5:4").size).toBe("2240x1792");
expect(imagePresetForRatio("4k", "5:4").size).toBe("3200x2560");
});
test("管理员设置同步支持值、默认值,并保持精确尺寸", () => {
const profile = defaultImageCapabilityConfig();
profile.size = { parameter: "size", values: ["1920x1080"], default: "1920x1080", allowCustom: false };
@@ -139,8 +150,11 @@ describe("统一图片分辨率与宽高比", () => {
expect(editor).toContain(`aria-label="${tier} 16:9"`);
}
expect(editor).toContain('aria-label="默认输出"');
expect(editor).toContain("全不选");
expect(editor).toContain("全选");
expect(editor).not.toContain("全不选");
expect(editor).not.toContain("全选");
expect(editor).toContain('aria-label="启用 1K 规格"');
expect(editor).toContain('aria-label="启用 2K 规格"');
expect(editor).toContain('aria-label="启用 4K 规格"');
const readOnly = renderToStaticMarkup(<ImageSizePresetsEditor profile={profile} disabled onChange={() => {}} />);
const buttons = [...readOnly.matchAll(/<button\b[^>]*>/g)];
expect(buttons.length).toBeGreaterThan(24);