fix(anatomy): V1-2.2 reserve the PDF halo id in the reader and composers
A drawing defining filter#osteo-halo replaced the PDF halo (a transparent filter erased the marker); an element holding the id before the first defs won its resolution. The reader refuses the id in any letter case (reserved_id), both composers refuse such a tree, the halo is always the engine's. Exact name only: osteo-overlays stays.
This commit is contained in:
1 parent
2f1f0764bf
commit
08efd9a792
13 files changed
+781
-34
No files matched your search
@@ -14,7 +14,9 @@ use std::collections::HashSet;
|
||||
use common::svg_tree::{
|
||||
reread, tree_value, view_names, with_ids_scoped_per_view, with_trigger_names_per_language,
|
||||
};
|
||||
use faunosteo_core::anatomy::compose::{asset_id_of_view, compose_canvas, compose_highlight};
|
||||
use faunosteo_core::anatomy::compose::{
|
||||
ComposeError, asset_id_of_view, compose_canvas, compose_highlight,
|
||||
};
|
||||
use faunosteo_core::anatomy::layer::render_layer;
|
||||
use faunosteo_core::anatomy::svg::{Element, read_svg};
|
||||
use faunosteo_core::domain::sheet::AnatomicalSheetDocument;
|
||||
@@ -166,17 +168,20 @@ fn count(element: &Element, matches: &dyn Fn(&Element) -> bool) -> usize {
|
||||
}
|
||||
|
||||
/// `render.compose.test.ts` "never duplicates the filter on a root that already holds it"
|
||||
/// (R5.7): composing a drawing that already carries the halo filter adds no second filter and no
|
||||
/// second `<defs>` (the TypeScript composed twice on one DOM root; the core takes the root it
|
||||
/// returned).
|
||||
/// (R5.7): the composition writes one halo filter and one `<defs>`. Composing the root it
|
||||
/// returned (the TypeScript composed twice on one DOM root) is refused since V1-2.2 (owner
|
||||
/// brief 2026-10-30): that root holds the reserved `osteo-halo`, which no input may hold.
|
||||
#[test]
|
||||
fn the_halo_filter_is_never_duplicated_on_a_root_that_holds_it() {
|
||||
fn the_halo_filter_is_written_once_and_a_composed_root_is_refused() {
|
||||
let draft = draft();
|
||||
let ids: HashSet<&str> = ["hip"].into_iter().collect();
|
||||
let horse = sanitized(&common::repo_file(HORSE));
|
||||
let once = compose_highlight(&draft, "main", horse, &ids, true).unwrap();
|
||||
let twice = compose_highlight(&draft, "main", once, &ids, true).unwrap();
|
||||
let halo = |e: &Element| e.qname == "filter" && e.attr("id") == Some("osteo-halo");
|
||||
assert_eq!(count(&twice, &halo), 1);
|
||||
assert_eq!(count(&twice, &|e: &Element| e.qname == "defs"), 1);
|
||||
assert_eq!(count(&once, &halo), 1);
|
||||
assert_eq!(count(&once, &|e: &Element| e.qname == "defs"), 1);
|
||||
assert_eq!(
|
||||
compose_highlight(&draft, "main", once, &ids, true).unwrap_err(),
|
||||
ComposeError::ReservedId
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user