@@ -127,24 +127,31 @@ int main()
127127 const long drawn = ink (surf);
128128 std::printf (" non-transparent pixels: %ld\n " , drawn);
129129
130- if (families > 0 ) {
130+ // ⚠️ THE GUARD IS THE LAYOUT'S OWN METRICS, NOT THE FAMILY COUNT.
131+ //
132+ // `families > 0` looked like enough and is not. A CI runner reported FOUR
133+ // families and measured this layout at 80x858545 — a nonsense height on a
134+ // 100px surface, because "four families" there means fontconfig has
135+ // entries but no usable font behind them. The glyphs then land off the
136+ // surface and the ink count is arbitrary: 0 in one process and 116 in
137+ // another, from byte-identical drawing code.
138+ //
139+ // An earlier version also asserted `drawn > 100`, which passed here (216
140+ // pixels, 184 families) and failed there (72) — a threshold calibrated to
141+ // the developer's font set is an assertion about the MACHINE. Ink is ink.
142+ const bool usable = families > 0 && w > 0 && h > 0 && h <= 100 ;
143+ if (usable) {
131144 // ⭐ THE WHOLE LINE, IN ONE ASSERTION.
132- check (w > 0 && h > 0 , " the layout measured a non-empty box" );
133- // ⚠️ `> 0`, NOT `> 100`. An earlier version used 100 and PASSED here
134- // (216 pixels, 184 font families) while FAILING on a CI runner with
135- // four families and 72 — because with almost no fonts "世界" renders
136- // as tofu boxes and the ink is thinner. The threshold was calibrated
137- // to the developer's font set, which makes it an assertion about the
138- // MACHINE rather than about this build. Ink is ink: any positive count
139- // proves all seven packages put pixels down.
140145 check (drawn > 0 ,
141146 " pango_cairo_show_layout put ink on the surface — seven packages" );
142147 } else {
143- // Not a pass. The runner has no fonts, so the only real check could
144- // not run, and saying so is the point.
145- std::printf (" ⚠️ 0 font families: this runner has no fonts, so the\n "
146- " rendering assertion was NOT run. That is a property\n "
147- " of the machine, not of this build.\n " );
148+ // Not a pass. The machine cannot render, so the only real check could
149+ // not run, and saying so is the point: "it was skipped" and "it worked"
150+ // must not look alike.
151+ std::printf (" \342\232\240 no usable font (families=%d, layout %dx%d on a\n "
152+ " 100px surface): the rendering assertion was NOT run.\n "
153+ " That is a property of this machine, not this build.\n " ,
154+ families, w, h);
148155 check (drawn >= 0 , " the surface is readable (rendering check skipped)" );
149156 }
150157
0 commit comments