diff options
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/layout/stack.typ | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/tests/typ/layout/stack.typ b/tests/typ/layout/stack.typ index 729d85fc..384f574f 100644 --- a/tests/typ/layout/stack.typ +++ b/tests/typ/layout/stack.typ @@ -1,18 +1,32 @@ // Test stack layouts. --- -#let rect(width, fill) = rect(width: width, height: 1cm, fill: fill) -#stack( - rect(2cm, rgb("2a631a")), - rect(3cm, forest), - rect(1cm, conifer), +// Test stacks with different directions. +#let widths = ( + 30pt, 20pt, 40pt, 15pt, + 30pt, 50%, 20pt, 100%, ) +#let shaded = { + let v = 0 + let next() = { v += 0.1; rgb(v, v, v) } + w => rect(width: w, height: 10pt, fill: next()) +} + +#let items = for w in widths { (shaded(w),) } + +#align(right) +#page(width: 50pt, margins: 0pt) +#stack(dir: btt, ..items) +#pagebreak() + +// Currently stack works like flexbox apparently. +#stack(dir: ltr, ..items) + --- // Test overflowing stack. - -#let rect(width, fill) = rect(width: 1cm, height: 0.4cm, fill: fill) -#box(height: 0.5cm, stack( - rect(3cm, forest), - rect(1cm, conifer), +#page(width: 50pt, height: 30pt, margins: 0pt) +#box(stack( + rect(width: 40pt, height: 20pt, fill: conifer), + rect(width: 30pt, height: 13pt, fill: forest), )) |
