Skip to main content

Module testing

Module testing 

Source
Expand description

Testing helpers for asserting glyph coverage against a font::FontChain (testing::assert_glyphs_covered, testing::uncovered_glyphs). Glyph-coverage testing helpers, feature-gated (testing), no effect on release builds.

A character no font in a FontChain covers still renders: it falls back to the substituted solid block (or, rarely, draws nothing at all – see FontChain::resolve). That fallback is a legitimate cell on its own, so a snapshot test of the rendered output cannot tell “this glyph is missing” from “this glyph is a block on purpose”: both are a stable, correctly-rendered image (crates-lurey-io/retroglyph#1292). This module is the check that actually asks the question a snapshot can’t: does chain.resolve(ch) answer with ch’s own glyph, or with the fallback?

diagnostics::warn_notdef_glyph catches the same gap at render time in a dev build; this module is for asserting it directly in a test, over whatever repertoire a consumer’s own UI actually draws, without hand-rolling a resolve-and-check loop or scanning source text for character literals.

Functions§

assert_glyphs_covered
Asserts every character in chars renders as itself in chain.
is_glyph_covered
Whether ch renders as its own glyph in chain: covered by some font in the chain, not the substituted notdef fallback.
uncovered_glyphs
Every character in chars that does not render as itself in chain, in iteration order, duplicates included.