summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com>2023-11-07 12:09:51 +0100
committerGitHub <noreply@github.com>2023-11-07 12:09:51 +0100
commit241a6d9e5aa36c41e1f3be8a75a769e2ce98f7fb (patch)
tree3c497c82ad1d19dee5b37515dea50c2868043eff /tests
parent4d5255d9cbfb3cb7fd48feee54138fcad4f5b552 (diff)
Gradient Part 5b: Fix gradients in math (#2604)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/visualize/gradient-math.pngbin0 -> 29775 bytes
-rw-r--r--tests/typ/visualize/gradient-math.typ68
2 files changed, 68 insertions, 0 deletions
diff --git a/tests/ref/visualize/gradient-math.png b/tests/ref/visualize/gradient-math.png
new file mode 100644
index 00000000..13185bec
--- /dev/null
+++ b/tests/ref/visualize/gradient-math.png
Binary files differ
diff --git a/tests/typ/visualize/gradient-math.typ b/tests/typ/visualize/gradient-math.typ
new file mode 100644
index 00000000..2030ecbb
--- /dev/null
+++ b/tests/typ/visualize/gradient-math.typ
@@ -0,0 +1,68 @@
+// 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 miscelaneous
+
+#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,
+) $