summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnton Wetzel <59712243+antonWetzel@users.noreply.github.com>2023-09-25 13:54:58 +0200
committerGitHub <noreply@github.com>2023-09-25 13:54:58 +0200
commit98e5d9750923fa05ff2ab39a55e3b48ddd5b9ed8 (patch)
tree90c85096fa314b5739dffded8d55bf1a38664863 /tests
parent44bbfded5fb270a0b6c38b1d4dc8923dc44d7e7e (diff)
Better rect edges (#1956)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/compiler/show-selector.pngbin20394 -> 17066 bytes
-rw-r--r--tests/ref/meta/figure.pngbin66110 -> 54197 bytes
-rw-r--r--tests/ref/visualize/shape-fill-stroke.pngbin5821 -> 10272 bytes
-rw-r--r--tests/ref/visualize/shape-rect.pngbin247247 -> 247599 bytes
-rw-r--r--tests/ref/visualize/shape-rounded.pngbin876 -> 1975 bytes
-rw-r--r--tests/ref/visualize/stroke.pngbin4254 -> 4465 bytes
-rw-r--r--tests/typ/visualize/shape-fill-stroke.typ51
-rw-r--r--tests/typ/visualize/shape-rect.typ2
-rw-r--r--tests/typ/visualize/shape-rounded.typ53
9 files changed, 98 insertions, 8 deletions
diff --git a/tests/ref/compiler/show-selector.png b/tests/ref/compiler/show-selector.png
index be5ba463..f8259698 100644
--- a/tests/ref/compiler/show-selector.png
+++ b/tests/ref/compiler/show-selector.png
Binary files differ
diff --git a/tests/ref/meta/figure.png b/tests/ref/meta/figure.png
index 37386698..83bd7b7f 100644
--- a/tests/ref/meta/figure.png
+++ b/tests/ref/meta/figure.png
Binary files differ
diff --git a/tests/ref/visualize/shape-fill-stroke.png b/tests/ref/visualize/shape-fill-stroke.png
index cabbfb2e..d4a4817a 100644
--- a/tests/ref/visualize/shape-fill-stroke.png
+++ b/tests/ref/visualize/shape-fill-stroke.png
Binary files differ
diff --git a/tests/ref/visualize/shape-rect.png b/tests/ref/visualize/shape-rect.png
index 48d40447..3eda642f 100644
--- a/tests/ref/visualize/shape-rect.png
+++ b/tests/ref/visualize/shape-rect.png
Binary files differ
diff --git a/tests/ref/visualize/shape-rounded.png b/tests/ref/visualize/shape-rounded.png
index 5e761a4d..ec926d0a 100644
--- a/tests/ref/visualize/shape-rounded.png
+++ b/tests/ref/visualize/shape-rounded.png
Binary files differ
diff --git a/tests/ref/visualize/stroke.png b/tests/ref/visualize/stroke.png
index 3aa87c4b..bdfcae9f 100644
--- a/tests/ref/visualize/stroke.png
+++ b/tests/ref/visualize/stroke.png
Binary files differ
diff --git a/tests/typ/visualize/shape-fill-stroke.typ b/tests/typ/visualize/shape-fill-stroke.typ
index 0d133171..8d187400 100644
--- a/tests/typ/visualize/shape-fill-stroke.typ
+++ b/tests/typ/visualize/shape-fill-stroke.typ
@@ -43,8 +43,51 @@
// Test stroke composition.
#set square(stroke: 4pt)
#set text(font: "Roboto")
-#square(
- stroke: (left: red, top: yellow, right: green, bottom: blue),
- radius: 100%, align(center+horizon)[*G*],
- inset: 8pt
+#stack(
+ dir: ltr,
+ square(
+ stroke: (left: red, top: yellow, right: green, bottom: blue),
+ radius: 50%, align(center+horizon)[*G*],
+ inset: 8pt
+ ),
+ h(0.5cm),
+ square(
+ stroke: (left: red, top: yellow + 8pt, right: green, bottom: blue + 2pt),
+ radius: 50%, align(center+horizon)[*G*],
+ inset: 8pt
+ ),
+ h(0.5cm),
+ square(
+ stroke: (left: red, top: yellow, right: green, bottom: blue),
+ radius: 100%, align(center+horizon)[*G*],
+ inset: 8pt
+ ),
+)
+
+// Join between different solid strokes
+#set square(size: 20pt, stroke: 2pt)
+#set square(stroke: (left: green + 4pt, top: black + 2pt, right: blue, bottom: black + 2pt))
+#stack(
+ dir: ltr,
+ square(),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 1pt)),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 8pt)),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 100pt)),
+)
+
+
+// Join between solid and dotted strokes
+#set square(stroke: (left: green + 4pt, top: black + 2pt, right: (paint: blue, dash: "dotted"), bottom: (paint: black, dash: "dotted")))
+#stack(
+ dir: ltr,
+ square(),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 1pt)),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 8pt)),
+ h(0.2cm),
+ square(radius: (top-left: 0pt, rest: 100pt)),
)
diff --git a/tests/typ/visualize/shape-rect.typ b/tests/typ/visualize/shape-rect.typ
index 17dd0f92..98450c80 100644
--- a/tests/typ/visualize/shape-rect.typ
+++ b/tests/typ/visualize/shape-rect.typ
@@ -32,7 +32,7 @@
#stack(
dir: ltr,
spacing: 1fr,
- rect(width: 2cm, radius: 60%),
+ rect(width: 2cm, radius: 30%),
rect(width: 1cm, radius: (left: 10pt, right: 5pt)),
rect(width: 1.25cm, radius: (
top-left: 2pt,
diff --git a/tests/typ/visualize/shape-rounded.typ b/tests/typ/visualize/shape-rounded.typ
index 862141ba..42432dc9 100644
--- a/tests/typ/visualize/shape-rounded.typ
+++ b/tests/typ/visualize/shape-rounded.typ
@@ -1,6 +1,53 @@
// Test rounded rectangles and squares.
---
-// Ensure that radius is clamped.
-#rect(radius: -20pt)
-#square(radius: 30pt)
+#set square(size: 20pt, stroke: 4pt)
+
+// no radius for non-rounded corners
+#stack(
+ dir: ltr,
+ square(),
+ h(10pt),
+ square(radius: 0pt),
+ h(10pt),
+ square(radius: -10pt),
+)
+
+#stack(
+ dir: ltr,
+ square(),
+ h(10pt),
+ square(radius: 0%),
+ h(10pt),
+ square(radius: -10%),
+)
+
+
+// small values for small radius
+#stack(
+ dir: ltr,
+ square(radius: 1pt),
+ h(10pt),
+ square(radius: 5%),
+ h(10pt),
+ square(radius: 2pt),
+)
+
+// large values for large radius or circle
+#stack(
+ dir: ltr,
+ square(radius: 8pt),
+ h(10pt),
+ square(radius: 10pt),
+ h(10pt),
+ square(radius: 12pt),
+)
+
+#stack(
+ dir: ltr,
+ square(radius: 45%),
+ h(10pt),
+ square(radius: 50%),
+ h(10pt),
+ square(radius: 55%),
+)