From 134638525516995d5947c5b3f98ffbc13784a143 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 17 Dec 2024 10:25:27 +0100 Subject: Rename `pattern` to `tiling` (#5590) --- tests/ref/grid-stroke-pattern.png | Bin 1815 -> 0 bytes tests/ref/grid-stroke-tiling.png | Bin 0 -> 1815 bytes tests/ref/pattern-line.png | Bin 125 -> 0 bytes tests/ref/pattern-lines.png | Bin 128 -> 0 bytes tests/ref/pattern-relative-parent.png | Bin 347 -> 0 bytes tests/ref/pattern-relative-self.png | Bin 474 -> 0 bytes tests/ref/pattern-small.png | Bin 83 -> 0 bytes tests/ref/pattern-spacing-negative.png | Bin 202 -> 0 bytes tests/ref/pattern-spacing-positive.png | Bin 241 -> 0 bytes tests/ref/pattern-spacing-zero.png | Bin 215 -> 0 bytes tests/ref/pattern-stroke-relative-parent.png | Bin 757 -> 0 bytes tests/ref/pattern-stroke.png | Bin 383 -> 0 bytes tests/ref/pattern-text.png | Bin 5302 -> 0 bytes tests/ref/tiling-line.png | Bin 0 -> 125 bytes tests/ref/tiling-lines.png | Bin 0 -> 128 bytes tests/ref/tiling-pattern-compatibility.png | Bin 0 -> 125 bytes tests/ref/tiling-relative-parent.png | Bin 0 -> 347 bytes tests/ref/tiling-relative-self.png | Bin 0 -> 474 bytes tests/ref/tiling-small.png | Bin 0 -> 83 bytes tests/ref/tiling-spacing-negative.png | Bin 0 -> 202 bytes tests/ref/tiling-spacing-positive.png | Bin 0 -> 241 bytes tests/ref/tiling-spacing-zero.png | Bin 0 -> 215 bytes tests/ref/tiling-stroke-relative-parent.png | Bin 0 -> 757 bytes tests/ref/tiling-stroke.png | Bin 0 -> 383 bytes tests/ref/tiling-text.png | Bin 0 -> 5302 bytes tests/suite/layout/grid/stroke.typ | 4 +- tests/suite/layout/table.typ | 2 +- tests/suite/text/font.typ | 6 +- tests/suite/visualize/gradient.typ | 2 +- tests/suite/visualize/pattern.typ | 159 -------------------------- tests/suite/visualize/rect.typ | 2 +- tests/suite/visualize/tiling.typ | 163 +++++++++++++++++++++++++++ 32 files changed, 171 insertions(+), 167 deletions(-) delete mode 100644 tests/ref/grid-stroke-pattern.png create mode 100644 tests/ref/grid-stroke-tiling.png delete mode 100644 tests/ref/pattern-line.png delete mode 100644 tests/ref/pattern-lines.png delete mode 100644 tests/ref/pattern-relative-parent.png delete mode 100644 tests/ref/pattern-relative-self.png delete mode 100644 tests/ref/pattern-small.png delete mode 100644 tests/ref/pattern-spacing-negative.png delete mode 100644 tests/ref/pattern-spacing-positive.png delete mode 100644 tests/ref/pattern-spacing-zero.png delete mode 100644 tests/ref/pattern-stroke-relative-parent.png delete mode 100644 tests/ref/pattern-stroke.png delete mode 100644 tests/ref/pattern-text.png create mode 100644 tests/ref/tiling-line.png create mode 100644 tests/ref/tiling-lines.png create mode 100644 tests/ref/tiling-pattern-compatibility.png create mode 100644 tests/ref/tiling-relative-parent.png create mode 100644 tests/ref/tiling-relative-self.png create mode 100644 tests/ref/tiling-small.png create mode 100644 tests/ref/tiling-spacing-negative.png create mode 100644 tests/ref/tiling-spacing-positive.png create mode 100644 tests/ref/tiling-spacing-zero.png create mode 100644 tests/ref/tiling-stroke-relative-parent.png create mode 100644 tests/ref/tiling-stroke.png create mode 100644 tests/ref/tiling-text.png delete mode 100644 tests/suite/visualize/pattern.typ create mode 100644 tests/suite/visualize/tiling.typ (limited to 'tests') diff --git a/tests/ref/grid-stroke-pattern.png b/tests/ref/grid-stroke-pattern.png deleted file mode 100644 index 024f9b20..00000000 Binary files a/tests/ref/grid-stroke-pattern.png and /dev/null differ diff --git a/tests/ref/grid-stroke-tiling.png b/tests/ref/grid-stroke-tiling.png new file mode 100644 index 00000000..024f9b20 Binary files /dev/null and b/tests/ref/grid-stroke-tiling.png differ diff --git a/tests/ref/pattern-line.png b/tests/ref/pattern-line.png deleted file mode 100644 index b891b6d7..00000000 Binary files a/tests/ref/pattern-line.png and /dev/null differ diff --git a/tests/ref/pattern-lines.png b/tests/ref/pattern-lines.png deleted file mode 100644 index 008d357e..00000000 Binary files a/tests/ref/pattern-lines.png and /dev/null differ diff --git a/tests/ref/pattern-relative-parent.png b/tests/ref/pattern-relative-parent.png deleted file mode 100644 index 786057ef..00000000 Binary files a/tests/ref/pattern-relative-parent.png and /dev/null differ diff --git a/tests/ref/pattern-relative-self.png b/tests/ref/pattern-relative-self.png deleted file mode 100644 index 617e7dd6..00000000 Binary files a/tests/ref/pattern-relative-self.png and /dev/null differ diff --git a/tests/ref/pattern-small.png b/tests/ref/pattern-small.png deleted file mode 100644 index 0406252d..00000000 Binary files a/tests/ref/pattern-small.png and /dev/null differ diff --git a/tests/ref/pattern-spacing-negative.png b/tests/ref/pattern-spacing-negative.png deleted file mode 100644 index 659c2283..00000000 Binary files a/tests/ref/pattern-spacing-negative.png and /dev/null differ diff --git a/tests/ref/pattern-spacing-positive.png b/tests/ref/pattern-spacing-positive.png deleted file mode 100644 index 3e475eee..00000000 Binary files a/tests/ref/pattern-spacing-positive.png and /dev/null differ diff --git a/tests/ref/pattern-spacing-zero.png b/tests/ref/pattern-spacing-zero.png deleted file mode 100644 index 5118471a..00000000 Binary files a/tests/ref/pattern-spacing-zero.png and /dev/null differ diff --git a/tests/ref/pattern-stroke-relative-parent.png b/tests/ref/pattern-stroke-relative-parent.png deleted file mode 100644 index fe9b1174..00000000 Binary files a/tests/ref/pattern-stroke-relative-parent.png and /dev/null differ diff --git a/tests/ref/pattern-stroke.png b/tests/ref/pattern-stroke.png deleted file mode 100644 index a9f30aa8..00000000 Binary files a/tests/ref/pattern-stroke.png and /dev/null differ diff --git a/tests/ref/pattern-text.png b/tests/ref/pattern-text.png deleted file mode 100644 index 2a8da45f..00000000 Binary files a/tests/ref/pattern-text.png and /dev/null differ diff --git a/tests/ref/tiling-line.png b/tests/ref/tiling-line.png new file mode 100644 index 00000000..b891b6d7 Binary files /dev/null and b/tests/ref/tiling-line.png differ diff --git a/tests/ref/tiling-lines.png b/tests/ref/tiling-lines.png new file mode 100644 index 00000000..008d357e Binary files /dev/null and b/tests/ref/tiling-lines.png differ diff --git a/tests/ref/tiling-pattern-compatibility.png b/tests/ref/tiling-pattern-compatibility.png new file mode 100644 index 00000000..b891b6d7 Binary files /dev/null and b/tests/ref/tiling-pattern-compatibility.png differ diff --git a/tests/ref/tiling-relative-parent.png b/tests/ref/tiling-relative-parent.png new file mode 100644 index 00000000..786057ef Binary files /dev/null and b/tests/ref/tiling-relative-parent.png differ diff --git a/tests/ref/tiling-relative-self.png b/tests/ref/tiling-relative-self.png new file mode 100644 index 00000000..617e7dd6 Binary files /dev/null and b/tests/ref/tiling-relative-self.png differ diff --git a/tests/ref/tiling-small.png b/tests/ref/tiling-small.png new file mode 100644 index 00000000..0406252d Binary files /dev/null and b/tests/ref/tiling-small.png differ diff --git a/tests/ref/tiling-spacing-negative.png b/tests/ref/tiling-spacing-negative.png new file mode 100644 index 00000000..659c2283 Binary files /dev/null and b/tests/ref/tiling-spacing-negative.png differ diff --git a/tests/ref/tiling-spacing-positive.png b/tests/ref/tiling-spacing-positive.png new file mode 100644 index 00000000..3e475eee Binary files /dev/null and b/tests/ref/tiling-spacing-positive.png differ diff --git a/tests/ref/tiling-spacing-zero.png b/tests/ref/tiling-spacing-zero.png new file mode 100644 index 00000000..5118471a Binary files /dev/null and b/tests/ref/tiling-spacing-zero.png differ diff --git a/tests/ref/tiling-stroke-relative-parent.png b/tests/ref/tiling-stroke-relative-parent.png new file mode 100644 index 00000000..fe9b1174 Binary files /dev/null and b/tests/ref/tiling-stroke-relative-parent.png differ diff --git a/tests/ref/tiling-stroke.png b/tests/ref/tiling-stroke.png new file mode 100644 index 00000000..a9f30aa8 Binary files /dev/null and b/tests/ref/tiling-stroke.png differ diff --git a/tests/ref/tiling-text.png b/tests/ref/tiling-text.png new file mode 100644 index 00000000..2a8da45f Binary files /dev/null and b/tests/ref/tiling-text.png 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) -- cgit v1.2.3