diff --git a/crates/engine/src/sampler_cmds.rs b/crates/engine/src/sampler_cmds.rs index 4d70a2bb28..27d499b1c9 100644 --- a/crates/engine/src/sampler_cmds.rs +++ b/crates/engine/src/sampler_cmds.rs @@ -449,8 +449,9 @@ mod tests { #[test] fn a_crop_to_a_target_size_scales_points() { - // The crop resamples the 20 x 20 area to 40 x 40: the point (10, 10 after the shift) doubles. - for angle in [None, Some(90)] { + // The crop resamples the 20 x 20 area to 40 x 40: the point (10, 10 after the shift; 10, 9 + // turned 90°, as in `a_rotated_crop_moves_points`) doubles. + for (angle, at) in [(None, [20.0, 20.0]), (Some(90), [20.0, 18.0])] { let mut s = session(); s.execute("view.colorSamplers.add", json!({"x": 50, "y": 40})).unwrap(); let mut p = json!({"x": 40, "y": 30, "width": 20, "height": 20, "targetWidth": 40, "targetHeight": 40}); @@ -460,7 +461,7 @@ mod tests { s.execute("image.crop", p).unwrap(); let p = points(&mut s); assert_eq!(p.len(), 1, "angle {angle:?}"); - assert_eq!(p[0]["position"], json!([20.0, 20.0]), "angle {angle:?}"); + assert_eq!(p[0]["position"], json!(at), "angle {angle:?}"); assert_eq!(s.take_samplers_removed(), 0, "angle {angle:?}"); } }