layout/tests/fullscreen: Add broken removing tile view pos restore test
Browse files at this commit318f6ca8cc930684634ca4dca0966d16ed3e1a6bParent: c9c28aa1 changed file +54 -0
src/layout/tests/fullscreen.rsmodified+54 -0
| @@ -541,3 +541,57 @@ fn unfullscreen_of_tabbed_via_change_to_normal_preserves_view_pos() { | |||
| 541 | // View pos is back to showing the first window. | 541 | // View pos is back to showing the first window. |
| 542 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); | 542 | assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); |
| 543 | } | 543 | } |
| 544 | + | ||
| 545 | +#[test] | ||
| 546 | +fn removing_only_fullscreen_tile_updates_view_offset() { | ||
| 547 | + let ops = [ | ||
| 548 | + Op::AddOutput(1), | ||
| 549 | + Op::AddWindow { | ||
| 550 | + params: TestWindowParams::new(1), | ||
| 551 | + }, | ||
| 552 | + Op::AddWindow { | ||
| 553 | + params: TestWindowParams::new(2), | ||
| 554 | + }, | ||
| 555 | + Op::ConsumeOrExpelWindowLeft { id: None }, | ||
| 556 | + Op::SetColumnDisplay(ColumnDisplay::Tabbed), | ||
| 557 | + Op::CompleteAnimations, | ||
| 558 | + ]; | ||
| 559 | + | ||
| 560 | + let mut layout = check_ops(&ops); | ||
| 561 | + | ||
| 562 | + // View pos with gap. | ||
| 563 | + assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16"); | ||
| 564 | + | ||
| 565 | + let ops = [ | ||
| 566 | + Op::FullscreenWindow(2), | ||
| 567 | + Op::Communicate(1), | ||
| 568 | + Op::Communicate(2), | ||
| 569 | + Op::CompleteAnimations, | ||
| 570 | + ]; | ||
| 571 | + check_ops_on_layout(&mut layout, &ops); | ||
| 572 | + | ||
| 573 | + // View pos without gap because we went fullscreen. | ||
| 574 | + assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); | ||
| 575 | + | ||
| 576 | + let ops = [ | ||
| 577 | + Op::FullscreenWindow(2), | ||
| 578 | + // The active window responds, the other tabbed window doesn't yet. | ||
| 579 | + Op::Communicate(2), | ||
| 580 | + Op::CompleteAnimations, | ||
| 581 | + ]; | ||
| 582 | + check_ops_on_layout(&mut layout, &ops); | ||
| 583 | + | ||
| 584 | + // View pos without gap because other tile is still fullscreen. | ||
| 585 | + assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); | ||
| 586 | + | ||
| 587 | + let ops = [ | ||
| 588 | + // Expel the fullscreen window from the column, changing the column to non-fullscreen. | ||
| 589 | + Op::ConsumeOrExpelWindowRight { id: Some(1) }, | ||
| 590 | + Op::CompleteAnimations, | ||
| 591 | + ]; | ||
| 592 | + check_ops_on_layout(&mut layout, &ops); | ||
| 593 | + | ||
| 594 | + // View pos should include gap now that the column is no longer fullscreen. | ||
| 595 | + // FIXME: currently, removing a tile doesn't cause the view offset to update. | ||
| 596 | + assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0"); | ||
| 597 | +} | ||