mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Panels: tests find the rail by its own button, since it is drawn inside the canvas panel
This commit is contained in:
1 parent
4f8382f56e
commit
edaa41cf05
2 files changed
+14
-6
No files matched your search
@@ -6793,6 +6793,12 @@ mod embedding_tests {
|
||||
egui::containers::panel::PanelState::load(&h.ctx, panel_state_id(&h.ctx, panel)).is_some()
|
||||
}
|
||||
|
||||
/// The rail is drawn inside the canvas panel, so its panel state is keyed under that panel's
|
||||
/// scope: find it by a button only the rail has.
|
||||
fn rail_drawn(h: &egui_kittest::Harness<'_, PhotocraftApp>) -> bool {
|
||||
h.query_by_label("Color & Swatches").is_some()
|
||||
}
|
||||
|
||||
/// An app that embeds the UI can hide the icon rail and the menu bar; both are on by default.
|
||||
#[test]
|
||||
fn rail_and_menu_bar_follow_their_panel_flags() {
|
||||
@@ -6800,11 +6806,11 @@ mod embedding_tests {
|
||||
assert!(panels.rail && panels.menu_bar);
|
||||
|
||||
let h = whole_app(true, true);
|
||||
assert!(drawn(&h, "rail") && drawn(&h, "title_bar"));
|
||||
assert!(rail_drawn(&h) && drawn(&h, "title_bar"));
|
||||
assert!(h.query_by_label("File").is_some());
|
||||
|
||||
let h = whole_app(false, false);
|
||||
assert!(!drawn(&h, "rail"), "the icon rail is drawn");
|
||||
assert!(!rail_drawn(&h), "the icon rail is drawn");
|
||||
assert!(!drawn(&h, "title_bar"), "the title bar is drawn");
|
||||
assert!(h.query_by_label("File").is_none(), "the menus are drawn");
|
||||
assert!(crate::panel_docking::last_bodies(&h.ctx).iter().any(|(id, _)| id == "layers"), "the dock itself stays");
|
||||
|
||||
@@ -597,10 +597,12 @@ mod tests {
|
||||
crate::menus::invoke(h.state_mut(), &ctx, "window.workspace.select", json!({"name": "Embedded"})).unwrap();
|
||||
h.run_steps(4);
|
||||
assert_eq!(h.state().ui.theme, theme, "the fixture renders the requested theme");
|
||||
for name in ["title_bar", "rail"] {
|
||||
if egui::containers::panel::PanelState::load(&h.ctx, crate::panels::panel_state_id(&h.ctx, name)).is_some() {
|
||||
failures.push(format!("{theme:?}, width={width}: {name} is drawn"));
|
||||
}
|
||||
if egui::containers::panel::PanelState::load(&h.ctx, crate::panels::panel_state_id(&h.ctx, "title_bar")).is_some() {
|
||||
failures.push(format!("{theme:?}, width={width}: title_bar is drawn"));
|
||||
}
|
||||
// The rail is drawn inside the canvas panel: find it by a button only it has.
|
||||
if egui_kittest::kittest::Queryable::query_by_label(&h, "Color & Swatches").is_some() {
|
||||
failures.push(format!("{theme:?}, width={width}: rail is drawn"));
|
||||
}
|
||||
if h.state().ui.panels.menu_bar || h.state().ui.panels.rail {
|
||||
failures.push(format!("{theme:?}, width={width}: host flags were overwritten"));
|
||||
|
||||
Reference in new issue
Block a user