summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorBeiri22 <beier1@hs-mittweida.de>2023-08-05 13:58:28 +0200
committerGitHub <noreply@github.com>2023-08-05 13:58:28 +0200
commite3115336bfe26cfddcce41dc9177f3bbe6d7d88e (patch)
tree00d8a5bd1e77cdc6138e60f76931b98a90c7513f /tests/typ
parent49282626e98cb1fbbb06c774cc0ae470b2854af6 (diff)
Decode image (#1810)
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/visualize/image.typ20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/typ/visualize/image.typ b/tests/typ/visualize/image.typ
index e3bcc64f..60ce4f68 100644
--- a/tests/typ/visualize/image.typ
+++ b/tests/typ/visualize/image.typ
@@ -60,3 +60,23 @@ A #box(image("/files/tiger.jpg", height: 1cm, width: 80%)) B
---
// Error: 2-25 failed to parse svg: found closing tag 'g' instead of 'style' in line 4
#image("/files/bad.svg")
+
+---
+// Test parsing from svg data
+#image.decode(`<svg xmlns="http://www.w3.org/2000/svg" height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg")
+
+---
+// Error: 2-168 failed to parse svg: missing root node
+#image.decode(`<svg height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg")
+
+---
+// Test format auto detect
+#image.decode(read("/files/tiger.jpg", encoding: none), width: 80%)
+
+---
+// Test format manual
+#image.decode(read("/files/tiger.jpg", encoding: none), format: "jpg", width: 80%)
+
+---
+// Error: 2-83 failed to decode image
+#image.decode(read("/files/tiger.jpg", encoding: none), format: "png", width: 80%)