PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Pipette cursor test: Windows reports the precise crosshair with its bitmap (Windows CI red since #1160) (#1626)
BFlat4a406a6cf688
diff --git a/crates/ui-egui/src/input_tests.rs b/crates/ui-egui/src/input_tests.rsindex b2df7b1bd..eb20783da 100644--- a/crates/ui-egui/src/input_tests.rs+++ b/crates/ui-egui/src/input_tests.rs@@ -488,10 +488,15 @@ fn eyedropper_and_alt_sampling_show_a_pipette() {h.event(egui::Event::ModifiersChanged(Modifiers::ALT));assert_eq!(cursor(&mut h), egui::CursorIcon::None, "⌥ samples with a pipette");h.state_mut().run("prefs.set", json!({"values": {"cursors.other": "precise"}})).unwrap();- // Windows draws the crosshair on the canvas and hides the OS cursor (`visible_crosshair`).- let crosshair = if cfg!(target_os = "windows") { egui::CursorIcon::None } else { egui::CursorIcon::Crosshair };- assert_eq!(cursor(&mut h), crosshair, "Precise keeps the crosshair");+ // Every platform reports the crosshair. Windows also hands the OS a black-and-white bitmap+ // for it (`tool_cursor`, #1160), with `Crosshair` underneath as the fallback.+ let precise = |h: &mut Harness<'static, PhotocraftApp>| {+ let icon = cursor(h);+ (icon, h.output().platform_output.cursor_image.is_some())+ };+ let windows = cfg!(target_os = "windows");+ assert_eq!(precise(&mut h), (egui::CursorIcon::Crosshair, windows), "Precise keeps the crosshair");h.event(egui::Event::ModifiersChanged(Modifiers::NONE));h.state_mut().ui.tool = crate::state::Tool::Eyedropper;- assert_eq!(cursor(&mut h), crosshair);+ assert_eq!(precise(&mut h), (egui::CursorIcon::Crosshair, windows));}