Skip to content

fix(ci): the svg text tests assumed the host has fonts - #395

Merged
LeadcodeDev merged 1 commit into
mainfrom
fix/svg-text-tests-need-a-font
Sep 27, 2026
Merged

LeadcodeDev merged 1 commit into
mainfrom
fix/svg-text-tests-need-a-font

Conversation

@LeadcodeDev

Copy link
Copy Markdown
Owner

main is red. #394 broke it and this is the fix.

What happened

Two tests from #374 asserted that Helvetica resolves. True on the Mac they were written on; false on CI's Ubuntu runner, which installs libfontconfig1-dev and libfreetype6-dev — the font libraries — and no font files. Nothing resolved, usvg dropped the <text> node, and both tests failed:

test svg::tests::a_resolvable_font_family_matches_declared_and_resolved_text_counts ... FAILED
test svg::tests::svg_text_with_a_system_font_is_rasterized ... FAILED

This is precisely the residual gap #374's own rule file describes — "a render host with zero usable fonts anywhere, e.g. a bare container with no font packages" — arriving as a red build instead of as a bad render.

Both sides were wrong, so both are fixed

The tests no longer name a family. They ask the shared fontdb for one the host actually has, and skip when there is none. They now mean the same thing on a laptop and in a container.

A new test covers the other side head-on: with an empty fontdb, the resolved <text> count is 0. That is the condition the warning exists for, and nothing was asserting it.

CI gains fonts-dejavu-core. A renderer that draws text needs font files on the host. A runner with none is not an environment that can prove anything about text, and leaving it that way would only mean the next text feature discovers this again.

How it reached main

I merged #394 while its test job was still pending. gh pr checks --watch returned on an earlier run and I did not re-read the state before merging — the second time today. Stating it because the fix for that is mine to apply, not the code's.

cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings clean; the eight svg tests pass locally, including the two that failed on CI and the new empty-fontdb one.

#394 turned main red. Two tests written against a Mac asserted that Helvetica
resolves; CI's Ubuntu runner installs `libfontconfig1-dev` and
`libfreetype6-dev` — the font *libraries* — and no font *files* at all, so
nothing resolved and usvg dropped the `<text>` node exactly as it does for any
host with an empty fontdb.

That is the residual gap #374's own rule file documents, arriving as a red
build rather than as a render.

Both sides fixed, because each was wrong on its own:

The tests no longer name a family. They ask the shared fontdb for a family the
host actually has and skip when there is none, so they mean the same thing on a
laptop and in a container. A new test covers the other side directly: with an
empty fontdb the `<text>` count resolves to 0, which is the condition the
warning exists for.

CI gains `fonts-dejavu-core`. A renderer that draws text needs font files on
the host, and a runner that has none is not a realistic environment to prove
anything about text in.

I merged #394 while its `test` job was still pending. That is what let this
reach main.
@LeadcodeDev LeadcodeDev added the bug Something isn't working label Sep 27, 2026
@LeadcodeDev LeadcodeDev self-assigned this Sep 27, 2026
@LeadcodeDev
LeadcodeDev merged commit dc99742 into main Sep 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant