summaryrefslogtreecommitdiff
path: root/tests/suite/layout/pad.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerGitHub <noreply@github.com>2024-04-13 08:39:45 +0000
commit020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch)
treec0027ad22046e2726c22298461327823d6b88d53 /tests/suite/layout/pad.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/layout/pad.typ')
-rw-r--r--tests/suite/layout/pad.typ30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/suite/layout/pad.typ b/tests/suite/layout/pad.typ
new file mode 100644
index 00000000..3a7439d0
--- /dev/null
+++ b/tests/suite/layout/pad.typ
@@ -0,0 +1,30 @@
+// Test the `pad` function.
+
+--- pad-basic ---
+// Use for indentation.
+#pad(left: 10pt, [Indented!])
+
+// All sides together.
+#set rect(inset: 0pt)
+#rect(fill: conifer,
+ pad(10pt, right: 20pt,
+ rect(width: 20pt, height: 20pt, fill: rgb("eb5278"))
+ )
+)
+
+Hi #box(pad(left: 10pt)[A]) there
+
+--- pad-expanding-contents ---
+// Pad can grow.
+#pad(left: 10pt, right: 10pt)[PL #h(1fr) PR]
+
+--- pad-followed-by-content ---
+// Test that the pad element doesn't consume the whole region.
+#set page(height: 6cm)
+#align(left)[Before]
+#pad(10pt, image("/assets/images/tiger.jpg"))
+#align(right)[After]
+
+--- pad-adding-to-100-percent ---
+// Test that padding adding up to 100% does not panic.
+#pad(50%)[]