diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rs index 976ecd55..fda3f315 100644 --- a/crates/ui-egui/src/headless.rs +++ b/crates/ui-egui/src/headless.rs @@ -1053,6 +1053,24 @@ mod tests { assert_ne!(h.app.session.active(), Some(first), "advanced"); } + /// The eye on a section header switches the section off and on again, one undo step each + /// (issue #316). + #[test] + fn section_eye_switches_a_section_off() { + let mut h = demo([1300.0, 900.0]); + let t = Duration::from_secs(10); + h.request("ui.set", json!({"view": "detail", "right": "edit"}), t); + h.settle(SETTLE); + let light_on = |h: &Headless| h.app.session.develop_of(h.app.session.active().unwrap()).unwrap().section_enabled("light"); + for expected in [false, true] { + // the eye shows while the pointer is on the header + assert_eq!(h.request("ui.hoverWidget", json!({"id": "section:light"}), t)["ok"], true); + assert_eq!(h.request("ui.clickWidget", json!({"id": "sectionEye:light"}), t)["ok"], true); + assert_eq!(light_on(&h), expected); + } + assert!(h.app.ui.section_open("light"), "the click didn't fold the section"); + } + /// Return commits a tool panel back to Edit; elsewhere it does nothing. #[test] fn return_commits_the_crop_tool() {