diff options
| author | Tobias Schmitz <tobiasschmitz2001@gmail.com> | 2025-07-09 16:32:41 +0200 |
|---|---|---|
| committer | Tobias Schmitz <tobiasschmitz2001@gmail.com> | 2025-07-09 17:34:17 +0200 |
| commit | a3784fba1e9906a91f285ddcbffdc4a76696b67b (patch) | |
| tree | 27b7aa459cb6c3bb7e5879583a4e57bc3997039e | |
| parent | 25ef7119e6b9b30b7dfa12da1c9f2002f4de1f6d (diff) | |
test: add test casesrect-strokes
Some of the stroked rectangles are still undesirable, but they are still added
as a reference.
| -rw-r--r-- | tests/ref/rect-small-radius-and-stroke-cap-variations.png | bin | 0 -> 4031 bytes | |||
| -rw-r--r-- | tests/ref/rect-stroke-variations-with-radius-and-adjacent-thin-stroke.png | bin | 0 -> 8121 bytes | |||
| -rw-r--r-- | tests/ref/rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke.png | bin | 0 -> 6552 bytes | |||
| -rw-r--r-- | tests/ref/rect-stroke-variations-with-radius.png | bin | 0 -> 6342 bytes | |||
| -rw-r--r-- | tests/ref/rect-stroke-variations-without-radius.png | bin | 0 -> 5051 bytes | |||
| -rw-r--r-- | tests/suite/visualize/rect.typ | 238 |
6 files changed, 238 insertions, 0 deletions
diff --git a/tests/ref/rect-small-radius-and-stroke-cap-variations.png b/tests/ref/rect-small-radius-and-stroke-cap-variations.png Binary files differnew file mode 100644 index 00000000..d82a92f4 --- /dev/null +++ b/tests/ref/rect-small-radius-and-stroke-cap-variations.png diff --git a/tests/ref/rect-stroke-variations-with-radius-and-adjacent-thin-stroke.png b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-thin-stroke.png Binary files differnew file mode 100644 index 00000000..a4bd33db --- /dev/null +++ b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-thin-stroke.png diff --git a/tests/ref/rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke.png b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke.png Binary files differnew file mode 100644 index 00000000..469f9369 --- /dev/null +++ b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke.png diff --git a/tests/ref/rect-stroke-variations-with-radius.png b/tests/ref/rect-stroke-variations-with-radius.png Binary files differnew file mode 100644 index 00000000..fa73c86f --- /dev/null +++ b/tests/ref/rect-stroke-variations-with-radius.png diff --git a/tests/ref/rect-stroke-variations-without-radius.png b/tests/ref/rect-stroke-variations-without-radius.png Binary files differnew file mode 100644 index 00000000..8771df1d --- /dev/null +++ b/tests/ref/rect-stroke-variations-without-radius.png diff --git a/tests/suite/visualize/rect.typ b/tests/suite/visualize/rect.typ index ba5792b7..9a510f53 100644 --- a/tests/suite/visualize/rect.typ +++ b/tests/suite/visualize/rect.typ @@ -127,3 +127,241 @@ #rect() #rect(height: 60pt) #rect(width: 60pt) + +--- rect-stroke-variations-without-radius --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let test-block(cap: "butt", dash: none, adjacent: none, radius: 0pt) = { + let adjacent-stroke = if adjacent == none { + none + } else { + (thickness: adjacent, paint: red, dash: dash) + } + bg-rect( + block( + height: 4em, + width: 5em, + stroke: ( + top: adjacent-stroke, + right: (cap: cap, thickness: 6pt, dash: dash, paint: green.transparentize(40%)), + bottom: (cap: cap, thickness: 2pt, dash: dash, paint: blue.transparentize(40%)), + left: adjacent-stroke + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [butt], [square], [round], + [no dash], + test-block(cap: "butt"), + test-block(cap: "square"), + test-block(cap: "round"), + + [dashed], + test-block(cap: "butt", dash: "dashed"), + test-block(cap: "square", dash: "dashed"), + test-block(cap: "round", dash: "dashed"), + + [loosely-dashed], + test-block(cap: "butt", dash: "loosely-dashed"), + test-block(cap: "square", dash: "loosely-dashed"), + test-block(cap: "round", dash: "loosely-dashed"), +) + +--- rect-stroke-variations-with-radius --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let test-block(cap: "butt", dash: none, adjacent: none, radius: 0pt) = { + let adjacent-stroke = if adjacent == none { + none + } else { + (thickness: adjacent, paint: red, dash: dash) + } + bg-rect( + block( + height: 4em, + width: 5em, + stroke: ( + top: adjacent-stroke, + right: (cap: cap, thickness: 6pt, dash: dash, paint: green.transparentize(40%)), + bottom: (cap: cap, thickness: 2pt, dash: dash, paint: blue.transparentize(40%)), + left: adjacent-stroke + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [butt], [square], [round], + [no dash], + test-block(cap: "butt", radius: 12pt), + test-block(cap: "square", radius: 12pt), + test-block(cap: "round", radius: 12pt), + + [dashed], + test-block(cap: "butt", radius: 12pt, dash: "dashed"), + test-block(cap: "square", radius: 12pt, dash: "dashed"), + test-block(cap: "round", radius: 12pt, dash: "dashed"), + + [loosely-dashed], + test-block(cap: "butt", radius: 12pt, dash: "loosely-dashed"), + test-block(cap: "square", radius: 12pt, dash: "loosely-dashed"), + test-block(cap: "round", radius: 12pt, dash: "loosely-dashed"), +) + +--- rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let test-block(cap: "butt", dash: none, adjacent: none, radius: 0pt) = { + let adjacent-stroke = if adjacent == none { + none + } else { + (thickness: adjacent, paint: red, dash: dash) + } + bg-rect( + block( + height: 4em, + width: 5em, + stroke: ( + top: adjacent-stroke, + right: (cap: cap, thickness: 6pt, dash: dash, paint: green.transparentize(40%)), + bottom: (cap: cap, thickness: 2pt, dash: dash, paint: blue.transparentize(40%)), + left: adjacent-stroke + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [butt], [square], [round], + [no dash], + test-block(cap: "butt", radius: 12pt, adjacent: 0pt), + test-block(cap: "square", radius: 12pt, adjacent: 0pt), + test-block(cap: "round", radius: 12pt, adjacent: 0pt), + + [dashed], + test-block(cap: "butt", radius: 12pt, adjacent: 0pt, dash: "dashed"), + test-block(cap: "square", radius: 12pt, adjacent: 0pt, dash: "dashed"), + test-block(cap: "round", radius: 12pt, adjacent: 0pt, dash: "dashed"), + + [loosely-dashed], + test-block(cap: "butt", radius: 12pt, adjacent: 0pt, dash: "loosely-dashed"), + test-block(cap: "square", radius: 12pt, adjacent: 0pt, dash: "loosely-dashed"), + test-block(cap: "round", radius: 12pt, adjacent: 0pt, dash: "loosely-dashed"), +) + +--- rect-stroke-variations-with-radius-and-adjacent-thin-stroke --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let test-block(cap: "butt", dash: none, adjacent: none, radius: 0pt) = { + let adjacent-stroke = if adjacent == none { + none + } else { + (thickness: adjacent, paint: red, dash: dash) + } + bg-rect( + block( + height: 4em, + width: 5em, + stroke: ( + top: adjacent-stroke, + right: (cap: cap, thickness: 6pt, dash: dash, paint: green.transparentize(40%)), + bottom: (cap: cap, thickness: 2pt, dash: dash, paint: blue.transparentize(40%)), + left: adjacent-stroke + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [butt], [square], [round], + [no dash], + test-block(cap: "butt", radius: 12pt, adjacent: 1pt), + test-block(cap: "square", radius: 12pt, adjacent: 1pt), + test-block(cap: "round", radius: 12pt, adjacent: 1pt), + + [dashed], + test-block(cap: "butt", radius: 12pt, adjacent: 1pt, dash: "dashed"), + test-block(cap: "square", radius: 12pt, adjacent: 1pt, dash: "dashed"), + test-block(cap: "round", radius: 12pt, adjacent: 1pt, dash: "dashed"), + + [loosely-dashed], + test-block(cap: "butt", radius: 12pt, adjacent: 1pt, dash: "loosely-dashed"), + test-block(cap: "square", radius: 12pt, adjacent: 1pt, dash: "loosely-dashed"), + test-block(cap: "round", radius: 12pt, adjacent: 1pt, dash: "loosely-dashed"), +) + +--- rect-small-radius-and-stroke-cap-variations --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let another-block(cap: "butt", radius: 5pt, adjacent: none) = { + let adjacent-stroke = if adjacent != none { + adjacent + } else { + none + } + bg-rect( + block( + height: 4em, + width: 5em, + stroke: ( + top: adjacent-stroke, + right: (cap: cap, thickness: 5pt), + bottom: (cap: cap, thickness: 5pt), + left: adjacent-stroke, + ), + radius: radius, + ) + ) +} + +#table( + columns: 4 * (1fr,), + [], [none], [0 width], [thin], + [], table.cell(colspan: 3)[radius same as thickness], + [butt], + another-block(cap: "butt", adjacent: none), + another-block(cap: "butt", adjacent: 0pt), + another-block(cap: "butt", adjacent: 1pt), + + [square], + another-block(cap: "square", adjacent: none), + another-block(cap: "square", adjacent: 0pt), + another-block(cap: "square", adjacent: 1pt), + + [round], + another-block(cap: "round", adjacent: none), + another-block(cap: "round", adjacent: 0pt), + another-block(cap: "round", adjacent: 1pt), + + [], table.cell(colspan: 3)[radius smaller than thickness], + [butt], + another-block(cap: "butt", radius: 2pt, adjacent: none), + another-block(cap: "butt", radius: 2pt, adjacent: 0pt), + another-block(cap: "butt", radius: 2pt, adjacent: 1pt), + + [square], + another-block(cap: "square", radius: 2pt, adjacent: none), + another-block(cap: "square", radius: 2pt, adjacent: 0pt), + another-block(cap: "square", radius: 2pt, adjacent: 1pt), + + [round], + another-block(cap: "round", radius: 2pt, adjacent: none), + another-block(cap: "round", radius: 2pt, adjacent: 0pt), + another-block(cap: "round", radius: 2pt, adjacent: 1pt), +) |
