diff options
| author | Martin <mhaug@live.de> | 2021-06-12 18:19:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-12 18:19:18 +0200 |
| commit | fec1f41106862617797abf65d4eba8061cf4497b (patch) | |
| tree | 06bc5418a7fc8db6ef091a235099aba38268f2ea /tests/typ | |
| parent | 4017b5a9f67e06145129d75de452c8a42e2d2f5a (diff) | |
Allow grid cells to span multiple regions. (#30)
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/layout/grid-1.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/grid-3.typ | 79 |
2 files changed, 82 insertions, 1 deletions
diff --git a/tests/typ/layout/grid-1.typ b/tests/typ/layout/grid-1.typ index 6a4aee87..827a98a7 100644 --- a/tests/typ/layout/grid-1.typ +++ b/tests/typ/layout/grid-1.typ @@ -25,7 +25,8 @@ --- #grid( columns: (auto, auto, 40%), - gutter: (1fr,), + gutter-columns: (1fr,), + gutter-rows: (1fr,), rect(fill: eastern)[dddaa aaa aaa], rect(fill: conifer)[ccc], rect(width: 100%, fill: #dddddd)[aaa], @@ -52,3 +53,4 @@ rows: (1fr, auto, 2fr), [], rect(width: 100%)[A bit more to the top], [], ) + diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ new file mode 100644 index 00000000..6ef0ab83 --- /dev/null +++ b/tests/typ/layout/grid-3.typ @@ -0,0 +1,79 @@ +// Test grid cells that overflow to the next region. + +--- +#page(width: 5cm, height: 3cm) +#grid( + columns: 2, + gutter-rows: 3 * (8pt,), + [Lorem ipsum dolor sit amet, consectetuer adipiscing elit. + + Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis.], + [Text that is rather short], + [Fireflies], + [Critical], + [Decorum], + [Rampage], +) + +--- +// Test a column that starts overflowing right after another row/column did +// that. +#page(width: 5cm, height: 2cm) +#grid( + columns: 4 * (1fr,), + gutter-rows: (10pt,), + gutter-columns: (0pt, 10%), + image("../../res/rhino.png"), + align(right, rect(width: 100%, fill: eastern)[LoL]), + "rofl", + "\nA" * 3, + "Ha!\n" * 3, +) + +--- +// Test two columns in the same row overflowing by a different amount. +#page(width: 5cm, height: 2cm) +#grid( + columns: 3 * (1fr,), + gutter-rows: (8pt,), + gutter-columns: (0pt, 10%), + [A], [B], [C], + "Ha!\n" * 6, + "rofl", + "\nA" * 3, + [hello], + [darkness], + [my old] +) + +--- +// Test grid within a grid, overflowing. +#page(width: 5cm, height: 2.25cm) +#grid( + columns: 4 * (1fr,), + gutter-rows: (10pt,), + gutter-columns: (0pt, 10%), + [A], [B], [C], [D], + grid(columns: 2, [A], [B], "C\n"*3, [D]), + align(right, rect(width: 100%, fill: eastern)[LoL]), + "rofl", + "E\n"*4, +) + +--- +// Test partition of `fr` units before and after multi-region layout. +#page(width: 5cm, height: 4cm) +#grid( + columns: 2 * (1fr,), + rows: (1fr, 2fr, auto, 1fr, 1cm), + gutter-rows: 4 * (10pt,), + rect(height: 100%, width: 100%, fill: #ff0000)[No height], + [foo], + rect(height: 100%, width: 100%, fill: #fc0030)[Still no height], + [bar], + [The nature of being itself is in question. Am I One? Am I Many? What is being alive?], + [baz], + [The answer], + [42], + [Other text of interest], +) |
