diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-09-27 13:40:56 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-09-27 13:45:18 +0200 |
| commit | e10b3d838a75ea351f8477e07f2e1e647f4539dc (patch) | |
| tree | 286183d4b7492ecf95b7a8b0a9c245bb85191db5 /tests/typ | |
| parent | ff37a2893dc7f0a29faa7cc57ccb4d746f483bed (diff) | |
Fix panic due to bad alignments in stack function
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), )) |
