summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/visualize/image.pngbin172120 -> 400573 bytes
-rw-r--r--tests/typ/visualize/image.typ20
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ref/visualize/image.png b/tests/ref/visualize/image.png
index 90aa9b48..ec53fa98 100644
--- a/tests/ref/visualize/image.png
+++ b/tests/ref/visualize/image.png
Binary files differ
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%)