summaryrefslogtreecommitdiff
path: root/tests/typ/visualize/shape-circle.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/shape-circle.typ
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/visualize/shape-circle.typ')
-rw-r--r--tests/typ/visualize/shape-circle.typ51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/typ/visualize/shape-circle.typ b/tests/typ/visualize/shape-circle.typ
new file mode 100644
index 00000000..13ff67de
--- /dev/null
+++ b/tests/typ/visualize/shape-circle.typ
@@ -0,0 +1,51 @@
+// Test the `circle` function.
+
+---
+// Default circle.
+#circle()
+#circle[Hey]
+
+---
+// Test auto sizing.
+
+Auto-sized circle. \
+#circle(fill: rgb("eb5278"), stroke: 2pt + black,
+ align(center + horizon)[But, soft!]
+)
+
+Center-aligned rect in auto-sized circle.
+#circle(fill: forest, stroke: conifer,
+ align(center + horizon,
+ rect(fill: conifer, inset: 5pt)[But, soft!]
+ )
+)
+
+Rect in auto-sized circle. \
+#circle(fill: forest,
+ rect(fill: conifer, stroke: white, inset: 4pt)[
+ #set text(8pt)
+ But, soft! what light through yonder window breaks?
+ ]
+)
+
+Expanded by height.
+#circle(stroke: black, align(center)[A \ B \ C])
+
+---
+// Ensure circle directly in rect works.
+#rect(width: 40pt, height: 30pt, fill: forest, circle(fill: conifer))
+
+---
+// Test relative sizing.
+#let centered(body) = align(center + horizon, body)
+#set text(fill: white)
+#rect(width: 100pt, height: 50pt, fill: rgb("aaa"), centered[
+ #circle(radius: 10pt, fill: eastern, centered[A]) // D=20pt
+ #circle(height: 60%, fill: eastern, centered[B]) // D=30pt
+ #circle(width: 20% + 20pt, fill: eastern, centered[C]) // D=40pt
+])
+
+---
+// Radius wins over width and height.
+// Error: 23-34 unexpected argument
+#circle(radius: 10pt, width: 50pt, height: 100pt, fill: eastern)