niri
Clone
https://git.tahinli.com/Tahinli/niri.git
0 watching·0 forks·Rust·GPL-3.0·12.1 MiB·9d8f4f8·Ivan Molodetskikh·1 month ago·2997 commits
| 1 | use insta::assert_snapshot; |
| 2 | |
| 3 | use super::*; |
| 4 | |
| 5 | #[test] |
| 6 | fn fullscreen() { |
| 7 | let ops = [ |
| 8 | Op::AddOutput(1), |
| 9 | Op::AddWindow { |
| 10 | params: TestWindowParams::new(1), |
| 11 | }, |
| 12 | Op::FullscreenWindow(1), |
| 13 | ]; |
| 14 | |
| 15 | check_ops(ops); |
| 16 | } |
| 17 | |
| 18 | #[test] |
| 19 | fn unfullscreen_window_in_column() { |
| 20 | let ops = [ |
| 21 | Op::AddOutput(1), |
| 22 | Op::AddWindow { |
| 23 | params: TestWindowParams::new(1), |
| 24 | }, |
| 25 | Op::AddWindow { |
| 26 | params: TestWindowParams::new(2), |
| 27 | }, |
| 28 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 29 | Op::SetFullscreenWindow { |
| 30 | window: 2, |
| 31 | is_fullscreen: false, |
| 32 | }, |
| 33 | ]; |
| 34 | |
| 35 | check_ops(ops); |
| 36 | } |
| 37 | |
| 38 | #[test] |
| 39 | fn unfullscreen_view_offset_not_reset_on_removal() { |
| 40 | let ops = [ |
| 41 | Op::AddOutput(1), |
| 42 | Op::AddWindow { |
| 43 | params: TestWindowParams::new(0), |
| 44 | }, |
| 45 | Op::FullscreenWindow(0), |
| 46 | Op::AddWindow { |
| 47 | params: TestWindowParams::new(1), |
| 48 | }, |
| 49 | Op::ConsumeOrExpelWindowRight { id: None }, |
| 50 | ]; |
| 51 | |
| 52 | check_ops(ops); |
| 53 | } |
| 54 | |
| 55 | #[test] |
| 56 | fn unfullscreen_view_offset_not_reset_on_consume() { |
| 57 | let ops = [ |
| 58 | Op::AddOutput(1), |
| 59 | Op::AddWindow { |
| 60 | params: TestWindowParams::new(0), |
| 61 | }, |
| 62 | Op::FullscreenWindow(0), |
| 63 | Op::AddWindow { |
| 64 | params: TestWindowParams::new(1), |
| 65 | }, |
| 66 | Op::ConsumeWindowIntoColumn, |
| 67 | ]; |
| 68 | |
| 69 | check_ops(ops); |
| 70 | } |
| 71 | |
| 72 | #[test] |
| 73 | fn unfullscreen_view_offset_not_reset_on_quick_double_toggle() { |
| 74 | let ops = [ |
| 75 | Op::AddOutput(1), |
| 76 | Op::AddWindow { |
| 77 | params: TestWindowParams::new(0), |
| 78 | }, |
| 79 | Op::FullscreenWindow(0), |
| 80 | Op::FullscreenWindow(0), |
| 81 | ]; |
| 82 | |
| 83 | check_ops(ops); |
| 84 | } |
| 85 | |
| 86 | #[test] |
| 87 | fn unfullscreen_view_offset_set_on_fullscreening_inactive_tile_in_column() { |
| 88 | let ops = [ |
| 89 | Op::AddOutput(1), |
| 90 | Op::AddWindow { |
| 91 | params: TestWindowParams::new(0), |
| 92 | }, |
| 93 | Op::AddWindow { |
| 94 | params: TestWindowParams::new(1), |
| 95 | }, |
| 96 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 97 | Op::FullscreenWindow(0), |
| 98 | ]; |
| 99 | |
| 100 | check_ops(ops); |
| 101 | } |
| 102 | |
| 103 | #[test] |
| 104 | fn unfullscreen_view_offset_not_reset_on_gesture() { |
| 105 | let ops = [ |
| 106 | Op::AddOutput(1), |
| 107 | Op::AddWindow { |
| 108 | params: TestWindowParams::new(0), |
| 109 | }, |
| 110 | Op::AddWindow { |
| 111 | params: TestWindowParams::new(1), |
| 112 | }, |
| 113 | Op::FullscreenWindow(1), |
| 114 | Op::ViewOffsetGestureBegin { |
| 115 | output_idx: 1, |
| 116 | workspace_idx: None, |
| 117 | is_touchpad: true, |
| 118 | }, |
| 119 | Op::ViewOffsetGestureEnd { |
| 120 | is_touchpad: Some(true), |
| 121 | }, |
| 122 | ]; |
| 123 | |
| 124 | check_ops(ops); |
| 125 | } |
| 126 | |
| 127 | #[test] |
| 128 | fn one_window_in_column_becomes_weight_1_after_fullscreen() { |
| 129 | let ops = [ |
| 130 | Op::AddOutput(1), |
| 131 | Op::AddWindow { |
| 132 | params: TestWindowParams::new(0), |
| 133 | }, |
| 134 | Op::AddWindow { |
| 135 | params: TestWindowParams::new(1), |
| 136 | }, |
| 137 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 138 | Op::AddWindow { |
| 139 | params: TestWindowParams::new(2), |
| 140 | }, |
| 141 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 142 | Op::SetWindowHeight { |
| 143 | id: None, |
| 144 | change: SizeChange::SetFixed(100), |
| 145 | }, |
| 146 | Op::Communicate(2), |
| 147 | Op::FocusWindowUp, |
| 148 | Op::SetWindowHeight { |
| 149 | id: None, |
| 150 | change: SizeChange::SetFixed(200), |
| 151 | }, |
| 152 | Op::Communicate(1), |
| 153 | Op::CloseWindow(0), |
| 154 | Op::FullscreenWindow(1), |
| 155 | ]; |
| 156 | |
| 157 | check_ops(ops); |
| 158 | } |
| 159 | |
| 160 | #[test] |
| 161 | fn disable_tabbed_mode_in_fullscreen() { |
| 162 | let ops = [ |
| 163 | Op::AddOutput(0), |
| 164 | Op::AddWindow { |
| 165 | params: TestWindowParams::new(0), |
| 166 | }, |
| 167 | Op::AddWindow { |
| 168 | params: TestWindowParams::new(1), |
| 169 | }, |
| 170 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 171 | Op::ToggleColumnTabbedDisplay, |
| 172 | Op::FullscreenWindow(0), |
| 173 | Op::ToggleColumnTabbedDisplay, |
| 174 | ]; |
| 175 | |
| 176 | check_ops(ops); |
| 177 | } |
| 178 | |
| 179 | #[test] |
| 180 | fn unfullscreen_with_large_border() { |
| 181 | let ops = [ |
| 182 | Op::AddWindow { |
| 183 | params: TestWindowParams::new(0), |
| 184 | }, |
| 185 | Op::FullscreenWindow(0), |
| 186 | Op::Communicate(0), |
| 187 | Op::FullscreenWindow(0), |
| 188 | ]; |
| 189 | |
| 190 | let options = Options { |
| 191 | layout: niri_config::Layout { |
| 192 | border: niri_config::Border { |
| 193 | off: false, |
| 194 | width: 10000., |
| 195 | ..Default::default() |
| 196 | }, |
| 197 | ..Default::default() |
| 198 | }, |
| 199 | ..Default::default() |
| 200 | }; |
| 201 | check_ops_with_options(options, ops); |
| 202 | } |
| 203 | |
| 204 | #[test] |
| 205 | fn fullscreen_to_windowed_fullscreen() { |
| 206 | let ops = [ |
| 207 | Op::AddOutput(0), |
| 208 | Op::AddWindow { |
| 209 | params: TestWindowParams::new(0), |
| 210 | }, |
| 211 | Op::FullscreenWindow(0), |
| 212 | Op::Communicate(0), // Make sure it goes into fullscreen. |
| 213 | Op::ToggleWindowedFullscreen(0), |
| 214 | ]; |
| 215 | |
| 216 | check_ops(ops); |
| 217 | } |
| 218 | |
| 219 | #[test] |
| 220 | fn windowed_fullscreen_to_fullscreen() { |
| 221 | let ops = [ |
| 222 | Op::AddOutput(0), |
| 223 | Op::AddWindow { |
| 224 | params: TestWindowParams::new(0), |
| 225 | }, |
| 226 | Op::FullscreenWindow(0), |
| 227 | Op::Communicate(0), // Commit fullscreen state. |
| 228 | Op::ToggleWindowedFullscreen(0), // Switch is_fullscreen() to false. |
| 229 | Op::FullscreenWindow(0), // Switch is_fullscreen() back to true. |
| 230 | ]; |
| 231 | |
| 232 | check_ops(ops); |
| 233 | } |
| 234 | |
| 235 | #[test] |
| 236 | fn move_pending_unfullscreen_window_out_of_active_column() { |
| 237 | let ops = [ |
| 238 | Op::AddOutput(1), |
| 239 | Op::AddWindow { |
| 240 | params: TestWindowParams::new(1), |
| 241 | }, |
| 242 | Op::FullscreenWindow(1), |
| 243 | Op::Communicate(1), |
| 244 | Op::AddWindow { |
| 245 | params: TestWindowParams::new(2), |
| 246 | }, |
| 247 | Op::ConsumeWindowIntoColumn, |
| 248 | // Window 1 is now pending unfullscreen. |
| 249 | // Moving it out should reset view_offset_before_fullscreen. |
| 250 | Op::MoveWindowToWorkspaceDown(true), |
| 251 | ]; |
| 252 | |
| 253 | check_ops(ops); |
| 254 | } |
| 255 | |
| 256 | #[test] |
| 257 | fn move_unfocused_pending_unfullscreen_window_out_of_active_column() { |
| 258 | let ops = [ |
| 259 | Op::AddOutput(1), |
| 260 | Op::AddWindow { |
| 261 | params: TestWindowParams::new(1), |
| 262 | }, |
| 263 | Op::FullscreenWindow(1), |
| 264 | Op::Communicate(1), |
| 265 | Op::AddWindow { |
| 266 | params: TestWindowParams::new(2), |
| 267 | }, |
| 268 | Op::ConsumeWindowIntoColumn, |
| 269 | // Window 1 is now pending unfullscreen. |
| 270 | // Moving it out should reset view_offset_before_fullscreen. |
| 271 | Op::FocusWindowDown, |
| 272 | Op::MoveWindowToWorkspace { |
| 273 | window_id: Some(1), |
| 274 | workspace_idx: 1, |
| 275 | }, |
| 276 | ]; |
| 277 | |
| 278 | check_ops(ops); |
| 279 | } |
| 280 | |
| 281 | #[test] |
| 282 | fn interactive_resize_on_pending_unfullscreen_column() { |
| 283 | let ops = [ |
| 284 | Op::AddWindow { |
| 285 | params: TestWindowParams::new(2), |
| 286 | }, |
| 287 | Op::FullscreenWindow(2), |
| 288 | Op::Communicate(2), |
| 289 | Op::SetFullscreenWindow { |
| 290 | window: 2, |
| 291 | is_fullscreen: false, |
| 292 | }, |
| 293 | Op::InteractiveResizeBegin { |
| 294 | window: 2, |
| 295 | edges: ResizeEdge::RIGHT, |
| 296 | }, |
| 297 | Op::Communicate(2), |
| 298 | ]; |
| 299 | |
| 300 | check_ops(ops); |
| 301 | } |
| 302 | |
| 303 | #[test] |
| 304 | fn interactive_move_unfullscreen_to_floating_stops_dnd_scroll() { |
| 305 | let ops = [ |
| 306 | Op::AddOutput(3), |
| 307 | Op::AddWindow { |
| 308 | params: TestWindowParams { |
| 309 | is_floating: true, |
| 310 | ..TestWindowParams::new(4) |
| 311 | }, |
| 312 | }, |
| 313 | // This moves the window to tiling. |
| 314 | Op::SetFullscreenWindow { |
| 315 | window: 4, |
| 316 | is_fullscreen: true, |
| 317 | }, |
| 318 | // This starts a DnD scroll since we're dragging a tiled window. |
| 319 | Op::InteractiveMoveBegin { |
| 320 | window: 4, |
| 321 | output_idx: 3, |
| 322 | px: 0.0, |
| 323 | py: 0.0, |
| 324 | }, |
| 325 | // This will cause the window to unfullscreen to floating, and should stop the DnD scroll |
| 326 | // since we're no longer dragging a tiled window, but rather a floating one. |
| 327 | Op::InteractiveMoveUpdate { |
| 328 | window: 4, |
| 329 | dx: 0.0, |
| 330 | dy: 15035.31210741684, |
| 331 | output_idx: 3, |
| 332 | px: 0.0, |
| 333 | py: 0.0, |
| 334 | }, |
| 335 | Op::InteractiveMoveEnd { window: 4 }, |
| 336 | ]; |
| 337 | |
| 338 | check_ops(ops); |
| 339 | } |
| 340 | |
| 341 | #[test] |
| 342 | fn interactive_move_restore_to_floating_animates_view_offset() { |
| 343 | let ops = [ |
| 344 | Op::AddOutput(1), |
| 345 | Op::AddWindow { |
| 346 | params: TestWindowParams::new(1), |
| 347 | }, |
| 348 | Op::AddWindow { |
| 349 | params: TestWindowParams::new(2), |
| 350 | }, |
| 351 | // Toggle window 1 to floating. |
| 352 | Op::FocusWindow(1), |
| 353 | Op::ToggleWindowFloating { id: None }, |
| 354 | // Fullscreen window 1 - it moves to scrolling with restore_to_floating = true. |
| 355 | Op::FullscreenWindow(1), |
| 356 | Op::Communicate(1), |
| 357 | Op::CompleteAnimations, |
| 358 | ]; |
| 359 | |
| 360 | let mut layout = check_ops(ops); |
| 361 | |
| 362 | // Verify window 1 is in scrolling and has restore_to_floating = true. |
| 363 | let scrolling = layout.active_workspace().unwrap().scrolling(); |
| 364 | let tile1 = scrolling.tiles().find(|t| *t.window().id() == 1).unwrap(); |
| 365 | assert!( |
| 366 | tile1.restore_to_floating, |
| 367 | "window 1 should have restore_to_floating = true" |
| 368 | ); |
| 369 | |
| 370 | let ops = [ |
| 371 | // Start interactive move on window 1. |
| 372 | Op::InteractiveMoveBegin { |
| 373 | window: 1, |
| 374 | output_idx: 1, |
| 375 | px: 100., |
| 376 | py: 100., |
| 377 | }, |
| 378 | // Update with a large delta to trigger the unmaximize. |
| 379 | Op::InteractiveMoveUpdate { |
| 380 | window: 1, |
| 381 | dx: 1000., |
| 382 | dy: 1000., |
| 383 | output_idx: 1, |
| 384 | px: 0., |
| 385 | py: 0., |
| 386 | }, |
| 387 | ]; |
| 388 | check_ops_on_layout(&mut layout, ops); |
| 389 | |
| 390 | // Window 1 should now be removed from the workspace (in the interactive move state). |
| 391 | // Window 2 should be the only window in the scrolling space. |
| 392 | let scrolling = layout.active_workspace().unwrap().scrolling(); |
| 393 | assert_eq!(scrolling.tiles().count(), 1); |
| 394 | assert!(scrolling.tiles().next().unwrap().window().id() == &2); |
| 395 | |
| 396 | // The view offset should be animating to show window 2. |
| 397 | assert!(scrolling.view_offset().is_animation_ongoing()); |
| 398 | } |
| 399 | |
| 400 | #[test] |
| 401 | fn unfullscreen_view_offset_not_reset_during_dnd_gesture() { |
| 402 | let ops = [ |
| 403 | Op::AddOutput(1), |
| 404 | Op::AddWindow { |
| 405 | params: TestWindowParams::new(3), |
| 406 | }, |
| 407 | Op::FullscreenWindow(3), |
| 408 | Op::Communicate(3), |
| 409 | Op::DndUpdate { |
| 410 | output_idx: 1, |
| 411 | px: 0.0, |
| 412 | py: 0.0, |
| 413 | }, |
| 414 | Op::FullscreenWindow(3), |
| 415 | Op::Communicate(3), |
| 416 | ]; |
| 417 | |
| 418 | check_ops(ops); |
| 419 | } |
| 420 | |
| 421 | #[test] |
| 422 | fn unfullscreen_view_offset_not_reset_during_gesture() { |
| 423 | let ops = [ |
| 424 | Op::AddOutput(1), |
| 425 | Op::AddWindow { |
| 426 | params: TestWindowParams::new(3), |
| 427 | }, |
| 428 | Op::FullscreenWindow(3), |
| 429 | Op::Communicate(3), |
| 430 | Op::ViewOffsetGestureBegin { |
| 431 | output_idx: 1, |
| 432 | workspace_idx: None, |
| 433 | is_touchpad: false, |
| 434 | }, |
| 435 | Op::FullscreenWindow(3), |
| 436 | Op::Communicate(3), |
| 437 | ]; |
| 438 | |
| 439 | check_ops(ops); |
| 440 | } |
| 441 | |
| 442 | #[test] |
| 443 | fn unfullscreen_view_offset_not_reset_during_ongoing_gesture() { |
| 444 | let ops = [ |
| 445 | Op::AddOutput(1), |
| 446 | Op::AddWindow { |
| 447 | params: TestWindowParams::new(3), |
| 448 | }, |
| 449 | Op::ViewOffsetGestureBegin { |
| 450 | output_idx: 1, |
| 451 | workspace_idx: None, |
| 452 | is_touchpad: false, |
| 453 | }, |
| 454 | Op::FullscreenWindow(3), |
| 455 | Op::Communicate(3), |
| 456 | Op::FullscreenWindow(3), |
| 457 | Op::Communicate(3), |
| 458 | ]; |
| 459 | |
| 460 | check_ops(ops); |
| 461 | } |
| 462 | |
| 463 | #[test] |
| 464 | fn unfullscreen_preserves_view_pos() { |
| 465 | let ops = [ |
| 466 | Op::AddOutput(1), |
| 467 | Op::AddWindow { |
| 468 | params: TestWindowParams::new(1), |
| 469 | }, |
| 470 | Op::AddWindow { |
| 471 | params: TestWindowParams::new(2), |
| 472 | }, |
| 473 | ]; |
| 474 | |
| 475 | let mut layout = check_ops(ops); |
| 476 | |
| 477 | // View pos is looking at the first window. |
| 478 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 479 | |
| 480 | let ops = [ |
| 481 | Op::FullscreenWindow(2), |
| 482 | Op::Communicate(2), |
| 483 | Op::CompleteAnimations, |
| 484 | ]; |
| 485 | check_ops_on_layout(&mut layout, ops); |
| 486 | |
| 487 | // View pos = width of first window + gap. |
| 488 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); |
| 489 | |
| 490 | let ops = [ |
| 491 | Op::FullscreenWindow(2), |
| 492 | Op::Communicate(2), |
| 493 | Op::CompleteAnimations, |
| 494 | ]; |
| 495 | check_ops_on_layout(&mut layout, ops); |
| 496 | |
| 497 | // View pos is back to showing the first window. |
| 498 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 499 | } |
| 500 | |
| 501 | #[test] |
| 502 | fn unfullscreen_of_tabbed_preserves_view_pos() { |
| 503 | let ops = [ |
| 504 | Op::AddOutput(1), |
| 505 | Op::AddWindow { |
| 506 | params: TestWindowParams::new(1), |
| 507 | }, |
| 508 | Op::AddWindow { |
| 509 | params: TestWindowParams::new(2), |
| 510 | }, |
| 511 | Op::AddWindow { |
| 512 | params: TestWindowParams::new(3), |
| 513 | }, |
| 514 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 515 | Op::SetColumnDisplay(ColumnDisplay::Tabbed), |
| 516 | // Get view pos back on the first window. |
| 517 | Op::FocusColumnLeft, |
| 518 | Op::FocusColumnRight, |
| 519 | ]; |
| 520 | |
| 521 | let mut layout = check_ops(ops); |
| 522 | |
| 523 | // View pos is looking at the first window. |
| 524 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 525 | |
| 526 | let ops = [ |
| 527 | Op::FullscreenWindow(2), |
| 528 | Op::Communicate(2), |
| 529 | Op::Communicate(3), |
| 530 | Op::CompleteAnimations, |
| 531 | ]; |
| 532 | check_ops_on_layout(&mut layout, ops); |
| 533 | |
| 534 | // View pos = width of first window + gap. |
| 535 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); |
| 536 | |
| 537 | let ops = [ |
| 538 | Op::FullscreenWindow(3), |
| 539 | Op::Communicate(3), |
| 540 | Op::CompleteAnimations, |
| 541 | ]; |
| 542 | check_ops_on_layout(&mut layout, ops); |
| 543 | |
| 544 | // View pos is still on the second column because the second tile hasn't unfullscreened yet. |
| 545 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); |
| 546 | |
| 547 | let ops = [Op::Communicate(2), Op::CompleteAnimations]; |
| 548 | check_ops_on_layout(&mut layout, ops); |
| 549 | |
| 550 | // View pos is back to showing the first window. |
| 551 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 552 | } |
| 553 | |
| 554 | #[test] |
| 555 | fn unfullscreen_of_tabbed_via_change_to_normal_preserves_view_pos() { |
| 556 | let ops = [ |
| 557 | Op::AddOutput(1), |
| 558 | Op::AddWindow { |
| 559 | params: TestWindowParams::new(1), |
| 560 | }, |
| 561 | Op::AddWindow { |
| 562 | params: TestWindowParams::new(2), |
| 563 | }, |
| 564 | Op::AddWindow { |
| 565 | params: TestWindowParams::new(3), |
| 566 | }, |
| 567 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 568 | Op::SetColumnDisplay(ColumnDisplay::Tabbed), |
| 569 | // Get view pos back on the first window. |
| 570 | Op::FocusColumnLeft, |
| 571 | Op::FocusColumnRight, |
| 572 | ]; |
| 573 | |
| 574 | let mut layout = check_ops(ops); |
| 575 | |
| 576 | // View pos is looking at the first window. |
| 577 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 578 | |
| 579 | let ops = [ |
| 580 | Op::FullscreenWindow(2), |
| 581 | Op::Communicate(2), |
| 582 | Op::Communicate(3), |
| 583 | Op::CompleteAnimations, |
| 584 | ]; |
| 585 | check_ops_on_layout(&mut layout, ops); |
| 586 | |
| 587 | // View pos = width of first window + gap. |
| 588 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); |
| 589 | |
| 590 | let ops = [ |
| 591 | Op::SetColumnDisplay(ColumnDisplay::Normal), |
| 592 | Op::Communicate(3), |
| 593 | Op::CompleteAnimations, |
| 594 | ]; |
| 595 | check_ops_on_layout(&mut layout, ops); |
| 596 | |
| 597 | // View pos is still on the second column because the second tile hasn't unfullscreened yet. |
| 598 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116"); |
| 599 | |
| 600 | let ops = [Op::Communicate(2), Op::CompleteAnimations]; |
| 601 | check_ops_on_layout(&mut layout, ops); |
| 602 | |
| 603 | // View pos is back to showing the first window. |
| 604 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 605 | } |
| 606 | |
| 607 | #[test] |
| 608 | fn removing_only_fullscreen_tile_updates_view_offset() { |
| 609 | let ops = [ |
| 610 | Op::AddOutput(1), |
| 611 | Op::AddWindow { |
| 612 | params: TestWindowParams::new(1), |
| 613 | }, |
| 614 | Op::AddWindow { |
| 615 | params: TestWindowParams::new(2), |
| 616 | }, |
| 617 | Op::ConsumeOrExpelWindowLeft { id: None }, |
| 618 | Op::SetColumnDisplay(ColumnDisplay::Tabbed), |
| 619 | Op::CompleteAnimations, |
| 620 | ]; |
| 621 | |
| 622 | let mut layout = check_ops(ops); |
| 623 | |
| 624 | // View pos with gap. |
| 625 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 626 | |
| 627 | let ops = [ |
| 628 | Op::FullscreenWindow(2), |
| 629 | Op::Communicate(1), |
| 630 | Op::Communicate(2), |
| 631 | Op::CompleteAnimations, |
| 632 | ]; |
| 633 | check_ops_on_layout(&mut layout, ops); |
| 634 | |
| 635 | // View pos without gap because we went fullscreen. |
| 636 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); |
| 637 | |
| 638 | let ops = [ |
| 639 | Op::FullscreenWindow(2), |
| 640 | // The active window responds, the other tabbed window doesn't yet. |
| 641 | Op::Communicate(2), |
| 642 | Op::CompleteAnimations, |
| 643 | ]; |
| 644 | check_ops_on_layout(&mut layout, ops); |
| 645 | |
| 646 | // View pos without gap because other tile is still fullscreen. |
| 647 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); |
| 648 | |
| 649 | let ops = [ |
| 650 | // Expel the fullscreen window from the column, changing the column to non-fullscreen. |
| 651 | Op::ConsumeOrExpelWindowRight { id: Some(1) }, |
| 652 | Op::CompleteAnimations, |
| 653 | ]; |
| 654 | check_ops_on_layout(&mut layout, ops); |
| 655 | |
| 656 | // View pos should include gap now that the column is no longer fullscreen. |
| 657 | // FIXME: currently, removing a tile doesn't cause the view offset to update. |
| 658 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); |
| 659 | } |