Files
vectorcraft/crates/engine/src/tests/effectedit.rs
T
dotCooCoo 25f9a53d78 3D: shadow docs and params text say which mode each rule covers
The shaded faces show the first light's shadow, and Render Settings ›
Rendered draws the shadows of every light with an Intensity above 0.
The Shadows table, its notes, the differences list, the effects summary,
docs/mcp.md and the shadow params text of Extrude & Bevel, Revolve,
Inflate and Rotate now say which mode they describe.

A new test checks that PNG export gives the pixels the canvas draws at
export quality, and that the rendered image has as many pixels as the
shaded faces' bounds times the resolution over 72, rounded up as a
raster effect's image is.
2026-11-30 23:00:30 -08:00

422 lines
23 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Appearance editing depth: moving and copying effects between the object and its fills and
//! strokes, duplicating and removing several items, Show All Hidden Attributes.
use serde_json::{Value, json};
use vectorcraft_doc::Node;
use vectorcraft_render::encode::{RasterExportOptions, RasterFormat};
use crate::*;
/// A selected 100×100 rectangle with the default appearance `[Fill white, Stroke black]`.
fn session_with_rect() -> (Session, NodeId) {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
let r = s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap();
(s, NodeId(r["id"].as_u64().unwrap()))
}
fn node(s: &Session, id: NodeId) -> Node {
s.doc().unwrap().doc.node(id).unwrap().clone()
}
fn run(s: &mut Session, id: &str, p: Value) -> Value {
s.execute(id, &p).unwrap_or_else(|e| panic!("{id} {p}: {e}"))
}
/// Effect ids of the object (`None`) or of item `i`.
fn fx(s: &Session, id: NodeId, item: Option<usize>) -> Vec<String> {
node(s, id).appearance.effects_at(item).unwrap().iter().map(|e| e.id.clone()).collect()
}
#[test]
fn effects_reorder_within_a_list_and_undo_in_one_step() {
let (mut s, id) = session_with_rect();
for e in ["distort.twist", "distort.roughen", "stylize.dropShadow"] {
run(&mut s, "effect.apply", json!({ "effect": e }));
}
let r = run(&mut s, "effect.move", json!({"from": 0, "to": 2}));
assert_eq!((r["index"].clone(), r["item"].clone()), (json!(2), Value::Null));
assert_eq!(fx(&s, id, None), ["distort.roughen", "stylize.dropShadow", "distort.twist"]);
// Past the end lands last.
run(&mut s, "effect.move", json!({"from": 0, "to": 9}));
assert_eq!(fx(&s, id, None), ["stylize.dropShadow", "distort.twist", "distort.roughen"]);
s.execute("edit.undo", &json!({})).unwrap();
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(fx(&s, id, None), ["distort.twist", "distort.roughen", "stylize.dropShadow"]);
assert!(s.execute("effect.move", &json!({"from": 3, "to": 0})).is_err());
}
#[test]
fn effects_move_and_copy_between_the_object_and_its_items() {
let (mut s, id) = session_with_rect();
run(&mut s, "effect.apply", json!({"effect": "distort.twist"}));
run(&mut s, "effect.apply", json!({"effect": "path.offsetPath", "item": 1}));
// Into the stroke, above its own effect.
let r = run(&mut s, "effect.move", json!({"from": 0, "fromItem": null, "to": 1, "toItem": 1}));
assert_eq!((r["index"].clone(), r["item"].clone()), (json!(1), json!(1)));
assert!(fx(&s, id, None).is_empty());
assert_eq!(fx(&s, id, Some(1)), ["path.offsetPath", "distort.twist"]);
// Out of the stroke onto the fill, as a copy (Alt-drag): the stroke keeps it.
run(&mut s, "effect.move", json!({"from": 0, "fromItem": 1, "to": 0, "toItem": 0, "copy": true}));
assert_eq!(fx(&s, id, Some(0)), ["path.offsetPath"]);
assert_eq!(fx(&s, id, Some(1)), ["path.offsetPath", "distort.twist"]);
// Back out to the object, one undo step each.
run(&mut s, "effect.move", json!({"from": 1, "fromItem": 1, "to": 0, "toItem": null}));
assert_eq!(fx(&s, id, None), ["distort.twist"]);
s.execute("edit.undo", &json!({})).unwrap();
assert!(fx(&s, id, None).is_empty());
s.execute("edit.undo", &json!({})).unwrap();
assert!(fx(&s, id, Some(0)).is_empty());
// A missing item is an error, not a silent no-op.
assert!(s.execute("effect.move", &json!({"from": 0, "fromItem": 1, "to": 0, "toItem": 7})).is_err());
}
#[test]
fn invalid_effect_move_flags_leave_the_effects_alone() {
let (mut s, id) = session_with_rect();
run(&mut s, "effect.apply", json!({"effect": "distort.twist"}));
let before_undo = s.doc().unwrap().history.undo.len();
let to_fill = json!({"from": 0, "fromItem": null, "to": 0, "toItem": 0});
for (key, value) in [("copy", json!("true")), ("copy", json!(1)), ("aligned", json!("false"))] {
let mut params = to_fill.clone();
params[key] = value;
assert!(s.execute("effect.move", &params).is_err(), "accepted {params}");
assert_eq!(fx(&s, id, None), ["distort.twist"], "moved the effect for {params}");
assert!(fx(&s, id, Some(0)).is_empty(), "copied the effect for {params}");
assert_eq!(s.doc().unwrap().history.undo.len(), before_undo, "recorded undo for {params}");
}
// Null, as for every command, is the same as leaving the flag out: a move.
let mut params = to_fill;
params["copy"] = Value::Null;
params["aligned"] = Value::Null;
run(&mut s, "effect.move", params);
assert!(fx(&s, id, None).is_empty());
assert_eq!(fx(&s, id, Some(0)), ["distort.twist"]);
}
/// `effect.duplicate` copies a fill's effect right after it.
#[test]
fn duplicate_selected_works_for_effects() {
let (mut s, id) = session_with_rect();
run(&mut s, "effect.apply", json!({"effect": "distort.roughen", "item": 0}));
run(&mut s, "effect.duplicate", json!({"index": 0, "item": 0}));
assert_eq!(fx(&s, id, Some(0)), ["distort.roughen", "distort.roughen"]);
}
/// `appearance.duplicateItem` copies a fill/stroke to a given position, and `appearance.removeItem` with `indices` removes several at once.
#[test]
fn items_duplicate_to_a_position_and_several_remove_at_once() {
let (mut s, id) = session_with_rect();
run(&mut s, "appearance.addFill", json!({})); // [Fill, Stroke, Fill]
run(&mut s, "appearance.setItem", json!({"index": 2, "color": "#ff0000"}));
// Alt-dragging the top fill to the bottom copies it there.
run(&mut s, "appearance.duplicateItem", json!({"index": 2, "to": 0}));
let kinds = |s: &Session| node(s, id).appearance.items.iter().map(|i| i.kind_name()).collect::<Vec<_>>();
assert_eq!(kinds(&s), ["fill", "fill", "stroke", "fill"]);
assert_eq!(node(&s, id).appearance.items[0].paint(), node(&s, id).appearance.items[3].paint());
// Duplicating several copies each above itself.
run(&mut s, "appearance.duplicateItem", json!({"indices": [0, 2]}));
assert_eq!(kinds(&s), ["fill", "fill", "fill", "stroke", "stroke", "fill"]);
// Several with `to` are copied as one block there (Alt-dragging highlighted rows).
run(&mut s, "appearance.duplicateItem", json!({"indices": [0, 1], "to": 3}));
assert_eq!(kinds(&s), ["fill", "fill", "fill", "fill", "fill", "stroke", "stroke", "fill"]);
s.execute("edit.undo", &json!({})).unwrap();
// Removing several in one step; the active item follows.
run(&mut s, "appearance.setActiveItem", json!({"index": 5}));
run(&mut s, "appearance.removeItem", json!({"indices": [4, 0, 1]}));
assert_eq!(kinds(&s), ["fill", "stroke", "fill"]);
assert_eq!(s.appearance_item(), Some(2));
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(node(&s, id).appearance.items.len(), 6);
}
#[test]
fn show_all_hidden_attributes() {
let (mut s, id) = session_with_rect();
run(&mut s, "effect.apply", json!({"effect": "distort.twist"}));
run(&mut s, "effect.apply", json!({"effect": "distort.roughen", "item": 1}));
assert!(s.execute("appearance.showAllHidden", &json!({})).is_err(), "nothing hidden yet");
run(&mut s, "appearance.setItem", json!({"index": 0, "visible": false}));
run(&mut s, "effect.setParams", json!({"index": 0, "visible": false, "item": null}));
run(&mut s, "effect.setParams", json!({"index": 0, "visible": false, "item": 1}));
assert!(node(&s, id).appearance.has_hidden());
let r = run(&mut s, "appearance.showAllHidden", json!({}));
assert_eq!(r["ids"], json!([id.0]));
let n = node(&s, id);
assert!(!n.appearance.has_hidden());
assert!(n.appearance.effects[0].visible && n.appearance.items[1].effects()[0].visible && n.appearance.items[0].visible());
s.execute("edit.undo", &json!({})).unwrap();
assert!(node(&s, id).appearance.has_hidden());
}
/// A Warp applied now takes its style's Bézier net (`version` 1) unless a map is given, an edit
/// keeps the map the effect has (one saved before the version existed keeps the earlier map), and
/// a map this build doesn't draw is refused.
#[test]
fn warps_keep_the_map_their_version_names() {
let (mut s, id) = session_with_rect();
let version = |s: &Session| node(s, id).appearance.effects[0].params.get("version").cloned();
run(&mut s, "effect.apply", json!({"effect": "warp.flag", "params": {"bend": 40}}));
assert_eq!(version(&s), Some(json!(vectorcraft_doc::live::WARP_NET)));
run(&mut s, "effect.setParams", json!({"index": 0, "params": {"bend": 20}, "warpStyle": "arc"}));
assert_eq!(version(&s), Some(json!(vectorcraft_doc::live::WARP_NET)));
// As a file saved before the version existed gives it.
let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
if let Some(Value::Object(p)) = doc.node_mut(id).and_then(|n| n.appearance.effects.first_mut()).map(|e| &mut e.params) {
p.remove("version");
}
run(&mut s, "effect.setParams", json!({"index": 0, "params": {"bend": 10, "horizontal": 20}}));
assert_eq!(version(&s), None);
run(&mut s, "effect.setParams", json!({"index": 0, "params": {"version": 1}}));
assert_eq!(version(&s), Some(json!(1)));
run(&mut s, "effect.apply", json!({"effect": "warp.arc", "params": {"version": 0}}));
assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(0));
// A whole number given as a float is that version.
run(&mut s, "effect.setParams", json!({"index": 1, "params": {"version": 1.0}}));
assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(1));
run(&mut s, "effect.setParams", json!({"index": 1, "params": {"version": 0.0}}));
assert_eq!(node(&s, id).appearance.effects[1].params["version"], json!(0));
for bad in [json!(2), json!(-1), json!(0.5), json!("1")] {
assert!(s.execute("effect.apply", &json!({"effect": "warp.arc", "params": {"version": bad}})).is_err(), "{bad}");
assert!(s.execute("effect.setParams", &json!({"index": 0, "params": {"version": bad}})).is_err(), "{bad}");
}
assert_eq!(node(&s, id).appearance.effects.len(), 2);
}
#[test]
fn rendered_warning_is_in_effect_command_results() {
let (mut s, _) = session_with_rect();
run(
&mut s,
"paint.setFill",
json!({"gradient": {"kind": "linear", "stops": [
{"offset": 0, "color": "#000000"}, {"offset": 1, "color": "#ffffff"}
]}}),
);
let warning = vectorcraft_render::effects::rendered::OPAQUE_ONLY;
let applied = run(&mut s, "effect.apply", json!({"effect": "threeD.extrude", "item": null, "params": {"render": {"mode": "rendered"}}}));
assert_eq!(applied["warning"], warning);
let shaded = run(&mut s, "effect.setParams", json!({"index": 0, "item": null, "params": {"render": {"mode": "shaded"}}}));
assert!(shaded.get("warning").is_none());
let params = json!({"index": 0, "item": null, "params": {"render": {"mode": "rendered"}}});
assert_eq!(run(&mut s, "effect.setParams", params.clone())["warning"], warning);
assert_eq!(run(&mut s, "effect.setParams", params)["warning"], warning, "unchanged settings still report the fallback");
run(&mut s, "paint.setFill", json!({"color": "#338ad6"}));
let plain = run(&mut s, "effect.setParams", json!({"index": 0, "item": null, "params": {"render": {"mode": "rendered", "quality": "low"}}}));
assert!(plain.get("warning").is_none());
}
/// The color space of each color image (not a soft mask) in PDF `bytes`, in order.
fn image_spaces(bytes: &[u8]) -> Vec<String> {
let text = String::from_utf8_lossy(bytes);
let mut out = vec![];
for (at, _) in text.match_indices("/Subtype/Image") {
let start = text[..at].rfind(" obj").unwrap_or(0);
let end = text[at..].find("stream").map_or(text.len(), |e| at + e);
let dict = &text[start..end];
let Some(cs) = dict.find("/ColorSpace") else { continue };
let name = dict[cs + "/ColorSpace".len()..].trim_start_matches(['[', ' ', '/']);
let space: String = name.chars().take_while(|c| c.is_ascii_alphanumeric()).collect();
if space != "DeviceGray" {
out.push(space);
}
}
out
}
/// In a CMYK document, PDF export writes a rendered 3D object as it writes a raster effect: one
/// image in the color space a drop shadow's image takes, kept in RGB by default and converted to
/// CMYK by Press Quality.
#[test]
fn a_rendered_3d_object_in_a_cmyk_pdf_is_written_as_raster_effects_are() {
let spaces = |effect: &str, params: Value, preset: Option<&str>| {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 300, "height": 300, "colorMode": "cmyk"})).unwrap();
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap();
run(&mut s, "paint.setStroke", json!({"none": true}));
run(&mut s, "paint.setFill", json!({"color": "#338ad6"}));
run(&mut s, "effect.apply", json!({"effect": effect, "item": null, "params": params}));
let v = s.execute("document.exportPdf", &preset.map_or(json!({}), |name| json!({"preset": name}))).unwrap();
image_spaces(&vectorcraft_format::base64_decode(v["dataBase64"].as_str().unwrap()).unwrap())
};
let rendered = json!({"render": {"mode": "rendered", "quality": "low"}});
let shadow = json!({"x": 6.0, "y": 6.0, "blur": 3.0, "opacity": 75.0});
for preset in [None, Some("Press Quality")] {
let three_d = spaces("threeD.extrude", rendered.clone(), preset);
let dropped = spaces("stylize.dropShadow", shadow.clone(), preset);
assert_eq!(three_d.len(), 1, "{preset:?}: one image of the rendered object: {three_d:?}");
assert_eq!(dropped.len(), 1, "{preset:?}: {dropped:?}");
assert_eq!(three_d, dropped, "{preset:?}: the rendered image takes the drop shadow's color space");
}
assert_eq!(spaces("threeD.extrude", rendered, Some("Press Quality")), vec!["DeviceCMYK".to_string()]);
}
/// A selected 100 pt square filled blue with no stroke, rendered by Extrude at Low quality, and
/// `after` (effect, params) applied after it.
fn rendered_square(after: &[(&str, Value)]) -> Session {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 300, "height": 300})).unwrap();
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap();
run(&mut s, "paint.setStroke", json!({"none": true}));
run(&mut s, "paint.setFill", json!({"color": "#338ad6"}));
run(&mut s, "effect.apply", json!({"effect": "threeD.extrude", "item": null, "params": {"render": {"mode": "rendered", "quality": "low"}}}));
for (effect, params) in after {
run(&mut s, "effect.apply", json!({"effect": effect, "item": null, "params": params}));
}
s
}
/// The `/Width` of each color image (not a soft mask) in PDF `bytes`.
fn image_widths(bytes: &[u8]) -> Vec<u32> {
let text = String::from_utf8_lossy(bytes);
let mut out = vec![];
for (at, _) in text.match_indices("/Subtype/Image") {
let start = text[..at].rfind(" obj").unwrap_or(0);
let end = text[at..].find("stream").map_or(text.len(), |e| at + e);
let dict = &text[start..end];
if dict.contains("/DeviceGray") {
continue;
}
if let Some(w) = dict.find("/Width") {
out.push(dict[w + "/Width".len()..].trim_start().chars().take_while(char::is_ascii_digit).collect::<String>().parse().unwrap());
}
}
out
}
/// PDF and SVG export write one image for a rendered 3D object, and Expand Appearance leaves one
/// embedded image of the same size in pixels that covers the object.
#[test]
fn export_and_expand_write_one_image_of_a_rendered_3d_object() {
let mut s = rendered_square(&[]);
let pdf = s.execute("document.exportPdf", &json!({})).unwrap();
let widths = image_widths(&vectorcraft_format::base64_decode(pdf["dataBase64"].as_str().unwrap()).unwrap());
assert_eq!(widths.len(), 1, "{widths:?}");
let svg = s.execute("document.export", &json!({"format": "svg"})).unwrap();
let svg = String::from_utf8(vectorcraft_format::base64_decode(svg["dataBase64"].as_str().unwrap()).unwrap()).unwrap();
assert_eq!(svg.matches("<image").count(), 1, "{svg}");
run(&mut s, "effect.expandAppearance", json!({}));
let mut found = vec![];
for l in &s.doc().unwrap().doc.layers {
l.walk(&mut |n| {
if let vectorcraft_doc::NodeKind::Image(im) = &n.kind {
found.push((**im).clone());
}
});
}
assert_eq!(found.len(), 1, "{found:?}");
let im = &found[0];
assert!(s.doc().unwrap().doc.images.contains_key(&im.key), "the image is embedded");
assert_eq!(im.width, widths[0], "the PDF's image and the expanded image have the same pixels");
let c = im.xf.as_coeffs();
let (x0, x1) = (c[4], c[4] + f64::from(im.width) * c[0]);
assert!(x0 <= 100.0 + 1e-6 && x1 >= 200.0 - 1e-6, "the image spans {x0} to {x1}");
}
/// PNG export draws a rendered 3D object as the canvas draws it at export quality. The rendered image takes as many
/// pixels as the shaded faces' bounds times the resolution over 72, rounded up to whole pixels as a
/// raster effect's image is (`effect_region` in `crates/engine/src/cmd/rasterfx.rs`), at the
/// effect's own resolution and at the document's raster effects resolution.
#[test]
fn png_export_matches_the_canvas_and_the_image_takes_the_raster_effect_size() {
for (doc_ppi, resolution) in [(72.0, Some(150.0)), (150.0, None), (300.0, Some(37.0))] {
let what = format!("document {doc_ppi} ppi, effect {resolution:?}");
let mut s = Session::new();
s.execute("file.new", &json!({"width": 300, "height": 300, "rasterEffectsPpi": doc_ppi})).unwrap();
s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap();
run(&mut s, "paint.setStroke", json!({"none": true}));
run(&mut s, "paint.setFill", json!({"color": "#338ad6"}));
let render = json!({"mode": "rendered", "quality": "low", "resolution": resolution});
run(&mut s, "effect.apply", json!({"effect": "threeD.extrude", "item": null, "params": {"render": render}}));
let png = s.execute("document.export", &json!({"format": "png", "background": "transparent"})).unwrap();
let png = image::load_from_memory(&vectorcraft_format::base64_decode(png["dataBase64"].as_str().unwrap()).unwrap()).unwrap().to_rgba8();
let doc = &s.doc().unwrap().doc;
// The canvas drawn at export quality (precise, supersampled and with templates left out) and
// at the resolution PNG export takes by default, the document's raster resolution.
let quality = RasterExportOptions::default().render_options(RasterFormat::Png);
let canvas = vectorcraft_render::Renderer::new().render_region_with(doc, doc.artboards[0].rect, doc_ppi / 72.0, &quality);
assert_eq!((png.width(), png.height()), (canvas.width, canvas.height), "{what}");
let changed = png.as_raw().chunks(4).zip(canvas.to_straight().chunks(4)).filter(|(a, b)| a != b).count();
assert_eq!(changed, 0, "{what}: pixels of the PNG export that differ from the canvas");
let drawn = |s: &Session| {
let doc = &s.doc().unwrap().doc;
let mut object = None;
for layer in &doc.layers {
layer.walk(&mut |n| {
if n.appearance.effects.iter().any(|e| e.id == "threeD.extrude") {
object = Some(n.clone());
}
});
}
vectorcraft_render::effects::solid_art_drawn_in(Some(doc), &object.unwrap()).unwrap()
};
let mut images = vec![];
drawn(&s).walk(&mut |n| {
if let vectorcraft_doc::NodeKind::Image(im) = &n.kind {
images.push((**im).clone());
}
});
assert_eq!(images.len(), 1, "{what}");
run(&mut s, "effect.setParams", json!({"index": 0, "item": null, "params": {"render": {"mode": "shaded"}}}));
let mut faces: Option<vectorcraft_geom::Rect> = None;
drawn(&s).walk(&mut |n| {
if let Some(b) = n.path_data().and_then(vectorcraft_geom::PathData::bounds) {
faces = Some(faces.map_or(b, |f| f.union(b)));
}
});
let faces = faces.unwrap();
let scale = resolution.unwrap_or(doc_ppi) / 72.0;
let expected = ((faces.width() * scale).ceil().max(1.0) as u32, (faces.height() * scale).ceil().max(1.0) as u32);
assert_eq!((images[0].width, images[0].height), expected, "{what}: the image's pixels for faces {faces:?}");
}
}
/// The page bounds, in whole points, of the pixels the canvas covers in session `s`.
fn covered(s: &Session) -> (Vec<u8>, [u32; 4]) {
let img =
vectorcraft_render::Renderer::new().render_region(&s.doc().unwrap().doc, vectorcraft_geom::Rect::new(0.0, 0.0, 300.0, 300.0), 1.0, false);
let mut b = [u32::MAX, u32::MAX, 0, 0];
for (i, p) in img.pixels.chunks(4).enumerate() {
if p[3] > 8 {
let (x, y) = (i as u32 % img.width, i as u32 / img.width);
b = [b[0].min(x), b[1].min(y), b[2].max(x), b[3].max(y)];
}
}
(img.pixels, b)
}
/// Gaussian Blur spreads a rendered 3D image past its edges and Transform moves it. Roughen
/// draws the shaded faces instead and reports why.
#[test]
fn effects_after_a_rendered_3d_effect_keep_the_image_or_reshape_the_faces() {
let (_, at) = covered(&rendered_square(&[]));
let (_, blurred) = covered(&rendered_square(&[("blur.gaussian", json!({"radius": 5.0}))]));
assert!(blurred[0] + 2 <= at[0] && blurred[2] >= at[2] + 2, "blurred {blurred:?} against {at:?}");
let (_, moved) = covered(&rendered_square(&[("distort.transform", json!({"moveH": 50.0}))]));
assert_eq!([moved[0], moved[2]], [at[0] + 50, at[2] + 50], "moved {moved:?} against {at:?}");
let rough = rendered_square(&[("distort.roughen", json!({"size": 5.0}))]);
let doc = &rough.doc().unwrap().doc;
let mut object = None;
for layer in &doc.layers {
layer.walk(&mut |n| {
if n.appearance.effects.iter().any(|e| e.id == "threeD.extrude") {
object = Some(n.clone());
}
});
}
let object = object.unwrap();
let art = vectorcraft_render::effects::solid_art_drawn_in(Some(doc), &object).unwrap();
let mut has_image = false;
let mut has_faces = false;
art.walk(&mut |n| {
has_image |= matches!(n.kind, vectorcraft_doc::NodeKind::Image(_));
has_faces |= n.path_data().is_some();
});
assert!(!has_image);
assert!(has_faces);
assert_eq!(
vectorcraft_render::effects::rendered_warning(doc, &object).as_deref(),
Some("A later effect reshapes the 3D object's paths; showing the shaded faces instead")
);
}