diff --git a/tests/ref/grid-rtl-rowspan-counter-equal.png b/tests/ref/grid-rtl-rowspan-counter-equal.png new file mode 100644 index 000000000..fb0df44ad Binary files /dev/null and b/tests/ref/grid-rtl-rowspan-counter-equal.png differ diff --git a/tests/ref/grid-rtl-rowspan-counter-unequal-1.png b/tests/ref/grid-rtl-rowspan-counter-unequal-1.png new file mode 100644 index 000000000..fffccc566 Binary files /dev/null and b/tests/ref/grid-rtl-rowspan-counter-unequal-1.png differ diff --git a/tests/ref/grid-rtl-rowspan-counter-unequal-2.png b/tests/ref/grid-rtl-rowspan-counter-unequal-2.png new file mode 100644 index 000000000..98265def8 Binary files /dev/null and b/tests/ref/grid-rtl-rowspan-counter-unequal-2.png differ diff --git a/tests/suite/layout/grid/rtl.typ b/tests/suite/layout/grid/rtl.typ index 866c8257b..971c5198f 100644 --- a/tests/suite/layout/grid/rtl.typ +++ b/tests/suite/layout/grid/rtl.typ @@ -213,3 +213,73 @@ #context test.get().first() ], ) + +--- grid-rtl-rowspan-counter-equal --- +// Test interaction between RTL and counters +#set text(dir: rtl) +#let test = counter("test") +#grid( + columns: (1fr, 1fr), + inset: 5pt, + align: center, + grid.cell(rowspan: 2, [ + a: // should produce 1 + #test.step() + #context test.get().first() + ]), + grid.cell(rowspan: 2, [ + b: // should produce 2 + #test.step() + #context test.get().first() + ]), +) + +--- grid-rtl-rowspan-counter-unequal-1 --- +// Test interaction between RTL and counters +#set text(dir: rtl) +#let test = counter("test") +#grid( + columns: (1fr, 1fr), + inset: 5pt, + align: center, + grid.cell(rowspan: 1, [ + a: // should produce 1 + #test.step() + #context test.get().first() + ]), + grid.cell(rowspan: 2, [ + b: // should produce 2 + #test.step() + #context test.get().first() + ]), + grid.cell(rowspan: 1, [ + c: // should produce 3 + #test.step() + #context test.get().first() + ]), +) + +--- grid-rtl-rowspan-counter-unequal-2 --- +// Test interaction between RTL and counters +#set text(dir: rtl) +#let test = counter("test") +#grid( + columns: (1fr, 1fr), + inset: 5pt, + align: center, + grid.cell(rowspan: 2, [ + a: // should produce 1 + #test.step() + #context test.get().first() + ]), + grid.cell(rowspan: 1, [ + b: // should produce 2 + #test.step() + #context test.get().first() + ]), + grid.cell(rowspan: 1, [ + d: // should produce 3 + #test.step() + #context test.get().first() + ]), +)