Fix main: SVG raster depth test after #11009 and #10953

#11009 added a check that rasterize_rgba8 renders 500 nested opacity groups.
#10953, merged after it, refuses whole-drawing rasterisation past 200 nested
layers. The test now expects that refusal as an error, and still renders a
drawing within the limit on the same 512 KiB stack.
This commit is contained in:
FredApps committed 2026-11-11 09:27:55 +01:00
1 parent e17091578e
commit cb5243bf78
1 file changed
+10 -1
+10 -1
View File
@@ -448,7 +448,16 @@ fn retained_deep_svg_groups_lower_render_and_drop_on_a_bounded_worker() {
let (preview, _) = svg::import_svg_preview_with_work("retained.svg", source.as_bytes(), u64::MAX).unwrap();
assert_eq!(preview.document.max_group_depth(), 100);
assert!(pixel(&preview.document)[3] > 0.5);
let (w, h, pixels) = svg::rasterize_rgba8(source.as_bytes()).unwrap();
// Whole-drawing rasterisation refuses more than 200 nested layers (#10953) with an
// error, not a crash; a drawing within that limit still renders on this small stack.
let refused = svg::rasterize_rgba8(source.as_bytes()).unwrap_err().to_string();
assert!(refused.contains("layers are nested too deeply"), "{refused}");
let within = format!(
"<svg {NS} width=\"8\" height=\"8\">{}<rect width=\"8\" height=\"8\"/>{}</svg>",
"<g opacity=\"0.99\"><rect width=\"1\" height=\"1\"/>".repeat(150),
"</g>".repeat(150)
);
let (w, h, pixels) = svg::rasterize_rgba8(within.as_bytes()).unwrap();
assert_eq!((w, h), (8, 8));
assert!(pixels[3] > 127);
})