summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPg Biel <9021226+PgBiel@users.noreply.github.com>2023-04-06 10:36:36 -0300
committerGitHub <noreply@github.com>2023-04-06 15:36:36 +0200
commitca71081d05e1d2fabf65f4d4576ef0ac095221f9 (patch)
treea705ca338a6f172d68635281df5ef587872f376a /tests
parent5cb226026e104c0ddb855c3ad6fee5212a796006 (diff)
Add 'layout' function to obtain the size of the outer container (#557)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/block-sizing.pngbin23032 -> 24503 bytes
-rw-r--r--tests/ref/layout/page.pngbin8104 -> 14273 bytes
-rw-r--r--tests/typ/layout/block-sizing.typ8
-rw-r--r--tests/typ/layout/page.typ9
4 files changed, 17 insertions, 0 deletions
diff --git a/tests/ref/layout/block-sizing.png b/tests/ref/layout/block-sizing.png
index ff95c34c..f6655e63 100644
--- a/tests/ref/layout/block-sizing.png
+++ b/tests/ref/layout/block-sizing.png
Binary files differ
diff --git a/tests/ref/layout/page.png b/tests/ref/layout/page.png
index 4881fa2b..bcf32526 100644
--- a/tests/ref/layout/page.png
+++ b/tests/ref/layout/page.png
Binary files differ
diff --git a/tests/typ/layout/block-sizing.typ b/tests/typ/layout/block-sizing.typ
index a768c3e3..181bbe31 100644
--- a/tests/typ/layout/block-sizing.typ
+++ b/tests/typ/layout/block-sizing.typ
@@ -14,3 +14,11 @@
fill: aqua,
lorem(8) + colbreak(),
)
+
+---
+// Layout inside a block with certain dimensions should provide those dimensions.
+
+#set page(height: 120pt)
+#block(width: 60pt, height: 80pt, layout(size => [
+ This block has a width of #size.width and height of #size.height
+]))
diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ
index ff050e55..f5c7822d 100644
--- a/tests/typ/layout/page.typ
+++ b/tests/typ/layout/page.typ
@@ -31,3 +31,12 @@
// Should result in one forest-colored A11 page and one auto-sized page.
#page("a11", flipped: true, fill: forest)[]
#pagebreak()
+
+---
+// Layout without any container should provide the page's dimensions, minus its margins.
+
+#page(width: 100pt, height: 100pt, {
+ layout(size => [This page has a width of #size.width and height of #size.height ])
+ h(1em)
+ place(left, rect(width: 80pt, stroke: blue))
+})