Design properties: project, author and licence in the design, its exports and inspect_design (#1015) (#1189)
A design carries metadata (format 21): project, part number, revision, author, organization, description and license, plus other tools' data under reverse-DNS keys, kept as written. Edited in the Design Properties window (Document Settings), set by document.metadata.set, reported by inspect_design, and written into STEP, IGES and 3MF where the format has a place for them. Translated, with tests.
This commit is contained in:
1 parent
78079587ad
commit
a4a8b48567
33 files changed
+1106
-21
No files matched your search
@@ -140,6 +140,23 @@ fn units_materials_and_rules_come_back() {
|
||||
assert_eq!(a, b, "mass comes from the replayed material");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn design_properties_come_back_and_odd_keys_are_listed() {
|
||||
let mut s = Session::default();
|
||||
run(&mut s, "solid.box", json!({"length": 10, "width": 10, "height": 10}));
|
||||
run(&mut s, "document.metadata.set", json!({"values": {"author": "Jane", "description": "two\nlines", "com.acme.tool": {"id": [1, 2]}}}));
|
||||
// Keys another tool wrote that the command would refuse.
|
||||
s.doc_mut().metadata.0.insert("revision".into(), json!(3));
|
||||
s.doc_mut().metadata.0.insert("org.other".into(), json!("text"));
|
||||
let r = run(&mut s, "timeline.export_script", json!({}));
|
||||
assert!(r["omitted"].to_string().contains("(org.other, revision)"), "{r}");
|
||||
let t = replay(&script(&mut s));
|
||||
assert_eq!(
|
||||
serde_json::to_value(&t.doc.metadata).unwrap(),
|
||||
json!({"author": "Jane", "description": "two\nlines", "com.acme.tool": {"id": [1, 2]}})
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn what_the_script_leaves_out_is_listed_and_components_are_refused() {
|
||||
let mut s = Session::default();
|
||||
|
||||
Reference in new issue
Block a user