Add SVG image suport (#2487)

* Add SVG blip extentions

* SVG Image feature now works

* Add and simplify tests

* Fix falsey issue with file

Write tests
100% Coverage
This commit is contained in:
Dolan
2023-12-31 18:54:35 +00:00
committed by GitHub
parent 7570fc2bf5
commit 24c159de37
27 changed files with 615 additions and 118 deletions

View File

@ -150,12 +150,25 @@ describe("Compiler", () => {
new Paragraph({
children: [
new ImageRun({
type: "png",
data: Buffer.from("", "base64"),
transformation: {
width: 100,
height: 100,
},
}),
new ImageRun({
type: "svg",
data: Buffer.from("", "base64"),
transformation: {
width: 100,
height: 100,
},
fallback: {
type: "png",
data: Buffer.from("", "base64"),
},
}),
],
}),
],
@ -165,7 +178,8 @@ describe("Compiler", () => {
vi.spyOn(compiler["imageReplacer"], "getMediaData").mockReturnValue([
{
stream: Buffer.from(""),
type: "png",
data: Buffer.from(""),
fileName: "test",
transformation: {
pixels: {
@ -178,6 +192,36 @@ describe("Compiler", () => {
},
},
},
{
type: "svg",
data: Buffer.from(""),
fileName: "test",
transformation: {
pixels: {
x: 100,
y: 100,
},
emus: {
x: 100,
y: 100,
},
},
fallback: {
type: "png",
data: Buffer.from(""),
fileName: "test",
transformation: {
pixels: {
x: 100,
y: 100,
},
emus: {
x: 100,
y: 100,
},
},
},
},
]);
compiler.compile(file);