From daf9a99eb2f5f34f3d37cc6048d682a9268267d1 Mon Sep 17 00:00:00 2001 From: Dmitrii Khlapov Date: Fri, 9 Oct 2026 14:48:15 +0200 Subject: [PATCH] Layout: first-page header test no longer depends on installed fonts (#65) tall_first_page_header_pushes_body_down compared page 1's first line with the last paragraph on the last page. Where Aptos falls back to Liberation Sans (Linux without Carlito), the last page is nearly full and that paragraph sits below page 1's first line, so the test failed although layout was correct. Compare with the first paragraph on page 2 instead, which is what the test means: later pages don't reserve the tall first-page header's space. Co-authored-by: Dmitrii Khlapov <19991457+dkhlapov@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 --- crates/layout/src/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/layout/src/tests.rs b/crates/layout/src/tests.rs index 554bfba34..cc35e6487 100644 --- a/crates/layout/src/tests.rs +++ b/crates/layout/src/tests.rs @@ -166,7 +166,9 @@ fn tall_first_page_header_pushes_body_down() { let l = lay(&d); let first = l.caret(&Pos::body(0, 0)).unwrap(); assert!(first.top > d.last_section.margin_top + 50.0, "{first:?}"); - let later = l.caret_on(&Pos::body(119, 0), l.pages.len() - 1).unwrap(); + // The first paragraph on page 2 (which has no header) sits higher than page 1's first line, + // whatever the installed fonts do to pagination. + let later = (0..120).filter_map(|i| l.caret(&Pos::body(i, 0))).find(|c| c.page == 1).unwrap(); assert!(later.top < first.top, "{later:?}"); }