summaryrefslogtreecommitdiff
path: root/tests/typ/elements
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/elements')
-rw-r--r--tests/typ/elements/circle.typ21
-rw-r--r--tests/typ/elements/ellipse.typ9
-rw-r--r--tests/typ/elements/image.typ3
-rw-r--r--tests/typ/elements/square.typ3
4 files changed, 19 insertions, 17 deletions
diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ
index 4413d0d9..5be9cf56 100644
--- a/tests/typ/elements/circle.typ
+++ b/tests/typ/elements/circle.typ
@@ -9,8 +9,7 @@
Auto-sized circle. \
#circle(fill: rgb("eb5278"))[
- #align(center, center)
- But, soft!
+ #align(center, center)[But, soft!]
]
Center-aligned rect in auto-sized circle.
@@ -31,14 +30,18 @@ Expanded by height.
#circle(fill: conifer)[A \ B \ C]
---
+// Ensure circle directly in rect works.
+#rect(width: 40pt, height: 30pt, circle(fill: forest))
+
+---
// Test relative sizing.
-#rect(width: 100pt, height: 50pt, fill: rgb("aaa"))[
- #align(center, center)
- #font(fill: white)
- #circle(radius: 10pt, fill: eastern)[A] // D=20pt
- #circle(height: 60%, fill: eastern)[B] // D=30pt
- #circle(width: 20% + 20pt, fill: eastern)[C] // D=40pt
-]
+#let centered(body) = align(center, center, body)
+#font(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.
diff --git a/tests/typ/elements/ellipse.typ b/tests/typ/elements/ellipse.typ
index 3c8572b1..9c36fb1c 100644
--- a/tests/typ/elements/ellipse.typ
+++ b/tests/typ/elements/ellipse.typ
@@ -8,10 +8,11 @@
Rect in ellipse in fixed rect. \
#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"),
ellipse(fill: forest,
- rect(fill: conifer)[
- #align(center, center)
- Stuff inside an ellipse!
- ]
+ rect(fill: conifer,
+ align(center, center)[
+ Stuff inside an ellipse!
+ ]
+ )
)
)
diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ
index 43f93baf..84260a28 100644
--- a/tests/typ/elements/image.typ
+++ b/tests/typ/elements/image.typ
@@ -21,8 +21,7 @@
#image("../../res/tiger.jpg", width: 100%, height: 20pt, fit: "stretch")
// Make sure the bounding-box of the image is correct.
-#align(bottom, right)
-#image("../../res/tiger.jpg", width: 40pt)
+#align(bottom, right, image("../../res/tiger.jpg", width: 40pt))
---
// Test all three fit modes.
diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ
index 3686debb..3163f872 100644
--- a/tests/typ/elements/square.typ
+++ b/tests/typ/elements/square.typ
@@ -9,8 +9,7 @@
// Test auto-sized square.
#square(fill: eastern)[
#font(fill: white, weight: "bold")
- #align(center)
- #pad(5pt)[Typst]
+ #align(center, pad(5pt)[Typst])
]
---