Check that the Devanagari filter drops a known Latin-only family

Counting rows also counted layer rows and passed for an empty list. Inter, the layer's font, is listed before the filter and gone after.
This commit is contained in:
ruchirguitar committed 2026-12-02 08:28:13 +05:30
1 parent 76c64f19e6
commit 55be3688f6
1 file changed
+4 -4
@@ -235,7 +235,7 @@ fn hovering_a_font_adds_no_history_step_and_a_pick_adds_one() {
}
/// The toolbar's Script select offers the Indic scripts (#10996); picking Devanagari narrows the family list and is
/// kept as the pickers' filter.
/// kept as the pickers' filter. Fonts come from the host, so the test checks only the bundled Latin-only Inter.
#[test]
fn the_family_list_filters_by_an_indic_script() {
let mut h = bar_harness(app_with_layer());
@@ -243,12 +243,12 @@ fn the_family_list_filters_by_an_indic_script() {
assert_eq!(h.state().ui.font_filters.script, None, "no script filter at first");
field(&h).click();
h.run();
let families = |h: &Harness<'static, Box<PhotocraftApp>>| h.query_all_by_role(Role::TreeItem).count();
let before = families(&h);
let inter = |h: &Harness<'static, Box<PhotocraftApp>>| h.query_by_role_and_label(Role::TreeItem, "Inter").is_some();
assert!(inter(&h), "the layer's Latin-only family is listed before the filter");
h.get_by_role_and_label(Role::ComboBox, "Script").click();
h.run();
h.get_by_label("Devanagari").click();
h.run();
assert_eq!(h.state().ui.font_filters.script, Some(craft::font_manager::picker::FontScript::Devanagari));
assert!(families(&h) < before, "the Latin-only families leave the list ({} of {before} left)", families(&h));
assert!(!inter(&h), "a Latin-only family leaves the Devanagari list");
}