修复了一点bug,然后增加了图层拆分更多的功能
This commit is contained in:
1 parent
1305a9cdd8
commit
ce8372e878
31 files changed
+2567
-391
No files matched your search
@@ -16,12 +16,16 @@ describe("Seedream layer composition download", () => {
|
||||
});
|
||||
const close = vi.fn();
|
||||
const drawImage = vi.fn();
|
||||
const save = vi.fn();
|
||||
const translate = vi.fn();
|
||||
const rotate = vi.fn();
|
||||
const restore = vi.fn();
|
||||
const click = vi.fn();
|
||||
const anchor = { href: "", download: "", click, remove: vi.fn() };
|
||||
const canvas = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
getContext: () => ({ clearRect: vi.fn(), drawImage }),
|
||||
getContext: () => ({ clearRect: vi.fn(), drawImage, save, translate, rotate, restore }),
|
||||
toBlob: (callback: BlobCallback) => callback(new Blob(["png"], { type: "image/png" }))
|
||||
};
|
||||
|
||||
@@ -35,7 +39,7 @@ describe("Seedream layer composition download", () => {
|
||||
vi.stubGlobal("URL", { createObjectURL: () => "blob:composition", revokeObjectURL: vi.fn() });
|
||||
|
||||
await expect(downloadSeedreamLayerComposition({
|
||||
items: [{ url: "/api/assets/private-layer/download?inline=1", visible: true, box: [0, 0, 1000, 1000] }],
|
||||
items: [{ url: "/api/assets/private-layer/download?inline=1", visible: true, box: [0, 0, 1000, 1000], rotation: 90 }],
|
||||
width: 100,
|
||||
height: 100,
|
||||
fileName: "composition.png"
|
||||
@@ -43,6 +47,10 @@ describe("Seedream layer composition download", () => {
|
||||
|
||||
expect(fetchMock).toHaveBeenCalledWith("/api/assets/private-layer/download", { credentials: "same-origin" });
|
||||
expect(drawImage).toHaveBeenCalledOnce();
|
||||
expect(save).toHaveBeenCalledOnce();
|
||||
expect(translate).toHaveBeenCalledWith(50, 50);
|
||||
expect(rotate).toHaveBeenCalledWith(Math.PI / 2);
|
||||
expect(restore).toHaveBeenCalledOnce();
|
||||
expect(click).toHaveBeenCalledOnce();
|
||||
expect(close).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user