M7/G4: retype checks points along every edge; keys charged once (#4934)

The whole-outline check tests points along every edge, so outlines with
the same corners joined another way do not match; past a work limit it
rejects. Face keys another Retype kept meanwhile are reused and charged
once. The fonts parameter test uses outlines that would match. The parity
note states the search limits.
This commit is contained in:
ruchirguitar
2026-11-18 15:25:41 +05:30
parent 06e8ce62b9
commit c1613f2bf5
3 changed files with 53 additions and 4 deletions
+9 -1
View File
@@ -80,7 +80,15 @@ fn a_drawn_shape_is_reported_and_left_alone() {
let e = s.execute("type.retype", &json!({})).unwrap_err().to_string();
assert!(e.contains("no selected shape matches"), "{e}");
assert!(s.doc().unwrap().doc == before, "nothing changes");
assert!(s.execute("type.retype", &json!({"fonts": "Source Sans 3"})).is_err(), "fonts is a list");
// With outlines that would match, a bad `fonts` is refused for itself, and nothing changes.
let g = outlined(&mut s, json!({"x": 40, "y": 200, "text": "AB", "size": 40}));
s.execute("select.set", &json!({"ids": [g]})).unwrap();
let before = s.doc().unwrap().doc.clone();
for bad in [json!("Source Sans 3"), json!([1]), json!({"family": "x"})] {
let e = s.execute("type.retype", &json!({"fonts": bad})).unwrap_err().to_string();
assert!(e.contains("fonts must be a list of family names"), "{e}");
}
assert!(s.doc().unwrap().doc == before);
}
#[test]