diff --git a/crates/engine-core/src/cmd/smart_cmds/tests.rs b/crates/engine-core/src/cmd/smart_cmds/tests.rs index 6ee2584ecf..fe123e2456 100644 --- a/crates/engine-core/src/cmd/smart_cmds/tests.rs +++ b/crates/engine-core/src/cmd/smart_cmds/tests.rs @@ -1038,7 +1038,16 @@ fn identity_mesh_on_a_skewed_smart_object_changes_nothing() { let mesh = photocraft_geom::warp::BezierMesh::fit(&place, vec![0.0, 1.0], vec![0.0, 0.25, 1.0]); let rect = [x0, y0, x1, y1 + 10.0]; s.execute("layer.smartObjects.warp", json!({"layer": id, "style": "custom", "rect": rect, "mesh": mesh})).unwrap(); - assert!(mean_diff(&before, &flat(&s)) < 0.01, "mean diff {}", mean_diff(&before, &flat(&s))); + // In source space the stored warp leaves every point where it was. + let w = active_smart(&s).warp.unwrap(); + for (u, v) in [(0.0, 0.0), (1.0, 0.0), (0.5, 0.3), (0.0, 1.0), (1.0, 1.0)] { + let (x, y) = (b[0] + u * (b[2] - b[0]), b[1] + v * (b[3] - b[1])); + let (wx, wy) = w.map(x, y); + assert!((wx - x).abs() < 0.05 && (wy - y).abs() < 0.05, "({x}, {y}) -> ({wx}, {wy})"); + } + // A warped smart object samples with the warp's smooth kernel (#17577), not the placement's + // bicubic, so the pixels differ by that alone (about 0.012); half a pixel off is about 0.06. + assert!(mean_diff(&before, &flat(&s)) < 0.02, "mean diff {}", mean_diff(&before, &flat(&s))); } fn convert_to_layers(s: &mut Session) -> Value {