From 8138fc12e707e2e03c6fc0f185efe75b8cbec720 Mon Sep 17 00:00:00 2001 From: Higgs32584 Date: Sun, 18 Oct 2026 15:04:18 -0400 Subject: [PATCH] test(web): a press, release and press in one frame keep all three events Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/touch_twins.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ui-egui/src/touch_twins.rs b/crates/ui-egui/src/touch_twins.rs index a000d0b05b8..aee4aa33d38 100644 --- a/crates/ui-egui/src/touch_twins.rs +++ b/crates/ui-egui/src/touch_twins.rs @@ -86,6 +86,17 @@ mod tests { assert!(tap(&mut harness, true), "a third tap opens it again"); } + /// A fast double tap delivered in one frame: each event changes the button's state, so none is + /// a twin. + #[test] + fn a_press_release_press_in_one_frame_keeps_all_three() { + let ctx = egui::Context::default(); + let p = pos2(10.0, 10.0); + let mut raw = RawInput { time: Some(1.0), events: vec![button(p, true), button(p, false), button(p, true)], ..Default::default() }; + drop_twins(&ctx, &mut raw); + assert_eq!(raw.events.len(), 3); + } + #[test] fn a_press_held_for_long_still_passes() { let ctx = egui::Context::default();