mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
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:
1 file changed
+8
-1
@@ -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"),
|
||||
|
||||
Reference in new issue
Block a user