2023-12-27 20:20:45 +00:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
import { Formatter } from "@export/formatter";
|
2024-10-21 03:57:15 +01:00
|
|
|
|
2023-12-27 20:20:45 +00:00
|
|
|
import { createInline } from "./inline";
|
|
|
|
|
|
|
|
describe("Inline", () => {
|
|
|
|
it("should create with default effect extent", () => {
|
|
|
|
const tree = new Formatter().format(
|
|
|
|
createInline({
|
|
|
|
mediaData: {
|
2023-12-31 18:54:35 +00:00
|
|
|
type: "png",
|
2023-12-27 20:20:45 +00:00
|
|
|
fileName: "test.png",
|
2023-12-31 18:54:35 +00:00
|
|
|
data: Buffer.from(""),
|
2023-12-27 20:20:45 +00:00
|
|
|
transformation: {
|
|
|
|
pixels: {
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
},
|
|
|
|
emus: {
|
|
|
|
x: 0,
|
|
|
|
y: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
transform: {
|
|
|
|
pixels: {
|
|
|
|
x: 100,
|
|
|
|
y: 100,
|
|
|
|
},
|
|
|
|
emus: {
|
|
|
|
x: 100,
|
|
|
|
y: 100,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
docProperties: {
|
|
|
|
name: "test",
|
|
|
|
description: "test",
|
|
|
|
title: "test",
|
|
|
|
},
|
|
|
|
outline: { type: "solidFill", solidFillType: "rgb", value: "FFFFFF" },
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(tree).toStrictEqual({
|
|
|
|
"wp:inline": expect.arrayContaining([
|
|
|
|
{
|
|
|
|
"wp:effectExtent": {
|
|
|
|
_attr: {
|
|
|
|
b: 19050,
|
|
|
|
l: 19050,
|
|
|
|
r: 19050,
|
|
|
|
t: 19050,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|