diff options
| author | Denis Maximov <denismaximov98@gmail.com> | 2020-11-14 19:59:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-14 18:59:37 +0100 |
| commit | a2914066bf0e2e2bf5caee263d2378b7d77f477f (patch) | |
| tree | 2a87397c32e2d9f512ad0c886107aa5c2e57d68e /src/tests/integration | |
| parent | HOTFIX: do not get os input unless we're starting the app (diff) | |
| download | sl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.tar.gz sl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.tar.xz sl0ppij-a2914066bf0e2e2bf5caee263d2378b7d77f477f.zip | |
feat: add rustfmt, update action workflow to check for formatting (#45)
Diffstat (limited to 'src/tests/integration')
| -rw-r--r-- | src/tests/integration/basic.rs | 100 | ||||
| -rw-r--r-- | src/tests/integration/close_pane.rs | 113 | ||||
| -rw-r--r-- | src/tests/integration/compatibility.rs | 46 | ||||
| -rw-r--r-- | src/tests/integration/mod.rs | 6 | ||||
| -rw-r--r-- | src/tests/integration/resize_down.rs | 101 | ||||
| -rw-r--r-- | src/tests/integration/resize_left.rs | 103 | ||||
| -rw-r--r-- | src/tests/integration/resize_right.rs | 102 | ||||
| -rw-r--r-- | src/tests/integration/resize_up.rs | 107 |
8 files changed, 443 insertions, 235 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs index a7e84ad0..6640b6e6 100644 --- a/src/tests/integration/basic.rs +++ b/src/tests/integration/basic.rs @@ -1,29 +1,20 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; -use crate::tests::utils::get_output_frame_snapshots; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, - SPLIT_VERTICALLY, - RESIZE_UP, - MOVE_FOCUS, - RESIZE_LEFT, - RESIZE_RIGHT, - SPAWN_TERMINAL, - QUIT, - SCROLL_UP, - SCROLL_DOWN, - TOGGLE_ACTIVE_TERMINAL_FULLSCREEN, + MOVE_FOCUS, QUIT, RESIZE_LEFT, RESIZE_RIGHT, RESIZE_UP, SCROLL_DOWN, SCROLL_UP, SPAWN_TERMINAL, + SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN, }; +use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } #[test] -pub fn starts_with_one_terminal () { +pub fn starts_with_one_terminal() { let fake_win_size = Winsize { ws_col: 121, ws_row: 20, @@ -33,7 +24,11 @@ pub fn starts_with_one_terminal () { let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -49,12 +44,13 @@ pub fn split_terminals_vertically() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -70,12 +66,13 @@ pub fn split_terminals_horizontally() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_HORIZONTALLY, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -83,7 +80,7 @@ pub fn split_terminals_horizontally() { } #[test] -pub fn split_largest_terminal () { +pub fn split_largest_terminal() { // this finds the largest pane and splits along its longest edge (vertically or horizontally) let fake_win_size = Winsize { ws_col: 121, @@ -92,14 +89,13 @@ pub fn split_largest_terminal () { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPAWN_TERMINAL, - SPAWN_TERMINAL, - SPAWN_TERMINAL, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPAWN_TERMINAL, SPAWN_TERMINAL, SPAWN_TERMINAL, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -144,7 +140,11 @@ pub fn resize_right_and_up_on_the_same_axis() { QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -170,7 +170,11 @@ pub fn scrolling_inside_a_pane() { QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -178,7 +182,7 @@ pub fn scrolling_inside_a_pane() { } #[test] -pub fn max_panes () { +pub fn max_panes() { // with the --max-panes option, we only allow a certain amount of panes on screen // simultaneously, new panes beyond this limit will close older panes on screen let fake_win_size = Winsize { @@ -193,12 +197,16 @@ pub fn max_panes () { SPAWN_TERMINAL, SPAWN_TERMINAL, SPAWN_TERMINAL, - QUIT + QUIT, ]); let mut opts = Opt::default(); opts.max_panes = Some(4); start(Box::new(fake_input_output.clone()), opts); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -206,7 +214,7 @@ pub fn max_panes () { } #[test] -pub fn toggle_focused_pane_fullscreen () { +pub fn toggle_focused_pane_fullscreen() { let fake_win_size = Winsize { ws_col: 121, ws_row: 20, @@ -229,12 +237,16 @@ pub fn toggle_focused_pane_fullscreen () { MOVE_FOCUS, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN, TOGGLE_ACTIVE_TERMINAL_FULLSCREEN, - QUIT + QUIT, ]); let mut opts = Opt::default(); opts.max_panes = Some(4); start(Box::new(fake_input_output.clone()), opts); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/close_pane.rs b/src/tests/integration/close_pane.rs index ddb41d1e..ba44ec08 100644 --- a/src/tests/integration/close_pane.rs +++ b/src/tests/integration/close_pane.rs @@ -1,22 +1,16 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, + CLOSE_FOCUSED_PANE, MOVE_FOCUS, QUIT, RESIZE_DOWN, RESIZE_LEFT, RESIZE_UP, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, - RESIZE_DOWN, - RESIZE_UP, - MOVE_FOCUS, - RESIZE_LEFT, - QUIT, - CLOSE_FOCUSED_PANE, }; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -37,14 +31,14 @@ pub fn close_pane_with_another_pane_above_it() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_HORIZONTALLY, - CLOSE_FOCUSED_PANE, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, CLOSE_FOCUSED_PANE, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -76,7 +70,11 @@ pub fn close_pane_with_another_pane_below_it() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -98,14 +96,14 @@ pub fn close_pane_with_another_pane_to_the_left() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - CLOSE_FOCUSED_PANE, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, CLOSE_FOCUSED_PANE, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -127,15 +125,14 @@ pub fn close_pane_with_another_pane_to_the_right() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - MOVE_FOCUS, - CLOSE_FOCUSED_PANE, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, MOVE_FOCUS, CLOSE_FOCUSED_PANE, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -170,7 +167,11 @@ pub fn close_pane_with_multiple_panes_above_it() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -203,7 +204,11 @@ pub fn close_pane_with_multiple_panes_below_it() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -238,7 +243,11 @@ pub fn close_pane_with_multiple_panes_to_the_left() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -271,7 +280,11 @@ pub fn close_pane_with_multiple_panes_to_the_right() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -318,7 +331,11 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -365,7 +382,11 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -414,7 +435,11 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -463,7 +488,11 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -489,7 +518,11 @@ pub fn closing_last_pane_exits_app() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index e6a913e6..a7cd375c 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -1,11 +1,11 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; use ::std::collections::HashMap; -use crate::{start, Opt}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::possible_tty_inputs::Bytes; -use crate::tests::fakes::{FakeInputOutput}; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::QUIT; @@ -22,7 +22,7 @@ use crate::tests::utils::commands::QUIT; * */ -fn get_fake_os_input (fake_win_size: &Winsize, fixture_name: &str) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize, fixture_name: &str) -> FakeInputOutput { let mut tty_inputs = HashMap::new(); let fixture_bytes = Bytes::from_file_in_fixtures(&fixture_name); tty_inputs.insert(fake_win_size.ws_col, fixture_bytes); @@ -41,7 +41,11 @@ pub fn run_bandwhich_from_fish_shell() { let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -60,7 +64,11 @@ pub fn fish_tab_completion_options() { let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -84,7 +92,11 @@ pub fn fish_select_tab_completion_options() { let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -92,7 +104,7 @@ pub fn fish_select_tab_completion_options() { } #[test] -pub fn vim_scroll_region_down () { +pub fn vim_scroll_region_down() { // here we test a case where vim defines the scroll region as lesser than the screen row count // and then scrolls down // the region is defined here by vim as 1-26 (there are 28 rows) @@ -113,7 +125,11 @@ pub fn vim_scroll_region_down () { // fake_input_output.add_terminal_input(&[17]); // quit (ctrl-q) fake_input_output.add_terminal_input(&[QUIT]); // quit (ctrl-q) start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -138,7 +154,11 @@ pub fn vim_ctrl_d() { let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -162,7 +182,11 @@ pub fn vim_ctrl_u() { let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); fake_input_output.add_terminal_input(&[QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/mod.rs b/src/tests/integration/mod.rs index 138f36a7..677af578 100644 --- a/src/tests/integration/mod.rs +++ b/src/tests/integration/mod.rs @@ -1,7 +1,7 @@ pub mod basic; +pub mod close_pane; pub mod compatibility; -pub mod resize_right; +pub mod resize_down; pub mod resize_left; +pub mod resize_right; pub mod resize_up; -pub mod resize_down; -pub mod close_pane; diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs index 732c01a7..cd149c59 100644 --- a/src/tests/integration/resize_down.rs +++ b/src/tests/integration/resize_down.rs @@ -1,20 +1,15 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, - SPLIT_VERTICALLY, - RESIZE_DOWN, - MOVE_FOCUS, - RESIZE_LEFT, - QUIT, + MOVE_FOCUS, QUIT, RESIZE_DOWN, RESIZE_LEFT, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, }; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -25,7 +20,7 @@ pub fn resize_down_with_pane_above() { // │ │ │ │ // ├───────────┤ ==resize=down==> │ │ // │███████████│ ├───────────┤ - // │███████████│ │███████████│ + // │███████████│ │███████████│ // │███████████│ │███████████│ // └───────────┘ └───────────┘ // █ == focused pane @@ -36,14 +31,14 @@ pub fn resize_down_with_pane_above() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_HORIZONTALLY, - RESIZE_DOWN, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, RESIZE_DOWN, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -67,14 +62,14 @@ pub fn resize_down_with_pane_below() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, - MOVE_FOCUS, - RESIZE_DOWN, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, MOVE_FOCUS, RESIZE_DOWN, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -111,7 +106,11 @@ pub fn resize_down_with_panes_above_and_below() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -148,7 +147,11 @@ pub fn resize_down_with_multiple_panes_above() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -187,7 +190,11 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -225,7 +232,11 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -261,7 +272,11 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -298,7 +313,11 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -338,7 +357,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -380,7 +403,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -437,7 +464,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -496,7 +527,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/resize_left.rs b/src/tests/integration/resize_left.rs index ad59b85e..87c746ca 100644 --- a/src/tests/integration/resize_left.rs +++ b/src/tests/integration/resize_left.rs @@ -1,20 +1,15 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, - SPLIT_VERTICALLY, - RESIZE_UP, - MOVE_FOCUS, - RESIZE_LEFT, - QUIT, + MOVE_FOCUS, QUIT, RESIZE_LEFT, RESIZE_UP, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, }; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -33,14 +28,14 @@ pub fn resize_left_with_pane_to_the_left() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - RESIZE_LEFT, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, RESIZE_LEFT, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -62,15 +57,14 @@ pub fn resize_left_with_pane_to_the_right() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - MOVE_FOCUS, - RESIZE_LEFT, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, MOVE_FOCUS, RESIZE_LEFT, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -102,7 +96,11 @@ pub fn resize_left_with_panes_to_the_left_and_right() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -137,7 +135,11 @@ pub fn resize_left_with_multiple_panes_to_the_left() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -174,7 +176,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -208,7 +214,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -244,7 +254,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -279,7 +293,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -319,7 +337,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -361,7 +383,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -418,7 +444,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -435,7 +465,8 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo // ├─────┼─────┤ ├───┴─┬─────┤ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { // TODO: combine with above + let fake_win_size = Winsize { + // TODO: combine with above ws_col: 121, ws_row: 40, ws_xpixel: 0, @@ -477,7 +508,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs index ee809b41..b2201591 100644 --- a/src/tests/integration/resize_right.rs +++ b/src/tests/integration/resize_right.rs @@ -1,20 +1,15 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, - SPLIT_VERTICALLY, - RESIZE_UP, - MOVE_FOCUS, - RESIZE_RIGHT, - QUIT, + MOVE_FOCUS, QUIT, RESIZE_RIGHT, RESIZE_UP, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, }; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -33,14 +28,14 @@ pub fn resize_right_with_pane_to_the_left() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - RESIZE_RIGHT, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, RESIZE_RIGHT, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -62,15 +57,14 @@ pub fn resize_right_with_pane_to_the_right() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_VERTICALLY, - MOVE_FOCUS, - RESIZE_RIGHT, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, MOVE_FOCUS, RESIZE_RIGHT, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -102,7 +96,11 @@ pub fn resize_right_with_panes_to_the_left_and_right() { ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -137,7 +135,11 @@ pub fn resize_right_with_multiple_panes_to_the_left() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -174,7 +176,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -208,7 +214,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -244,7 +254,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -279,7 +293,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -314,12 +332,16 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p MOVE_FOCUS, SPLIT_VERTICALLY, RESIZE_RIGHT, - QUIT + QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -361,7 +383,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -418,7 +444,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -477,7 +507,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); diff --git a/src/tests/integration/resize_up.rs b/src/tests/integration/resize_up.rs index 4b0fcc45..d4e75376 100644 --- a/src/tests/integration/resize_up.rs +++ b/src/tests/integration/resize_up.rs @@ -1,20 +1,15 @@ -use ::nix::pty::Winsize; use ::insta::assert_snapshot; +use ::nix::pty::Winsize; -use crate::{start, Opt}; -use crate::tests::fakes::{FakeInputOutput}; +use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; +use crate::{start, Opt}; use crate::tests::utils::commands::{ - SPLIT_HORIZONTALLY, - SPLIT_VERTICALLY, - RESIZE_UP, - MOVE_FOCUS, - RESIZE_LEFT, - QUIT, + MOVE_FOCUS, QUIT, RESIZE_LEFT, RESIZE_UP, SPLIT_HORIZONTALLY, SPLIT_VERTICALLY, }; -fn get_fake_os_input (fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -35,14 +30,14 @@ pub fn resize_up_with_pane_above() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_HORIZONTALLY, - RESIZE_UP, - QUIT - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, RESIZE_UP, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -66,15 +61,14 @@ pub fn resize_up_with_pane_below() { ws_ypixel: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); - fake_input_output.add_terminal_input(&[ - SPLIT_HORIZONTALLY, - MOVE_FOCUS, - RESIZE_UP, - QUIT, - ]); + fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, MOVE_FOCUS, RESIZE_UP, QUIT]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -104,13 +98,18 @@ pub fn resize_up_with_panes_above_and_below() { fake_input_output.add_terminal_input(&[ SPLIT_HORIZONTALLY, SPLIT_HORIZONTALLY, - MOVE_FOCUS, MOVE_FOCUS, + MOVE_FOCUS, + MOVE_FOCUS, RESIZE_UP, QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -146,7 +145,11 @@ pub fn resize_up_with_multiple_panes_above() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -183,7 +186,11 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -216,12 +223,16 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() { MOVE_FOCUS, MOVE_FOCUS, RESIZE_UP, - QUIT + QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -257,7 +268,11 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -294,7 +309,11 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -334,7 +353,11 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() { start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -371,12 +394,16 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() { MOVE_FOCUS, MOVE_FOCUS, RESIZE_UP, - QUIT + QUIT, ]); start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -433,7 +460,11 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_ start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); @@ -492,7 +523,11 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri start(Box::new(fake_input_output.clone()), Opt::default()); - let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap(); + let output_frames = fake_input_output + .stdout_writer + .output_frames + .lock() + .unwrap(); let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size); for snapshot in snapshots { assert_snapshot!(snapshot); |
