From 0b5d4df26138b140f193f059bab463e8a64568cc Mon Sep 17 00:00:00 2001 From: Lucas Batista Vargas Date: Thu, 26 Nov 2026 18:29:41 -0300 Subject: [PATCH] test(widgets): restore a_combo_field_reached_with_tab_shows_its_hint_after_a_delay test (#7317) (#7594) --- crates/ui-egui/src/ribbon/home.rs | 4 +++- crates/ui-egui/src/ribbon/tests.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/ribbon/home.rs b/crates/ui-egui/src/ribbon/home.rs index 0b006178d4..d49feae6eb 100644 --- a/crates/ui-egui/src/ribbon/home.rs +++ b/crates/ui-egui/src/ribbon/home.rs @@ -189,7 +189,9 @@ pub(super) fn home(row: &mut RibbonRow<'_>, app: &mut WordApp) { let mut size = st.get("size").and_then(Value::as_f64).map(fmt).unwrap_or_default(); let sizes: Vec> = wordcraft_engine::cmd::format::SIZES.iter().map(|s| Entry::new(fmt(f64::from(*s)), fmt(f64::from(*s)))).collect(); - let out = craft::ui::pickers::ComboBox::new(tl!("Font Size").to_string(), Bind::bound(&mut size), &sizes).show(ui); + let out = craft::ui::pickers::ComboBox::new(tl!("Font Size").to_string(), Bind::bound(&mut size), &sizes) + .tooltip(tl!("Font Size").to_string()) + .show(ui); if let Some(v) = out.edit.events.committed() && let Ok(x) = v.trim().parse::() { diff --git a/crates/ui-egui/src/ribbon/tests.rs b/crates/ui-egui/src/ribbon/tests.rs index bc305a4fa4..f584dc0d33 100644 --- a/crates/ui-egui/src/ribbon/tests.rs +++ b/crates/ui-egui/src/ribbon/tests.rs @@ -1295,3 +1295,30 @@ fn the_styles_gallery_reads_from_the_right_in_a_right_to_left_interface() { ); } } + +#[test] +fn a_combo_field_reached_with_tab_shows_its_hint_after_a_delay() { + use egui::accesskit::Role; + + let app = WordApp::new(Session::new(wordcraft_doc::Document::from_text("Sample")), crate::Services::default()); + let mut h = tab_harness(app, "Home"); + + // Focus the Font box right before Font Size, then Tab onto Font Size. + h.get(By::new().role(Role::ComboBox).label("Font")).focus(); + h.step(); + for _ in 0..4 { + h.key_press(egui::Key::Tab); + h.step(); + if h.query(By::new().role(Role::ComboBox).label("Font Size")).is_some_and(|n| n.is_focused()) { + break; + } + } + assert!(h.get(By::new().role(Role::ComboBox).label("Font Size")).is_focused(), "Tab should focus Font Size"); + assert_eq!(h.query_all_by_label("Font Size").count(), 1, "hint must not show immediately before delay"); + + let frames = ((craft::ui::contract::tooltip::DELAY * 60.0).ceil() as usize) + 5; + for _ in 0..frames { + h.step(); + } + assert!(h.query_all_by_label("Font Size").count() >= 2, "hint must show after tooltip delay"); +}