From cf93aeecd4728cb13266173fb32e88ec8c837949 Mon Sep 17 00:00:00 2001 From: Raghav Krishna Date: Mon, 9 Nov 2026 19:10:57 +0530 Subject: [PATCH] Pencil: check both directions of the pressure-flag isolation (#11962) --- .../src/pencil_pressure_toggles_tests.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/ui-egui/src/pencil_pressure_toggles_tests.rs b/crates/ui-egui/src/pencil_pressure_toggles_tests.rs index b12376d0bc..c044398f33 100644 --- a/crates/ui-egui/src/pencil_pressure_toggles_tests.rs +++ b/crates/ui-egui/src/pencil_pressure_toggles_tests.rs @@ -82,6 +82,23 @@ fn the_brush_keeps_its_own_pressure_flags() { h.state_mut().ui.tool = Tool::Pencil; h.run_steps(4); assert!(h.state().session.tools.brush.pressure_opacity, "the Pencil's flag came back"); + + // The mirror: the Brush on, the Pencil off, so a reset to one value cannot pass. + h.state_mut().ui.tool = Tool::Brush; + h.run_steps(4); + h.state_mut().session.tools.brush.pressure_opacity = true; + h.run_steps(2); + h.state_mut().ui.tool = Tool::Pencil; + h.run_steps(4); + h.get_by_label("Always use pressure for opacity").click(); + h.run_steps(2); + assert!(!h.state().session.tools.brush.pressure_opacity, "the Pencil is off"); + h.state_mut().ui.tool = Tool::Brush; + h.run_steps(4); + assert!(h.state().session.tools.brush.pressure_opacity, "the Brush stayed on"); + h.state_mut().ui.tool = Tool::Pencil; + h.run_steps(4); + assert!(!h.state().session.tools.brush.pressure_opacity, "the Pencil stayed off"); } #[test]