facett-map/tests/a11y.rs
//! **FC-4** interaction proof for `MapView`. The whole painted map (points +
//! the vector basemap) is a single AccessKit Image node summarising the pane
//! (title + point count + way count) — so a robot driver / screen reader reads
//! what the map shows instead of a blank canvas.
use egui_kittest::Harness;
use egui_kittest::kittest::{NodeT, Queryable};
use facett_core::Facet;
use facett_map::MapView;
#[test]
fn map_pane_is_a_labelled_image_node_with_point_count() {
let mut view = MapView::new("Sweden", vec![(11.0, 57.0), (18.0, 59.0), (13.0, 55.0)]);
let mut harness = Harness::builder().with_size(egui::vec2(400.0, 300.0)).build_ui(move |ui| view.ui(ui));
harness.run();
// The pane summary now carries the way count too (0 ways here — point-only).
let pane = harness.get_by_label("Sweden — 3 points · 0 ways").accesskit_node();
assert_eq!(pane.role(), egui::accesskit::Role::Image, "the map pane is an Image-role AccessKit node");
assert_eq!(pane.numeric_value(), Some(3.0), "the point count rides the tree as numeric_value");
// Feed the matrix: ok iff the FC-4 pane node carries the right point count.
#[cfg(feature = "testmatrix")]
facett_core::testmatrix::emit(
"MapView",
"fc4_pane_node",
pane.role() == egui::accesskit::Role::Image && pane.numeric_value() == Some(3.0),
"pane Image node, numeric_value=3 points",
);
}