summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-12-17 10:25:27 +0100
committerGitHub <noreply@github.com>2024-12-17 09:25:27 +0000
commit134638525516995d5947c5b3f98ffbc13784a143 (patch)
tree549d3ed3b5a4eac66b585314e772fda092058021 /tests
parented67220e4b5ae6b3a1bc50f59bd52b5b1dea3a6b (diff)
Rename `pattern` to `tiling` (#5590)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/grid-stroke-tiling.png (renamed from tests/ref/grid-stroke-pattern.png)bin1815 -> 1815 bytes
-rw-r--r--tests/ref/tiling-line.png (renamed from tests/ref/pattern-line.png)bin125 -> 125 bytes
-rw-r--r--tests/ref/tiling-lines.png (renamed from tests/ref/pattern-lines.png)bin128 -> 128 bytes
-rw-r--r--tests/ref/tiling-pattern-compatibility.pngbin0 -> 125 bytes
-rw-r--r--tests/ref/tiling-relative-parent.png (renamed from tests/ref/pattern-relative-parent.png)bin347 -> 347 bytes
-rw-r--r--tests/ref/tiling-relative-self.png (renamed from tests/ref/pattern-relative-self.png)bin474 -> 474 bytes
-rw-r--r--tests/ref/tiling-small.png (renamed from tests/ref/pattern-small.png)bin83 -> 83 bytes
-rw-r--r--tests/ref/tiling-spacing-negative.png (renamed from tests/ref/pattern-spacing-negative.png)bin202 -> 202 bytes
-rw-r--r--tests/ref/tiling-spacing-positive.png (renamed from tests/ref/pattern-spacing-positive.png)bin241 -> 241 bytes
-rw-r--r--tests/ref/tiling-spacing-zero.png (renamed from tests/ref/pattern-spacing-zero.png)bin215 -> 215 bytes
-rw-r--r--tests/ref/tiling-stroke-relative-parent.png (renamed from tests/ref/pattern-stroke-relative-parent.png)bin757 -> 757 bytes
-rw-r--r--tests/ref/tiling-stroke.png (renamed from tests/ref/pattern-stroke.png)bin383 -> 383 bytes
-rw-r--r--tests/ref/tiling-text.png (renamed from tests/ref/pattern-text.png)bin5302 -> 5302 bytes
-rw-r--r--tests/suite/layout/grid/stroke.typ4
-rw-r--r--tests/suite/layout/table.typ2
-rw-r--r--tests/suite/text/font.typ6
-rw-r--r--tests/suite/visualize/gradient.typ2
-rw-r--r--tests/suite/visualize/pattern.typ159
-rw-r--r--tests/suite/visualize/rect.typ2
-rw-r--r--tests/suite/visualize/tiling.typ163
20 files changed, 171 insertions, 167 deletions
diff --git a/tests/ref/grid-stroke-pattern.png b/tests/ref/grid-stroke-tiling.png
index 024f9b20..024f9b20 100644
--- a/tests/ref/grid-stroke-pattern.png
+++ b/tests/ref/grid-stroke-tiling.png
Binary files differ
diff --git a/tests/ref/pattern-line.png b/tests/ref/tiling-line.png
index b891b6d7..b891b6d7 100644
--- a/tests/ref/pattern-line.png
+++ b/tests/ref/tiling-line.png
Binary files differ
diff --git a/tests/ref/pattern-lines.png b/tests/ref/tiling-lines.png
index 008d357e..008d357e 100644
--- a/tests/ref/pattern-lines.png
+++ b/tests/ref/tiling-lines.png
Binary files differ
diff --git a/tests/ref/tiling-pattern-compatibility.png b/tests/ref/tiling-pattern-compatibility.png
new file mode 100644
index 00000000..b891b6d7
--- /dev/null
+++ b/tests/ref/tiling-pattern-compatibility.png
Binary files differ
diff --git a/tests/ref/pattern-relative-parent.png b/tests/ref/tiling-relative-parent.png
index 786057ef..786057ef 100644
--- a/tests/ref/pattern-relative-parent.png
+++ b/tests/ref/tiling-relative-parent.png
Binary files differ
diff --git a/tests/ref/pattern-relative-self.png b/tests/ref/tiling-relative-self.png
index 617e7dd6..617e7dd6 100644
--- a/tests/ref/pattern-relative-self.png
+++ b/tests/ref/tiling-relative-self.png
Binary files differ
diff --git a/tests/ref/pattern-small.png b/tests/ref/tiling-small.png
index 0406252d..0406252d 100644
--- a/tests/ref/pattern-small.png
+++ b/tests/ref/tiling-small.png
Binary files differ
diff --git a/tests/ref/pattern-spacing-negative.png b/tests/ref/tiling-spacing-negative.png
index 659c2283..659c2283 100644
--- a/tests/ref/pattern-spacing-negative.png
+++ b/tests/ref/tiling-spacing-negative.png
Binary files differ
diff --git a/tests/ref/pattern-spacing-positive.png b/tests/ref/tiling-spacing-positive.png
index 3e475eee..3e475eee 100644
--- a/tests/ref/pattern-spacing-positive.png
+++ b/tests/ref/tiling-spacing-positive.png
Binary files differ
diff --git a/tests/ref/pattern-spacing-zero.png b/tests/ref/tiling-spacing-zero.png
index 5118471a..5118471a 100644
--- a/tests/ref/pattern-spacing-zero.png
+++ b/tests/ref/tiling-spacing-zero.png
Binary files differ
diff --git a/tests/ref/pattern-stroke-relative-parent.png b/tests/ref/tiling-stroke-relative-parent.png
index fe9b1174..fe9b1174 100644
--- a/tests/ref/pattern-stroke-relative-parent.png
+++ b/tests/ref/tiling-stroke-relative-parent.png
Binary files differ
diff --git a/tests/ref/pattern-stroke.png b/tests/ref/tiling-stroke.png
index a9f30aa8..a9f30aa8 100644
--- a/tests/ref/pattern-stroke.png
+++ b/tests/ref/tiling-stroke.png
Binary files differ
diff --git a/tests/ref/pattern-text.png b/tests/ref/tiling-text.png
index 2a8da45f..2a8da45f 100644
--- a/tests/ref/pattern-text.png
+++ b/tests/ref/tiling-text.png
Binary files differ
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)