summaryrefslogtreecommitdiff
path: root/tests/typ/visualize/shape-aspect.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-aspect.typ
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/visualize/shape-aspect.typ')
-rw-r--r--tests/typ/visualize/shape-aspect.typ46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/typ/visualize/shape-aspect.typ b/tests/typ/visualize/shape-aspect.typ
new file mode 100644
index 00000000..f2dd9b51
--- /dev/null
+++ b/tests/typ/visualize/shape-aspect.typ
@@ -0,0 +1,46 @@
+// Test that squares and circles respect their 1-1 aspect ratio.
+
+---
+// Test relative width and height and size that is smaller
+// than default size.
+#set page(width: 120pt, height: 70pt)
+#square(width: 50%, align(bottom)[A])
+#square(height: 50%)
+#box(stack(square(size: 10pt), 5pt, square(size: 10pt, [B])))
+
+---
+// Test alignment in automatically sized square and circle.
+#set text(8pt)
+#square(inset: 4pt)[
+ Hey there, #align(center + bottom, rotate(180deg, [you!]))
+]
+#circle(align(center + horizon, [Hey.]))
+
+---
+// Test that maximum wins if both width and height are given.
+#square(width: 10pt, height: 20pt)
+#circle(width: 20%, height: 10pt)
+
+---
+// Test square that is limited by region size.
+#set page(width: 20pt, height: 10pt, margin: 0pt)
+#stack(dir: ltr, square(fill: forest), square(fill: conifer))
+
+---
+// Test different ways of sizing.
+#set page(width: 120pt, height: 40pt)
+#circle(radius: 5pt)
+#circle(width: 10%)
+#circle(height: 50%)
+
+---
+// Test square that is overflowing due to its aspect ratio.
+#set page(width: 40pt, height: 20pt, margin: 5pt)
+#square(width: 100%) #parbreak()
+#square(width: 100%)[Hello]
+
+---
+// Size cannot be relative because we wouldn't know
+// relative to which axis.
+// Error: 15-18 expected length, found ratio
+#square(size: 50%)