Apply DIMOVERRIDE text together with dimension variables (#108) (#141)

This commit is contained in:
MarekSpodBiedry
2026-10-10 12:12:33 -04:00
committed by GitHub
parent 50b9a23a98
commit 3ef52e31d8
2 changed files with 45 additions and 14 deletions
+17
View File
@@ -193,6 +193,23 @@ fn dimension_overrides() {
assert_eq!(dim(&s, d).text, "<> TYP");
}
#[test]
fn dimension_override_text_with_variables() {
let mut s = Session::new();
let d = h(&s.execute("dimlinear", &json!({ "p1": [0, 0], "p2": [10, 0], "at": [5, 2] })).unwrap());
s.execute("dimoverride", &json!({ "handles": [d.hex()], "text": "<> OLD" })).unwrap();
s.execute("dimoverride", &json!({ "handles": [d.hex()], "DIMTXT": 0.4 })).unwrap();
let r = s.execute("dimoverride", &json!({ "handles": [d.hex()], "text": "<> TYP", "DIMDEC": 1 })).unwrap();
assert_eq!(r["changed"], json!(1));
let dm = dim(&s, d);
assert_eq!(dm.text, "<> TYP");
assert_eq!(dm.overrides.get("decimals"), Some(&json!(1)));
assert!(dm.overrides.contains_key("textHeight"));
// An unknown variable next to valid text is still an error and changes nothing.
assert!(s.execute("dimoverride", &json!({ "handles": [d.hex()], "text": "X", "nope": 1 })).is_err());
assert_eq!(dim(&s, d).text, "<> TYP");
}
#[test]
fn dimtedit_and_dimspace() {
let mut s = Session::new();