summaryrefslogtreecommitdiff
path: root/tests/typ/func-image.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-01-13 14:07:38 +0100
committerLaurenz <laurmaedje@gmail.com>2021-01-13 14:07:38 +0100
commit60154474ba1cf4a556bbed7f80ee0947c29dbca8 (patch)
treeb864fb2503c6a49f1c6676db85d6d3397462a35b /tests/typ/func-image.typ
parent539735e668f601058c2c71a847335e17fac107e8 (diff)
Enable multiple tests per file 🧱
Diffstat (limited to 'tests/typ/func-image.typ')
-rw-r--r--tests/typ/func-image.typ46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/typ/func-image.typ b/tests/typ/func-image.typ
new file mode 100644
index 00000000..78a644c0
--- /dev/null
+++ b/tests/typ/func-image.typ
@@ -0,0 +1,46 @@
+// Test loading different image formats.
+
+// Load an RGBA PNG image.
+[image "res/rhino.png"]
+[pagebreak]
+
+// Load an RGB JPEG image.
+[image "res/tiger.jpg"]
+
+---
+// Test configuring the size and fitting behaviour of images.
+
+// Fit to width of page.
+[image "res/rhino.png"]
+
+// Fit to height of page.
+[page width: 270pt][
+ [image "res/rhino.png"]
+]
+
+// Set width explicitly.
+[image "res/rhino.png", width: 50pt]
+
+// Set height explicitly.
+[image "res/rhino.png", height: 50pt]
+
+// Set width and height explicitly and force stretching.
+[image "res/rhino.png", width: 25pt, height: 50pt]
+
+// Make sure the bounding-box of the image is correct.
+[align bottom, right][
+ [image "res/tiger.jpg"]
+]
+
+---
+// Test error cases.
+//
+// ref: false
+// error: 3:8-3:29 failed to load image
+// error: 6:8-6:29 failed to load image
+
+// File does not exist.
+[image "path/does/not/exist"]
+
+// File exists, but is no image.
+[image "typ/image-error.typ"]