summaryrefslogtreecommitdiff
path: root/tests/typ/visualize/gradient-relative-linear.typ
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-10-06 16:47:20 +0200
committerGitHub <noreply@github.com>2023-10-06 16:47:20 +0200
commite7443abfe681a27ee47993d192f8a82953d43b73 (patch)
tree03446e4bfe9ab9aae96f151c7c228d3e26bdc89d /tests/typ/visualize/gradient-relative-linear.typ
parentbced71b250225e30efa2fd0341bf825bf685a376 (diff)
Gradient Part 3 - Radial gradients (#2312)
Diffstat (limited to 'tests/typ/visualize/gradient-relative-linear.typ')
-rw-r--r--tests/typ/visualize/gradient-relative-linear.typ29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/typ/visualize/gradient-relative-linear.typ b/tests/typ/visualize/gradient-relative-linear.typ
new file mode 100644
index 00000000..8e1d04dc
--- /dev/null
+++ b/tests/typ/visualize/gradient-relative-linear.typ
@@ -0,0 +1,29 @@
+// Test whether `relative: "parent"` works correctly on linear gradients.
+
+---
+// The image should look as if there is a single gradient that is being used for
+// both the page and the rectangles.
+#let grad = gradient.linear(red, blue, green, purple, relative: "parent");
+#let my-rect = rect(width: 50%, height: 50%, fill: grad)
+#set page(
+ height: 200pt,
+ width: 200pt,
+ fill: grad,
+ background: place(top + left, my-rect),
+)
+#place(top + right, my-rect)
+#place(bottom + center, rotate(45deg, my-rect))
+
+---
+// The image should look as if there are multiple gradients, one for each
+// rectangle.
+#let grad = gradient.linear(red, blue, green, purple, relative: "self");
+#let my-rect = rect(width: 50%, height: 50%, fill: grad)
+#set page(
+ height: 200pt,
+ width: 200pt,
+ fill: grad,
+ background: place(top + left, my-rect),
+)
+#place(top + right, my-rect)
+#place(bottom + center, rotate(45deg, my-rect))