Tests: the Picked files group test checks that both paths are inside the group

The test for a script's file dialog with two picked files checked only that a
group named Picked files exists. It now walks that group's accessibility
children and checks that /picked/a.txt and /picked/b.txt are among them, so a
group drawn without the paths fails the test.
This commit is contained in:
dotCooCoo committed 2026-11-24 18:33:19 -08:00
1 parent db7810888d
commit b1d67df34d
1 file changed
+17
+17
View File
@@ -484,6 +484,23 @@ fn a_scripts_file_dialog_lists_several_picked_files_in_a_named_group() {
let groups: Vec<_> =
update.nodes.iter().filter(|(_, node)| node.role() == egui::accesskit::Role::Group).filter_map(|(_, node)| node.label()).collect();
assert!(groups.contains(&"Picked files"), "a group named Picked files: {groups:?}");
let nodes: std::collections::HashMap<_, _> = update.nodes.iter().map(|(id, node)| (*id, node)).collect();
let (_, group) = update
.nodes
.iter()
.find(|(_, node)| node.role() == egui::accesskit::Role::Group && node.label() == Some("Picked files"))
.expect("the Picked files group");
let mut texts = Vec::new();
let mut pending = group.children().to_vec();
while let Some(id) = pending.pop() {
if let Some(node) = nodes.get(&id) {
texts.extend(node.label().into_iter().chain(node.value()).map(str::to_owned));
pending.extend_from_slice(node.children());
}
}
for path in ["/picked/a.txt", "/picked/b.txt"] {
assert!(texts.iter().any(|text| text == path), "{path} is inside the Picked files group: {texts:?}");
}
cancel(&mut app, PICKER_KIND);
finish(&mut app);
}