summaryrefslogtreecommitdiff
path: root/tests/typ/bugs
diff options
context:
space:
mode:
authorbluebear94 <uruwi@protonmail.com>2023-10-05 04:26:36 -0400
committerGitHub <noreply@github.com>2023-10-05 10:26:36 +0200
commit6bb776029e5d3261bd79605f91eb1e7fd14d06ea (patch)
tree17c6f352d848731309580c3dbe0c9f08304d7b38 /tests/typ/bugs
parentea0f22a8ca2eec4bde44fc4afc6032c2728aed27 (diff)
Fix crashes with infinite lengths (part 2) (#2298)
Diffstat (limited to 'tests/typ/bugs')
-rw-r--r--tests/typ/bugs/layout-infinite-lengths.typ25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/typ/bugs/layout-infinite-lengths.typ b/tests/typ/bugs/layout-infinite-lengths.typ
new file mode 100644
index 00000000..501e517e
--- /dev/null
+++ b/tests/typ/bugs/layout-infinite-lengths.typ
@@ -0,0 +1,25 @@
+// Test that passing infinite lengths to drawing primitives does not crash Typst.
+
+---
+#set page(width: auto, height: auto)
+
+// Error: cannot expand into infinite width
+#layout(size => grid(columns: (size.width, size.height))[a][b][c][d])
+
+---
+#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])
+
+---
+#set page(width: auto, height: auto)
+
+// Error: 17-41 cannot create line with infinite length
+#layout(size => line(length: size.width))
+
+---
+#set page(width: auto, height: auto)
+
+// Error: 17-54 cannot create polygon with infinite size
+#layout(size => polygon((0pt,0pt), (0pt, size.width)))