#3233: an empty Layer Settings name follows the text again; document the name rule on layer.newText, layer.setText and layer.settings

This commit is contained in:
vangel76
2026-11-08 02:32:11 +01:00
parent 61af9e5b72
commit 77c3fad6c5
4 changed files with 18 additions and 5 deletions
+5
View File
@@ -1465,6 +1465,11 @@ fn a_text_layer_name_follows_its_text_until_renamed() {
s.execute("layer.settings", json!({"layer": t, "name": "Settings Name"})).unwrap();
s.execute("layer.setText", json!({"layer": t, "text": "Later"})).unwrap();
assert_eq!(layer_name(&s, t), "Settings Name", "Layer Settings names it for good");
// An empty Layer Settings name follows the text again, as `layer.rename` does.
s.execute("layer.settings", json!({"layer": t, "name": ""})).unwrap();
assert_eq!(layer_name(&s, t), "Later", "an empty Layer Settings name shows the text");
s.execute("layer.setText", json!({"layer": t, "text": "Follows"})).unwrap();
assert_eq!(layer_name(&s, t), "Follows", "and follows it again");
// A layer given a name when it is made does not follow.
let named = s.execute("layer.newText", json!({"text": "Body", "name": "Caption"})).unwrap()["layer"].as_u64().unwrap();
s.execute("layer.setText", json!({"layer": named, "text": "Other"})).unwrap();