summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalo <57839069+MDLC01@users.noreply.github.com>2023-12-18 11:37:30 +0100
committerGitHub <noreply@github.com>2023-12-18 11:37:30 +0100
commit356bdeba18153efd4209657182971e22bdaf4db2 (patch)
tree3efedaf7d0795c0e54420eb04263a1bb1e9329dd /tests
parent41c0dae2097ae4368c259bd1b1b10ef6667bb850 (diff)
Do not create a block frame for out-of-flow items only (#2517)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/columns.pngbin107087 -> 95706 bytes
-rw-r--r--tests/ref/layout/out-of-flow-in-block.pngbin0 -> 16297 bytes
-rw-r--r--tests/typ/layout/columns.typ7
-rw-r--r--tests/typ/layout/out-of-flow-in-block.typ61
4 files changed, 68 insertions, 0 deletions
diff --git a/tests/ref/layout/columns.png b/tests/ref/layout/columns.png
index 51fd5b2c..38912f1b 100644
--- a/tests/ref/layout/columns.png
+++ b/tests/ref/layout/columns.png
Binary files differ
diff --git a/tests/ref/layout/out-of-flow-in-block.png b/tests/ref/layout/out-of-flow-in-block.png
new file mode 100644
index 00000000..97637145
--- /dev/null
+++ b/tests/ref/layout/out-of-flow-in-block.png
Binary files differ
diff --git a/tests/typ/layout/columns.typ b/tests/typ/layout/columns.typ
index 32060ab4..ecf636e7 100644
--- a/tests/typ/layout/columns.typ
+++ b/tests/typ/layout/columns.typ
@@ -103,3 +103,10 @@ This is a normal page. Very normal.
// Test a page with zero columns.
// Error: 49-50 number must be positive
#set page(height: auto, width: 7.05cm, columns: 0)
+
+---
+// Test colbreak after only out-of-flow elements.
+#set page(width: 7.05cm, columns: 2)
+#place[OOF]
+#colbreak()
+In flow.
diff --git a/tests/typ/layout/out-of-flow-in-block.typ b/tests/typ/layout/out-of-flow-in-block.typ
new file mode 100644
index 00000000..2461aa5d
--- /dev/null
+++ b/tests/typ/layout/out-of-flow-in-block.typ
@@ -0,0 +1,61 @@
+// Test out-of-flow items (place, counter updates, etc.) at the
+// beginning of a block not creating a frame just for them.
+
+---
+// No item in the first region.
+#set page(height: 5cm, margin: 1cm)
+No item in the first region.
+#block(breakable: true, stroke: 1pt, inset: 0.5cm)[
+ #rect(height: 2cm, fill: gray)
+]
+
+---
+// Counter update in the first region.
+#set page(height: 5cm, margin: 1cm)
+Counter update.
+#block(breakable: true, stroke: 1pt, inset: 0.5cm)[
+ #counter("dummy").step()
+ #rect(height: 2cm, fill: gray)
+]
+
+---
+// Placed item in the first region.
+#set page(height: 5cm, margin: 1cm)
+Placed item in the first region.
+#block(breakable: true, above: 1cm, stroke: 1pt, inset: 0.5cm)[
+ #place(dx: -0.5cm, dy: -0.75cm, box(width: 200%)[OOF])
+ #rect(height: 2cm, fill: gray)
+]
+
+---
+// In-flow item with size zero in the first region.
+#set page(height: 5cm, margin: 1cm)
+In-flow, zero-sized item.
+#block(breakable: true, stroke: 1pt, inset: 0.5cm)[
+ #set block(spacing: 0pt)
+ #line(length: 0pt)
+ #rect(height: 2cm, fill: gray)
+ #line(length: 100%)
+]
+
+---
+// Counter update and placed item in the first region.
+#set page(height: 5cm, margin: 1cm)
+Counter update + place.
+#block(breakable: true, above: 1cm, stroke: 1pt, inset: 0.5cm)[
+ #counter("dummy").step()
+ #place(dx: -0.5cm, dy: -0.75cm, box([OOF]))
+ #rect(height: 2cm, fill: gray)
+]
+
+---
+// Mix-and-match all the previous ones.
+#set page(height: 5cm, margin: 1cm)
+Mix-and-match all the previous tests.
+#block(breakable: true, above: 1cm, stroke: 1pt, inset: 0.5cm)[
+ #counter("dummy").step()
+ #place(dx: -0.5cm, dy: -0.75cm, box(width: 200%)[OOF])
+ #line(length: 100%)
+ #place(dy: -0.8em)[OOF]
+ #rect(height: 2cm, fill: gray)
+]