forge
Explore
Log in

Don't you dare go Hollow

Add test for set_fullscreen panic on removed wl_output

Browse files at this commit

68bb942d2146cd2c8af69c0f16db18396b4388feIvan MolodetskikhParent: 04c422e
src/tests/mod.rsmodified+1 -0
@@ -8,5 +8,6 @@ mod animations;
8 mod floating;8 mod floating;
9 mod fullscreen;9 mod fullscreen;
10 mod layer_shell;10 mod layer_shell;
11+mod remove_output;
11 mod transactions;12 mod transactions;
12 mod window_opening;13 mod window_opening;
src/tests/remove_output.rsadded+34 -0
@@ -0,0 +1,34 @@
1+use super::*;
2+
3+#[test]
4+fn set_fullscreen_on_removed_output_does_not_panic() {
5+ let mut f = Fixture::new();
6+ f.add_output(1, (1920, 1080));
7+ f.add_output(2, (1280, 720));
8+
9+ let id = f.add_client();
10+
11+ let window = f.client(id).create_window();
12+ let surface = window.surface.clone();
13+ window.commit();
14+ f.roundtrip(id);
15+
16+ let window = f.client(id).window(&surface);
17+ window.attach_new_buffer();
18+ window.set_size(100, 100);
19+ window.ack_last_and_commit();
20+ f.double_roundtrip(id);
21+
22+ // Grab the second output's wl_output proxy on the client side.
23+ let wl_output = f.client(id).output("headless-2");
24+
25+ // Remove the output on the niri side. Its wl_output global is disabled but not yet
26+ // destroyed, so the client's wl_output resource is still valid and usable.
27+ let output = f.niri_output(2);
28+ f.niri().remove_output(&output);
29+
30+ // Request fullscreen on the now-removed wl_output. niri must not panic.
31+ let window = f.client(id).window(&surface);
32+ window.set_fullscreen(Some(&wl_output));
33+ f.double_roundtrip(id);
34+}