mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-02 18:13:39 +00:00
Pipette cursor test: Windows reports the precise crosshair with its bitmap (#1160)
test (windows-latest) fails on main in input_tests::eyedropper_and_alt_sampling_show_a_pipette
("Precise keeps the crosshair": left Crosshair, right None). #1437 expected None on Windows because
the canvas drew the crosshair and hid the OS cursor; since #1160 Windows hands the OS a bitmap
cursor and tool_cursor's end-of-pass hook reports Crosshair underneath it. The test now expects
Crosshair everywhere, plus the bitmap on Windows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UHgFEHEsefoQoBParH47JA
(cherry picked from commit 32657d5b26)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user