From 35cbab476ebfc271909777029f56f666b29d76a2 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 2 Sep 2025 08:07:22 +0300 Subject: Add unmap-from-floating test Hits a code path that reads the last acked state after unmapping. --- src/tests/client.rs | 4 ++++ src/tests/floating.rs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/tests/client.rs b/src/tests/client.rs index d118e472..fc61c2ac 100644 --- a/src/tests/client.rs +++ b/src/tests/client.rs @@ -341,6 +341,10 @@ impl Window { self.surface.attach(Some(&buffer), 0, 0); } + pub fn attach_null(&self) { + self.surface.attach(None, 0, 0); + } + pub fn set_size(&self, w: u16, h: u16) { self.viewport.set_destination(i32::from(w), i32::from(h)); } diff --git a/src/tests/floating.rs b/src/tests/floating.rs index b2eaabfb..4d0b9383 100644 --- a/src/tests/floating.rs +++ b/src/tests/floating.rs @@ -855,6 +855,23 @@ window-rule { ); } +#[test] +fn unmap_from_floating() { + let (mut f, id, surface) = set_up(); + + f.niri().layout.toggle_window_floating(None); + f.double_roundtrip(id); + let _ = f.client(id).window(&surface).recent_configures(); + + // Resize to something different on both axes. + let window = f.client(id).window(&surface); + window.attach_null(); + window.commit(); + + // Shouldn't panic. + f.double_roundtrip(id); +} + #[test] fn unfullscreen_to_floating_doesnt_send_extra_configure() { let (mut f, id, surface) = set_up(); -- cgit