aboutsummaryrefslogtreecommitdiff
path: root/src/layout/tests
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-09-21 08:48:00 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-10-02 09:33:08 +0300
commit8df6231cc164396e19a892f11beb8c02e2e88efb (patch)
tree05ea1d39b6dd00b5ab8c909e0e4af1350c9035ed /src/layout/tests
parente837e39623457dc5ad29c34a5ce4d4616e5fbf1e (diff)
downloadniri-8df6231cc164396e19a892f11beb8c02e2e88efb.tar.gz
niri-8df6231cc164396e19a892f11beb8c02e2e88efb.tar.bz2
niri-8df6231cc164396e19a892f11beb8c02e2e88efb.zip
layout/tests: Make Op non-Copy
Diffstat (limited to 'src/layout/tests')
-rw-r--r--src/layout/tests/animations.rs54
-rw-r--r--src/layout/tests/fullscreen.rs68
2 files changed, 61 insertions, 61 deletions
diff --git a/src/layout/tests/animations.rs b/src/layout/tests/animations.rs
index 3f39e25a..21be56f1 100644
--- a/src/layout/tests/animations.rs
+++ b/src/layout/tests/animations.rs
@@ -62,7 +62,7 @@ fn set_up_two_in_column() -> Layout<TestWindow> {
Op::CompleteAnimations,
];
- check_ops_with_options(make_options(), &ops)
+ check_ops_with_options(make_options(), ops)
}
#[test]
@@ -83,7 +83,7 @@ fn height_resize_animates_next_y() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed yet, so we're at the initial state.
assert_snapshot!(format_tiles(&layout), @r"
@@ -130,7 +130,7 @@ fn clientside_height_change_doesnt_animate() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed yet, but we are at the final state right away.
assert_snapshot!(format_tiles(&layout), @r"
@@ -166,7 +166,7 @@ fn height_resize_and_back() {
// Advance the time halfway.
Op::AdvanceAnimations { msec_delta: 500 },
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Top window is half-resized at 150 px tall, bottom window is at y=150 matching it.
assert_snapshot!(format_tiles(&layout), @r"
@@ -189,7 +189,7 @@ fn height_resize_and_back() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed yet, and we expect no animation jumps, so this state matches the last.
assert_snapshot!(format_tiles(&layout), @r"
@@ -243,7 +243,7 @@ fn height_resize_and_cancel() {
// Advance the time slightly.
Op::AdvanceAnimations { msec_delta: 50 },
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Top window is half-resized at 105 px tall, bottom window is at y=105 matching it.
assert_snapshot!(format_tiles(&layout), @r"
@@ -267,7 +267,7 @@ fn height_resize_and_cancel() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Since the resize animation is cancelled, the height goes to the new value immediately. The Y
// position doesn't jump, instead the animation is offset to preserve the current position.
@@ -309,7 +309,7 @@ fn height_resize_and_back_during_another_y_anim() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The initial state.
assert_snapshot!(format_tiles(&layout), @r"
@@ -350,7 +350,7 @@ fn height_resize_and_back_during_another_y_anim() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed, so no change in state yet.
assert_snapshot!(format_tiles(&layout), @r"
@@ -383,7 +383,7 @@ fn height_resize_and_back_during_another_y_anim() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed, so no change in state yet.
assert_snapshot!(format_tiles(&layout), @r"
@@ -442,7 +442,7 @@ fn height_resize_and_cancel_during_another_y_anim() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The initial state.
assert_snapshot!(format_tiles(&layout), @r"
@@ -485,7 +485,7 @@ fn height_resize_and_cancel_during_another_y_anim() {
// Advance the time slightly.
Op::AdvanceAnimations { msec_delta: 50 },
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// X changed by 5, but y changed by 8 since the Y movement from the resize compounds with the Y
// movement from consume-into-column.
@@ -510,7 +510,7 @@ fn height_resize_and_cancel_during_another_y_anim() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Since the resize anim was cancelled, second window's Y anim is adjusted to preserve the
// current position while targeting the new final position.
@@ -577,7 +577,7 @@ fn height_resize_before_another_y_anim_then_back() {
// Advance the time a bit.
Op::AdvanceAnimations { msec_delta: 200 },
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The resize is in progress.
assert_snapshot!(format_tiles(&layout), @r"
@@ -620,7 +620,7 @@ fn height_resize_before_another_y_anim_then_back() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// No time had passed, so no change in state yet.
assert_snapshot!(format_tiles(&layout), @r"
@@ -692,7 +692,7 @@ fn height_resize_before_another_y_anim_then_cancel() {
// Advance the time a bit.
Op::AdvanceAnimations { msec_delta: 20 },
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The resize is in progress.
assert_snapshot!(format_tiles(&layout), @r"
@@ -734,7 +734,7 @@ fn height_resize_before_another_y_anim_then_cancel() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// The second window's trajectory readjusts to the new final position at 100 px, without jumps.
assert_snapshot!(format_tiles(&layout), @r"
@@ -781,7 +781,7 @@ fn clientside_height_change_during_another_y_anim() {
// Advance the time a bit.
Op::AdvanceAnimations { msec_delta: 200 },
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// Second window on its way to the bottom.
assert_snapshot!(format_tiles(&layout), @r"
@@ -798,7 +798,7 @@ fn clientside_height_change_during_another_y_anim() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// The second window's trajectory readjusts to the new final position at 200 px, without jumps.
assert_snapshot!(format_tiles(&layout), @r"
@@ -857,7 +857,7 @@ fn height_resize_cancel_with_stationary_second_window() {
let mut options = make_options();
// Window movement will happen instantly.
options.animations.window_movement.0.off = true;
- let mut layout = check_ops_with_options(options, &ops);
+ let mut layout = check_ops_with_options(options, ops);
// The resize is in progress.
assert_snapshot!(format_tiles(&layout), @r"
@@ -901,7 +901,7 @@ fn height_resize_cancel_with_stationary_second_window() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// This causes the second window to jump down, which is correct because it hadn't been in an
// animation, and as far as it's concerned, this is the same case as a window just deciding to
@@ -937,7 +937,7 @@ fn width_resize_and_cancel() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The initial state.
assert_snapshot!(format_tiles(&layout), @r"
@@ -962,7 +962,7 @@ fn width_resize_and_cancel() {
// Advance the time slightly.
Op::AdvanceAnimations { msec_delta: 50 },
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Left window is half-resized at 105 px wide, right window is at x=105 matching it.
assert_snapshot!(format_tiles(&layout), @r"
@@ -986,7 +986,7 @@ fn width_resize_and_cancel() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Since the resize animation is cancelled, the width goes to the new value immediately. The X
// position doesn't jump, instead the animation is restarted to preserve the current position.
@@ -1027,7 +1027,7 @@ fn width_resize_and_cancel_of_column_to_the_left() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- let mut layout = check_ops_with_options(make_options(), &ops);
+ let mut layout = check_ops_with_options(make_options(), ops);
// The initial state.
assert_snapshot!(format_tiles(&layout), @r"
@@ -1052,7 +1052,7 @@ fn width_resize_and_cancel_of_column_to_the_left() {
// Advance the time slightly.
Op::AdvanceAnimations { msec_delta: 50 },
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Left window is half-resized at 105 px wide, it's at x=-5 matching the right edge position.
assert_snapshot!(format_tiles(&layout), @r"
@@ -1076,7 +1076,7 @@ fn width_resize_and_cancel_of_column_to_the_left() {
Op::Communicate(1),
Op::Communicate(2),
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// Since the resize animation is cancelled, the width goes to the new value immediately. The X
// position doesn't jump, instead the animation is restarted to preserve the current position.
diff --git a/src/layout/tests/fullscreen.rs b/src/layout/tests/fullscreen.rs
index 7b473325..4d9d79ca 100644
--- a/src/layout/tests/fullscreen.rs
+++ b/src/layout/tests/fullscreen.rs
@@ -12,7 +12,7 @@ fn fullscreen() {
Op::FullscreenWindow(1),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -32,7 +32,7 @@ fn unfullscreen_window_in_column() {
},
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -49,7 +49,7 @@ fn unfullscreen_view_offset_not_reset_on_removal() {
Op::ConsumeOrExpelWindowRight { id: None },
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -66,7 +66,7 @@ fn unfullscreen_view_offset_not_reset_on_consume() {
Op::ConsumeWindowIntoColumn,
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -80,7 +80,7 @@ fn unfullscreen_view_offset_not_reset_on_quick_double_toggle() {
Op::FullscreenWindow(0),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -97,7 +97,7 @@ fn unfullscreen_view_offset_set_on_fullscreening_inactive_tile_in_column() {
Op::FullscreenWindow(0),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -121,7 +121,7 @@ fn unfullscreen_view_offset_not_reset_on_gesture() {
},
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -154,7 +154,7 @@ fn one_window_in_column_becomes_weight_1_after_fullscreen() {
Op::FullscreenWindow(1),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -173,7 +173,7 @@ fn disable_tabbed_mode_in_fullscreen() {
Op::ToggleColumnTabbedDisplay,
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -195,7 +195,7 @@ fn unfullscreen_with_large_border() {
},
..Default::default()
};
- check_ops_with_options(options, &ops);
+ check_ops_with_options(options, ops);
}
#[test]
@@ -210,7 +210,7 @@ fn fullscreen_to_windowed_fullscreen() {
Op::ToggleWindowedFullscreen(0),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -226,7 +226,7 @@ fn windowed_fullscreen_to_fullscreen() {
Op::FullscreenWindow(0), // Switch is_fullscreen() back to true.
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -247,7 +247,7 @@ fn move_pending_unfullscreen_window_out_of_active_column() {
Op::MoveWindowToWorkspaceDown(true),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -272,7 +272,7 @@ fn move_unfocused_pending_unfullscreen_window_out_of_active_column() {
},
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -294,7 +294,7 @@ fn interactive_resize_on_pending_unfullscreen_column() {
Op::Communicate(2),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -332,7 +332,7 @@ fn interactive_move_unfullscreen_to_floating_stops_dnd_scroll() {
Op::InteractiveMoveEnd { window: 4 },
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -353,7 +353,7 @@ fn unfullscreen_view_offset_not_reset_during_dnd_gesture() {
Op::Communicate(3),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -374,7 +374,7 @@ fn unfullscreen_view_offset_not_reset_during_gesture() {
Op::Communicate(3),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -395,7 +395,7 @@ fn unfullscreen_view_offset_not_reset_during_ongoing_gesture() {
Op::Communicate(3),
];
- check_ops(&ops);
+ check_ops(ops);
}
#[test]
@@ -410,7 +410,7 @@ fn unfullscreen_preserves_view_pos() {
},
];
- let mut layout = check_ops(&ops);
+ let mut layout = check_ops(ops);
// View pos is looking at the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -420,7 +420,7 @@ fn unfullscreen_preserves_view_pos() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos = width of first window + gap.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
@@ -430,7 +430,7 @@ fn unfullscreen_preserves_view_pos() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos is back to showing the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -456,7 +456,7 @@ fn unfullscreen_of_tabbed_preserves_view_pos() {
Op::FocusColumnRight,
];
- let mut layout = check_ops(&ops);
+ let mut layout = check_ops(ops);
// View pos is looking at the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -467,7 +467,7 @@ fn unfullscreen_of_tabbed_preserves_view_pos() {
Op::Communicate(3),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos = width of first window + gap.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
@@ -477,13 +477,13 @@ fn unfullscreen_of_tabbed_preserves_view_pos() {
Op::Communicate(3),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos is still on the second column because the second tile hasn't unfullscreened yet.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
let ops = [Op::Communicate(2), Op::CompleteAnimations];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos is back to showing the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -509,7 +509,7 @@ fn unfullscreen_of_tabbed_via_change_to_normal_preserves_view_pos() {
Op::FocusColumnRight,
];
- let mut layout = check_ops(&ops);
+ let mut layout = check_ops(ops);
// View pos is looking at the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -520,7 +520,7 @@ fn unfullscreen_of_tabbed_via_change_to_normal_preserves_view_pos() {
Op::Communicate(3),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos = width of first window + gap.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
@@ -530,13 +530,13 @@ fn unfullscreen_of_tabbed_via_change_to_normal_preserves_view_pos() {
Op::Communicate(3),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos is still on the second column because the second tile hasn't unfullscreened yet.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"116");
let ops = [Op::Communicate(2), Op::CompleteAnimations];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos is back to showing the first window.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -557,7 +557,7 @@ fn removing_only_fullscreen_tile_updates_view_offset() {
Op::CompleteAnimations,
];
- let mut layout = check_ops(&ops);
+ let mut layout = check_ops(ops);
// View pos with gap.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"-16");
@@ -568,7 +568,7 @@ fn removing_only_fullscreen_tile_updates_view_offset() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos without gap because we went fullscreen.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0");
@@ -579,7 +579,7 @@ fn removing_only_fullscreen_tile_updates_view_offset() {
Op::Communicate(2),
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos without gap because other tile is still fullscreen.
assert_snapshot!(layout.active_workspace().unwrap().scrolling().view_pos(), @"0");
@@ -589,7 +589,7 @@ fn removing_only_fullscreen_tile_updates_view_offset() {
Op::ConsumeOrExpelWindowRight { id: Some(1) },
Op::CompleteAnimations,
];
- check_ops_on_layout(&mut layout, &ops);
+ check_ops_on_layout(&mut layout, ops);
// View pos should include gap now that the column is no longer fullscreen.
// FIXME: currently, removing a tile doesn't cause the view offset to update.