summaryrefslogtreecommitdiff
path: root/tests/typ/visualize/line.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-29 13:37:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-29 14:18:13 +0100
commit0efe669278a5e1c3f2985eba2f3360e91159c54a (patch)
tree502712857c48f0decb5e698257c0a96d358a436e /tests/typ/visualize/line.typ
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/visualize/line.typ')
-rw-r--r--tests/typ/visualize/line.typ52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/typ/visualize/line.typ b/tests/typ/visualize/line.typ
new file mode 100644
index 00000000..2cb2fc9c
--- /dev/null
+++ b/tests/typ/visualize/line.typ
@@ -0,0 +1,52 @@
+// Test lines
+
+---
+// Default line.
+#line()
+
+---
+// Test the to argument.
+{
+ line(to: (10pt, 0pt))
+ line(origin: (0pt, 10pt), to: (0pt, 0pt))
+ line(to: (15pt, 15pt))
+}
+#v(.5cm)
+
+---
+// Test the angle argument and positioning.
+
+#set page(fill: rgb("0B1026"))
+#set line(stroke: white)
+
+#let star(width, ..args) = box(width: width, height: width)[
+ #set text(spacing: 0%)
+ #set line(..args)
+ #set par(align: left)
+ #line(length: +30%, origin: (09.0%, 02%))
+ #line(length: +30%, origin: (38.7%, 02%), angle: -72deg)
+ #line(length: +30%, origin: (57.5%, 02%), angle: 252deg)
+ #line(length: +30%, origin: (57.3%, 02%))
+ #line(length: -30%, origin: (88.0%, 02%), angle: -36deg)
+ #line(length: +30%, origin: (73.3%, 48%), angle: 252deg)
+ #line(length: -30%, origin: (73.5%, 48%), angle: 36deg)
+ #line(length: +30%, origin: (25.4%, 48%), angle: -36deg)
+ #line(length: +30%, origin: (25.6%, 48%), angle: -72deg)
+ #line(length: +32%, origin: (8.50%, 02%), angle: 34deg)
+]
+
+#align(center, grid(
+ columns: 3,
+ column-gutter: 10pt,
+ ..((star(20pt, stroke: 0.5pt),) * 9)
+))
+
+---
+// Test errors.
+
+// Error: 11-18 point array must contain exactly two entries
+#line(to: (50pt,))
+
+---
+// Error: 15-27 expected relative length, found angle
+#line(origin: (3deg, 10pt), length: 5cm)