mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 06:17:22 -06:00
Crop: the rotated target-size sampler test expects the turned pixel (10, 9) doubled (#7012)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a738fcb9fe
commit
2f96260c99
@@ -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:?}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user