io: assert the embedded-SVG depth boundary is blank

The deepest-chain test treated any Ok raster as an accepted chain. At MAX_EMBEDDED_SVG_DEPTH + 1 the bounded non-strict path intentionally omits the image and returns a transparent canvas, so the test asserted the opposite of the documented behavior. Check that the over-limit image is blank instead.
This commit is contained in:
Dylan M. Taylor committed 2026-11-14 17:02:17 -05:00
1 parent 0fd3210c20
commit 0aba3962f2
1 file changed
+8 -1
+8 -1
View File
@@ -1045,7 +1045,14 @@ fn the_deepest_chain_of_embedded_svg_images_fits_a_small_stack() {
for levels in 1..=MAX_EMBEDDED_SVG_DEPTH + 1 {
match rasterize_bounded(chain(levels).as_bytes(), 1.0, MAX_RASTER_PIXELS) {
Ok(buf) => {
assert!(buf.px[4 * 8 + 4][3] > 0.99, "{levels} levels: the innermost rect draws through every level");
let drawn = buf.px[4 * 8 + 4][3] > 0.99;
if levels > MAX_EMBEDDED_SVG_DEPTH {
// A chain past the limit is left out rather than rejected; it must not
// still draw its innermost image through the exhausted depth budget.
assert!(!drawn, "{levels} levels: the too-deep image is left out");
break;
}
assert!(drawn, "{levels} levels: the innermost rect draws through every level");
accepted = levels;
}
Err(_) => assert!(accepted > 0, "a one-level chain renders"),