fix(anatomy): V1-2.2 refuse a root visibility that hides the markers
Both composers append the marker layer as the root's last child, so a root visibility="hidden" whose children set visible back drew the drawing without a marker (0 marker pixels in Chromium and Firefox, PDF and canvas). The reader refuses any root visibility but visible (root_visibility); cleaning, verdict, preview, PDF gate and both composers answer it.
This commit is contained in:
1 parent
81f7639c75
commit
d8562f60f5
14 files changed
+509
-169
No files matched your search
@@ -490,3 +490,29 @@ fn holders<'a>(element: &'a Element, id: &str, out: &mut Vec<&'a Element>) {
|
||||
holders(child, id, out);
|
||||
}
|
||||
}
|
||||
|
||||
/// V1-2.2 owner brief 2026-10-30 (root visibility, `tests/svg_root_visibility.rs`): a snapshot
|
||||
/// drawing whose root is not `visible`, its children set `visible` back, is refused at the gate
|
||||
/// (`snapshot_invalid`, `asset root_visibility`): its markers would not show in the PDF.
|
||||
#[test]
|
||||
fn the_pdf_refuses_a_drawing_whose_root_hides_the_markers() {
|
||||
for value in ["hidden", "collapse", "HIDDEN", "inherit"] {
|
||||
let edit = move |svg: &str| {
|
||||
let tagged = svg.replacen("<svg", &format!("<svg visibility=\"{value}\""), 1);
|
||||
let open = tagged.find("<svg").unwrap();
|
||||
let end = open + tagged[open..].find('>').unwrap() + 1;
|
||||
format!(
|
||||
"{}<g visibility=\"visible\">{}</g></svg>",
|
||||
&tagged[..end],
|
||||
tagged[end..].trim_end().trim_end_matches("</svg>")
|
||||
)
|
||||
};
|
||||
match export_with_drawing(edit) {
|
||||
Err(error) => {
|
||||
assert_eq!(error.kind, ExportErrorKind::SnapshotInvalid, "{value}");
|
||||
assert_eq!(error.detail, "asset root_visibility", "{value}");
|
||||
}
|
||||
Ok(_) => panic!("{value}: composed"),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user