summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/grid-footer-expand.pngbin365 -> 0 bytes
-rw-r--r--tests/ref/grid-footer-moved-to-bottom-of-rowspans.pngbin0 -> 1182 bytes
-rw-r--r--tests/ref/grid-footer-top-hlines-with-only-row-pos-cell.pngbin0 -> 385 bytes
-rw-r--r--tests/ref/grid-footer-top-hlines-with-row-and-auto-pos-cell.pngbin0 -> 579 bytes
-rw-r--r--tests/ref/grid-header-cell-with-x.pngbin0 -> 419 bytes
-rw-r--r--tests/ref/grid-header-expand.pngbin2005 -> 0 bytes
-rw-r--r--tests/ref/issue-5359-column-override-stays-inside-footer.pngbin0 -> 674 bytes
-rw-r--r--tests/suite/layout/grid/footers.typ159
-rw-r--r--tests/suite/layout/grid/headers.typ106
9 files changed, 255 insertions, 10 deletions
diff --git a/tests/ref/grid-footer-expand.png b/tests/ref/grid-footer-expand.png
deleted file mode 100644
index 6b173b0d..00000000
--- a/tests/ref/grid-footer-expand.png
+++ /dev/null
Binary files differ
diff --git a/tests/ref/grid-footer-moved-to-bottom-of-rowspans.png b/tests/ref/grid-footer-moved-to-bottom-of-rowspans.png
new file mode 100644
index 00000000..d8a9c74f
--- /dev/null
+++ b/tests/ref/grid-footer-moved-to-bottom-of-rowspans.png
Binary files differ
diff --git a/tests/ref/grid-footer-top-hlines-with-only-row-pos-cell.png b/tests/ref/grid-footer-top-hlines-with-only-row-pos-cell.png
new file mode 100644
index 00000000..f78e80c1
--- /dev/null
+++ b/tests/ref/grid-footer-top-hlines-with-only-row-pos-cell.png
Binary files differ
diff --git a/tests/ref/grid-footer-top-hlines-with-row-and-auto-pos-cell.png b/tests/ref/grid-footer-top-hlines-with-row-and-auto-pos-cell.png
new file mode 100644
index 00000000..fda05a3c
--- /dev/null
+++ b/tests/ref/grid-footer-top-hlines-with-row-and-auto-pos-cell.png
Binary files differ
diff --git a/tests/ref/grid-header-cell-with-x.png b/tests/ref/grid-header-cell-with-x.png
new file mode 100644
index 00000000..65982625
--- /dev/null
+++ b/tests/ref/grid-header-cell-with-x.png
Binary files differ
diff --git a/tests/ref/grid-header-expand.png b/tests/ref/grid-header-expand.png
deleted file mode 100644
index d0fbd72e..00000000
--- a/tests/ref/grid-header-expand.png
+++ /dev/null
Binary files differ
diff --git a/tests/ref/issue-5359-column-override-stays-inside-footer.png b/tests/ref/issue-5359-column-override-stays-inside-footer.png
new file mode 100644
index 00000000..8339a409
--- /dev/null
+++ b/tests/ref/issue-5359-column-override-stays-inside-footer.png
Binary files differ
diff --git a/tests/suite/layout/grid/footers.typ b/tests/suite/layout/grid/footers.typ
index edbb36fb..f7f1deb0 100644
--- a/tests/suite/layout/grid/footers.typ
+++ b/tests/suite/layout/grid/footers.typ
@@ -83,12 +83,55 @@
grid.cell(y: 1)[c],
)
---- grid-footer-expand ---
-// Ensure footer properly expands
+--- grid-footer-cell-with-x ---
+#grid(
+ columns: 2,
+ stroke: black,
+ inset: 5pt,
+ grid.cell(x: 1)[a],
+ // Error: 3-56 footer must end at the last row
+ grid.footer(grid.cell(x: 0)[b1], grid.cell(x: 0)[b2]),
+ // This should skip the footer
+ grid.cell(x: 1)[c]
+)
+
+--- grid-footer-no-expand-with-col-and-row-pos-cell ---
+#grid(
+ columns: 2,
+ [a], [],
+ [b], [],
+ fill: (_, y) => if calc.odd(y) { blue } else { red },
+ inset: 5pt,
+ grid.cell(x: 1, y: 3, rowspan: 4)[b],
+ grid.cell(y: 2, rowspan: 2)[a],
+ grid.footer(),
+ // Error: 3-27 cell would conflict with footer spanning the same position
+ // Hint: 3-27 try reducing the cell's rowspan or moving the footer
+ grid.cell(x: 1, y: 7)[d],
+)
+
+--- grid-footer-no-expand-with-row-pos-cell ---
+#grid(
+ columns: 2,
+ [a], [],
+ [b], [],
+ fill: (_, y) => if calc.odd(y) { blue } else { red },
+ inset: 5pt,
+ grid.cell(x: 1, y: 3, rowspan: 4)[b],
+ grid.cell(y: 2, rowspan: 2)[a],
+ grid.footer(),
+ // Error: 3-33 cell would conflict with footer spanning the same position
+ // Hint: 3-33 try reducing the cell's rowspan or moving the footer
+ grid.cell(y: 6, rowspan: 2)[d],
+)
+
+--- grid-footer-moved-to-bottom-of-rowspans ---
#grid(
columns: 2,
[a], [],
[b], [],
+ stroke: red,
+ inset: 5pt,
grid.cell(x: 1, y: 3, rowspan: 4)[b],
grid.cell(y: 2, rowspan: 2)[a],
grid.footer(),
@@ -113,13 +156,13 @@
)
--- grid-footer-overlap ---
-// Error: 4:3-4:19 footer would conflict with a cell placed before it at column 1 row 0
-// Hint: 4:3-4:19 try reducing that cell's rowspan or moving the footer
#grid(
columns: 2,
grid.header(),
- grid.footer([a]),
- grid.cell(x: 1, y: 0, rowspan: 2)[a],
+ grid.footer(grid.cell(y: 2)[a]),
+ // Error: 3-39 cell would conflict with footer spanning the same position
+ // Hint: 3-39 try reducing the cell's rowspan or moving the footer
+ grid.cell(x: 1, y: 1, rowspan: 2)[a],
)
--- grid-footer-multiple ---
@@ -374,8 +417,8 @@
table.hline(stroke: red),
table.vline(stroke: green),
[b],
+ [c]
),
- table.cell(x: 1, y: 3)[c]
)
--- grid-footer-hline-and-vline-2 ---
@@ -385,8 +428,8 @@
#table(
columns: 3,
inset: 1.5pt,
- table.cell(y: 0)[a],
table.footer(
+ table.cell(y: 0)[a],
table.hline(stroke: red),
table.hline(y: 1, stroke: aqua),
table.cell(y: 0)[b],
@@ -394,6 +437,38 @@
)
)
+--- grid-footer-top-hlines-with-only-row-pos-cell ---
+// Top hlines should attach to the top of the footer.
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 3,
+ inset: 2.5pt,
+ table.footer(
+ table.hline(stroke: red),
+ table.vline(stroke: blue),
+ table.cell(x: 2, y: 2)[a],
+ table.hline(stroke: 3pt),
+ table.vline(stroke: 3pt),
+ )
+)
+
+--- grid-footer-top-hlines-with-row-and-auto-pos-cell ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 3,
+ inset: 2.5pt,
+ table.footer(
+ table.hline(stroke: red),
+ table.vline(stroke: blue),
+ table.cell(x: 2, y: 2)[a],
+ [b],
+ table.hline(stroke: 3pt),
+ table.vline(stroke: 3pt),
+ )
+)
+
--- grid-footer-below-rowspans ---
// Footer should go below the rowspans.
#set page(margin: 2pt)
@@ -404,3 +479,71 @@
table.cell(rowspan: 2)[a], table.cell(rowspan: 2)[b],
table.footer()
)
+
+--- grid-footer-row-pos-cell-inside-conflicts-with-row-before ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 3,
+ inset: 1.5pt,
+ table.cell(y: 0)[a],
+ table.footer(
+ table.hline(stroke: red),
+ table.hline(y: 1, stroke: aqua),
+ // Error: 5-24 cell would cause footer to expand to non-empty row 0
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 0)[b],
+ [c]
+ )
+)
+
+--- grid-footer-auto-pos-cell-inside-conflicts-with-row-after ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 2,
+ inset: 1.5pt,
+ table.cell(y: 1)[a],
+ table.footer(
+ [b], [c],
+ // Error: 6-7 cell would cause footer to expand to non-empty row 1
+ // Hint: 6-7 try moving its cells to available rows
+ [d],
+ ),
+)
+
+--- grid-footer-row-pos-cell-inside-conflicts-with-row-after ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 2,
+ inset: 1.5pt,
+ table.cell(y: 2)[a],
+ table.footer(
+ [b], [c],
+ // Error: 5-24 cell would cause footer to expand to non-empty row 2
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 3)[d],
+ ),
+)
+
+--- grid-footer-conflicts-with-empty-header ---
+#table(
+ columns: 2,
+ table.header(),
+ table.footer(
+ // Error: 5-24 cell would cause footer to expand to non-empty row 0
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 0)[a]
+ ),
+)
+
+--- issue-5359-column-override-stays-inside-footer ---
+#table(
+ columns: 3,
+ [Outside],
+ table.footer(
+ [A], table.cell(x: 1)[B], [C],
+ table.cell(x: 1)[D],
+ ),
+)
diff --git a/tests/suite/layout/grid/headers.typ b/tests/suite/layout/grid/headers.typ
index cb263376..229bce61 100644
--- a/tests/suite/layout/grid/headers.typ
+++ b/tests/suite/layout/grid/headers.typ
@@ -60,6 +60,16 @@
grid.cell(y: 2)[c]
)
+--- grid-header-cell-with-x ---
+#grid(
+ columns: 2,
+ stroke: black,
+ inset: 5pt,
+ grid.header(grid.cell(x: 0)[b1], grid.cell(x: 0)[b2]),
+ // This should skip the header
+ grid.cell(x: 1)[c]
+)
+
--- grid-header-last-child ---
// When the header is the last grid child, it shouldn't include the gutter row
// after it, because there is none.
@@ -273,8 +283,7 @@
)
#context count.display()
---- grid-header-expand ---
-// Ensure header expands to fit cell placed in it after its declaration
+--- grid-header-no-expand-with-col-and-row-pos-cell ---
#set page(height: 10em)
#table(
columns: 2,
@@ -282,9 +291,24 @@
[a], [b],
[c],
),
+ // Error: 3-48 cell would conflict with header spanning the same position
+ // Hint: 3-48 try moving the cell or the header
table.cell(x: 1, y: 1, rowspan: 2, lorem(80))
)
+--- grid-header-no-expand-with-row-pos-cell ---
+#set page(height: 10em)
+#table(
+ columns: 2,
+ table.header(
+ [a], [b],
+ [c],
+ ),
+ // Error: 3-42 cell would conflict with header spanning the same position
+ // Hint: 3-42 try moving the cell or the header
+ table.cell(y: 1, rowspan: 2, lorem(80))
+)
+
--- grid-nested-with-headers ---
// Nested table with header should repeat both headers
#set page(height: 10em)
@@ -368,3 +392,81 @@
[b]
)
)
+
+--- grid-header-row-pos-cell-inside-conflicts-with-row-before ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 3,
+ inset: 1.5pt,
+ table.cell(y: 0)[a],
+ table.header(
+ table.hline(stroke: red),
+ table.hline(y: 1, stroke: aqua),
+ // Error: 5-24 cell would cause header to expand to non-empty row 0
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 0)[b],
+ [c]
+ )
+)
+
+--- grid-header-row-pos-cell-inside-conflicts-with-row-before-after-first-empty-row ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 3,
+ inset: 1.5pt,
+ // Rows: Occupied, Empty, Occupied, Empty, Empty, ...
+ // Should not be able to expand header from the second Empty to the second Occupied.
+ table.cell(y: 0)[a],
+ table.cell(y: 2)[a],
+ table.header(
+ table.hline(stroke: red),
+ table.hline(y: 3, stroke: aqua),
+ // Error: 5-24 cell would cause header to expand to non-empty row 2
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 2)[b],
+ )
+)
+
+--- grid-header-auto-pos-cell-inside-conflicts-with-row-after ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 2,
+ inset: 1.5pt,
+ table.cell(y: 1)[a],
+ table.header(
+ [b], [c],
+ // Error: 6-7 cell would cause header to expand to non-empty row 1
+ // Hint: 6-7 try moving its cells to available rows
+ [d],
+ ),
+)
+
+--- grid-header-row-pos-cell-inside-conflicts-with-row-after ---
+#set page(margin: 2pt)
+#set text(6pt)
+#table(
+ columns: 2,
+ inset: 1.5pt,
+ table.cell(y: 2)[a],
+ table.header(
+ [b], [c],
+ // Error: 5-24 cell would cause header to expand to non-empty row 2
+ // Hint: 5-24 try moving its cells to available rows
+ table.cell(y: 3)[d],
+ ),
+)
+
+--- issue-5359-column-override-stays-inside-header ---
+#table(
+ columns: 3,
+ [Outside],
+ // Error: 1:3-4:4 header must start at the first row
+ // Hint: 1:3-4:4 remove any rows before the header
+ table.header(
+ [A], table.cell(x: 1)[B], [C],
+ table.cell(x: 1)[D],
+ ),
+)