diff options
| author | Pg Biel <9021226+PgBiel@users.noreply.github.com> | 2023-04-06 10:36:36 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-06 15:36:36 +0200 |
| commit | ca71081d05e1d2fabf65f4d4576ef0ac095221f9 (patch) | |
| tree | a705ca338a6f172d68635281df5ef587872f376a /tests | |
| parent | 5cb226026e104c0ddb855c3ad6fee5212a796006 (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.png | bin | 23032 -> 24503 bytes | |||
| -rw-r--r-- | tests/ref/layout/page.png | bin | 8104 -> 14273 bytes | |||
| -rw-r--r-- | tests/typ/layout/block-sizing.typ | 8 | ||||
| -rw-r--r-- | tests/typ/layout/page.typ | 9 |
4 files changed, 17 insertions, 0 deletions
diff --git a/tests/ref/layout/block-sizing.png b/tests/ref/layout/block-sizing.png Binary files differindex ff95c34c..f6655e63 100644 --- a/tests/ref/layout/block-sizing.png +++ b/tests/ref/layout/block-sizing.png diff --git a/tests/ref/layout/page.png b/tests/ref/layout/page.png Binary files differindex 4881fa2b..bcf32526 100644 --- a/tests/ref/layout/page.png +++ b/tests/ref/layout/page.png 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)) +}) |
