diff --git a/crates/ui-egui/src/tools/crop_mode/tests.rs b/crates/ui-egui/src/tools/crop_mode/tests.rs index 278832a735a..a676cd6e5fb 100644 --- a/crates/ui-egui/src/tools/crop_mode/tests.rs +++ b/crates/ui-egui/src/tools/crop_mode/tests.rs @@ -579,8 +579,9 @@ fn p_toggles_classic_mode_while_a_crop_is_in_progress() { assert!(!classic(&app)); } -/// After a commit the tool shows its untouched default frame again: H and P are the Hand and Pen -/// keys there, as when the tool is picked, not Show Cropped Area and Classic Mode (#9731, #6536). +/// After a commit the tool shows no frame until the next press or re-picking the tool, which +/// brings its untouched default frame back: H and P are the Hand and Pen keys there, as when the +/// tool is picked, not Show Cropped Area and Classic Mode (#9731, #6536). #[test] fn h_and_p_pick_their_tools_over_the_default_frame_after_a_commit() { for (k, tool) in [(egui::Key::H, Tool::Hand), (egui::Key::P, Tool::Pen)] { @@ -589,7 +590,10 @@ fn h_and_p_pick_their_tools_over_the_default_frame_after_a_commit() { key(&mut app, egui::Key::Enter, NONE); assert_eq!(app.session.active().map(|st| st.doc.size), Some(Size::new(60, 40)), "the crop committed"); crate::crop_ui::ensure_frame(&mut app); - assert!(app.ui.crop_rect.is_some() && app.crop.default_frame, "the default frame is back"); + assert!(app.ui.crop_rect.is_none(), "the commit hides the frame"); + crate::tool_memory::select(&mut app, Tool::Crop); + crate::crop_ui::ensure_frame(&mut app); + assert!(app.ui.crop_rect.is_some() && app.crop.default_frame, "re-picking the tool brings the default frame back"); key(&mut app, k, NONE); assert_eq!(app.ui.tool, tool, "{k:?}"); let s = &app.ui.tool_options.crop_shield; diff --git a/crates/ui-egui/src/tools/crop_ui/tests.rs b/crates/ui-egui/src/tools/crop_ui/tests.rs index 9a93cebe5fa..0eb5d13434d 100644 --- a/crates/ui-egui/src/tools/crop_ui/tests.rs +++ b/crates/ui-egui/src/tools/crop_ui/tests.rs @@ -1282,7 +1282,8 @@ fn info_size_is_shown_in_the_ruler_unit() { /// #3145 review: after the crop is cancelled or committed, or the tool is left, W and H are the /// selection's again. With the Crop tool still picked, the new default frame is the selection's -/// bounds (or the canvas), as in Photoshop, so the panel shows the same size. +/// bounds (or the canvas), as in Photoshop, so the panel shows the same size. After a commit that +/// frame waits for the next press or re-picking the tool. #[test] fn info_size_returns_to_the_selection_after_cancel_or_commit() { let mut app = app(SampleType::U8); @@ -1304,6 +1305,9 @@ fn info_size_returns_to_the_selection_after_cancel_or_commit() { assert_eq!(app.session.active().unwrap().doc.size, Size::new(40, 30)); assert_eq!(info_size(&app), None, "committed: no frame"); ensure_frame(&mut app); + assert_eq!(info_size(&app), None, "committed: the frame stays hidden"); + crate::tool_memory::select(&mut app, Tool::Crop); + ensure_frame(&mut app); assert_eq!(info_size(&app), Some([40.0, 30.0]), "the new frame is the cropped canvas"); // Leaving the tool: the panel shows the selection, whatever the frame. app.ui.tool = Tool::Move;