Merge main (433ddb59) into feat/native-save-precision

This commit is contained in:
dotCooCoo
2026-10-31 17:22:00 -07:00
676 changed files with 74763 additions and 5037 deletions
+1 -1
View File
@@ -129,7 +129,7 @@ fn unused_images_are_pruned() {
n.extras_mut().mask = Some(Box::new(OpacityMask::new(image_node(&mut d, "in mask"), false)));
d.insert(Some(layer), 0, n).unwrap();
let art = image_node(&mut d, "in symbol");
d.symbols.push(Symbol { name: "S".into(), art: Arc::new(art) });
d.symbols.push(Symbol { dynamic: false, name: "S".into(), art: Arc::new(art) });
// Image objects inside foreign data (a brush library kept as JSON) keep theirs too.
d.unknown.insert("brushes".into(), json!([{"art": {"type": "image", "key": "in brush"}}]));
let back = load(&save(&d, true)).unwrap();
+1 -1
View File
@@ -203,7 +203,7 @@ fn art_outside_the_layers_counts_too() {
let mut art = paths_doc(1, anchors_for(1, 2 * PRETTY_MAX_BYTES));
let path = Arc::clone(&art.layers[0]);
art.layers.clear();
d.symbols.push(Symbol { name: "Leaves".into(), art: path });
d.symbols.push(Symbol { dynamic: false, name: "Leaves".into(), art: path });
assert!(!SaveOptions::for_doc(&d).pretty);
let bytes = save_file(&d);
assert!(!is_pretty(&bytes));
+21
View File
@@ -171,6 +171,27 @@ fn rich_document_roundtrips() {
assert_eq!(v["version"], vectorcraft_format::VERSION);
}
/// A file's Path Effects are its own business: whatever their parameters hold, they load and save
/// as they are (the engine's tests draw them).
#[test]
fn path_effects_with_junk_params_round_trip() {
let mut d = rich_doc();
let mut id = None;
d.walk(|n| id = id.or(n.path_data().map(|_| n.id)));
let id = id.unwrap();
let effects: Vec<vectorcraft_doc::Effect> = [
("addon.path.dashes", json!({"dash1": 1e308, "gap1": -1e308, "offset": "x", "alignCorners": 3})),
("addon.path.addAnchors", json!({"count": 1e308, "maxCount": 1e308, "distance": -1e308, "spacing": "distance", "target": []})),
("addon.path.extend", json!(null)),
]
.into_iter()
.map(|(id, params)| vectorcraft_doc::Effect { id: id.into(), params, visible: true })
.collect();
d.node_mut(id).unwrap().appearance.effects = effects.clone();
let back = load(&save(&d, true)).unwrap();
assert_eq!(back.node(id).unwrap().appearance.effects, effects);
}
#[test]
fn sniff_distinguishes_formats() {
assert!(sniff(&save(&Document::new(1.0, 1.0), false)));