M4: an empty text stays as it is under Outline stroke (#2405)

This commit is contained in:
bflatastic committed 2026-11-19 02:39:15 +07:00
1 parent 64b0b45108
commit 50d94f98c8
1 file changed
+11 -1
+11 -1
View File
@@ -582,7 +582,7 @@ fn outline_stroke_outlines_a_text_without_a_stroke() {
let page = s.page().unwrap();
let out = ex(&mut s, "vector.outlineStroke", json!({"ids": [t]}));
let ids: Vec<NodeId> = out["ids"].as_array().unwrap().iter().filter_map(id_of).collect();
// Without a font nothing lays out, so there is nothing to outline (CI has no fonts).
// Without a font nothing lays out, so there is nothing to outline.
if !figcraft_text::layout_node(&before).is_some_and(|(l, _)| !l.glyphs.is_empty()) {
assert!(ids.is_empty() && matches!(node(&s, t).kind, NodeKind::Text(_)), "no glyphs: the text stays: {out}");
return;
@@ -597,6 +597,16 @@ fn outline_stroke_outlines_a_text_without_a_stroke() {
assert!(matches!(node(&s, t).kind, NodeKind::Text(_)), "undo brings the text back");
}
#[test]
fn outline_stroke_leaves_an_empty_text_as_it_is() {
// An empty text has no glyphs to outline: it stays, and nothing else changes.
let mut s = Session::new();
let t = create(&mut s, "text.create", json!({"text": "", "x": 10, "y": 20}));
let out = ex(&mut s, "vector.outlineStroke", json!({"ids": [t]}));
assert_eq!(out["ids"], json!([]), "nothing outlined: {out}");
assert!(matches!(node(&s, t).kind, NodeKind::Text(_)), "the text stays");
}
#[test]
fn node_set_non_numeric_miter_smoothing_paragraph_is_an_error() {
let mut s = Session::new();