Skip to content

test(layout): the wrapped map title test picks its names in the installed fonts (#3043) - #3045

Merged
jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:test/3043-wrapped-title-fonts
Nov 27, 2026
Merged

jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:test/3043-wrapped-title-fonts

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

a_wrapped_map_title_is_sized_for_its_drawn_lines (from #2972) still fails on main on Fedora with Noto Sans. Its four map names were picked to sit at the wrap boundary in the fonts of the Ubuntu runner; in other fonts the classic name fits on one line. #3046 fixed macOS and Windows by skipping a style whose title doesn't wrap there, but on Linux every title must still wrap, so other Linux fonts keep failing.

The test now checks each style's box against the drawn lines twice: on a long name, and on a name found on the machine it runs on, from a fixed sequence made from a fixed word list, whose title wraps and which the sheet's line breaking counts differently from the drawn lines. Not every font has such a name for every style (banner on macOS has none in the 20,000 tried), so the test requires one in at least one style and panics otherwise: it never passes without having told the two line breakings apart. This replaces the per-platform skip from #3046: every style is checked on every platform. Test only; no product code changes.

Testing

On Fedora with Noto Sans:

  • the test fails on main with test(layout): a wrapped map title is checked where its names wrap #3046 in it (c2bf412f);
  • with this change it passes, in about 2 s;
  • with the title's box temporarily sized by the sheet's line breaking instead (report::wrap_with in cmd/layout.rs), it fails on classic (3 lines sized, 2 drawn);
  • the same on each of the other styles run alone: banner, panel and editorial fail;
  • fmt, clippy -D warnings on rustgis-engine and the 13 layout_title tests pass.

Pull requests run these tests on Ubuntu only, so this one is labelled ci:windows and ci:macos.

UI evidence

No visible UI change.

Related issue

Closes #3043

Summary by CodeRabbit

  • Tests
    • Expanded coverage of title wrapping across sheet and page renderers. Tests now compare title-box sizing with the rendered lines across four text styles, using font-aware candidate names to check cases where the renderers wrap differently. This helps detect inconsistencies across available fonts and rendering environments.

@jgregoriorincon jgregoriorincon added ci:macos Run the macOS CI jobs on this pull request ci:windows Run the Windows CI jobs on this pull request labels Nov 26, 2026
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The layout-title test generates repeatable candidate names and searches installed fonts for cases where page and sheet line counts differ. For each of four styles, it checks title-box sizing against the page’s drawn lines.

Changes: Layout-title test

Layer / File(s) Summary
Generate and verify wrapping cases
crates/engine/src/tests/layout_title.rs
The test uses a fixed-seed generator to search candidate names across four styles. It checks title-box sizing against drawn lines for LONG and for a candidate whose page and sheet line counts differ.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other · Severity of issue fixed: Low

Possibly related PRs

  • opengeos/RustGIS#3046: It changes the same test to handle font-dependent wrapping, so it overlaps with this fix.
  • opengeos/RustGIS#2972: It introduced the map-title wrapping and sizing behavior that this test checks.

Suggested reviewers: mavrick-f

Merge Risk: Minimal · up to 8f0a4

This is a test-only change with no product behavior impact. No actionable merge risk remains; the platform CI runs requested by the labels will confirm the behavior on other systems.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the test change (picking wrapped map names in the installed fonts) and matches the sole change in the PR, which only touches the layout title test. It is specific enough for a teammate…
Linked Issues check Passed Issue #3043 requires a test-only fix. At head, a_wrapped_map_title_is_sized_for_its_drawn_lines in crates/engine/src/tests/layout_title.rs meets each stated requirement. (1) It uses a fixed-seed lin…
Out of Scope Changes check Passed The PR summary and the change summary both state that the only changed file is crates/engine/src/tests/layout_title.rs, and the PR makes no product-code changes. The head version of that file contains…
Description check Passed The description covers the required sections. The Summary states what changed and why: the test fails on Fedora with Noto Sans, and the change replaces the per-platform skip with a search for a discri…
Full details: Title check

Explanation

The title names the test change (picking wrapped map names in the installed fonts) and matches the sole change in the PR, which only touches the layout title test. It is specific enough for a teammate scanning history. The title uses the conventional test(scope) prefix and includes the issue number.

Full details: Linked Issues check

Explanation

Issue #3043 requires a test-only fix. At head, a_wrapped_map_title_is_sized_for_its_drawn_lines in crates/engine/src/tests/layout_title.rs meets each stated requirement. (1) It uses a fixed-seed linear congruential generator (candidate) over the fixed WORDS list, so the search is deterministic and runs on the test machine. (2) For each style, it checks the title box against the drawn lines on LONG (sized_as_drawn). (3) It accepts a candidate only if the page's wrapped line count is above 1 and differs from the count from report::wrap_with (breaks_differ), and the title wraps. (4) It checks the box against the drawn lines for that candidate. (5) It asserts told_apart and panics when no style finds such a name. The author-reported results (failing on main on Fedora with Noto Sans, passing with this change) were not re-run here. The check relies on the file content and the code shown, not on those reports.

Full details: Out of Scope Changes check

Explanation

The PR summary and the change summary both state that the only changed file is crates/engine/src/tests/layout_title.rs, and the PR makes no product-code changes. The head version of that file contains only test helpers and tests (drawn_lines, sized_lines, candidate, breaks_differ, and the new test body). Every changed item supports the objective in #3043. The whole-PR diff could not be read: the changed blobs were missing from the checkout. Scope therefore rests on the summaries and the head file content, not on a verified diff of product code.

Full details: Description check

Explanation

The description covers the required sections. The Summary states what changed and why: the test fails on Fedora with Noto Sans, and the change replaces the per-platform skip with a search for a discriminating name on the running machine. The Testing section lists concrete verification on Fedora, including a negative check with the sheet's line breaking. The UI evidence section keeps the template line 'No visible UI change.' The Related issue section says 'Closes #3043'. The template's comment asks for screenshots only when UI changes, so none are needed here. The description is complete and specific.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit seeds names in a list,
Then checks how each title is split.
Four styles take their turn,
While page and sheet lines are discerned,
The drawn lines set the box just right.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 0296584d-36b8-47df-a371-bb30142eddbc
Commits

Reviewing files that changed from the base of the PR and between 1c02803 and 8f0a4b5.

Files selected for processing: 1

  • crates/engine/src/tests/layout_title.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

Comment thread crates/engine/src/tests/layout_title.rs Resolved
Comment thread crates/engine/src/tests/layout_title.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

PR #3045 changes one file, crates/engine/src/tests/layout_title.rs. It is a test-only change and touches no product code. I found no bugs or security issues. I did not run the tests, so the claims below rest on reading the code.

Bugs

None found. I checked the candidate search for correctness: candidate yields 6 to 29 words, and the LCG and wrapping_* arithmetic cannot panic. The titled helper sets the title's box, size, face and alignment from the element that the sheet builds. The found assertion means the test cannot pass without finding a name where the two line breakings differ. The wraps check keeps only titles that actually wrap.

Security

None. The change adds no input handling outside the test.

Performance

  • Unbounded search (confidence: moderate-low, inline comment posted at line 187). The search can try up to 20,000 candidates per style. Each candidate that passes the screen costs two full wraps, and nothing bounds the time. If the installed fonts yield no differing candidate, the test runs the whole search before it fails. A smaller cap and the count tried in the panic message would fix this.

Quality

  • breaks_differ naming and return type (confidence: high, inline comment posted at line 175). It returns Option<usize> but is used as a predicate in one place and for its count in another.
  • Mutation coverage (confidence: moderate). The PR reports that the regression was checked by a mutation for classic only. The banner, panel and editorial styles use pad = 0.0, which takes a different branch of the assertion. A mutation check on those styles would show the test covers them.
  • Oracle fidelity (confidence: moderate, no action needed). by_the_sheet models the pre-fix sizing (report::wrap_with on the filled name), not any current product path. The real sheet reaches wrap_with only for {map} lines that fit, so the oracle is a counterfactual. That is fine for a regression test, but a comment saying so would help a future reader.
  • Direct mutation of s.project.layouts (confidence: low). titled clears the layouts directly instead of through a command. Undo history is left pointing at cleared layouts. The test never undoes, so this is harmless today.

AGENTS.md

No breaks found. The test has no timer waits and no ignored tests. Its assertions are not tautologies. The lines I checked fit the 140-column rustfmt.toml limit. I did not check the ci:windows and ci:macos labels, which the PR says were applied.

Prior reviews

No earlier review threads on this PR, so none were left alone.

Change size

Compared with main, merge base 5d49160 to PR head 8b579b4.

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 14.9 KB
Size after 17.0 KB
Total size change +2.0 KB
File Before After Change
crates/engine/src/tests/layout_title.rs 14.9 KB 17.0 KB +2.0 KB

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the other review points:

  • Mutation coverage: with the title sized by report::wrap_with, each of the other styles fails too, run one at a time: banner (2 lines sized, 3 drawn), panel (10, 9), editorial (4, 5).
  • by_the_sheet is a counterfactual on purpose; the test's doc comment says the box must not be sized that way.
  • Clearing s.project.layouts directly is harmless here: the test never undoes.

@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3045/
Web app https://preview.rustgis.app/pr-3045/app/
Commit 8f0a4b5

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon marked this pull request as draft November 26, 2026 20:42
Comment thread crates/engine/src/tests/layout_title.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: one file, crates/engine/src/tests/layout_title.rs, a test-only change. I read the diff, the prior threads, and the helpers the new code calls (wrap_with, serif_width_mm, width_mm, wrapped_lines, TextAlign/FontFamily, which derive Copy). I did not build or run the test. The PR says it was run on Fedora only.

Bugs: none found. The types, borrows and helper signatures line up as far as I can check by reading. The LCG in candidate is deterministic, and its word count range of 6 to 29 matches the doc comment.

Security: none. The change is test code only.

Performance:

  • layout_title.rs:197: the search for a telling name runs in full for any style that has none. The earlier cap thread answered that the cost only matters when the test is about to fail. The PR body contradicts that: on macOS, banner finds no candidate in 20,000 and the test still passes. I re-raised this inline with that evidence. Confidence: medium. I have not timed it.

Quality:

  • The "some style must find one" gate is test-wide. On a font set where banner finds no telling name, its box is only checked on LONG, so a sizing regression in that style would go unnoticed on that platform. The other styles still catch the bug class, so this is a coverage gap, not a defect. Confidence: low to medium. Not posted inline.
  • The new test was verified on Fedora only. The ci:windows and ci:macos runs are the real check for the "some style finds a name" assertion on other font sets. Confidence that it passes there: unknown until those runs finish.
  • I left one earlier concern alone: the breaks_differ naming thread (line 177 earlier, now about line 77). It was answered by the author and I have no new evidence. I re-raised one earlier concern (the search cap, now at line 197) because the answer's premise is contradicted by the PR body.

AGENTS.md:

  • No violations found. The panics and unwraps are in test code, which the rules allow.
  • test-hygiene concerns: no assert_eq! compares identical tokens, and no timer waits or ignored tests were added.
  • The twin-family check does not apply, since the change touches no command, reader, overlay tool or wasm branch.

Change size

Compared with main (merge base 5d49160 to PR head 1c02803): the whole PR, not the latest push.

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 14.9 KB
Size after 17.4 KB
Total size change +2.5 KB
Path Before After Change
crates/engine/src/tests/layout_title.rs 14.9 KB 17.4 KB +2.5 KB

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Scope: one test file, crates/engine/src/tests/layout_title.rs. No product code changes. I read the diff, the helpers it calls (wrap_with, serif_width_mm, width_mm, wrapped_lines), and the sheet's title sizing in cmd/layout.rs:1413-1430. I could not compile or run the test here.

Bugs

  • None found. I checked the types (FontFamily and TextAlign are Copy, Text.size is f64, wrapped_lines takes the arguments the test passes), the closure borrows (titled takes &mut Session and the search loop holds no conflicting borrow), and the candidate generator (6 to 29 words, deterministic). The screen mirrors the sheet and page wraps that the product uses. Confidence: high.

Security

  • None.

Performance

  • Screening runs the sheet wrap before the page wrap, so a candidate that fits on one line still pays for a sheet wrap. Reordering the two keeps the result the same and reduces the search cost. The reordered version is posted inline. Confidence: medium on the saving, high that the result is unchanged.

Quality

  • No new points. I left the earlier concerns alone (see the count below).

AGENTS.md

  • None. The change is test-only, adds no timer waits or #[ignore], has no assert_eq! with identical sides, and the PR's ci:windows and ci:macos labels match its note that the other platforms are untested.

Not verified

  • The author ran this on Fedora only. The Windows and macOS results come from the labelled CI runs and are not checked here.

Earlier concerns left alone

I left 3 earlier concerns alone, because the author answered them and no new evidence was posted: the Option<usize> naming, the cost of the full search for banner on passing macOS runs, and the search cap with the panic message. The cap thread is outdated.

Change size

Compared with the base branch: the whole PR against main (merge base 5d49160 to PR head 1c02803).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 14.9 KB
Size after 17.4 KB
Total size change +2.5 KB
Path Before After Change
crates/engine/src/tests/layout_title.rs 14.9 KB 17.4 KB +2.5 KB

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the screening order (the inline suggestion it mentions isn't on the PR): leaving it as it is. It saves test time only, and the PR is approved with its platform runs under way, which a push would restart.

…itle-fonts

# Conflicts:
#	crates/engine/src/tests/layout_title.rs
Comment thread crates/engine/src/tests/layout_title.rs Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security problems, or AGENTS.md breaks in this test-only change. One quality point is posted inline. I checked the test's sheet measure against the product sizing in cmd/layout.rs (broken, around lines 1413–1427) and it matches. The candidate generator's length stays well under the 200-character name cap, and the title box width doesn't depend on the map name, so the LONG screen is exact.

Bugs: none found.

Security: none found.

Performance: no new concerns. The 20,000-candidate search cost was raised on earlier threads and I left it alone (see below).

Quality:

  • layout_title.rs:184: the by_the_page.len() > 1 guard means names the page draws as one line, but the sheet breaks into two or more, are never checked. The guard can go. Confidence: low to medium. I haven't measured whether such names occur in the installed fonts. Posted inline.

AGENTS.md: no breaks found. The test has no timer waits, its assert_eq! sides differ, and the change adds no assets. The titled closure's layouts.clear() and the unconditional wraps check are safe: the existing a_map_name_wider_than_the_title… test already asserts wrapping for these four styles on every platform.

Twins: not applicable. The change is test-only and touches no format reader, overlay tool, add/open command, or wasm branch.

Earlier concerns: I left 3 alone because they were already raised and answered: the breaks_differ return-type naming (line 177), the cost of the search on passing macOS runs (line 197), and the 20,000 cap (line 187, outdated). The author's answers stand, and the search cost is an accepted trade-off.

Change size

Compared: the whole PR against main (merge base bd73d65 to PR head 8f0a4b5).

Measure Value
Files changed 1 (added 0, modified 1, removed 0, renamed 0)
Size before 15.2 KB
Size after 17.4 KB
Total size change +2.2 KB
Path Before After Change
crates/engine/src/tests/layout_title.rs 15.2 KB 17.4 KB +2.2 KB

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 26, 2026
@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit 09f7541 Nov 27, 2026
36 checks passed
@jgregoriorincon
jgregoriorincon deleted the test/3043-wrapped-title-fonts branch November 27, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:macos Run the macOS CI jobs on this pull request ci:windows Run the Windows CI jobs on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: a layout title test fails on Windows, macOS and some Linux: its map names fit the title box in other fonts

1 participant