Drawing export: the last two tests that read text read svg (#12164)

#12152 put an SVG's text back under `svg` in drawing.export's reply and
missed two readers: the delete test that selects a drawing's objects and the
pictures test that draws an image under the views.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CamWightandClaude Opus 5.5 authored and GitHub committed 2026-11-04 21:08:15 -05:00
1 parent e6e6df0d86
commit e821b3ea3c
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -569,7 +569,7 @@ mod tests {
run(&mut s, "drawing.view.edit", json!({"view": ids::encode(view), "set": {"visual_style": "visible"}}));
}
let sheet = ids::encode(s.drawing("test").unwrap().sheets[0].id);
let svg = run(&mut s, "drawing.export", json!({"sheet": sheet}))["text"].clone();
let svg = run(&mut s, "drawing.export", json!({"sheet": sheet}))["svg"].clone();
assert!(svg.is_string(), "{svg}");
let (doc, steps) = (s.doc.clone(), s.undo.len());
let reply = run(&mut s, "select.set", json!({"items": [item(drawing, front), item(drawing, dimension), item(drawing, balloon)]}));
@@ -578,7 +578,7 @@ mod tests {
run(&mut s, "select.set", json!({"items": [item(drawing, right)], "add": true}));
assert_eq!(s.selection.len(), 4);
assert!(std::sync::Arc::ptr_eq(&doc, &s.doc) && s.undo.len() == steps);
assert_eq!(run(&mut s, "drawing.export", json!({"sheet": sheet}))["text"], svg);
assert_eq!(run(&mut s, "drawing.export", json!({"sheet": sheet}))["svg"], svg);
run(&mut s, "select.clear", json!({}));
assert!(s.selection.is_empty());
}
+2 -2
View File
@@ -85,7 +85,7 @@ fn an_image_draws_under_the_views_on_its_rectangle() {
assert!(conforms(schema.as_value(), schema.as_value(), &reply), "{reply}");
let reply = run(&mut s, "drawing.export", json!({"sheet": ids::encode(sheet)}));
let svg = reply["text"].as_str().unwrap();
let svg = reply["svg"].as_str().unwrap();
assert_eq!(svg.matches("<image ").count(), 1, "{}", &svg[..200]);
// On the A3 sheet, whose y runs down in an SVG: 297 - 32.7.
let at = "<image x=\"10\" y=\"264.3\" width=\"25.4\" height=\"12.7\" preserveAspectRatio=\"none\" href=\"data:image/png;base64,";
@@ -95,7 +95,7 @@ fn an_image_draws_under_the_views_on_its_rectangle() {
assert_eq!(pixels.dimensions(), (300, 150));
assert_eq!((pixels.get_pixel(0, 0).0, pixels.get_pixel(149, 149).0), (RED, RED));
assert_eq!((pixels.get_pixel(150, 0).0, pixels.get_pixel(299, 149).0), (BLUE, BLUE));
assert!(!run(&mut s, "drawing.export", json!({"sheet": ids::encode(elsewhere)}))["text"].as_str().unwrap().contains("<image "));
assert!(!run(&mut s, "drawing.export", json!({"sheet": ids::encode(elsewhere)}))["svg"].as_str().unwrap().contains("<image "));
}
/// A file that doesn't decode refuses the sheet it sits on, naming the placement, and writes