diff --git a/tests/ref/rect-cap-variations-radius-1-3-of-stroke-thickness.png b/tests/ref/rect-cap-variations-radius-1-3-of-stroke-thickness.png new file mode 100644 index 000000000..29e4615f9 Binary files /dev/null and b/tests/ref/rect-cap-variations-radius-1-3-of-stroke-thickness.png differ diff --git a/tests/ref/rect-cap-variations-radius-2-3-of-stroke-thickness.png b/tests/ref/rect-cap-variations-radius-2-3-of-stroke-thickness.png new file mode 100644 index 000000000..25a11a10d Binary files /dev/null and b/tests/ref/rect-cap-variations-radius-2-3-of-stroke-thickness.png differ diff --git a/tests/ref/rect-cap-variations-radius-4-3-of-stroke-thickness.png b/tests/ref/rect-cap-variations-radius-4-3-of-stroke-thickness.png new file mode 100644 index 000000000..8b7ad8e55 Binary files /dev/null and b/tests/ref/rect-cap-variations-radius-4-3-of-stroke-thickness.png differ diff --git a/tests/ref/rect-cap-variations-radius-same-as-stroke-thickness.png b/tests/ref/rect-cap-variations-radius-same-as-stroke-thickness.png new file mode 100644 index 000000000..50d802da6 Binary files /dev/null and b/tests/ref/rect-cap-variations-radius-same-as-stroke-thickness.png differ 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 new file mode 100644 index 000000000..a4bd33db3 Binary files /dev/null and b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-thin-stroke.png differ 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 new file mode 100644 index 000000000..469f93699 Binary files /dev/null and b/tests/ref/rect-stroke-variations-with-radius-and-adjacent-zero-width-stroke.png differ diff --git a/tests/ref/rect-stroke-variations-with-radius.png b/tests/ref/rect-stroke-variations-with-radius.png new file mode 100644 index 000000000..fa73c86f3 Binary files /dev/null and b/tests/ref/rect-stroke-variations-with-radius.png differ diff --git a/tests/ref/rect-stroke-variations-without-radius.png b/tests/ref/rect-stroke-variations-without-radius.png new file mode 100644 index 000000000..8771df1d4 Binary files /dev/null and b/tests/ref/rect-stroke-variations-without-radius.png differ diff --git a/tests/suite/visualize/rect.typ b/tests/suite/visualize/rect.typ index ba5792b78..c723e3c85 100644 --- a/tests/suite/visualize/rect.typ +++ b/tests/suite/visualize/rect.typ @@ -127,3 +127,355 @@ #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-cap-variations-radius-4-3-of-stroke-thickness --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let another-block(cap: "butt", radius: 6pt, 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: 6pt), + bottom: (cap: cap, thickness: 6pt), + left: adjacent-stroke, + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [none], [0 width], [thin], + [butt], + another-block(cap: "butt", radius: 8pt, adjacent: none), + another-block(cap: "butt", radius: 8pt, adjacent: 0pt), + another-block(cap: "butt", radius: 8pt, adjacent: 1pt), + + [square], + another-block(cap: "square", radius: 8pt, adjacent: none), + another-block(cap: "square", radius: 8pt, adjacent: 0pt), + another-block(cap: "square", radius: 8pt, adjacent: 1pt), + + [round], + another-block(cap: "round", radius: 8pt, adjacent: none), + another-block(cap: "round", radius: 8pt, adjacent: 0pt), + another-block(cap: "round", radius: 8pt, adjacent: 1pt), +) + +--- rect-cap-variations-radius-same-as-stroke-thickness --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let another-block(cap: "butt", radius: 6pt, 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: 6pt), + bottom: (cap: cap, thickness: 6pt), + left: adjacent-stroke, + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [none], [0 width], [thin], + [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), +) + +--- rect-cap-variations-radius-2-3-of-stroke-thickness --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let another-block(cap: "butt", radius: 6pt, 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: 6pt), + bottom: (cap: cap, thickness: 6pt), + left: adjacent-stroke, + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [none], [0 width], [thin], + [butt], + another-block(cap: "butt", radius: 4pt, adjacent: none), + another-block(cap: "butt", radius: 4pt, adjacent: 0pt), + another-block(cap: "butt", radius: 4pt, adjacent: 1pt), + + [square], + another-block(cap: "square", radius: 4pt, adjacent: none), + another-block(cap: "square", radius: 4pt, adjacent: 0pt), + another-block(cap: "square", radius: 4pt, adjacent: 1pt), + + [round], + another-block(cap: "round", radius: 4pt, adjacent: none), + another-block(cap: "round", radius: 4pt, adjacent: 0pt), + another-block(cap: "round", radius: 4pt, adjacent: 1pt), +) + +--- rect-cap-variations-radius-1-3-of-stroke-thickness --- +#set page(width: 12cm) +#let bg-rect(inner) = { + rect(inset: 0pt, outset: 0pt, fill: luma(200), inner) +} +#let another-block(cap: "butt", radius: 6pt, 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: 6pt), + bottom: (cap: cap, thickness: 6pt), + left: adjacent-stroke, + ), + radius: radius, + ) + ) +} +#table( + columns: 4 * (1fr,), + [], [none], [0 width], [thin], + [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), +)