summaryrefslogtreecommitdiff
path: root/tests/suite/visualize
diff options
context:
space:
mode:
Diffstat (limited to 'tests/suite/visualize')
-rw-r--r--tests/suite/visualize/color.typ17
-rw-r--r--tests/suite/visualize/gradient.typ9
-rw-r--r--tests/suite/visualize/image.typ5
-rw-r--r--tests/suite/visualize/stroke.typ20
4 files changed, 14 insertions, 37 deletions
diff --git a/tests/suite/visualize/color.typ b/tests/suite/visualize/color.typ
index bc8f8be5..f7eccdf3 100644
--- a/tests/suite/visualize/color.typ
+++ b/tests/suite/visualize/color.typ
@@ -160,12 +160,12 @@
let are-equal((a, b)) = {
let to-float(x) = if type(x) == angle { x.rad() } else { float(x) }
let epsilon = 1e-4 // The maximum error between both numbers
- assert.eq(type(a), type(b))
+ test(type(a), type(b))
calc.abs(to-float(a) - to-float(b)) < epsilon
}
let ref-without-alpha = if has-alpha { ref.slice(0, -1) } else { ref }
- assert.eq(col.components().len(), ref.len())
+ test(col.components().len(), ref.len())
assert(col.components().zip(ref).all(are-equal))
assert(col.components(alpha: false).zip(ref-without-alpha).all(are-equal))
}
@@ -317,19 +317,6 @@
#test-repr(luma(100%, 50%).opacify(-50%), luma(100%, 25%))
#test-repr(luma(100%, 0%).opacify(0%), luma(100%, 0%))
---- repr-color ---
-// Colors
-#set page(width: 400pt)
-#set text(0.8em)
-#blue \
-#color.linear-rgb(blue) \
-#oklab(blue) \
-#oklch(blue) \
-#cmyk(blue) \
-#color.hsl(blue) \
-#color.hsv(blue) \
-#luma(blue)
-
--- issue-color-mix-luma ---
// When mixing luma colors, we accidentally used the wrong component.
#rect(fill: gradient.linear(black, silver, space: luma))
diff --git a/tests/suite/visualize/gradient.typ b/tests/suite/visualize/gradient.typ
index 61f6b6d0..ff1aef3a 100644
--- a/tests/suite/visualize/gradient.typ
+++ b/tests/suite/visualize/gradient.typ
@@ -613,15 +613,6 @@ $ A = mat(
((red, 0%), (green, 25%), (blue, 50%), (green, 75%), (red, 100%))
)
---- gradient-repr ---
-// Gradients
-#set page(width: 400pt)
-#set text(0.8em)
-#gradient.linear(blue, red) \
-#gradient.linear(blue, red, dir: ttb) \
-#gradient.linear(blue, red, angle: 45deg, relative: "self") \
-#gradient.linear(blue, red, angle: 45deg, space: rgb)
-
--- issue-2902-gradient-oklch-panic ---
// Minimal reproduction of #2902
#set page(width: 15cm, height: auto, margin: 1em)
diff --git a/tests/suite/visualize/image.typ b/tests/suite/visualize/image.typ
index 3bda8d0e..846650c6 100644
--- a/tests/suite/visualize/image.typ
+++ b/tests/suite/visualize/image.typ
@@ -1,11 +1,10 @@
// Test the `image` function.
---- image-rgba-png-and-jpeg ---
-// Test loading different image formats.
-
+--- image-png ---
// Load an RGBA PNG image.
#image("/assets/images/rhino.png")
+--- image-jpg ---
// Load an RGB JPEG image.
#set page(height: 60pt)
#image("/assets/images/tiger.jpg")
diff --git a/tests/suite/visualize/stroke.typ b/tests/suite/visualize/stroke.typ
index b03c96c5..387e88cb 100644
--- a/tests/suite/visualize/stroke.typ
+++ b/tests/suite/visualize/stroke.typ
@@ -2,18 +2,18 @@
--- stroke-constructor ---
// 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)
+#test(stroke(red).paint, red)
+#test(stroke(red).thickness, auto)
+#test(stroke(2pt).paint, auto)
+#test(stroke((cap: "round", paint: blue)).cap, "round")
+#test(stroke((cap: auto, paint: blue)).cap, auto)
+#test(stroke((cap: auto, paint: blue)).thickness, auto)
// 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)
+#test(stroke(paint: blue, thickness: 8pt), 8pt + blue)
+#test(stroke(thickness: 2pt), stroke(2pt))
+#test(stroke(cap: "round").thickness, auto)
+#test(stroke(cap: "round", thickness: auto).thickness, auto)
--- stroke-constructor-unknown-key ---
// Error: 9-21 unexpected key "foo", valid keys are "paint", "thickness", "cap", "join", "dash", and "miter-limit"