From a4e357fb37d76d32d06ad8cc21e47bb2cc064cfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20d=27Herbais=20de=20Thun?= Date: Tue, 3 Oct 2023 19:31:02 +0200 Subject: Gradient Part 2 - Linear gradients (#2279) --- tests/typ/visualize/gradient-relative.typ | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/typ/visualize/gradient-relative.typ (limited to 'tests/typ/visualize/gradient-relative.typ') diff --git a/tests/typ/visualize/gradient-relative.typ b/tests/typ/visualize/gradient-relative.typ new file mode 100644 index 00000000..549a05b4 --- /dev/null +++ b/tests/typ/visualize/gradient-relative.typ @@ -0,0 +1,30 @@ +// Test whether `relative: "parent"` works correctly. + + +--- +// 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)) -- cgit v1.2.3