diff options
| author | Anton Wetzel <59712243+antonWetzel@users.noreply.github.com> | 2023-09-25 13:54:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-25 13:54:58 +0200 |
| commit | 98e5d9750923fa05ff2ab39a55e3b48ddd5b9ed8 (patch) | |
| tree | 90c85096fa314b5739dffded8d55bf1a38664863 /tests/typ/visualize | |
| parent | 44bbfded5fb270a0b6c38b1d4dc8923dc44d7e7e (diff) | |
Better rect edges (#1956)
Diffstat (limited to 'tests/typ/visualize')
| -rw-r--r-- | tests/typ/visualize/shape-fill-stroke.typ | 51 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-rect.typ | 2 | ||||
| -rw-r--r-- | tests/typ/visualize/shape-rounded.typ | 53 |
3 files changed, 98 insertions, 8 deletions
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%), +) |
