summaryrefslogtreecommitdiff
path: root/tests/typ/library/image.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-02-20 17:53:40 +0100
committerLaurenz <laurmaedje@gmail.com>2021-02-20 23:34:33 +0100
commit05727bfc3a9cfd45a8e2028dfd0806f7a8f88015 (patch)
tree6c0b66eb2a9dff224cb39eb6ccb478656a706c04 /tests/typ/library/image.typ
parent927341d93ae29678095e3b874bd68bfc57d4bc05 (diff)
Reorganize tests 🔀
Diffstat (limited to 'tests/typ/library/image.typ')
-rw-r--r--tests/typ/library/image.typ35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/typ/library/image.typ b/tests/typ/library/image.typ
new file mode 100644
index 00000000..9c3cd4fe
--- /dev/null
+++ b/tests/typ/library/image.typ
@@ -0,0 +1,35 @@
+// Test loading different image formats.
+
+// Load an RGBA PNG image.
+#image("res/rhino.png")
+#pagebreak()
+
+// Load an RGB JPEG image.
+#image("res/tiger.jpg")
+
+// Error: 8-29 failed to load image
+#image("path/does/not/exist")
+
+// Error: 8-29 failed to load image
+#image("typ/image-error.typ")
+
+---
+// Test configuring the size and fitting behaviour of images.
+
+// Fit to width of page.
+#image("res/rhino.png")
+
+// Fit to height of page.
+#page(height: 40pt, 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", width: 60pt))