diff --git a/crates/ui-egui/src/pencil_tests.rs b/crates/ui-egui/src/pencil_tests.rs index 2fbc2c9dbad..5b79bf4cc2a 100644 --- a/crates/ui-egui/src/pencil_tests.rs +++ b/crates/ui-egui/src/pencil_tests.rs @@ -434,15 +434,15 @@ fn a_tool_key_mid_stroke_paints_what_the_stroke_paints_without_it() { ("no dynamics, then size jitter", round.clone(), json!({"shapeDynamics": {"enabled": true, "size": {"jitter": 1.0}}})), ("no smoothing, then 90 %", round.clone(), json!({"smoothing": {"enabled": true, "amount": 0.9}})), ]; - for mode in ["", "brush", "pencil", "block"] { - for (what, pressed, switched) in &cases { - let plain = history_stroke_pixels(mode, pressed, None); - assert!(history_stroke_pixels(mode, pressed, Some(switched)) == plain, "{mode} {what}: the switch changed the stroke"); - // The switched-to brush paints differently, so the comparison means something; Block - // mode keeps only the brush's smoothing. - if mode != "block" || what.contains("smoothing") { - assert!(history_stroke_pixels(mode, switched, None) != plain, "{mode} {what}: both brushes paint alike"); - } - } + // Each choice, not every mode with every case (#16041): the brush is captured once, at the + // press, whatever the mode, so History Brush takes every case and each Erase to History mode + // one, for its own flags: Brush and Pencil with the sampled tip, Block with smoothing (the only + // brush setting Block keeps). + let runs = cases.iter().map(|c| ("", c)).chain([("brush", &cases[2]), ("pencil", &cases[2]), ("block", &cases[4])]); + for (mode, (what, pressed, switched)) in runs { + let plain = history_stroke_pixels(mode, pressed, None); + assert!(history_stroke_pixels(mode, pressed, Some(switched)) == plain, "{mode} {what}: the switch changed the stroke"); + // The switched-to brush paints differently, so the comparison means something. + assert!(history_stroke_pixels(mode, switched, None) != plain, "{mode} {what}: both brushes paint alike"); } }