summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPgBiel <9021226+PgBiel@users.noreply.github.com>2024-02-22 05:42:10 -0300
committerGitHub <noreply@github.com>2024-02-22 08:42:10 +0000
commita8671962d6cfde985c49e0ca8ebc27ed4c9118cc (patch)
treef9fb06446bb9e40065b6d31d4056ea4529b8b2e8 /tests
parent92a2f01b7488432df8bd6ed37b7565e39cd76f93 (diff)
Some table improvements [More flexible tables] (#3473)
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/grid-stroke.pngbin48961 -> 48899 bytes
-rw-r--r--tests/ref/layout/grid-styling.pngbin27200 -> 30784 bytes
-rw-r--r--tests/ref/layout/table.pngbin22446 -> 26146 bytes
-rw-r--r--tests/typ/layout/grid-cell.typ4
-rw-r--r--tests/typ/layout/grid-stroke.typ18
-rw-r--r--tests/typ/layout/grid-styling.typ26
-rw-r--r--tests/typ/layout/table-cell.typ4
-rw-r--r--tests/typ/layout/table.typ26
8 files changed, 77 insertions, 1 deletions
diff --git a/tests/ref/layout/grid-stroke.png b/tests/ref/layout/grid-stroke.png
index c31519e6..0f0b562a 100644
--- a/tests/ref/layout/grid-stroke.png
+++ b/tests/ref/layout/grid-stroke.png
Binary files differ
diff --git a/tests/ref/layout/grid-styling.png b/tests/ref/layout/grid-styling.png
index c626d2e7..dc50dd90 100644
--- a/tests/ref/layout/grid-styling.png
+++ b/tests/ref/layout/grid-styling.png
Binary files differ
diff --git a/tests/ref/layout/table.png b/tests/ref/layout/table.png
index f2a9d104..ddd0e043 100644
--- a/tests/ref/layout/table.png
+++ b/tests/ref/layout/table.png
Binary files differ
diff --git a/tests/typ/layout/grid-cell.typ b/tests/typ/layout/grid-cell.typ
index 425d036c..a812fefc 100644
--- a/tests/typ/layout/grid-cell.typ
+++ b/tests/typ/layout/grid-cell.typ
@@ -127,3 +127,7 @@
[Jake], [49], [Epic]
)
}
+
+---
+// Error: 7-19 cannot use `table.cell` as a grid cell; use `grid.cell` instead
+#grid(table.cell[])
diff --git a/tests/typ/layout/grid-stroke.typ b/tests/typ/layout/grid-stroke.typ
index 87389ad5..51b810d9 100644
--- a/tests/typ/layout/grid-stroke.typ
+++ b/tests/typ/layout/grid-stroke.typ
@@ -139,7 +139,7 @@
---
// Line specification order priority
// The last line should be blue, not red.
-// The middle line should have disappeared.
+// The middle aqua line should be gone due to the 'none' override.
#grid(
columns: 2,
inset: 2pt,
@@ -345,6 +345,22 @@
)
---
+// Error: 7-20 cannot use `table.hline` as a grid line; use `grid.hline` instead
+#grid(table.hline())
+
+---
+// Error: 7-20 cannot use `table.vline` as a grid line; use `grid.vline` instead
+#grid(table.vline())
+
+---
+// Error: 8-20 cannot use `grid.hline` as a table line; use `table.hline` instead
+#table(grid.hline())
+
+---
+// Error: 8-20 cannot use `grid.vline` as a table line; use `table.vline` instead
+#table(grid.vline())
+
+---
// Error: 3:3-3:31 line cannot end before it starts
#grid(
columns: 3,
diff --git a/tests/typ/layout/grid-styling.typ b/tests/typ/layout/grid-styling.typ
index e076d0c4..f83c3cc4 100644
--- a/tests/typ/layout/grid-styling.typ
+++ b/tests/typ/layout/grid-styling.typ
@@ -88,6 +88,32 @@ a
[B],
)
+#grid(
+ columns: 3,
+ fill: (x, y) => (if y == 0 { aqua } else { orange }).darken(x * 15%),
+ inset: (x, y) => (left: if x == 0 { 0pt } else { 5pt }, right: if x == 0 { 5pt } else { 0pt }, y: if y == 0 { 0pt } else { 5pt }),
+ [A], [B], [C],
+ [A], [B], [C],
+)
+
+#grid(
+ columns: 3,
+ inset: (0pt, 5pt, 10pt),
+ fill: (x, _) => aqua.darken(x * 15%),
+ [A], [B], [C],
+)
+
+---
+// Test inset folding
+#set grid(inset: 10pt)
+#set grid(inset: (left: 0pt))
+
+#grid(
+ fill: red,
+ inset: (right: 0pt),
+ grid.cell(inset: (top: 0pt))[a]
+)
+
---
// Test interaction with gutters.
#grid(
diff --git a/tests/typ/layout/table-cell.typ b/tests/typ/layout/table-cell.typ
index d79298ae..cbe0b9f0 100644
--- a/tests/typ/layout/table-cell.typ
+++ b/tests/typ/layout/table-cell.typ
@@ -122,3 +122,7 @@
[Jake], [49], [Epic]
)
}
+
+---
+// Error: 8-19 cannot use `grid.cell` as a table cell; use `table.cell` instead
+#table(grid.cell[])
diff --git a/tests/typ/layout/table.typ b/tests/typ/layout/table.typ
index 1b250aa4..89a7dab5 100644
--- a/tests/typ/layout/table.typ
+++ b/tests/typ/layout/table.typ
@@ -61,6 +61,32 @@
[B],
)
+#table(
+ columns: 3,
+ fill: (x, y) => (if y == 0 { aqua } else { orange }).darken(x * 15%),
+ inset: (x, y) => (left: if x == 0 { 0pt } else { 5pt }, right: if x == 0 { 5pt } else { 0pt }, y: if y == 0 { 0pt } else { 5pt }),
+ [A], [B], [C],
+ [A], [B], [C],
+)
+
+#table(
+ columns: 3,
+ inset: (0pt, 5pt, 10pt),
+ fill: (x, _) => aqua.darken(x * 15%),
+ [A], [B], [C],
+)
+
+---
+// Test inset folding
+#set table(inset: 10pt)
+#set table(inset: (left: 0pt))
+
+#table(
+ fill: red,
+ inset: (right: 0pt),
+ table.cell(inset: (top: 0pt))[a]
+)
+
---
// Test interaction with gutters.
#table(