diff --git a/crates/layout/src/floats.rs b/crates/layout/src/floats.rs index 933c09c321..89264cbb27 100644 --- a/crates/layout/src/floats.rs +++ b/crates/layout/src/floats.rs @@ -718,12 +718,18 @@ pub(crate) fn place_objects(ctx: &mut Ctx, req: &ObjectPlacement) -> (Vec Document { + let mut d = Document::from_text(""); + d.body = vec![wordcraft_doc::para_block(Paragraph::with_text(&"x\n".repeat(n), CharProps::default()))]; + d +} + +/// The piece of a long paragraph on each page looked through every line of the paragraph for the +/// pictures and shapes to draw with it (#6757). +#[test] +fn a_paragraph_over_many_pages_lays_out_in_linear_time() { + let pages = lay(&many_lines(SCALE * 400), &LayoutOptions::default()).pages.len(); + assert!(pages > 40, "the paragraph runs over many pages: {pages}"); + assert_layout_linear("a paragraph over many pages", 400, many_lines, &LayoutOptions::default()); +} + /// A table of `n` rows of 60 cells, each row exactly half a point high, so every cell clips its /// (empty) paragraph and the whole table fits on the first page. fn clipped_table(n: usize) -> Document {