tests/fullscreen: Add broken slow client unfullscreen view offset restoration test

This commit is contained in:
Ivan Molodetskikh
2025-09-02 18:55:10 +03:00
parent 618c83c59f
commit 2f9832aa36

View File

@@ -153,3 +153,65 @@ fn windowed_fullscreen_chain() {
"
);
}
#[test]
fn unfullscreen_before_fullscreen_ack_doesnt_prevent_view_offset_save_restore() {
let (mut f, id, _surface) = set_up();
let window2 = f.client(id).create_window();
let surface2 = window2.surface.clone();
window2.commit();
f.roundtrip(id);
let window2 = f.client(id).window(&surface2);
window2.attach_new_buffer();
window2.set_size(200, 200);
window2.ack_last_and_commit();
f.double_roundtrip(id);
let _ = f.client(id).window(&surface2).recent_configures();
let niri = f.niri();
let mapped2 = niri.layout.windows().last().unwrap().1;
let window2_id = mapped2.window.clone();
// The view position is at the first window.
assert_snapshot!(niri.layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
// Fullscreen window2 and send the configure so we can clear pending.
niri.layout.set_fullscreen(&window2_id, true);
f.double_roundtrip(id);
// Before acking, unfullscreen the column, clearing the pending fullscreen flag.
f.niri().layout.set_fullscreen(&window2_id, false);
// Now, window2 receives the fullscreen configure and resizes in response.
let window2 = f.client(id).window(&surface2);
assert_snapshot!(
window2.format_recent_configures(),
@"size: 1920 × 1080, bounds: 1888 × 1048, states: [Activated, Fullscreen]"
);
let (_, configure) = window2.configures_received.last().unwrap();
window2.set_size(configure.size.0 as u16, configure.size.1 as u16);
window2.ack_last_and_commit();
f.double_roundtrip(id);
f.niri_complete_animations();
// The view position is now at the fullscreen-sized window2.
assert_snapshot!(f.niri().layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
// Now, window2 receives the unfullscreen configure and resizes in response.
let window2 = f.client(id).window(&surface2);
assert_snapshot!(
window2.format_recent_configures(),
@"size: 936 × 1048, bounds: 1888 × 1048, states: [Activated]"
);
window2.set_size(200, 200);
window2.ack_last_and_commit();
f.roundtrip(id);
f.niri_complete_animations();
// The view position should restore to the first window.
// FIXME: this currently doesn't work and sets the view position to the second window.
assert_snapshot!(f.niri().layout.active_workspace().unwrap().scrolling().view_pos(), @"100");
}