summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2023-12-19 06:28:41 -0300
committerGitHub <noreply@github.com>2023-12-19 10:28:41 +0100
commit111a69f6aaf0dd470dd2319f8cff29194aa0da08 (patch)
tree9138db0720aa692f89395ccc1a6ab1f0c9bb5e23 /tests
parentc361566cb2d992596544d1277bcd8d93c14c9f90 (diff)
Grid and Table API Unification [More Flexible Tables Pt.1] (#3009)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/grid-styling.pngbin0 -> 18429 bytes
-rw-r--r--tests/typ/layout/grid-styling.typ89
2 files changed, 89 insertions, 0 deletions
diff --git a/tests/ref/layout/grid-styling.png b/tests/ref/layout/grid-styling.png
new file mode 100644
index 00000000..ae5c0519
--- /dev/null
+++ b/tests/ref/layout/grid-styling.png
Binary files differ
diff --git a/tests/typ/layout/grid-styling.typ b/tests/typ/layout/grid-styling.typ
new file mode 100644
index 00000000..577e15c4
--- /dev/null
+++ b/tests/typ/layout/grid-styling.typ
@@ -0,0 +1,89 @@
+// Test grid styling options.
+
+---
+#set page(height: 70pt)
+#set grid(fill: (x, y) => if calc.even(x + y) { rgb("aaa") })
+
+#grid(
+ columns: (1fr,) * 3,
+ stroke: 2pt + rgb("333"),
+ [A], [B], [C], [], [], [D \ E \ F \ \ \ G], [H],
+)
+
+---
+#grid(columns: 3, stroke: none, fill: green, [A], [B], [C])
+
+---
+// Test general alignment.
+#grid(
+ columns: 3,
+ align: left,
+ [Hello], [Hello], [Hello],
+ [A], [B], [C],
+)
+
+// Test alignment with a function.
+#grid(
+ columns: 3,
+ align: (x, y) => (left, center, right).at(x),
+ [Hello], [Hello], [Hello],
+ [A], [B], [C],
+)
+
+// Test alignment with array.
+#grid(
+ columns: (1fr, 1fr, 1fr),
+ align: (left, center, right),
+ [A], [B], [C]
+)
+
+// Test empty array.
+#set align(center)
+#grid(
+ columns: (1fr, 1fr, 1fr),
+ align: (),
+ [A], [B], [C]
+)
+
+a
+
+---
+// Test inset.
+#grid(
+ columns: (1fr,) * 3,
+ stroke: 2pt + rgb("333"),
+ inset: 5pt,
+ [A], [B], [C], [], [], [D \ E \ F \ \ \ G], [H],
+)
+
+#grid(
+ columns: 3,
+ inset: 10pt,
+ fill: blue,
+ [A], [B], [C]
+)
+
+#grid(
+ columns: 3,
+ inset: (y: 10pt),
+ [A], [B], [C]
+)
+
+#grid(
+ columns: 3,
+ inset: (left: 20pt, rest: 10pt),
+ stroke: 3pt + red,
+ [A], [B], [C]
+)
+
+#grid(
+ columns: 2,
+ inset: (
+ left: 20pt,
+ right: 5pt,
+ top: 10pt,
+ bottom: 3pt,
+ ),
+ [A],
+ [B],
+)