mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Crop: the Shift-corner unit test expects the diagonal size (#10871)
This commit is contained in:
1 parent
61c72186f6
commit
6dd5156e5f
1 file changed
+3
-2
@@ -387,13 +387,14 @@ fn handles_resize_with_shift_and_alt() {
|
||||
// Bottom-right corner, free.
|
||||
drag(&mut app, &[[120.0, 60.0], [140.0, 70.0]], NONE);
|
||||
assert_eq!(app.ui.crop_rect, Some([20.0, 20.0, 140.0, 70.0]));
|
||||
// ⇧ keeps 120:50 from the top-left corner: the larger relative extent wins.
|
||||
// ⇧ keeps 120:50 from the top-left corner: the corner follows the frame's diagonal, so the
|
||||
// drag (−10, −20) projected onto (−120, −50) grows the frame by 2200 / 16900 (#10871).
|
||||
app.ui.crop_rect = Some([20.0, 20.0, 140.0, 70.0]);
|
||||
drag(&mut app, &[[20.0, 20.0], [10.0, 0.0]], SHIFT);
|
||||
let r = app.ui.crop_rect.unwrap();
|
||||
assert_eq!((r[2], r[3]), (140.0, 70.0), "opposite corner fixed");
|
||||
assert!(((r[2] - r[0]) / (r[3] - r[1]) - 120.0 / 50.0).abs() < 1e-9, "{r:?}");
|
||||
assert_eq!(r[3] - r[1], 70.0);
|
||||
assert!((r[3] - r[1] - 50.0 * (1.0 + 2200.0 / 16900.0)).abs() < 1e-9, "{r:?}");
|
||||
// ⌥ resizes about the centre.
|
||||
app.ui.crop_rect = Some([40.0, 20.0, 80.0, 60.0]);
|
||||
drag(&mut app, &[[80.0, 40.0], [90.0, 40.0]], Modifiers::ALT);
|
||||
|
||||
Reference in new issue
Block a user