summaryrefslogtreecommitdiff
path: root/tests/typ/layout
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-28 17:57:16 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-28 17:57:16 +0100
commit836692e73cff0356e409a9ba5b4887b86809d4ca (patch)
treee174178047c368c66746ee073eea1b3129825479 /tests/typ/layout
parent989d170dc7318ca3cbaa5b76760eb14f4e6a8605 (diff)
Widow and orphan prevention
Diffstat (limited to 'tests/typ/layout')
-rw-r--r--tests/typ/layout/columns.typ4
-rw-r--r--tests/typ/layout/grid-3.typ18
-rw-r--r--tests/typ/layout/orphan-heading.typ8
-rw-r--r--tests/typ/layout/orphan-widow.typ23
4 files changed, 33 insertions, 20 deletions
diff --git a/tests/typ/layout/columns.typ b/tests/typ/layout/columns.typ
index 1e77e6bc..315393a0 100644
--- a/tests/typ/layout/columns.typ
+++ b/tests/typ/layout/columns.typ
@@ -52,8 +52,8 @@ a page for a test but it does get the job done.
#set page(height: 3.25cm, width: 7.05cm, columns: 3)
#set columns(gutter: 30pt)
-#rect(width: 100%, height: 2.5cm, fill: conifer)
-#rect(width: 100%, height: 2cm, fill: eastern)
+#rect(width: 100%, height: 2.5cm, fill: conifer) #parbreak()
+#rect(width: 100%, height: 2cm, fill: eastern) #parbreak()
#circle(fill: eastern)
---
diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ
index 6b7dc47f..c55f22a6 100644
--- a/tests/typ/layout/grid-3.typ
+++ b/tests/typ/layout/grid-3.typ
@@ -59,21 +59,3 @@
[rofl],
[E\ ]*4,
)
-
----
-// Test partition of `fr` units before and after multi-region layout.
-#set page(width: 5cm, height: 4cm)
-#grid(
- columns: 2 * (1fr,),
- rows: (1fr, 2fr, auto, 1fr, 1cm),
- row-gutter: 10pt,
- rect(fill: rgb("ff0000"))[No height],
- [foo],
- rect(fill: rgb("fc0030"))[Still no height],
- [bar],
- [The nature of being itself is in question. Am I One? What is being alive?],
- [baz],
- [The answer],
- [42],
- [Other text of interest],
-)
diff --git a/tests/typ/layout/orphan-heading.typ b/tests/typ/layout/orphan-heading.typ
new file mode 100644
index 00000000..ef3de885
--- /dev/null
+++ b/tests/typ/layout/orphan-heading.typ
@@ -0,0 +1,8 @@
+// Test that a heading doesn't become an orphan.
+
+---
+#set page(height: 100pt)
+#lorem(12)
+
+= Introduction
+This is the start and it goes on.
diff --git a/tests/typ/layout/orphan-widow.typ b/tests/typ/layout/orphan-widow.typ
new file mode 100644
index 00000000..445b44e3
--- /dev/null
+++ b/tests/typ/layout/orphan-widow.typ
@@ -0,0 +1,23 @@
+// Test widow and orphan prevention.
+
+---
+#set page("a8", height: 150pt)
+#set text(weight: 700)
+
+// Fits fully onto the first page.
+#set text(blue)
+#lorem(27)
+
+// The first line would fit, but is moved to the second page.
+#lorem(20)
+
+// The second-to-last line is moved to the third page so that the last is isn't
+// as lonely.
+#set text(maroon)
+#lorem(11)
+
+#lorem(13)
+
+// All three lines go to the next page.
+#set text(olive)
+#lorem(10)