test: add test cases

Some of the stroked rectangles are still undesirable, but they are still added
as a reference.
This commit is contained in:
Tobias Schmitz 2025-07-09 16:32:41 +02:00
parent 25ef7119e6
commit 31cd2a96d2
No known key found for this signature in database
9 changed files with 352 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -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),
)