atagen

monolith

public
Star0
Watch0

Commit 38125b3487d7

tarball

atagen <boss@atagen.co>2026-10-17 05:03 UTC

1 file changed+40-0
layout: check arrangements against visible() and test replug restores

The scene draws from arrange while focus and frame callbacks use visible, and the two disagreeing is how the hidden lone window showed through. Replugging restoring an output exactly is the promise parking makes, so it gets its own property.
Modified file: crates/layout/src/tests.rs+40 additions
@@ -131,6 +131,23 @@ fn apply(l: &mut Layout, tags: &[TagId], op: &Op) {
131131 fn check_geometry(l: &Layout) {
132132 for (o, out) in l.outputs() {
133133 let arr = l.arrange(o);
134+ let mut drawn: Vec<WindowId> = arr
135+ .tiled
136+ .iter()
137+ .filter(|p| p.visible)
138+ .map(|p| p.window)
139+ .chain(arr.floating.iter().map(|&(w, _)| w))
140+ .chain(arr.fullscreen)
141+ .collect();
142+ drawn.sort();
143+ drawn.dedup();
144+ let mut visible: Vec<WindowId> = l
145+ .windows()
146+ .filter(|&(w, win)| win.output == Some(o) && l.visible(w))
147+ .map(|(w, _)| w)
148+ .collect();
149+ visible.sort();
150+ assert_eq!(drawn, visible, "arrangement disagrees with visible()");
134151 let shown: Vec<Rect> = arr
135152 .tiled
136153 .iter()
@@ -170,6 +187,29 @@ proptest! {
170187 check_geometry(&l);
171188 }
172189 }
190+
191+ #[test]
192+ fn replugging_restores_what_unplugging_moved(ops in prop::collection::vec(op(), 1..60)) {
193+ let mut l = Layout::default();
194+ l.add_output("a", AREA);
195+ l.add_output("b", Rect::new(1000.0, 0.0, 800.0, 600.0));
196+ let tags = [l.homeless(), l.tag("1"), l.tag("2"), l.tag("3")];
197+ for op in &ops {
198+ apply(&mut l, &tags, op);
199+ }
200+ let Some(b) = l.outputs().find(|(_, out)| out.name == "b").map(|(o, _)| o) else {
201+ return Ok(());
202+ };
203+ let before = |l: &Layout, o| {
204+ let out = l.output(o).unwrap();
205+ (out.tree.windows().collect::<Vec<_>>(), out.floating.clone(), out.viewed.clone())
206+ };
207+ let was = before(&l, b);
208+ l.remove_output(b);
209+ let b = l.add_output("b", Rect::new(1000.0, 0.0, 800.0, 600.0));
210+ l.check();
211+ prop_assert_eq!(before(&l, b), was);
212+ }
173213 }
174214
175215 /// The hidden-slot rules from planner.html, demo 11.