forge
Explore
Log in

Don't you dare go Hollow

Add unmap-from-floating test

Browse files at this commit

35cbab476ebfc271909777029f56f666b29d76a2Ivan MolodetskikhParent: 28d072d
Hits a code path that reads the last acked state after unmapping.
src/tests/client.rsmodified+4 -0
@@ -341,6 +341,10 @@ impl Window {
341 self.surface.attach(Some(&buffer), 0, 0);341 self.surface.attach(Some(&buffer), 0, 0);
342 }342 }
343 343
344+ pub fn attach_null(&self) {
345+ self.surface.attach(None, 0, 0);
346+ }
347+
344 pub fn set_size(&self, w: u16, h: u16) {348 pub fn set_size(&self, w: u16, h: u16) {
345 self.viewport.set_destination(i32::from(w), i32::from(h));349 self.viewport.set_destination(i32::from(w), i32::from(h));
346 }350 }
src/tests/floating.rsmodified+17 -0
@@ -855,6 +855,23 @@ window-rule {
855 );855 );
856 }856 }
857 857
858+#[test]
859+fn unmap_from_floating() {
860+ let (mut f, id, surface) = set_up();
861+
862+ f.niri().layout.toggle_window_floating(None);
863+ f.double_roundtrip(id);
864+ let _ = f.client(id).window(&surface).recent_configures();
865+
866+ // Resize to something different on both axes.
867+ let window = f.client(id).window(&surface);
868+ window.attach_null();
869+ window.commit();
870+
871+ // Shouldn't panic.
872+ f.double_roundtrip(id);
873+}
874+
858 #[test]875 #[test]
859 fn unfullscreen_to_floating_doesnt_send_extra_configure() {876 fn unfullscreen_to_floating_doesnt_send_extra_configure() {
860 let (mut f, id, surface) = set_up();877 let (mut f, id, surface) = set_up();