diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /tests/typ/visualize | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'tests/typ/visualize')
36 files changed, 0 insertions, 1449 deletions
diff --git a/tests/typ/visualize/gradient-conic.typ b/tests/typ/visualize/gradient-conic.typ deleted file mode 100644 index 83fdb07c..00000000 --- a/tests/typ/visualize/gradient-conic.typ +++ /dev/null @@ -1,25 +0,0 @@ -// Test conic gradients - ---- -#square( - size: 50pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsv), -) - ---- -#square( - size: 50pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsv, center: (10%, 10%)), -) - ---- -#square( - size: 50pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsv, center: (90%, 90%)), -) - ---- -#square( - size: 50pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsv, angle: 90deg), -) diff --git a/tests/typ/visualize/gradient-dir.typ b/tests/typ/visualize/gradient-dir.typ deleted file mode 100644 index 92e00393..00000000 --- a/tests/typ/visualize/gradient-dir.typ +++ /dev/null @@ -1,13 +0,0 @@ -// Test gradients with direction. - ---- -#set page(width: 900pt) -#for i in range(0, 360, step: 15){ - box( - height: 100pt, - width: 100pt, - fill: gradient.linear(angle: i * 1deg, (red, 0%), (blue, 100%)), - align(center + horizon)[Angle: #i degrees], - ) - h(30pt) -} diff --git a/tests/typ/visualize/gradient-hue-rotation.typ b/tests/typ/visualize/gradient-hue-rotation.typ deleted file mode 100644 index 2cc6f9a6..00000000 --- a/tests/typ/visualize/gradient-hue-rotation.typ +++ /dev/null @@ -1,66 +0,0 @@ -// Tests whether hue rotation works correctly. - ---- -// Test in Oklab space for reference. -#set page( - width: 100pt, - height: 30pt, - fill: gradient.linear(red, purple, space: oklab) -) - ---- -// Test in OkLCH space. -#set page( - width: 100pt, - height: 30pt, - fill: gradient.linear(red, purple, space: oklch) -) - ---- -// Test in HSV space. -#set page( - width: 100pt, - height: 30pt, - fill: gradient.linear(red, purple, space: color.hsv) -) - ---- -// Test in HSL space. -#set page( - width: 100pt, - height: 30pt, - fill: gradient.linear(red, purple, space: color.hsl) -) - - ---- -// Test in Oklab space for reference. -#set page( - width: 100pt, - height: 100pt, - fill: gradient.conic(red, purple, space: oklab) -) - ---- -// Test in OkLCH space. -#set page( - width: 100pt, - height: 100pt, - fill: gradient.conic(red, purple, space: oklch) -) - ---- -// Test in HSV space. -#set page( - width: 100pt, - height: 100pt, - fill: gradient.conic(red, purple, space: color.hsv) -) - ---- -// Test in HSL space. -#set page( - width: 100pt, - height: 100pt, - fill: gradient.conic(red, purple, space: color.hsl) -) diff --git a/tests/typ/visualize/gradient-math.typ b/tests/typ/visualize/gradient-math.typ deleted file mode 100644 index f16e5c58..00000000 --- a/tests/typ/visualize/gradient-math.typ +++ /dev/null @@ -1,89 +0,0 @@ -// Test that gradients are applied correctly on equations. - ---- -// Test on cancel -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ a dot cancel(5) = cancel(25) 5 x + cancel(5) 1 $ - ---- -// Test on frac -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ nabla dot bold(E) = frac(rho, epsilon_0) $ - ---- -// Test on root -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $ - ---- -// Test on matrix -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ A = mat( - 1, 2, 3; - 4, 5, 6; - 7, 8, 9 -) $ - ---- -// Test on underover -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ underline(X^2) $ -$ overline("hello, world!") $ - ---- -// Test a different direction -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow, dir: ttb)) -#show math.equation: box - -$ A = mat( - 1, 2, 3; - 4, 5, 6; - 7, 8, 9 -) $ - -$ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $ - ---- -// Test miscellaneous -#show math.equation: set text(fill: gradient.linear(..color.map.rainbow)) -#show math.equation: box - -$ hat(x) = bar x bar = vec(x, y, z) = tilde(x) = dot(x) $ -$ x prime = vec(1, 2, delim: "[") $ -$ sum_(i in NN) 1 + i $ -$ attach( - Pi, t: alpha, b: beta, - tl: 1, tr: 2+3, bl: 4+5, br: 6, -) $ - ---- -// Test radial gradient -#show math.equation: set text(fill: gradient.radial(..color.map.rainbow, center: (30%, 30%))) -#show math.equation: box - -$ A = mat( - 1, 2, 3; - 4, 5, 6; - 7, 8, 9 -) $ - ---- -// Test conic gradient -#show math.equation: set text(fill: gradient.conic(red, blue, angle: 45deg)) -#show math.equation: box - -$ A = mat( - 1, 2, 3; - 4, 5, 6; - 7, 8, 9 -) $ diff --git a/tests/typ/visualize/gradient-presets.typ b/tests/typ/visualize/gradient-presets.typ deleted file mode 100644 index ca1a7007..00000000 --- a/tests/typ/visualize/gradient-presets.typ +++ /dev/null @@ -1,33 +0,0 @@ -// Test all gradient presets. - ---- -#set page(width: 200pt, height: auto, margin: 0pt) -#set text(fill: white, size: 18pt) -#set text(top-edge: "bounds", bottom-edge: "bounds") - -#let presets = ( - ("turbo", color.map.turbo), - ("cividis", color.map.cividis), - ("rainbow", color.map.rainbow), - ("spectral", color.map.spectral), - ("viridis", color.map.viridis), - ("inferno", color.map.inferno), - ("magma", color.map.magma), - ("plasma", color.map.plasma), - ("rocket", color.map.rocket), - ("mako", color.map.mako), - ("vlag", color.map.vlag), - ("icefire", color.map.icefire), - ("flare", color.map.flare), - ("crest", color.map.crest), -) - -#stack( - spacing: 3pt, - ..presets.map(((name, preset)) => block( - width: 100%, - height: 20pt, - fill: gradient.linear(..preset), - align(center + horizon, smallcaps(name)), - )) -) diff --git a/tests/typ/visualize/gradient-radial.typ b/tests/typ/visualize/gradient-radial.typ deleted file mode 100644 index c0d1b249..00000000 --- a/tests/typ/visualize/gradient-radial.typ +++ /dev/null @@ -1,49 +0,0 @@ -// Test the different radial gradient features. ---- - -#square( - size: 100pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl), -) ---- - -#grid( - columns: 2, - square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (0%, 0%)), - ), - square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (0%, 100%)), - ), - square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (100%, 0%)), - ), - square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, center: (100%, 100%)), - ), -) - ---- - -#square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, radius: 10%), -) -#square( - size: 50pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl, radius: 72%), -) - ---- -#circle( - radius: 25pt, - fill: gradient.radial(white, rgb("#8fbc8f"), focal-center: (35%, 35%), focal-radius: 5%), -) -#circle( - radius: 25pt, - fill: gradient.radial(white, rgb("#8fbc8f"), focal-center: (75%, 35%), focal-radius: 5%), -) diff --git a/tests/typ/visualize/gradient-relative-conic.typ b/tests/typ/visualize/gradient-relative-conic.typ deleted file mode 100644 index 26b509af..00000000 --- a/tests/typ/visualize/gradient-relative-conic.typ +++ /dev/null @@ -1,29 +0,0 @@ -// Test whether `relative: "parent"` works correctly on conic 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.conic(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.conic(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)) diff --git a/tests/typ/visualize/gradient-relative-linear.typ b/tests/typ/visualize/gradient-relative-linear.typ deleted file mode 100644 index 8e1d04dc..00000000 --- a/tests/typ/visualize/gradient-relative-linear.typ +++ /dev/null @@ -1,29 +0,0 @@ -// 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)) diff --git a/tests/typ/visualize/gradient-relative-radial.typ b/tests/typ/visualize/gradient-relative-radial.typ deleted file mode 100644 index 87686896..00000000 --- a/tests/typ/visualize/gradient-relative-radial.typ +++ /dev/null @@ -1,29 +0,0 @@ -// Test whether `relative: "parent"` works correctly on radial 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.radial(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.radial(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)) diff --git a/tests/typ/visualize/gradient-repeat.typ b/tests/typ/visualize/gradient-repeat.typ deleted file mode 100644 index fd4ea279..00000000 --- a/tests/typ/visualize/gradient-repeat.typ +++ /dev/null @@ -1,36 +0,0 @@ -// Test repeated gradients. - ---- -#rect( - height: 40pt, - width: 100%, - fill: gradient.linear(..color.map.inferno).repeat(2, mirror: true) -) - ---- -#rect( - height: 40pt, - width: 100%, - fill: gradient.linear(..color.map.rainbow).repeat(2, mirror: true), -) - ---- -#rect( - height: 40pt, - width: 100%, - fill: gradient.linear(..color.map.rainbow).repeat(5, mirror: true) -) - ---- -#rect( - height: 40pt, - width: 100%, - fill: gradient.linear(..color.map.rainbow).sharp(10).repeat(5, mirror: false) -) - ---- -#rect( - height: 40pt, - width: 100%, - fill: gradient.linear(..color.map.rainbow).sharp(10).repeat(5, mirror: true) -) diff --git a/tests/typ/visualize/gradient-sharp.typ b/tests/typ/visualize/gradient-sharp.typ deleted file mode 100644 index 89841efd..00000000 --- a/tests/typ/visualize/gradient-sharp.typ +++ /dev/null @@ -1,29 +0,0 @@ -// Test sharp gradients. - ---- -#square( - size: 100pt, - fill: gradient.linear(..color.map.rainbow, space: color.hsl).sharp(10), -) -#square( - size: 100pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl).sharp(10), -) -#square( - size: 100pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsl).sharp(10), -) - ---- -#square( - size: 100pt, - fill: gradient.linear(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), -) -#square( - size: 100pt, - fill: gradient.radial(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), -) -#square( - size: 100pt, - fill: gradient.conic(..color.map.rainbow, space: color.hsl).sharp(10, smoothness: 40%), -) diff --git a/tests/typ/visualize/gradient-stroke.typ b/tests/typ/visualize/gradient-stroke.typ deleted file mode 100644 index d4461497..00000000 --- a/tests/typ/visualize/gradient-stroke.typ +++ /dev/null @@ -1,31 +0,0 @@ -// Test gradients on strokes. - ---- -#align(center + top, square(size: 50pt, fill: black, stroke: 5pt + gradient.linear(red, blue))) - ---- -#align( - center + bottom, - square( - size: 50pt, - fill: gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)), - stroke: 10pt + gradient.radial(red, blue, radius: 70.7%, focal-center: (10%, 10%)) - ) -) - ---- -#align( - center + bottom, - square( - size: 50pt, - fill: black, - stroke: 10pt + gradient.conic(red, blue) - ) -) - ---- -// Test gradient on lines -#set page(width: 100pt, height: 100pt) -#line(length: 100%, stroke: 1pt + gradient.linear(red, blue)) -#line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue)) -#line(length: 100%, angle: 10deg, stroke: 1pt + gradient.linear(red, blue, relative: "parent")) diff --git a/tests/typ/visualize/gradient-text-decorations.typ b/tests/typ/visualize/gradient-text-decorations.typ deleted file mode 100644 index a4e861d8..00000000 --- a/tests/typ/visualize/gradient-text-decorations.typ +++ /dev/null @@ -1,9 +0,0 @@ -// Tests gradients on text decorations. - ---- - -#set text(fill: gradient.linear(red, blue)) - -Hello #underline[World]! \ -Hello #overline[World]! \ -Hello #strike[World]! \ diff --git a/tests/typ/visualize/gradient-text-other.typ b/tests/typ/visualize/gradient-text-other.typ deleted file mode 100644 index 04b84cb6..00000000 --- a/tests/typ/visualize/gradient-text-other.typ +++ /dev/null @@ -1,14 +0,0 @@ -// Test text gradients with radial and conic gradients. - ---- -#set page(width: 200pt, height: auto, margin: 10pt) -#set par(justify: true) -#set text(fill: gradient.radial(red, blue)) -#lorem(30) - - ---- -#set page(width: 200pt, height: auto, margin: 10pt) -#set par(justify: true) -#set text(fill: gradient.conic(red, blue, angle: 45deg)) -#lorem(30) diff --git a/tests/typ/visualize/gradient-text.typ b/tests/typ/visualize/gradient-text.typ deleted file mode 100644 index 671172e1..00000000 --- a/tests/typ/visualize/gradient-text.typ +++ /dev/null @@ -1,49 +0,0 @@ -// Test that gradient fills on text. -// The solid bar gradients are used to make sure that all transforms are -// correct: if you can see the text through the bar, then the gradient is -// misaligned to its reference container. -// Ref: true - ---- -// Ref: false -// 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 -#set text(fill: gradient.linear(red, blue, relative: "self")) - ---- -// Test that gradient fills on text work for globally defined gradients. - -#set page(width: 200pt, height: auto, margin: 10pt, background: { - rect(width: 100%, height: 30pt, fill: gradient.linear(red, blue)) -}) -#set par(justify: true) -#set text(fill: gradient.linear(red, blue)) -#lorem(30) - ---- -// Sanity check that the direction works on text. - -#set page(width: 200pt, height: auto, margin: 10pt, background: { - rect(height: 100%, width: 30pt, fill: gradient.linear(dir: btt, red, blue)) -}) -#set par(justify: true) -#set text(fill: gradient.linear(dir: btt, red, blue)) -#lorem(30) - ---- -// Test that gradient fills on text work for locally defined gradients. - -#set page(width: auto, height: auto, margin: 10pt) -#show box: set text(fill: gradient.linear(..color.map.rainbow)) - -Hello, #box[World]! - ---- -// Test that gradients fills on text work with transforms. - -#set page(width: auto, height: auto, margin: 10pt) -#show box: set text(fill: gradient.linear(..color.map.rainbow)) - -#rotate(45deg, box[World]) diff --git a/tests/typ/visualize/gradient-transform.typ b/tests/typ/visualize/gradient-transform.typ deleted file mode 100644 index d33c4ac2..00000000 --- a/tests/typ/visualize/gradient-transform.typ +++ /dev/null @@ -1,12 +0,0 @@ -// Test whether gradients work well when they are contained within a transform. - ---- -#let grad = gradient.linear(red, blue, green, purple, relative: "parent"); -#let my-rect = rect(width: 50pt, height: 50pt, fill: grad) -#set page( - height: 200pt, - width: 200pt, -) -#place(top + right, scale(x: 200%, y: 130%, my-rect)) -#place(bottom + center, rotate(45deg, my-rect)) -#place(horizon + center, scale(x: 200%, y: 130%, rotate(45deg, my-rect))) diff --git a/tests/typ/visualize/image-scale.typ b/tests/typ/visualize/image-scale.typ deleted file mode 100644 index 7ddf435e..00000000 --- a/tests/typ/visualize/image-scale.typ +++ /dev/null @@ -1,6 +0,0 @@ -// Test that images aren't upscaled. - ---- -// Image is just 48x80 at 220dpi. It should not be scaled to fit the page -// width, but rather max out at its natural size. -#image("/assets/images/f2t.jpg") diff --git a/tests/typ/visualize/image.typ b/tests/typ/visualize/image.typ deleted file mode 100644 index a7965b2d..00000000 --- a/tests/typ/visualize/image.typ +++ /dev/null @@ -1,82 +0,0 @@ -// Test the `image` function. - ---- -// Test loading different image formats. - -// Load an RGBA PNG image. -#image("/assets/images/rhino.png") - -// Load an RGB JPEG image. -#set page(height: 60pt) -#image("../../assets/images/tiger.jpg") - ---- -// Test configuring the size and fitting behaviour of images. - -// Set width and height explicitly. -#box(image("/assets/images/rhino.png", width: 30pt)) -#box(image("/assets/images/rhino.png", height: 30pt)) - -// Set width and height explicitly and force stretching. -#image("/assets/images/monkey.svg", width: 100%, height: 20pt, fit: "stretch") - -// Make sure the bounding-box of the image is correct. -#align(bottom + right, image("/assets/images/tiger.jpg", width: 40pt, alt: "A tiger")) - ---- -// Test all three fit modes. -#set page(height: 50pt, margin: 0pt) -#grid( - columns: (1fr, 1fr, 1fr), - rows: 100%, - gutter: 3pt, - image("/assets/images/tiger.jpg", width: 100%, height: 100%, fit: "contain"), - image("/assets/images/tiger.jpg", width: 100%, height: 100%, fit: "cover"), - image("/assets/images/monkey.svg", width: 100%, height: 100%, fit: "stretch"), -) - ---- -// Does not fit to remaining height of page. -#set page(height: 60pt) -Stuff -#image("/assets/images/rhino.png") - ---- -// Test baseline. -A #box(image("/assets/images/tiger.jpg", height: 1cm, width: 80%)) B - ---- -// Test advanced SVG features. -#image("/assets/images/pattern.svg") - ---- -// Error: 8-29 file not found (searched at typ/visualize/path/does/not/exist) -#image("path/does/not/exist") - ---- -// Error: 2-22 unknown image format -#image("./image.typ") - ---- -// Error: 2-33 failed to parse SVG (found closing tag 'g' instead of 'style' in line 4) -#image("/assets/images/bad.svg") - ---- -// Test parsing from svg data -#image.decode(`<svg xmlns="http://www.w3.org/2000/svg" height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg") - ---- -// Error: 2-168 failed to parse SVG (missing root node) -#image.decode(`<svg height="140" width="500"><ellipse cx="200" cy="80" rx="100" ry="50" style="fill:yellow;stroke:purple;stroke-width:2" /></svg>`.text, format: "svg") - ---- -// Test format auto detect -#image.decode(read("/assets/images/tiger.jpg", encoding: none), width: 80%) - ---- -// Test format manual -#image.decode(read("/assets/images/tiger.jpg", encoding: none), format: "jpg", width: 80%) - ---- -// Error: 2-91 failed to decode image (Format error decoding Png: Invalid PNG signature.) -#image.decode(read("/assets/images/tiger.jpg", encoding: none), format: "png", width: 80%) diff --git a/tests/typ/visualize/line.typ b/tests/typ/visualize/line.typ deleted file mode 100644 index 8c405932..00000000 --- a/tests/typ/visualize/line.typ +++ /dev/null @@ -1,51 +0,0 @@ -// Test lines. - ---- -#set page(height: 60pt) -#box({ - set line(stroke: 0.75pt) - place(line(end: (0.4em, 0pt))) - place(line(start: (0pt, 0.4em), end: (0pt, 0pt))) - line(end: (0.6em, 0.6em)) -}) Hello #box(line(length: 1cm))! - -#line(end: (70%, 50%)) - ---- -// Test the angle argument and positioning. - -#set page(fill: rgb("0B1026")) -#set line(stroke: white) - -#let star(size, ..args) = box(width: size, height: size)[ - #set text(spacing: 0%) - #set line(..args) - #set align(left) - #v(30%) - #place(line(length: +30%, start: (09.0%, 02%))) - #place(line(length: +30%, start: (38.7%, 02%), angle: -72deg)) - #place(line(length: +30%, start: (57.5%, 02%), angle: 252deg)) - #place(line(length: +30%, start: (57.3%, 02%))) - #place(line(length: -30%, start: (88.0%, 02%), angle: -36deg)) - #place(line(length: +30%, start: (73.3%, 48%), angle: 252deg)) - #place(line(length: -30%, start: (73.5%, 48%), angle: 36deg)) - #place(line(length: +30%, start: (25.4%, 48%), angle: -36deg)) - #place(line(length: +30%, start: (25.6%, 48%), angle: -72deg)) - #place(line(length: +32%, start: (8.50%, 02%), angle: 34deg)) -] - -#align(center, grid( - columns: 3, - column-gutter: 10pt, - ..((star(20pt, stroke: 0.5pt),) * 9) -)) - ---- -// Test errors. - -// Error: 12-19 point array must contain exactly two entries -#line(end: (50pt,)) - ---- -// Error: 14-26 expected relative length, found angle -#line(start: (3deg, 10pt), length: 5cm) diff --git a/tests/typ/visualize/path.typ b/tests/typ/visualize/path.typ deleted file mode 100644 index d475811f..00000000 --- a/tests/typ/visualize/path.typ +++ /dev/null @@ -1,52 +0,0 @@ -// Test paths. - ---- -#set page(height: 200pt, width: 200pt) -#table( - columns: (1fr, 1fr), - rows: (1fr, 1fr), - align: center + horizon, - path( - fill: red, - closed: true, - ((0%, 0%), (4%, -4%)), - ((50%, 50%), (4%, -4%)), - ((0%, 50%), (4%, 4%)), - ((50%, 0%), (4%, 4%)), - ), - path( - fill: purple, - stroke: 1pt, - (0pt, 0pt), - (30pt, 30pt), - (0pt, 30pt), - (30pt, 0pt), - ), - path( - fill: blue, - stroke: 1pt, - closed: true, - ((30%, 0%), (35%, 30%), (-20%, 0%)), - ((30%, 60%), (-20%, 0%), (0%, 0%)), - ((50%, 30%), (60%, -30%), (60%, 0%)), - ), - path( - stroke: 5pt, - closed: true, - (0pt, 30pt), - (30pt, 30pt), - (15pt, 0pt), - ), -) - ---- -// Error: 7-9 path vertex must have 1, 2, or 3 points -#path(()) - ---- -// Error: 7-47 path vertex must have 1, 2, or 3 points -#path(((0%, 0%), (0%, 0%), (0%, 0%), (0%, 0%))) - ---- -// Error: 7-31 point array must contain exactly two entries -#path(((0%, 0%), (0%, 0%, 0%))) diff --git a/tests/typ/visualize/pattern-relative.typ b/tests/typ/visualize/pattern-relative.typ deleted file mode 100644 index 78517e1e..00000000 --- a/tests/typ/visualize/pattern-relative.typ +++ /dev/null @@ -1,23 +0,0 @@ -// Test pattern with different `relative`. - ---- -// Test with relative set to `"self"` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #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(fill: pat(relative: "self"), width: 100%, height: 100%, stroke: 1pt) - ---- -// Test with relative set to `"parent"` -#let pat(..args) = pattern(size: (30pt, 30pt), ..args)[ - #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(fill: pat(relative: "parent"), width: 100%, height: 100%, stroke: 1pt) diff --git a/tests/typ/visualize/pattern-simple.typ b/tests/typ/visualize/pattern-simple.typ deleted file mode 100644 index 9c41067d..00000000 --- a/tests/typ/visualize/pattern-simple.typ +++ /dev/null @@ -1,18 +0,0 @@ -// 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) - ---- -#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) diff --git a/tests/typ/visualize/pattern-small.typ b/tests/typ/visualize/pattern-small.typ deleted file mode 100644 index 1d289f92..00000000 --- a/tests/typ/visualize/pattern-small.typ +++ /dev/null @@ -1,19 +0,0 @@ -// 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)) -) - ---- -// 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)))) diff --git a/tests/typ/visualize/pattern-spacing.typ b/tests/typ/visualize/pattern-spacing.typ deleted file mode 100644 index f8f5f9fd..00000000 --- a/tests/typ/visualize/pattern-spacing.typ +++ /dev/null @@ -1,31 +0,0 @@ -// Test pattern with different `spacing`. - ---- -// 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) - ---- -// 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) - ---- -// 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) diff --git a/tests/typ/visualize/pattern-stroke.typ b/tests/typ/visualize/pattern-stroke.typ deleted file mode 100644 index 3cc43a70..00000000 --- a/tests/typ/visualize/pattern-stroke.typ +++ /dev/null @@ -1,13 +0,0 @@ -// Test pattern on strokes - ---- -#align( - center + top, - square( - size: 50pt, - stroke: 5pt + pattern( - size: (5pt, 5pt), - align(horizon + center, circle(fill: blue, radius: 2.5pt)) - ) - ) -) diff --git a/tests/typ/visualize/pattern-text.typ b/tests/typ/visualize/pattern-text.typ deleted file mode 100644 index a9fbfb37..00000000 --- a/tests/typ/visualize/pattern-text.typ +++ /dev/null @@ -1,28 +0,0 @@ -// 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/typ/visualize/polygon.typ b/tests/typ/visualize/polygon.typ deleted file mode 100644 index cad62497..00000000 --- a/tests/typ/visualize/polygon.typ +++ /dev/null @@ -1,36 +0,0 @@ -// Test polygons. - ---- -#set page(width: 50pt) -#set polygon(stroke: 0.75pt, fill: blue) - -// These are not visible, but should also not give an error -#polygon() -#polygon((0em, 0pt)) -#polygon((0pt, 0pt), (10pt, 0pt)) -#polygon.regular(size: 0pt, vertices: 9) - -#polygon((5pt, 0pt), (0pt, 10pt), (10pt, 10pt)) -#polygon( - (0pt, 0pt), (5pt, 5pt), (10pt, 0pt), - (15pt, 5pt), - (5pt, 10pt) -) -#polygon(stroke: none, (5pt, 0pt), (0pt, 10pt), (10pt, 10pt)) -#polygon(stroke: 3pt, fill: none, (5pt, 0pt), (0pt, 10pt), (10pt, 10pt)) - -// Relative size -#polygon((0pt, 0pt), (100%, 5pt), (50%, 10pt)) - -// Antiparallelogram -#polygon((0pt, 5pt), (5pt, 0pt), (0pt, 10pt), (5pt, 15pt)) - -// Self-intersections -#polygon((0pt, 10pt), (30pt, 20pt), (0pt, 30pt), (20pt, 0pt), (20pt, 35pt)) - -// Regular polygon; should have equal side lengths -#for k in range(3, 9) {polygon.regular(size: 30pt, vertices: k,)} - ---- -// Error: 10-17 point array must contain exactly two entries -#polygon((50pt,)) diff --git a/tests/typ/visualize/shape-aspect.typ b/tests/typ/visualize/shape-aspect.typ deleted file mode 100644 index d3606808..00000000 --- a/tests/typ/visualize/shape-aspect.typ +++ /dev/null @@ -1,63 +0,0 @@ -// Test that squares and circles respect their 1-1 aspect ratio. - ---- -// Test relative width and height and size that is smaller -// than default size. -#set page(width: 120pt, height: 70pt) -#set align(bottom) -#let centered = align.with(center + horizon) -#stack( - dir: ltr, - spacing: 1fr, - square(width: 50%, centered[A]), - square(height: 50%), - stack( - square(size: 10pt), - square(size: 20pt, centered[B]) - ), -) - ---- -// Test alignment in automatically sized square and circle. -#set text(8pt) -#box(square(inset: 4pt)[ - Hey there, #align(center + bottom, rotate(180deg, [you!])) -]) -#box(circle(align(center + horizon, [Hey.]))) - ---- -// Test that minimum wins if both width and height are given. -#stack( - dir: ltr, - spacing: 2pt, - square(width: 20pt, height: 40pt), - circle(width: 20%, height: 100pt), -) - ---- -// Test square that is limited by region size. -#set page(width: 20pt, height: 10pt, margin: 0pt) -#stack(dir: ltr, square(fill: forest), square(fill: conifer)) - ---- -// Test different ways of sizing. -#set page(width: 120pt, height: 40pt) -#stack( - dir: ltr, - spacing: 2pt, - circle(radius: 5pt), - circle(width: 10%), - circle(height: 50%), -) - ---- -// Test that square doesn't overflow due to its aspect ratio. -#set page(width: 40pt, height: 25pt, margin: 5pt) -#square(width: 100%) -#square(width: 100%)[Hello there] - ---- -// Size cannot be relative because we wouldn't know -// relative to which axis. -// Error: 15-18 expected length or auto, found ratio -#square(size: 50%) diff --git a/tests/typ/visualize/shape-circle.typ b/tests/typ/visualize/shape-circle.typ deleted file mode 100644 index 34238d9a..00000000 --- a/tests/typ/visualize/shape-circle.typ +++ /dev/null @@ -1,58 +0,0 @@ -// Test the `circle` function. - ---- -// Default circle. -#box(circle()) -#box(circle[Hey]) - ---- -// Test auto sizing. -#set circle(inset: 0pt) - -Auto-sized circle. -#circle(fill: rgb("eb5278"), stroke: 2pt + black, - align(center + horizon)[But, soft!] -) - -Center-aligned rect in auto-sized circle. -#circle(fill: forest, stroke: conifer, - align(center + horizon, - rect(fill: conifer, inset: 5pt)[But, soft!] - ) -) - -Rect in auto-sized circle. -#circle(fill: forest, - rect(fill: conifer, stroke: white, inset: 4pt)[ - #set text(8pt) - But, soft! what light through yonder window breaks? - ] -) - -Expanded by height. -#circle(stroke: black, align(center)[A \ B \ C]) - ---- -// Ensure circle directly in rect works. -#rect(width: 40pt, height: 30pt, fill: forest, - circle(fill: conifer)) - ---- -// Test relative sizing. -#set text(fill: white) -#show: rect.with(width: 100pt, height: 50pt, inset: 0pt, fill: rgb("aaa")) -#set align(center + horizon) -#stack( - dir: ltr, - spacing: 1fr, - 1fr, - circle(radius: 10pt, fill: eastern, [A]), // D=20pt - circle(height: 60%, fill: eastern, [B]), // D=30pt - circle(width: 20% + 20pt, fill: eastern, [C]), // D=40pt - 1fr, -) - ---- -// Radius wins over width and height. -// Error: 23-34 unexpected argument: width -#circle(radius: 10pt, width: 50pt, height: 100pt, fill: eastern) diff --git a/tests/typ/visualize/shape-ellipse.typ b/tests/typ/visualize/shape-ellipse.typ deleted file mode 100644 index 2fd4acd9..00000000 --- a/tests/typ/visualize/shape-ellipse.typ +++ /dev/null @@ -1,31 +0,0 @@ -// Test the `ellipse` function. - ---- -// Default ellipse. -#ellipse() - ---- -#set rect(inset: 0pt) -#set ellipse(inset: 0pt) - -Rect in ellipse in fixed rect. -#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"), - ellipse(fill: forest, width: 100%, height: 100%, - rect(fill: conifer, width: 100%, height: 100%, - align(center + horizon)[ - Stuff inside an ellipse! - ] - ) - ) -) - -Auto-sized ellipse. -#ellipse(fill: conifer, stroke: 3pt + forest, inset: 3pt)[ - #set text(8pt) - But, soft! what light through yonder window breaks? -] - - -An inline -#box(ellipse(width: 8pt, height: 6pt, outset: (top: 3pt, rest: 5.5pt))) -ellipse. diff --git a/tests/typ/visualize/shape-fill-stroke.typ b/tests/typ/visualize/shape-fill-stroke.typ deleted file mode 100644 index 8d187400..00000000 --- a/tests/typ/visualize/shape-fill-stroke.typ +++ /dev/null @@ -1,93 +0,0 @@ -// Test shape fill & stroke. - ---- -#let variant = rect.with(width: 20pt, height: 10pt) -#let items = for (i, item) in ( - variant(stroke: none), - variant(), - variant(fill: none), - variant(stroke: 2pt), - variant(stroke: eastern), - variant(stroke: eastern + 2pt), - variant(fill: eastern), - variant(fill: eastern, stroke: none), - variant(fill: forest, stroke: none), - variant(fill: forest, stroke: conifer), - variant(fill: forest, stroke: black + 2pt), - variant(fill: forest, stroke: conifer + 2pt), -).enumerate() { - (align(horizon)[#(i + 1).], item, []) -} - -#grid( - columns: (auto, auto, 1fr, auto, auto, 0fr), - gutter: 5pt, - ..items, -) - ---- -// Test stroke folding. -#let sq(..args) = box(square(size: 10pt, ..args)) - -#set square(stroke: none) -#sq() -#set square(stroke: auto) -#sq() -#sq(fill: teal) -#sq(stroke: 2pt) -#sq(stroke: blue) -#sq(fill: teal, stroke: blue) -#sq(fill: teal, stroke: 2pt + blue) - ---- -// Test stroke composition. -#set square(stroke: 4pt) -#set text(font: "Roboto") -#stack( - dir: ltr, - square( - stroke: (left: red, top: yellow, right: green, bottom: blue), - radius: 50%, align(center+horizon)[*G*], - inset: 8pt - ), - h(0.5cm), - square( - stroke: (left: red, top: yellow + 8pt, right: green, bottom: blue + 2pt), - radius: 50%, align(center+horizon)[*G*], - inset: 8pt - ), - h(0.5cm), - square( - stroke: (left: red, top: yellow, right: green, bottom: blue), - radius: 100%, align(center+horizon)[*G*], - inset: 8pt - ), -) - -// Join between different solid strokes -#set square(size: 20pt, stroke: 2pt) -#set square(stroke: (left: green + 4pt, top: black + 2pt, right: blue, bottom: black + 2pt)) -#stack( - dir: ltr, - square(), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 1pt)), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 8pt)), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 100pt)), -) - - -// Join between solid and dotted strokes -#set square(stroke: (left: green + 4pt, top: black + 2pt, right: (paint: blue, dash: "dotted"), bottom: (paint: black, dash: "dotted"))) -#stack( - dir: ltr, - square(), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 1pt)), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 8pt)), - h(0.2cm), - square(radius: (top-left: 0pt, rest: 100pt)), -) diff --git a/tests/typ/visualize/shape-rect.typ b/tests/typ/visualize/shape-rect.typ deleted file mode 100644 index bd9cf1ae..00000000 --- a/tests/typ/visualize/shape-rect.typ +++ /dev/null @@ -1,78 +0,0 @@ -// Test the `rect` function. - ---- -// Default rectangle. -#rect() - ---- -#set page(width: 150pt) - -// Fit to text. -#rect(fill: conifer)[Textbox] - -// Empty with fixed width and height. -#block(rect( - height: 15pt, - fill: rgb("46b3c2"), - stroke: 2pt + rgb("234994"), -)) - -// Fixed width, text height. -#rect(width: 2cm, fill: rgb("9650d6"))[Fixed and padded] - -// Page width, fixed height. -#rect(height: 1cm, width: 100%, fill: rgb("734ced"))[Topleft] - -// These are inline with text. -{#box(rect(width: 0.5in, height: 7pt, fill: rgb("d6cd67"))) - #box(rect(width: 0.5in, height: 7pt, fill: rgb("edd466"))) - #box(rect(width: 0.5in, height: 7pt, fill: rgb("e3be62")))} - -// Rounded corners. -#stack( - dir: ltr, - spacing: 1fr, - rect(width: 2cm, radius: 30%), - rect(width: 1cm, radius: (left: 10pt, right: 5pt)), - rect(width: 1.25cm, radius: ( - top-left: 2pt, - top-right: 5pt, - bottom-right: 8pt, - bottom-left: 11pt - )), -) - -// Different strokes. -#set rect(stroke: (right: red)) -#rect(width: 100%, fill: lime, stroke: (x: 5pt, y: 1pt)) - ---- -// Error: 15-38 unexpected key "cake", valid keys are "top-left", "top-right", "bottom-right", "bottom-left", "left", "top", "right", "bottom", and "rest" -#rect(radius: (left: 10pt, cake: 5pt)) - ---- -// Error: 15-21 expected length, color, gradient, pattern, dictionary, stroke, none, or auto, found array -#rect(stroke: (1, 2)) - ---- -#set page(width: 17.8cm) -#lorem(100) -#rect(lorem(100)) -#set par(justify: true) -#lorem(100) -#rect(lorem(100)) - ---- -// Negative dimensions -#rect(width: -1cm, fill: gradient.linear(red, blue))[Reverse left] - -#rect(width: 1cm, fill: gradient.linear(red, blue))[Left] - -#align(center, rect(width: -1cm, fill: gradient.linear(red, blue))[Reverse center]) - -#align(center, rect(width: 1cm, fill: gradient.linear(red, blue))[Center]) - -#align(right, rect(width: -1cm, fill: gradient.linear(red, blue))[Reverse right]) - -#align(right, rect(width: 1cm, fill: gradient.linear(red, blue))[Right]) - diff --git a/tests/typ/visualize/shape-rounded.typ b/tests/typ/visualize/shape-rounded.typ deleted file mode 100644 index 42432dc9..00000000 --- a/tests/typ/visualize/shape-rounded.typ +++ /dev/null @@ -1,53 +0,0 @@ -// Test rounded rectangles and squares. - ---- -#set square(size: 20pt, stroke: 4pt) - -// no radius for non-rounded corners -#stack( - dir: ltr, - square(), - h(10pt), - square(radius: 0pt), - h(10pt), - square(radius: -10pt), -) - -#stack( - dir: ltr, - square(), - h(10pt), - square(radius: 0%), - h(10pt), - square(radius: -10%), -) - - -// small values for small radius -#stack( - dir: ltr, - square(radius: 1pt), - h(10pt), - square(radius: 5%), - h(10pt), - square(radius: 2pt), -) - -// large values for large radius or circle -#stack( - dir: ltr, - square(radius: 8pt), - h(10pt), - square(radius: 10pt), - h(10pt), - square(radius: 12pt), -) - -#stack( - dir: ltr, - square(radius: 45%), - h(10pt), - square(radius: 50%), - h(10pt), - square(radius: 55%), -) diff --git a/tests/typ/visualize/shape-square.typ b/tests/typ/visualize/shape-square.typ deleted file mode 100644 index a321dc4a..00000000 --- a/tests/typ/visualize/shape-square.typ +++ /dev/null @@ -1,39 +0,0 @@ -// Test the `square` function. - ---- -// Default square. -#box(square()) -#box(square[hey!]) - ---- -// Test auto-sized square. -#square(fill: eastern)[ - #set text(fill: white, weight: "bold") - Typst -] - ---- -// Test relative-sized child. -#square(fill: eastern)[ - #rect(width: 10pt, height: 5pt, fill: conifer) - #rect(width: 40%, height: 5pt, stroke: conifer) -] - ---- -// Test text overflowing height. -#set page(width: 75pt, height: 100pt) -#square(fill: conifer)[ - But, soft! what light through yonder window breaks? -] - ---- -// Test that square does not overflow page. -#set page(width: 100pt, height: 75pt) -#square(fill: conifer)[ - But, soft! what light through yonder window breaks? -] - ---- -// Size wins over width and height. -// Error: 09-20 unexpected argument: width -#square(width: 10cm, height: 20cm, size: 1cm, fill: rgb("eb5278")) diff --git a/tests/typ/visualize/stroke.typ b/tests/typ/visualize/stroke.typ deleted file mode 100644 index cf91dcc3..00000000 --- a/tests/typ/visualize/stroke.typ +++ /dev/null @@ -1,115 +0,0 @@ -// Test lines. - ---- -// Some simple test lines -#line(length: 60pt, stroke: red) -#v(3pt) -#line(length: 60pt, stroke: 2pt) -#v(3pt) -#line(length: 60pt, stroke: blue + 1.5pt) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: "dashed")) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 4pt, cap: "round")) - ---- -// Set rules with stroke -#set line(stroke: (paint: red, thickness: 1pt, cap: "butt", dash: "dash-dotted")) -#line(length: 60pt) -#v(3pt) -#line(length: 60pt, stroke: blue) -#v(3pt) -#line(length: 60pt, stroke: (dash: none)) - ---- -// Rectangle strokes -#rect(width: 20pt, height: 20pt, stroke: red) -#v(3pt) -#rect(width: 20pt, height: 20pt, stroke: (rest: red, top: (paint: blue, dash: "dashed"))) -#v(3pt) -#rect(width: 20pt, height: 20pt, stroke: (thickness: 5pt, join: "round")) - ---- -// Dashing -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: ("dot", 1pt))) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: ("dot", 1pt, 4pt, 2pt))) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: (array: ("dot", 1pt, 4pt, 2pt), phase: 5pt))) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: ())) -#v(3pt) -#line(length: 60pt, stroke: (paint: red, thickness: 1pt, dash: (1pt, 3pt, 9pt))) - ---- -// Line joins -#stack( - dir: ltr, - spacing: 1em, - polygon(stroke: (thickness: 4pt, paint: blue, join: "round"), - (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), - polygon(stroke: (thickness: 4pt, paint: blue, join: "bevel"), - (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), - polygon(stroke: (thickness: 4pt, paint: blue, join: "miter"), - (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), - polygon(stroke: (thickness: 4pt, paint: blue, join: "miter", miter-limit: 20.0), - (0pt, 20pt), (15pt, 0pt), (0pt, 40pt), (15pt, 45pt)), -) ---- -// Error: 29-56 unexpected key "thicknes", valid keys are "paint", "thickness", "cap", "join", "dash", and "miter-limit" -#line(length: 60pt, stroke: (paint: red, thicknes: 1pt)) - ---- -// Error: 29-55 expected "solid", "dotted", "densely-dotted", "loosely-dotted", "dashed", "densely-dashed", "loosely-dashed", "dash-dotted", "densely-dash-dotted", "loosely-dash-dotted", array, dictionary, none, or auto -#line(length: 60pt, stroke: (paint: red, dash: "dash")) - ---- -// 0pt strokes must function exactly like 'none' strokes and not draw anything -#rect(width: 10pt, height: 10pt, stroke: none) -#rect(width: 10pt, height: 10pt, stroke: 0pt) -#rect(width: 10pt, height: 10pt, stroke: none, fill: blue) -#rect(width: 10pt, height: 10pt, stroke: 0pt + red, fill: blue) - -#line(length: 30pt, stroke: 0pt) -#line(length: 30pt, stroke: (paint: red, thickness: 0pt, dash: ("dot", 1pt))) - -#table(columns: 2, stroke: none)[A][B] -#table(columns: 2, stroke: 0pt)[A][B] - -#path( - fill: red, - stroke: none, - closed: true, - ((0%, 0%), (4%, -4%)), - ((50%, 50%), (4%, -4%)), - ((0%, 50%), (4%, 4%)), - ((50%, 0%), (4%, 4%)), -) - -#path( - fill: red, - stroke: 0pt, - closed: true, - ((0%, 0%), (4%, -4%)), - ((50%, 50%), (4%, -4%)), - ((0%, 50%), (4%, 4%)), - ((50%, 0%), (4%, 4%)), -) - ---- -// Converting to stroke -#assert.eq(stroke(red).paint, red) -#assert.eq(stroke(red).thickness, auto) -#assert.eq(stroke(2pt).paint, auto) -#assert.eq(stroke((cap: "round", paint: blue)).cap, "round") -#assert.eq(stroke((cap: auto, paint: blue)).cap, auto) -#assert.eq(stroke((cap: auto, paint: blue)).thickness, auto) - -// Error: 9-21 unexpected key "foo", valid keys are "paint", "thickness", "cap", "join", "dash", and "miter-limit" -#stroke((foo: "bar")) - -// Constructing with named arguments -#assert.eq(stroke(paint: blue, thickness: 8pt), 8pt + blue) -#assert.eq(stroke(thickness: 2pt), stroke(2pt)) -#assert.eq(stroke(cap: "round").thickness, auto) -#assert.eq(stroke(cap: "round", thickness: auto).thickness, auto) diff --git a/tests/typ/visualize/svg-text.typ b/tests/typ/visualize/svg-text.typ deleted file mode 100644 index 6f0a758e..00000000 --- a/tests/typ/visualize/svg-text.typ +++ /dev/null @@ -1,18 +0,0 @@ -// Test SVG with text. - ---- -#set page(width: 250pt) - -#figure( - image("/assets/images/diagram.svg"), - caption: [A textful diagram], -) - ---- -#set page(width: 250pt) -#show image: set text(font: ("Roboto", "Noto Serif CJK SC")) - -#figure( - image("/assets/images/chinese.svg"), - caption: [Bilingual text] -) |
