PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge PR #7128: Crop: Straighten is one box Undo step (#7127)
aiongg2d14c7ceb7dc
diff --cc crates/ui-egui/src/crop_straighten.rsindex d124dd678,d3ea8e479..5f663f2e6--- a/crates/ui-egui/src/crop_straighten.rs+++ b/crates/ui-egui/src/crop_straighten.rs@@@ -233,17 -231,21 +233,32 @@@ mod testsassert_eq!(frame_angle([0.0, 0.0], [f64::INFINITY, 1.0], 1.0), None);}+ /// A straighten is one box Undo step (#3145): Undo turns the frame back instead of undoing the+ /// document under the pending crop, and Redo turns it again.+ #[test]+ fn straighten_is_a_box_undo_step() {+ let mut app = app(SampleType::U8);+ let before = (app.ui.crop_rect, app.ui.crop_angle);+ drag(&mut app, &[[0.0, 0.0], [100.0, 17.6]], CMD);+ let turned = (app.ui.crop_rect, app.ui.crop_angle);+ assert!(turned.1.abs() > 5.0, "{turned:?}");+ assert!(crate::crop_ui::intercept(&mut app, "edit.undo").is_some(), "Undo steps the box");+ assert_eq!((app.ui.crop_rect, app.ui.crop_angle), before);+ assert!(crate::crop_ui::intercept(&mut app, "edit.redo").is_some());+ assert_eq!((app.ui.crop_rect, app.ui.crop_angle), turned);+ }++ #[test]+ fn the_angle_readout_never_shows_minus_zero_or_minus_180() {+ use crate::canvas::angle_readout;+ assert_eq!(angle_readout(-0.03), "0.0°");+ assert_eq!(angle_readout(0.0), "0.0°");+ assert_eq!(angle_readout(-179.97), "180.0°");+ assert_eq!(angle_readout(179.97), "180.0°");+ assert_eq!(angle_readout(12.34), "12.3°");+ assert_eq!(angle_readout(-12.36), "-12.4°");+ }+#[test]fn the_fitted_frame_is_the_largest_of_its_proportions_inside_the_canvas() {// Upright, the canvas's own proportions fill it.