Tests: the Slices keyboard test checks Line Color and starts from the search field

keyboard_focus_on_a_slices_row_shows_its_description stopped at Show Slice
Numbers, so nothing checked that keyboard focus on Line Color shows its
sentence, and the test passed even when the first Tab did not start from
the search field. It now uses tab_to_each, as the Hyphenation test does:
it asserts the search field has the keyboard first, then tabs to Show
Slice Numbers and Line Color in that order and checks that each focused
control carries its sentence.
This commit is contained in:
dotCooCoo committed 2026-11-20 23:50:12 -08:00
1 parent 9fff48d88f
commit 7b9603bb87
1 file changed
+7 -11
+7 -11
View File
@@ -2439,8 +2439,9 @@ fn hovering_a_slices_row_shows_its_description() {
assert!(painted(&after, color) && !painted(&after, numbers), "the Line Color row's sentence shows: {after:?}");
}
/// Tab from the search field reaches Slices' first control, the Show Slice Numbers box: the line
/// shows its sentence and a screen reader gets it as the control's description.
/// Tab from the search field reaches Slices' Show Slice Numbers box and then its Line Color control,
/// in that order: the line shows each one's sentence in turn, and a screen reader gets it as the
/// focused control's description.
#[test]
fn keyboard_focus_on_a_slices_row_shows_its_description() {
let mut a = app();
@@ -2451,16 +2452,11 @@ fn keyboard_focus_on_a_slices_row_shows_its_description() {
description_frame(&mut a, &ctx, vec![]);
description_frame(&mut a, &ctx, vec![]);
let numbers = descriptions::description("showSliceNumbers").expect("Show Slice Numbers has a sentence");
let mut shown = None;
for _ in 0..40 {
let (texts, described) = description_frame(&mut a, &ctx, key_press(egui::Key::Tab, egui::Modifiers::NONE));
if painted(&texts, numbers) {
shown = Some(described);
break;
}
let color = descriptions::description("sliceLineColor").expect("Line Color has a sentence");
let first = tab_to_each(&mut a, &ctx, &[numbers, color]);
for ((described, _), sentence) in first.iter().zip([numbers, color]) {
assert_eq!(described.as_deref(), Some(sentence), "the focused control carries the sentence");
}
let described = shown.expect("Tab reaches the Show Slice Numbers row and its sentence shows");
assert!(described.iter().any(|d| d == numbers), "the focused control carries the sentence: {described:?}");
}
/// Whether `sentence` is one of `texts` and is drawn on the description line of the frame that