summaryrefslogtreecommitdiff
path: root/tests/typ/elements/image.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-16 21:32:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-16 21:32:29 +0100
commit9a800daa82833c57eee04e92c701ca9a05a67d3b (patch)
treea2c790f606037319393e9da3150bf58b44d4171d /tests/typ/elements/image.typ
parent0cdf17216f47312f634d2dea8db237118ede72ce (diff)
Image fit modes
Diffstat (limited to 'tests/typ/elements/image.typ')
-rw-r--r--tests/typ/elements/image.typ30
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ
index c0e6a3ef..43f93baf 100644
--- a/tests/typ/elements/image.typ
+++ b/tests/typ/elements/image.typ
@@ -5,30 +5,42 @@
// Load an RGBA PNG image.
#image("../../res/rhino.png")
-#pagebreak()
// Load an RGB JPEG image.
+#page(height: 60pt)
#image("../../res/tiger.jpg")
---
// Test configuring the size and fitting behaviour of images.
-// Set width explicitly.
-#image("../../res/rhino.png", width: 50pt)
-
-// Set height explicitly.
-#image("../../res/rhino.png", height: 50pt)
+// Set width and height explicitly.
+#image("../../res/rhino.png", width: 30pt)
+#image("../../res/rhino.png", height: 30pt)
// Set width and height explicitly and force stretching.
-#image("../../res/rhino.png", width: 25pt, height: 50pt)
+#image("../../res/tiger.jpg", width: 100%, height: 20pt, fit: "stretch")
// Make sure the bounding-box of the image is correct.
#align(bottom, right)
-#image("../../res/tiger.jpg", width: 60pt)
+#image("../../res/tiger.jpg", width: 40pt)
+
+---
+// Test all three fit modes.
+#page(height: 50pt, margins: 0pt)
+#grid(
+ columns: 3,
+ rows: 100%,
+ gutter: 3pt,
+ image("../../res/tiger.jpg", fit: "contain"),
+ image("../../res/tiger.jpg", fit: "cover"),
+ image("../../res/tiger.jpg", fit: "stretch"),
+)
---
-// Does not fit to height of page.
+// Does not fit to remaining height of page.
#page(height: 60pt)
+Stuff \
+Stuff
#image("../../res/rhino.png")
---