From 8f1a136e42e3f9559df087898e23c30d01bccf0b Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 04:36:11 +0000 Subject: [PATCH] FontsPanel trial: with the keyboard on a card, Cmd/Ctrl+F puts it in the search field --- crates/font-manager/tests/it/panel.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/crates/font-manager/tests/it/panel.rs b/crates/font-manager/tests/it/panel.rs index f8fbbc428..c27b7137f 100644 --- a/crates/font-manager/tests/it/panel.rs +++ b/crates/font-manager/tests/it/panel.rs @@ -212,3 +212,27 @@ fn queued_installs_run_one_runner_in_request_order() { spawned.remove(0)(); assert_eq!(rig.store.calls(), [Call::Install("Amiri".into()), Call::Install("Hack".into())]); } + +impl Rig { + /// The names of the family cards on screen. + fn cards(&self) -> Vec { + (self.fx.by_role(Role::LIST_ITEM).into_iter()) + .filter_map(|target| craft_ui::testing::access::name(self.fx.tree(), target.node).map(str::to_owned)) + .collect() + } +} + +/// With the keyboard on a card, Cmd/Ctrl+F puts it in the search field: typed text searches. +#[trial] +fn find_puts_the_keyboard_in_the_search_field() { + let mut rig = setup("find"); + let card = rig.named(Role::LIST_ITEM, "Hack"); + rig.fx.click_at(Pos2::new(card.rect.left() + 4.0, card.rect.top() + 4.0)); + rig.fx.settle(); + rig.fx.key(Key::F, Modifiers::COMMAND); + rig.fx.settle(); + rig.fx.type_text("Ubuntu"); + rig.fx.settle(); + let cards = rig.cards(); + assert!(!cards.is_empty() && cards.iter().all(|name| !name.starts_with("Hack")), "the search keeps only Ubuntu: {cards:?}"); +}