From 8df6231cc164396e19a892f11beb8c02e2e88efb Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 21 Sep 2025 08:48:00 +0300 Subject: layout/tests: Make Op non-Copy --- src/layout/tests.rs | 158 +++++++++++++++++++++-------------------- src/layout/tests/animations.rs | 54 +++++++------- src/layout/tests/fullscreen.rs | 68 +++++++++--------- 3 files changed, 142 insertions(+), 138 deletions(-) (limited to 'src/layout') diff --git a/src/layout/tests.rs b/src/layout/tests.rs index dc628198..4afa5364 100644 --- a/src/layout/tests.rs +++ b/src/layout/tests.rs @@ -396,7 +396,7 @@ fn arbitrary_column_display() -> impl Strategy { prop_oneof![Just(ColumnDisplay::Normal), Just(ColumnDisplay::Tabbed)] } -#[derive(Debug, Clone, Copy, Arbitrary)] +#[derive(Debug, Clone, Arbitrary)] enum Op { AddOutput(#[proptest(strategy = "1..=5usize")] usize), AddScaledOutput { @@ -1549,7 +1549,7 @@ impl Op { } #[track_caller] -fn check_ops_on_layout(layout: &mut Layout, ops: &[Op]) { +fn check_ops_on_layout(layout: &mut Layout, ops: impl IntoIterator) { for op in ops { op.apply(layout); layout.verify_invariants(); @@ -1557,14 +1557,17 @@ fn check_ops_on_layout(layout: &mut Layout, ops: &[Op]) { } #[track_caller] -fn check_ops(ops: &[Op]) -> Layout { +fn check_ops(ops: impl IntoIterator) -> Layout { let mut layout = Layout::default(); check_ops_on_layout(&mut layout, ops); layout } #[track_caller] -fn check_ops_with_options(options: Options, ops: &[Op]) -> Layout { +fn check_ops_with_options( + options: Options, + ops: impl IntoIterator, +) -> Layout { let mut layout = Layout::with_options(Clock::with_time(Duration::ZERO), options); check_ops_on_layout(&mut layout, ops); layout @@ -1663,17 +1666,17 @@ fn operations_dont_panic() { Op::ToggleColumnTabbedDisplay, ]; - for third in every_op { - for second in every_op { - for first in every_op { + for third in &every_op { + for second in &every_op { + for first in &every_op { // eprintln!("{first:?}, {second:?}, {third:?}"); let mut layout = Layout::default(); - first.apply(&mut layout); + first.clone().apply(&mut layout); layout.verify_invariants(); - second.apply(&mut layout); + second.clone().apply(&mut layout); layout.verify_invariants(); - third.apply(&mut layout); + third.clone().apply(&mut layout); layout.verify_invariants(); } } @@ -1838,21 +1841,22 @@ fn operations_from_starting_state_dont_panic() { Op::ToggleColumnTabbedDisplay, ]; - for third in every_op { - for second in every_op { - for first in every_op { + for third in &every_op { + for second in &every_op { + for first in &every_op { // eprintln!("{first:?}, {second:?}, {third:?}"); let mut layout = Layout::default(); - for op in setup_ops { - op.apply(&mut layout); + for op in &setup_ops { + op.clone().apply(&mut layout); } - first.apply(&mut layout); + let mut layout = Layout::default(); + first.clone().apply(&mut layout); layout.verify_invariants(); - second.apply(&mut layout); + second.clone().apply(&mut layout); layout.verify_invariants(); - third.apply(&mut layout); + third.clone().apply(&mut layout); layout.verify_invariants(); } } @@ -1877,7 +1881,7 @@ fn primary_active_workspace_idx_not_updated_on_output_add() { Op::AddOutput(2), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -1891,7 +1895,7 @@ fn window_closed_on_previous_workspace() { Op::CloseWindow(0), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -1905,7 +1909,7 @@ fn removing_output_must_keep_empty_focus_on_primary() { Op::RemoveOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -1935,7 +1939,7 @@ fn move_to_workspace_by_idx_does_not_leave_empty_workspaces() { }, ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -1962,7 +1966,7 @@ fn empty_workspaces_dont_move_back_to_original_output() { Op::AddOutput(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -1985,7 +1989,7 @@ fn named_workspaces_dont_update_original_output_on_adding_window() { Op::AddOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let (mon, _, ws) = layout .workspaces() .find(|(_, _, ws)| ws.name().is_some()) @@ -2010,7 +2014,7 @@ fn workspaces_update_original_output_on_moving_to_same_output() { Op::AddOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let (mon, _, ws) = layout .workspaces() .find(|(_, _, ws)| ws.name().is_some()) @@ -2038,7 +2042,7 @@ fn workspaces_update_original_output_on_moving_to_same_monitor() { Op::AddOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let (mon, _, ws) = layout .workspaces() .find(|(_, _, ws)| ws.name().is_some()) @@ -2065,7 +2069,7 @@ fn large_negative_height_change() { options.border.off = false; options.border.width = FloatOrInt(1.); - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2084,7 +2088,7 @@ fn large_max_size() { options.border.off = false; options.border.width = FloatOrInt(1.); - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2098,7 +2102,7 @@ fn workspace_cleanup_during_switch() { Op::CloseWindow(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2119,7 +2123,7 @@ fn workspace_transfer_during_switch() { Op::AddOutput(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2135,7 +2139,7 @@ fn workspace_transfer_during_switch_from_last() { Op::AddOutput(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2152,7 +2156,7 @@ fn workspace_transfer_during_switch_gets_cleaned_up() { Op::AddOutput(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2167,7 +2171,7 @@ fn move_workspace_to_output() { Op::MoveWorkspaceToOutput(2), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, @@ -2203,7 +2207,7 @@ fn open_right_of_on_different_workspace() { }, ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -2243,7 +2247,7 @@ fn open_right_of_on_different_workspace_ewaf() { empty_workspace_above_first: true, ..Default::default() }; - let layout = check_ops_with_options(options, &ops); + let layout = check_ops_with_options(options, ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -2276,7 +2280,7 @@ fn removing_all_outputs_preserves_empty_named_workspaces() { Op::RemoveOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::NoOutputs { workspaces } = layout.monitor_set else { unreachable!() @@ -2364,7 +2368,7 @@ fn set_window_height_recomputes_to_auto() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2397,7 +2401,7 @@ fn one_window_in_column_becomes_weight_1() { Op::CloseWindow(1), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2426,7 +2430,7 @@ fn fixed_height_takes_max_non_auto_into_account() { gaps: 0., ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2445,7 +2449,7 @@ fn start_interactive_move_then_remove_window() { Op::CloseWindow(0), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2473,7 +2477,7 @@ fn interactive_move_onto_empty_output() { Op::InteractiveMoveEnd { window: 0 }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2505,7 +2509,7 @@ fn interactive_move_onto_empty_output_ewaf() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2534,7 +2538,7 @@ fn interactive_move_onto_last_workspace() { Op::InteractiveMoveEnd { window: 0 }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2566,7 +2570,7 @@ fn interactive_move_onto_first_empty_workspace() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2584,7 +2588,7 @@ fn output_active_workspace_is_preserved() { Op::AddOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -2609,7 +2613,7 @@ fn output_active_workspace_is_preserved_with_other_outputs() { Op::AddOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -2629,7 +2633,7 @@ fn named_workspace_to_output() { Op::MoveWorkspaceToOutput(1), Op::FocusWorkspaceUp, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2647,7 +2651,7 @@ fn named_workspace_to_output_ewaf() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2666,7 +2670,7 @@ fn move_window_to_empty_workspace_above_first() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2683,7 +2687,7 @@ fn move_window_to_different_output() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2699,7 +2703,7 @@ fn close_window_empty_ws_above_first() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2716,7 +2720,7 @@ fn add_and_remove_output() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -2728,7 +2732,7 @@ fn switch_ewaf_on() { }, ]; - let mut layout = check_ops(&ops); + let mut layout = check_ops(ops); layout.update_options(Options { empty_workspace_above_first: true, ..Default::default() @@ -2749,7 +2753,7 @@ fn switch_ewaf_off() { empty_workspace_above_first: true, ..Default::default() }; - let mut layout = check_ops_with_options(options, &ops); + let mut layout = check_ops_with_options(options, ops); layout.update_options(Options::default()); layout.verify_invariants(); } @@ -2780,7 +2784,7 @@ fn interactive_move_drop_on_other_output_during_animation() { Op::RemoveOutput(4), Op::InteractiveMoveEnd { window: 3 }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2813,7 +2817,7 @@ fn add_window_next_to_only_interactively_moved_without_outputs() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2842,7 +2846,7 @@ fn interactive_move_toggle_floating_ends_dnd_gesture() { Op::InteractiveMoveEnd { window: 2 }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2855,7 +2859,7 @@ fn set_width_fixed_negative() { Op::ToggleWindowFloating { id: Some(3) }, Op::SetColumnWidth(SizeChange::SetFixed(-100)), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2871,7 +2875,7 @@ fn set_height_fixed_negative() { change: SizeChange::SetFixed(-100), }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2892,7 +2896,7 @@ fn interactive_resize_to_negative() { dy: -10000., }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2906,7 +2910,7 @@ fn windows_on_other_workspaces_remain_activated() { Op::Refresh { is_active: true }, ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let (_, win) = layout.windows().next().unwrap(); assert!(win.0.pending_activated.get()); } @@ -2930,7 +2934,7 @@ fn stacking_add_parent_brings_up_child() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2959,7 +2963,7 @@ fn stacking_add_parent_brings_up_descendants() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -2995,7 +2999,7 @@ fn stacking_activate_brings_up_descendants() { Op::FocusWindow(0), ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -3020,7 +3024,7 @@ fn stacking_set_parent_brings_up_child() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -3038,7 +3042,7 @@ fn move_window_to_workspace_with_different_active_output() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -3051,7 +3055,7 @@ fn set_first_workspace_name() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -3068,7 +3072,7 @@ fn set_first_workspace_name_ewaf() { empty_workspace_above_first: true, ..Default::default() }; - check_ops_with_options(options, &ops); + check_ops_with_options(options, ops); } #[test] @@ -3085,7 +3089,7 @@ fn set_last_workspace_name() { }, ]; - check_ops(&ops); + check_ops(ops); } #[test] @@ -3112,7 +3116,7 @@ fn move_workspace_to_same_monitor_doesnt_reorder() { }, ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let counts: Vec<_> = layout .workspaces() .map(|(_, _, ws)| ws.windows().count()) @@ -3140,7 +3144,7 @@ fn removing_window_above_preserves_focused_window() { Op::CloseWindow(0), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let win = layout.focus().unwrap(); assert_eq!(win.0.id, 1); } @@ -3159,7 +3163,7 @@ fn preset_column_width_fixed_correct_with_border() { preset_column_widths: vec![PresetSize::Fixed(500)], ..Default::default() }; - let mut layout = check_ops_with_options(options, &ops); + let mut layout = check_ops_with_options(options, ops); let win = layout.windows().next().unwrap().1; assert_eq!(win.requested_size().unwrap().w, 500); @@ -3205,7 +3209,7 @@ fn preset_column_width_reset_after_set_width() { preset_column_widths: vec![PresetSize::Fixed(500), PresetSize::Fixed(1000)], ..Default::default() }; - let layout = check_ops_with_options(options, &ops); + let layout = check_ops_with_options(options, ops); let win = layout.windows().next().unwrap().1; assert_eq!(win.requested_size().unwrap().w, 500); } @@ -3249,7 +3253,7 @@ fn move_column_to_workspace_unfocused_with_multiple_monitors() { Op::FocusOutput(1), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); assert_eq!(layout.active_workspace().unwrap().name().unwrap(), "ws102"); @@ -3287,7 +3291,7 @@ fn move_column_to_workspace_down_focus_false_on_floating_window() { Op::MoveColumnToWorkspaceDown(false), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -3310,7 +3314,7 @@ fn move_column_to_workspace_focus_false_on_floating_window() { Op::MoveColumnToWorkspace(1, false), ]; - let layout = check_ops(&ops); + let layout = check_ops(ops); let MonitorSet::Normal { monitors, .. } = layout.monitor_set else { unreachable!() @@ -3504,7 +3508,7 @@ proptest! { post_options in prop::option::of(arbitrary_options()), ) { // eprintln!("{ops:?}"); - let mut layout = check_ops_with_options(options, &ops); + let mut layout = check_ops_with_options(options, ops); if let Some(post_options) = post_options { layout.update_options(post_options); 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 { 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. -- cgit