diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-12-17 10:25:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-17 09:25:27 +0000 |
| commit | 134638525516995d5947c5b3f98ffbc13784a143 (patch) | |
| tree | 549d3ed3b5a4eac66b585314e772fda092058021 /tests/suite | |
| parent | ed67220e4b5ae6b3a1bc50f59bd52b5b1dea3a6b (diff) | |
Rename `pattern` to `tiling` (#5590)
Diffstat (limited to 'tests/suite')
| -rw-r--r-- | tests/suite/layout/grid/stroke.typ | 4 | ||||
| -rw-r--r-- | tests/suite/layout/table.typ | 2 | ||||
| -rw-r--r-- | tests/suite/text/font.typ | 6 | ||||
| -rw-r--r-- | tests/suite/visualize/gradient.typ | 2 | ||||
| -rw-r--r-- | tests/suite/visualize/pattern.typ | 159 | ||||
| -rw-r--r-- | tests/suite/visualize/rect.typ | 2 | ||||
| -rw-r--r-- | tests/suite/visualize/tiling.typ | 163 |
7 files changed, 171 insertions, 167 deletions
diff --git a/tests/suite/layout/grid/stroke.typ b/tests/suite/layout/grid/stroke.typ index 3a26b69a..4e81d549 100644 --- a/tests/suite/layout/grid/stroke.typ +++ b/tests/suite/layout/grid/stroke.typ @@ -1,5 +1,5 @@ ---- grid-stroke-pattern --- -#let double-line = pattern(size: (1.5pt, 1.5pt), { +--- grid-stroke-tiling --- +#let double-line = tiling(size: (1.5pt, 1.5pt), { place(line(stroke: .6pt, start: (0%, 50%), end: (100%, 50%))) }) diff --git a/tests/suite/layout/table.typ b/tests/suite/layout/table.typ index fe138f60..f59d8b42 100644 --- a/tests/suite/layout/table.typ +++ b/tests/suite/layout/table.typ @@ -17,7 +17,7 @@ #table(columns: 3, stroke: none, fill: green, [A], [B], [C]) --- table-fill-bad --- -// Error: 14-19 expected color, gradient, pattern, none, array, or function, found string +// Error: 14-19 expected color, gradient, tiling, none, array, or function, found string #table(fill: "hey") --- table-align-array --- diff --git a/tests/suite/text/font.typ b/tests/suite/text/font.typ index 5c972ff3..bb75f4ae 100644 --- a/tests/suite/text/font.typ +++ b/tests/suite/text/font.typ @@ -84,7 +84,7 @@ I --- issue-5499-text-fill-in-clip-block --- -#let pat = pattern( +#let t = tiling( size: (30pt, 30pt), relative: "parent", square( @@ -101,7 +101,7 @@ I [ ] text(fill: gradient.linear(..color.map.rainbow), "Hello") [ ] - text(fill: pat, "Hello") + text(fill: t, "Hello") }) #block(clip: true, height: 2em, { text(fill: blue, "Hello") @@ -110,5 +110,5 @@ I [ ] text(fill: gradient.linear(..color.map.rainbow), "Hello") [ ] - text(fill: pat, "Hello") + text(fill: t, "Hello") }) diff --git a/tests/suite/visualize/gradient.typ b/tests/suite/visualize/gradient.typ index d66241f7..b221f411 100644 --- a/tests/suite/visualize/gradient.typ +++ b/tests/suite/visualize/gradient.typ @@ -390,7 +390,7 @@ --- gradient-text-bad-relative --- // Make sure they don't work when `relative: "self"`. // Hint: 17-61 make sure to set `relative: auto` on your text fill -// Error: 17-61 gradients and patterns on text must be relative to the parent +// Error: 17-61 gradients and tilings on text must be relative to the parent #set text(fill: gradient.linear(red, blue, relative: "self")) --- gradient-text-global --- diff --git a/tests/suite/visualize/pattern.typ b/tests/suite/visualize/pattern.typ deleted file mode 100644 index b87b7755..00000000 --- a/tests/suite/visualize/pattern.typ +++ /dev/null @@ -1,159 +0,0 @@ -// Test patterns. - ---- pattern-line --- -// Tests that simple patterns work. -#set page(width: auto, height: auto, margin: 0pt) -#let pat = pattern(size: (10pt, 10pt), line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%))) -#rect(width: 50pt, height: 50pt, fill: pat) - ---- pattern-lines --- -#set page(width: auto, height: auto, margin: 0pt) - -#let pat = pattern(size: (10pt, 10pt), { - place(line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%))) - place(line(stroke: 4pt, start: (100%,0%), end: (200%, 100%))) - place(line(stroke: 4pt, start: (0%,100%), end: (100%, 200%))) - place(line(stroke: 4pt, start: (-100%,0%), end: (0%, 100%))) - place(line(stroke: 4pt, start: (0%,-100%), end: (100%, 0%))) -}) -#rect(width: 50pt, height: 50pt, fill: pat) - ---- pattern-relative-self --- -// Test with relative set to `"self"` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #set line(stroke: green) - #place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt)) - #place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt)) -] - -#set page(fill: pat(), width: 100pt, height: 100pt) -#rect( - width: 100%, - height: 100%, - fill: pat(relative: "self"), - stroke: 1pt + green, -) - ---- pattern-relative-parent --- -// Test with relative set to `"parent"` -#let pat(fill, ..args) = pattern(size: (30pt, 30pt), ..args)[ - #rect(width: 100%, height: 100%, fill: fill, stroke: none) - #place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt)) - #place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt)) -] - -#set page(fill: pat(white), width: 100pt, height: 100pt) - -#rect(fill: pat(none, relative: "parent"), width: 100%, height: 100%, stroke: 1pt) - ---- pattern-small --- -// Tests small patterns for pixel accuracy. -#box( - width: 8pt, - height: 1pt, - fill: pattern(size: (1pt, 1pt), square(size: 1pt, fill: black)) -) -#v(-1em) -#box( - width: 8pt, - height: 1pt, - fill: pattern(size: (2pt, 1pt), square(size: 1pt, fill: black)) -) - ---- pattern-zero-sized --- -// Error: 15-52 pattern tile size must be non-zero -// Hint: 15-52 try setting the size manually -#line(stroke: pattern(path((0pt, 0pt), (1em, 0pt)))) - ---- pattern-spacing-negative --- -// Test with spacing set to `(-10pt, -10pt)` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) -] - -#set page(width: 100pt, height: 100pt) - -#rect(fill: pat(spacing: (-10pt, -10pt)), width: 100%, height: 100%, stroke: 1pt) - ---- pattern-spacing-zero --- -// Test with spacing set to `(0pt, 0pt)` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) -] - -#set page(width: 100pt, height: 100pt) - -#rect(fill: pat(spacing: (0pt, 0pt)), width: 100%, height: 100%, stroke: 1pt) - ---- pattern-spacing-positive --- -// Test with spacing set to `(10pt, 10pt)` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) -] - -#set page(width: 100pt, height: 100pt) - -#rect(fill: pat(spacing: (10pt, 10pt,)), width: 100%, height: 100%, stroke: 1pt) - ---- pattern-stroke --- -// Test pattern on strokes -#align( - center + top, - square( - size: 50pt, - fill: pattern( - size: (5pt, 5pt), - align(horizon + center, circle(fill: blue, radius: 2.5pt)) - ), - stroke: 7.5pt + pattern( - size: (5pt, 5pt), - align(horizon + center, circle(fill: red, radius: 2.5pt)) - ) - ) -) - ---- pattern-stroke-relative-parent --- -// Test pattern on strokes with relative set to `"parent"` -// The pattern on the circle should align with the pattern on the square. -#align( - center + top, - block( - width: 50pt, - height: 50pt, - fill: pattern(size: (5pt, 5pt), circle(radius: 2.5pt, fill: blue)), - align(center + horizon, circle( - radius: 15pt, - stroke: 7.5pt + pattern( - size: (5pt, 5pt), circle(radius: 2.5pt, fill: red), relative: "parent" - ), - )) - ) -) - ---- pattern-text --- -// Test a pattern on some text -// You shouldn't be able to see the text, if you can then -// that means that the transform matrices are not being -// applied to the text correctly. -#let pat = pattern( - size: (30pt, 30pt), - relative: "parent", - square(size: 30pt, fill: gradient.conic(..color.map.rainbow)) -); - -#set page( - width: 140pt, - height: 140pt, - fill: pat -) - -#rotate(45deg, scale(x: 50%, y: 70%, rect( - width: 100%, - height: 100%, - stroke: 1pt, -)[ - #lorem(10) - - #set text(fill: pat) - #lorem(10) -])) diff --git a/tests/suite/visualize/rect.typ b/tests/suite/visualize/rect.typ index 5dfe29f3..a659287e 100644 --- a/tests/suite/visualize/rect.typ +++ b/tests/suite/visualize/rect.typ @@ -55,7 +55,7 @@ #rect(width: 20pt, height: 20pt, stroke: (thickness: 5pt, join: "round")) --- red-stroke-bad-type --- -// Error: 15-21 expected length, color, gradient, pattern, dictionary, stroke, none, or auto, found array +// Error: 15-21 expected length, color, gradient, tiling, dictionary, stroke, none, or auto, found array #rect(stroke: (1, 2)) --- rect-fill-stroke --- diff --git a/tests/suite/visualize/tiling.typ b/tests/suite/visualize/tiling.typ new file mode 100644 index 00000000..5272328d --- /dev/null +++ b/tests/suite/visualize/tiling.typ @@ -0,0 +1,163 @@ +// Test tilings. + +--- tiling-line --- +// Tests that simple tilings work. +#set page(width: auto, height: auto, margin: 0pt) +#let t = tiling(size: (10pt, 10pt), line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%))) +#rect(width: 50pt, height: 50pt, fill: t) + +--- tiling-lines --- +#set page(width: auto, height: auto, margin: 0pt) + +#let t = tiling(size: (10pt, 10pt), { + place(line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%))) + place(line(stroke: 4pt, start: (100%,0%), end: (200%, 100%))) + place(line(stroke: 4pt, start: (0%,100%), end: (100%, 200%))) + place(line(stroke: 4pt, start: (-100%,0%), end: (0%, 100%))) + place(line(stroke: 4pt, start: (0%,-100%), end: (100%, 0%))) +}) +#rect(width: 50pt, height: 50pt, fill: t) + +--- tiling-relative-self --- +// Test with relative set to `"self"` +#let t(..args) = tiling(size: (30pt, 30pt), ..args)[ + #set line(stroke: green) + #place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt)) + #place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt)) +] + +#set page(fill: t(), width: 100pt, height: 100pt) +#rect( + width: 100%, + height: 100%, + fill: t(relative: "self"), + stroke: 1pt + green, +) + +--- tiling-relative-parent --- +// Test with relative set to `"parent"` +#let t(fill, ..args) = tiling(size: (30pt, 30pt), ..args)[ + #rect(width: 100%, height: 100%, fill: fill, stroke: none) + #place(top + left, line(start: (0%, 0%), end: (100%, 100%), stroke: 1pt)) + #place(top + left, line(start: (0%, 100%), end: (100%, 0%), stroke: 1pt)) +] + +#set page(fill: t(white), width: 100pt, height: 100pt) + +#rect(fill: t(none, relative: "parent"), width: 100%, height: 100%, stroke: 1pt) + +--- tiling-small --- +// Tests small tilings for pixel accuracy. +#box( + width: 8pt, + height: 1pt, + fill: tiling(size: (1pt, 1pt), square(size: 1pt, fill: black)) +) +#v(-1em) +#box( + width: 8pt, + height: 1pt, + fill: tiling(size: (2pt, 1pt), square(size: 1pt, fill: black)) +) + +--- tiling-zero-sized --- +// Error: 15-51 tile size must be non-zero +// Hint: 15-51 try setting the size manually +#line(stroke: tiling(path((0pt, 0pt), (1em, 0pt)))) + +--- tiling-spacing-negative --- +// Test with spacing set to `(-10pt, -10pt)` +#let t(..args) = tiling(size: (30pt, 30pt), ..args)[ + #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) +] + +#set page(width: 100pt, height: 100pt) + +#rect(fill: t(spacing: (-10pt, -10pt)), width: 100%, height: 100%, stroke: 1pt) + +--- tiling-spacing-zero --- +// Test with spacing set to `(0pt, 0pt)` +#let t(..args) = tiling(size: (30pt, 30pt), ..args)[ + #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) +] + +#set page(width: 100pt, height: 100pt) + +#rect(fill: t(spacing: (0pt, 0pt)), width: 100%, height: 100%, stroke: 1pt) + +--- tiling-spacing-positive --- +// Test with spacing set to `(10pt, 10pt)` +#let t(..args) = tiling(size: (30pt, 30pt), ..args)[ + #square(width: 100%, height: 100%, stroke: 1pt, fill: blue) +] + +#set page(width: 100pt, height: 100pt) + +#rect(fill: t(spacing: (10pt, 10pt,)), width: 100%, height: 100%, stroke: 1pt) + +--- tiling-stroke --- +// Test tiling on strokes +#align( + center + top, + square( + size: 50pt, + fill: tiling( + size: (5pt, 5pt), + align(horizon + center, circle(fill: blue, radius: 2.5pt)) + ), + stroke: 7.5pt + tiling( + size: (5pt, 5pt), + align(horizon + center, circle(fill: red, radius: 2.5pt)) + ) + ) +) + +--- tiling-stroke-relative-parent --- +// Test tiling on strokes with relative set to `"parent"` +// The tiling on the circle should align with the tiling on the square. +#align( + center + top, + block( + width: 50pt, + height: 50pt, + fill: tiling(size: (5pt, 5pt), circle(radius: 2.5pt, fill: blue)), + align(center + horizon, circle( + radius: 15pt, + stroke: 7.5pt + tiling( + size: (5pt, 5pt), circle(radius: 2.5pt, fill: red), relative: "parent" + ), + )) + ) +) + +--- tiling-text --- +// Test a tiling on some text. You shouldn't be able to see the text, if you can +// then that means that the transform matrices are not being applied to the text +// correctly. +#let t = tiling( + size: (30pt, 30pt), + relative: "parent", + square(size: 30pt, fill: gradient.conic(..color.map.rainbow)) +); + +#set page( + width: 140pt, + height: 140pt, + fill: t +) + +#rotate(45deg, scale(x: 50%, y: 70%, rect( + width: 100%, + height: 100%, + stroke: 1pt, +)[ + #lorem(10) + + #set text(fill: t) + #lorem(10) +])) + +--- tiling-pattern-compatibility --- +#set page(width: auto, height: auto, margin: 0pt) +#let t = pattern(size: (10pt, 10pt), line(stroke: 4pt, start: (0%, 0%), end: (100%, 100%))) +#rect(width: 50pt, height: 50pt, fill: t) |
