summaryrefslogtreecommitdiff
path: root/tests/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
parent0cdf17216f47312f634d2dea8db237118ede72ce (diff)
Image fit modes
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/elements/image.typ30
-rw-r--r--tests/typ/layout/grid-3.typ2
-rw-r--r--tests/typ/layout/stack-1.typ1
3 files changed, 22 insertions, 11 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")
---
diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ
index af971875..82472e55 100644
--- a/tests/typ/layout/grid-3.typ
+++ b/tests/typ/layout/grid-3.typ
@@ -23,7 +23,7 @@
columns: 4 * (1fr,),
row-gutter: 10pt,
column-gutter: (0pt, 10%),
- image("../../res/rhino.png"),
+ align(top, image("../../res/rhino.png")),
align(right, rect(width: 100%, fill: eastern)[LoL]),
[rofl],
[\ A] * 3,
diff --git a/tests/typ/layout/stack-1.typ b/tests/typ/layout/stack-1.typ
index 42a0137d..2fbe22e3 100644
--- a/tests/typ/layout/stack-1.typ
+++ b/tests/typ/layout/stack-1.typ
@@ -17,7 +17,6 @@
#page(width: 50pt, margins: 0pt)
#stack(dir: btt, ..items)
-#pagebreak()
---
// Test spacing.