tests/fullscreen: Add broken slow client unfullscreen view offset restoration test
Browse files at this commit2f9832aa367e9038d3e1374cf61fe2235175b936Parent: 618c83c1 changed file +62 -0
- src/tests/fullscreen.rs +62 -0
src/tests/fullscreen.rsmodified+62 -0
| @@ -153,3 +153,65 @@ fn windowed_fullscreen_chain() { | ||
| 153 | 153 | " |
| 154 | 154 | ); |
| 155 | 155 | } |
| 156 | + | |
| 157 | +#[test] | |
| 158 | +fn unfullscreen_before_fullscreen_ack_doesnt_prevent_view_offset_save_restore() { | |
| 159 | + let (mut f, id, _surface) = set_up(); | |
| 160 | + | |
| 161 | + let window2 = f.client(id).create_window(); | |
| 162 | + let surface2 = window2.surface.clone(); | |
| 163 | + window2.commit(); | |
| 164 | + f.roundtrip(id); | |
| 165 | + | |
| 166 | + let window2 = f.client(id).window(&surface2); | |
| 167 | + window2.attach_new_buffer(); | |
| 168 | + window2.set_size(200, 200); | |
| 169 | + window2.ack_last_and_commit(); | |
| 170 | + f.double_roundtrip(id); | |
| 171 | + | |
| 172 | + let _ = f.client(id).window(&surface2).recent_configures(); | |
| 173 | + | |
| 174 | + let niri = f.niri(); | |
| 175 | + let mapped2 = niri.layout.windows().last().unwrap().1; | |
| 176 | + let window2_id = mapped2.window.clone(); | |
| 177 | + | |
| 178 | + // The view position is at the first window. | |
| 179 | + assert_snapshot!(niri.layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); | |
| 180 | + | |
| 181 | + // Fullscreen window2 and send the configure so we can clear pending. | |
| 182 | + niri.layout.set_fullscreen(&window2_id, true); | |
| 183 | + f.double_roundtrip(id); | |
| 184 | + | |
| 185 | + // Before acking, unfullscreen the column, clearing the pending fullscreen flag. | |
| 186 | + f.niri().layout.set_fullscreen(&window2_id, false); | |
| 187 | + | |
| 188 | + // Now, window2 receives the fullscreen configure and resizes in response. | |
| 189 | + let window2 = f.client(id).window(&surface2); | |
| 190 | + assert_snapshot!( | |
| 191 | + window2.format_recent_configures(), | |
| 192 | + @"size: 1920 × 1080, bounds: 1888 × 1048, states: [Activated, Fullscreen]" | |
| 193 | + ); | |
| 194 | + let (_, configure) = window2.configures_received.last().unwrap(); | |
| 195 | + window2.set_size(configure.size.0 as u16, configure.size.1 as u16); | |
| 196 | + window2.ack_last_and_commit(); | |
| 197 | + f.double_roundtrip(id); | |
| 198 | + f.niri_complete_animations(); | |
| 199 | + | |
| 200 | + // The view position is now at the fullscreen-sized window2. | |
| 201 | + assert_snapshot!(f.niri().layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); | |
| 202 | + | |
| 203 | + // Now, window2 receives the unfullscreen configure and resizes in response. | |
| 204 | + let window2 = f.client(id).window(&surface2); | |
| 205 | + assert_snapshot!( | |
| 206 | + window2.format_recent_configures(), | |
| 207 | + @"size: 936 × 1048, bounds: 1888 × 1048, states: [Activated]" | |
| 208 | + ); | |
| 209 | + window2.set_size(200, 200); | |
| 210 | + window2.ack_last_and_commit(); | |
| 211 | + f.roundtrip(id); | |
| 212 | + f.niri_complete_animations(); | |
| 213 | + | |
| 214 | + // The view position should restore to the first window. | |
| 215 | + // FIXME: this currently doesn't work and sets the view position to the second window. | |
| 216 | + assert_snapshot!(f.niri().layout.active_workspace().unwrap().scrolling().view_pos(), @"100"); | |
| 217 | +} |