diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /tests/suite/layout/flow | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'tests/suite/layout/flow')
| -rw-r--r-- | tests/suite/layout/flow/flow.typ | 67 | ||||
| -rw-r--r-- | tests/suite/layout/flow/invisibles.typ | 61 | ||||
| -rw-r--r-- | tests/suite/layout/flow/orphan.typ | 31 |
3 files changed, 159 insertions, 0 deletions
diff --git a/tests/suite/layout/flow/flow.typ b/tests/suite/layout/flow/flow.typ new file mode 100644 index 00000000..9c48c9ac --- /dev/null +++ b/tests/suite/layout/flow/flow.typ @@ -0,0 +1,67 @@ +--- flow-fr --- +#set page(height: 2cm) +#set text(white) +#rect(fill: forest)[ + #v(1fr) + #h(1fr) Hi you! +] + +--- issue-flow-overlarge-frames --- +// In this bug, the first line of the second paragraph was on its page alone an +// the rest moved down. The reason was that the second block resulted in +// overlarge frames because the region wasn't finished properly. +#set page(height: 70pt) +#block[This file tests a bug where an almost empty page occurs.] +#block[ + The text in this second block was torn apart and split up for + some reason beyond my knowledge. +] + +--- issue-flow-trailing-leading --- +// In this bug, the first part of the paragraph moved down to the second page +// because trailing leading wasn't trimmed, resulting in an overlarge frame. +#set page(height: 60pt) +#v(19pt) +#block[ + But, soft! what light through yonder window breaks? + It is the east, and Juliet is the sun. +] + +--- issue-flow-weak-spacing --- +// In this bug, there was a bit of space below the heading because weak spacing +// directly before a layout-induced column or page break wasn't trimmed. +#set page(height: 60pt) +#rect(inset: 0pt, columns(2)[ + Text + #v(12pt) + Hi + #v(10pt, weak: true) + At column break. +]) + +--- issue-flow-frame-placement --- +// In this bug, a frame intended for the second region ended up in the first. +#set page(height: 105pt) +#block(lorem(20)) + +--- issue-flow-layout-index-out-of-bounds --- +// This bug caused an index-out-of-bounds panic when layouting paragraphs needed +// multiple reorderings. +#set page(height: 200pt) +#lorem(30) + +#figure(placement: auto, block(height: 100%)) + +#lorem(10) + +#lorem(10) + +--- issue-3641-float-loop --- +// Flow layout should terminate! +// +// This is not yet ideal: The heading should not move to the second page, but +// that's a separate bug and not a regression. +#set page(height: 40pt) + += Heading +#lorem(6) diff --git a/tests/suite/layout/flow/invisibles.typ b/tests/suite/layout/flow/invisibles.typ new file mode 100644 index 00000000..7e460373 --- /dev/null +++ b/tests/suite/layout/flow/invisibles.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. + +--- flow-first-region-no-item --- +// 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) +] + +--- flow-first-region-counter-update --- +// 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) +] + +--- flow-first-region-placed --- +// 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) +] + +--- flow-first-region-zero-sized-item --- +// 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%) +] + +--- flow-first-region-counter-update-and-placed --- +// 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) +] + +--- flow-first-region-counter-update-placed-and-line --- +// 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) +] diff --git a/tests/suite/layout/flow/orphan.typ b/tests/suite/layout/flow/orphan.typ new file mode 100644 index 00000000..70eac731 --- /dev/null +++ b/tests/suite/layout/flow/orphan.typ @@ -0,0 +1,31 @@ +// Test that lines and headings doesn't become orphan. + +--- flow-heading-no-orphan --- +#set page(height: 100pt) +#lorem(12) + += Introduction +This is the start and it goes on. + +--- flow-par-no-orphan-and-widow-lines --- +// LARGE +#set page("a8", height: 140pt) +#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) |
