summaryrefslogtreecommitdiff
path: root/tests/suite/layout/limits.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerGitHub <noreply@github.com>2024-04-13 08:39:45 +0000
commit020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch)
treec0027ad22046e2726c22298461327823d6b88d53 /tests/suite/layout/limits.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/layout/limits.typ')
-rw-r--r--tests/suite/layout/limits.typ32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/suite/layout/limits.typ b/tests/suite/layout/limits.typ
new file mode 100644
index 00000000..e1f0ec5f
--- /dev/null
+++ b/tests/suite/layout/limits.typ
@@ -0,0 +1,32 @@
+// Test how the layout engine reacts when reaching limits like
+// zero, infinity or when dealing with NaN.
+
+--- issue-1216-clamp-panic ---
+#set page(height: 20pt, margin: 0pt)
+#v(22pt)
+#block(fill: red, width: 100%, height: 10pt, radius: 4pt)
+
+--- issue-1918-layout-infinite-length-grid-columns ---
+// Test that passing infinite lengths to drawing primitives does not crash Typst.
+#set page(width: auto, height: auto)
+
+// Error: 58-59 cannot expand into infinite width
+#layout(size => grid(columns: (size.width, size.height))[a][b][c][d])
+
+--- issue-1918-layout-infinite-length-grid-rows ---
+#set page(width: auto, height: auto)
+
+// Error: 17-66 cannot create grid with infinite height
+#layout(size => grid(rows: (size.width, size.height))[a][b][c][d])
+
+--- issue-1918-layout-infinite-length-line ---
+#set page(width: auto, height: auto)
+
+// Error: 17-41 cannot create line with infinite length
+#layout(size => line(length: size.width))
+
+--- issue-1918-layout-infinite-length-polygon ---
+#set page(width: auto, height: auto)
+
+// Error: 17-54 cannot create polygon with infinite size
+#layout(size => polygon((0pt,0pt), (0pt, size.width)))