summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMyriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com>2024-01-03 20:04:36 +0800
committerGitHub <noreply@github.com>2024-01-03 12:04:36 +0000
commit34e3bd52aa4ca0ba0586736dde299070848c5a42 (patch)
tree8e3d6c2e3821af05f9c7aa4690a9708fc52cf343 /tests
parent3aeb150c95f9ae55ded7233b86108be18c3028db (diff)
Inline equations linebreak at appropriate places (#2938)
Co-authored-by: David Maxwell <damaxwell@alaska.edu> Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/math/delimited.pngbin29020 -> 29090 bytes
-rw-r--r--tests/ref/math/linebreak.pngbin0 -> 7385 bytes
-rw-r--r--tests/ref/text/linebreak-obj.pngbin45919 -> 46208 bytes
-rw-r--r--tests/typ/math/delimited.typ1
-rw-r--r--tests/typ/math/linebreak.typ50
-rw-r--r--tests/typ/math/spacing.typ2
6 files changed, 52 insertions, 1 deletions
diff --git a/tests/ref/math/delimited.png b/tests/ref/math/delimited.png
index 727f2d13..5c827c48 100644
--- a/tests/ref/math/delimited.png
+++ b/tests/ref/math/delimited.png
Binary files differ
diff --git a/tests/ref/math/linebreak.png b/tests/ref/math/linebreak.png
new file mode 100644
index 00000000..f3212a4a
--- /dev/null
+++ b/tests/ref/math/linebreak.png
Binary files differ
diff --git a/tests/ref/text/linebreak-obj.png b/tests/ref/text/linebreak-obj.png
index 3c21377c..b13ced1a 100644
--- a/tests/ref/text/linebreak-obj.png
+++ b/tests/ref/text/linebreak-obj.png
Binary files differ
diff --git a/tests/typ/math/delimited.typ b/tests/typ/math/delimited.typ
index 6607c302..ba623b34 100644
--- a/tests/typ/math/delimited.typ
+++ b/tests/typ/math/delimited.typ
@@ -2,6 +2,7 @@
---
// Test automatic matching.
+#set page(width:122pt)
$ (a) + {b/2} + abs(a)/2 + (b) $
$f(x/2) < zeta(c^2 + abs(a + b/2))$
diff --git a/tests/typ/math/linebreak.typ b/tests/typ/math/linebreak.typ
new file mode 100644
index 00000000..88ce69d2
--- /dev/null
+++ b/tests/typ/math/linebreak.typ
@@ -0,0 +1,50 @@
+// Test inline equation line breaking.
+
+---
+// Basic breaking after binop, rel
+#let hrule(x) = box(line(length: x))
+#hrule(45pt)$e^(pi i)+1 = 0$\
+#hrule(55pt)$e^(pi i)+1 = 0$\
+#hrule(70pt)$e^(pi i)+1 = 0$
+
+---
+// LR groups prevent linbreaking.
+#let hrule(x) = box(line(length: x))
+#hrule(76pt)$a+b$\
+#hrule(74pt)$(a+b)$\
+#hrule(74pt)$paren.l a+b paren.r$
+
+---
+// Multiline yet inline does not linebreak
+#let hrule(x) = box(line(length: x))
+#hrule(80pt)$a + b \ c + d$\
+
+---
+// A single linebreak at the end still counts as one line.
+#let hrule(x) = box(line(length: x))
+#hrule(60pt)$e^(pi i)+1 = 0\ $
+
+---
+// Inline, in a box, doesn't linebreak.
+#let hrule(x) = box(line(length: x))
+#hrule(80pt)#box($a+b$)
+
+---
+// A relation followed by a relation doesn't linebreak
+#let hrule(x) = box(line(length: x))
+#hrule(70pt)$a < = b$\
+#hrule(74pt)$a < = b$
+
+---
+// Page breaks can happen after a relation even if there is no
+// explicit space.
+#let hrule(x) = box(line(length: x))
+#hrule(90pt)$<;$\
+#hrule(95pt)$<;$\
+#hrule(90pt)$<)$\
+#hrule(95pt)$<)$
+
+---
+// Verify empty rows are handled ok.
+$ $\
+Nothing: $ $, just empty.
diff --git a/tests/typ/math/spacing.typ b/tests/typ/math/spacing.typ
index e62d2eb3..63a60ae1 100644
--- a/tests/typ/math/spacing.typ
+++ b/tests/typ/math/spacing.typ
@@ -3,7 +3,7 @@
---
// Test spacing cases.
$ä, +, c, (, )$ \
-$=), (+), {times}$
+$=), (+), {times}$ \
$⟧<⟦, abs(-), [=$ \
$a=b, a==b$ \
$-a, +a$ \