Skip to content

Commit 4ecf6c6

Browse files
committed
Add svg test
1 parent a15f7b2 commit 4ecf6c6

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
9.94 KB
Loading

package/src/renderer/__tests__/e2e/SVG.spec.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ const tiger = new SVGAsset(
5555
800
5656
);
5757

58+
const text = new SVGAsset(
59+
`<svg viewBox='0 0 290 500' width='290' height='325' xmlns='http://www.w3.org/2000/svg'>
60+
<circle cx='31' cy='325' r='120px' fill='#c02aaa'/>
61+
<text x="20" y="35" fill="black">My Text</text>
62+
</svg>`,
63+
290,
64+
500
65+
);
66+
5867
const svgWithoutSize = {
5968
__typename__: "SVG" as const,
6069
width() {
@@ -66,7 +75,7 @@ const svgWithoutSize = {
6675
dispose() {},
6776
source() {
6877
return `<svg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'>
69-
<circle cx='10' cy='10' r='10' fill='#00FFFF'/>
78+
<circle cx='10' cy='10' r='10' fill='#00FFFF' />
7079
</svg>`;
7180
},
7281
};
@@ -195,4 +204,14 @@ describe("Displays SVGs", () => {
195204
);
196205
checkImage(image, docPath("opacity-tiger.png"));
197206
});
207+
208+
itRunsE2eOnly("can render text", async () => {
209+
const image = await surface.draw(
210+
<>
211+
<Fill color="white" />
212+
<ImageSVG svg={text} x={0} y={0} width={800} height={800} />
213+
</>
214+
);
215+
checkImage(image, "snapshots/svg/text.png");
216+
});
198217
});

0 commit comments

Comments
 (0)