Batch: H/P and Info panel tests pick the Crop tool again after a commit

#10642 hides the frame after a committed crop until the next press or
re-picking the tool. The #9855 and #10453 tests expected the default frame
right after the commit; they now check that it is hidden, pick the tool
again and then test the default frame as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David MannandClaude Opus 5.5 committed 2026-11-03 22:56:21 +01:00
1 parent e06d1cbdc1
commit c466cac619
2 files changed
+12 -4

No files matched your search

+7 -3
View File
@@ -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;
+5 -1
View File
@@ -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;