From af963475871bed6d18a2ad3db95d0fb5567b9ae2 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 30 Nov 2026 03:29:10 +0000 Subject: [PATCH] Test: the title bar's Home is on while Home is open Guards the framework fix that marks a checked bar item's part on. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 4e0d5a894..fd769217b 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -277,6 +277,28 @@ fn change_picture_replaces_the_selected_picture() { } } +/// The title bar's Home button shows on while Home (the File view) is open over a presentation, and off once it is +/// left. +#[test] +fn the_title_bars_home_button_is_on_while_home_is_open() { + use egui::accesskit::Toggled; + use egui_kittest::kittest::{NodeT, Queryable}; + let mut h = crate::test_harness::harness(Session::with_new(), Services::default()); + h.run_steps(2); + // The title bar's item, not the File view's Home page in its side menu. + let in_title_bar = |node: &egui_kittest::Node<'_>| node.accesskit_node().bounding_box().is_some_and(|bounds| bounds.y1 <= 44.0); + let home_on = |h: &egui_kittest::Harness<'_, SlideApp>| { + let homes: Vec<_> = h.query_all_by(|node| node.label().is_some_and(|label| label.starts_with("Home"))).filter(in_title_bar).collect(); + assert!(!homes.is_empty(), "the title bar has a Home item"); + homes.iter().any(|node| node.accesskit_node().toggled() == Some(Toggled::True)) + }; + assert!(!home_on(&h), "Home is off over the slides"); + h.state_mut().run("app.home", json!({})).unwrap(); + h.run_steps(2); + assert!(h.state().backstage_open()); + assert!(home_on(&h), "Home is on while the File view is open"); +} + /// #17: Home created a new blank presentation instead of going to the start screen. #[test] fn home_shows_the_start_screen_over_the_open_presentation() {