diff options
| author | Denis Maximov <denismaximov98@gmail.com> | 2020-11-19 16:30:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-19 15:30:05 +0100 |
| commit | cf43736656e0d9ba0744c687373a60749a92cdb0 (patch) | |
| tree | 9c5ab10a6e1632fe1b4fcb1861cf94c04c5de6f2 /src/tests | |
| parent | fix(compatibility): some fixes for htop (#53) (diff) | |
| download | sl0ppij-cf43736656e0d9ba0744c687373a60749a92cdb0.tar.gz sl0ppij-cf43736656e0d9ba0744c687373a60749a92cdb0.tar.xz sl0ppij-cf43736656e0d9ba0744c687373a60749a92cdb0.zip | |
refactor(data-structures): #51 change winsize to positionandsize (#56)
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/fakes.rs | 8 | ||||
| -rw-r--r-- | src/tests/integration/basic.rs | 84 | ||||
| -rw-r--r-- | src/tests/integration/close_pane.rs | 134 | ||||
| -rw-r--r-- | src/tests/integration/compatibility.rs | 69 | ||||
| -rw-r--r-- | src/tests/integration/layouts.rs | 14 | ||||
| -rw-r--r-- | src/tests/integration/resize_down.rs | 124 | ||||
| -rw-r--r-- | src/tests/integration/resize_left.rs | 124 | ||||
| -rw-r--r-- | src/tests/integration/resize_right.rs | 124 | ||||
| -rw-r--r-- | src/tests/integration/resize_up.rs | 124 | ||||
| -rw-r--r-- | src/tests/integration/toggle_fullscreen.rs | 24 | ||||
| -rw-r--r-- | src/tests/utils.rs | 7 |
11 files changed, 419 insertions, 417 deletions
diff --git a/src/tests/fakes.rs b/src/tests/fakes.rs index 37d1bf79..79a57f86 100644 --- a/src/tests/fakes.rs +++ b/src/tests/fakes.rs @@ -1,4 +1,4 @@ -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use ::std::collections::HashMap; use ::std::io::{Read, Write}; use ::std::os::unix::io::RawFd; @@ -80,12 +80,12 @@ pub struct FakeInputOutput { stdin_writes: Arc<Mutex<HashMap<RawFd, Vec<u8>>>>, pub stdout_writer: FakeStdoutWriter, // stdout_writer.output is already an arc/mutex io_events: Arc<Mutex<Vec<IoEvent>>>, - win_sizes: Arc<Mutex<HashMap<RawFd, Winsize>>>, + win_sizes: Arc<Mutex<HashMap<RawFd, PositionAndSize>>>, possible_tty_inputs: HashMap<u16, Bytes>, } impl FakeInputOutput { - pub fn new(winsize: Winsize) -> Self { + pub fn new(winsize: PositionAndSize) -> Self { let mut win_sizes = HashMap::new(); win_sizes.insert(0, winsize); // 0 is the current terminal FakeInputOutput { @@ -111,7 +111,7 @@ impl FakeInputOutput { } impl OsApi for FakeInputOutput { - fn get_terminal_size_using_fd(&self, pid: RawFd) -> Winsize { + fn get_terminal_size_using_fd(&self, pid: RawFd) -> PositionAndSize { let win_sizes = self.win_sizes.lock().unwrap(); let winsize = win_sizes.get(&pid).unwrap(); *winsize diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs index 6640b6e6..b3b8c2e6 100644 --- a/src/tests/integration/basic.rs +++ b/src/tests/integration/basic.rs @@ -1,5 +1,5 @@ +use crate::terminal_pane::PositionAndSize; use ::insta::assert_snapshot; -use ::nix::pty::Winsize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::commands::{ @@ -9,17 +9,17 @@ use crate::tests::utils::commands::{ 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } #[test] pub fn starts_with_one_terminal() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[QUIT]); @@ -37,11 +37,11 @@ pub fn starts_with_one_terminal() { #[test] pub fn split_terminals_vertically() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, QUIT]); @@ -59,11 +59,11 @@ pub fn split_terminals_vertically() { #[test] pub fn split_terminals_horizontally() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, QUIT]); @@ -82,11 +82,11 @@ pub fn split_terminals_horizontally() { #[test] 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, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -119,11 +119,11 @@ pub fn resize_right_and_up_on_the_same_axis() { // │█████│ │ │█████│ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -153,11 +153,11 @@ pub fn resize_right_and_up_on_the_same_axis() { #[test] pub fn scrolling_inside_a_pane() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -185,11 +185,11 @@ pub fn scrolling_inside_a_pane() { 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 { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -215,11 +215,11 @@ pub fn max_panes() { #[test] pub fn toggle_focused_pane_fullscreen() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/close_pane.rs b/src/tests/integration/close_pane.rs index ba44ec08..3c2fec2f 100644 --- a/src/tests/integration/close_pane.rs +++ b/src/tests/integration/close_pane.rs @@ -1,5 +1,5 @@ +use crate::terminal_pane::PositionAndSize; use ::insta::assert_snapshot; -use ::nix::pty::Winsize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; @@ -10,7 +10,7 @@ use crate::tests::utils::commands::{ SPLIT_VERTICALLY, }; -fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -24,11 +24,11 @@ pub fn close_pane_with_another_pane_above_it() { // │███████████│ │xxxxxxxxxxx│ // └───────────┘ └───────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -55,11 +55,11 @@ pub fn close_pane_with_another_pane_below_it() { // │xxxxxxxxxxx│ │xxxxxxxxxxx│ // └───────────┘ └───────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -89,11 +89,11 @@ pub fn close_pane_with_another_pane_to_the_left() { // │xxxxx│█████│ │xxxxxxxxxx│ // └─────┴─────┘ └──────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -118,11 +118,11 @@ pub fn close_pane_with_another_pane_to_the_right() { // │█████│xxxxx│ │xxxxxxxxxx│ // └─────┴─────┘ └──────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -149,11 +149,11 @@ pub fn close_pane_with_multiple_panes_above_it() { // │███████████│ │xxxxx│xxxxx│ // └───────────┘ └─────┴─────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -188,11 +188,11 @@ pub fn close_pane_with_multiple_panes_below_it() { // │xxxxx│xxxxx│ │xxxxx│xxxxx│ // └─────┴─────┘ └─────┴─────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -225,11 +225,11 @@ pub fn close_pane_with_multiple_panes_to_the_left() { // │xxxxx│█████│ │xxxxxxxxxx│ // └─────┴─────┘ └──────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -264,11 +264,11 @@ pub fn close_pane_with_multiple_panes_to_the_right() { // │█████│xxxxx│ │xxxxxxxxxx│ // └─────┴─────┘ └──────────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -301,11 +301,11 @@ pub fn close_pane_with_multiple_panes_above_it_away_from_screen_edges() { // │xxx│███████│xxx│ │xxx│xxx│xxx│xxx│ // └───┴───────┴───┘ └───┴───┴───┴───┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -352,11 +352,11 @@ pub fn close_pane_with_multiple_panes_below_it_away_from_screen_edges() { // │xxx│xxx│xxx│xxx│ │xxx│xxx│xxx│xxx│ // └───┴───┴───┴───┘ └───┴───┴───┴───┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -405,11 +405,11 @@ pub fn close_pane_with_multiple_panes_to_the_left_away_from_screen_edges() { // │xxxx│xxxxxx│ │xxxx│xxxxxx│ // └────┴──────┘ └────┴──────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -458,11 +458,11 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { // │xxxx│xxxxxx│ │xxxx│xxxxxx│ // └────┴──────┘ └────┴──────┘ // █ == pane being closed - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -501,11 +501,11 @@ pub fn close_pane_with_multiple_panes_to_the_right_away_from_screen_edges() { #[test] pub fn closing_last_pane_exits_app() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index a7cd375c..60f45844 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -1,14 +1,13 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; use ::std::collections::HashMap; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::possible_tty_inputs::Bytes; +use crate::tests::utils::commands::QUIT; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; -use crate::tests::utils::commands::QUIT; - /* * These tests are general compatibility tests for non-trivial scenarios running in the terminal. * They use fake TTY input replicated from these scenarios (and so don't actually interact with the @@ -22,20 +21,20 @@ 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: &PositionAndSize, 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); + tty_inputs.insert(fake_win_size.columns as u16, fixture_bytes); FakeInputOutput::new(fake_win_size.clone()).with_tty_inputs(tty_inputs) } #[test] pub fn run_bandwhich_from_fish_shell() { - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "fish_and_bandwhich"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -54,11 +53,11 @@ pub fn run_bandwhich_from_fish_shell() { #[test] pub fn fish_tab_completion_options() { - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "fish_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -82,11 +81,11 @@ pub fn fish_select_tab_completion_options() { // changes. // this is not clearly seen in the snapshot because it does not include styles, // but we can see the command line change and the cursor staying in place - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "fish_select_tab_completion_options"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -114,11 +113,11 @@ pub fn vim_scroll_region_down() { // this tests also has other steps afterwards that fills the line with the next line in the // file // experience appear to the user - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "vim_scroll_region_down"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -144,11 +143,11 @@ pub fn vim_ctrl_d() { // what happens here is that 13 lines are deleted and instead 13 empty lines are added at the // end of the scroll region // vim makes sure to fill these empty lines with the rest of the file - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "vim_ctrl_d"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); @@ -172,11 +171,11 @@ pub fn vim_ctrl_u() { // this case) lines at the cursor, pushing away (deleting) the last line in the scroll region // this causes the effect of scrolling up X lines (vim replaces the lines with the ones in the // file above the current content) - let fake_win_size = Winsize { - ws_col: 116, - ws_row: 28, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, }; let fixture_name = "vim_ctrl_u"; let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); diff --git a/src/tests/integration/layouts.rs b/src/tests/integration/layouts.rs index 2ab0375e..0212cb06 100644 --- a/src/tests/integration/layouts.rs +++ b/src/tests/integration/layouts.rs @@ -1,22 +1,22 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::commands::QUIT; 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } #[test] pub fn accepts_basic_layout() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[QUIT]); diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs index cd149c59..24c53340 100644 --- a/src/tests/integration/resize_down.rs +++ b/src/tests/integration/resize_down.rs @@ -1,6 +1,6 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; @@ -9,7 +9,7 @@ use crate::tests::utils::commands::{ 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -24,11 +24,11 @@ pub fn resize_down_with_pane_above() { // │███████████│ │███████████│ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, RESIZE_DOWN, QUIT]); @@ -55,11 +55,11 @@ pub fn resize_down_with_pane_below() { // │ │ │ │ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -89,11 +89,11 @@ pub fn resize_down_with_panes_above_and_below() { // │ │ │ │ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -127,11 +127,11 @@ pub fn resize_down_with_multiple_panes_above() { // │███████████│ │███████████│ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -168,11 +168,11 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { // │ │█████│ │ │█████│ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -211,11 +211,11 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -253,11 +253,11 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { // │█████│ │ │█████│ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -293,11 +293,11 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -334,11 +334,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { // │ │███│ │ │ │███│ │ // └───┴───┴───┘ └───┴───┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -378,11 +378,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { // │ │ │ │ │ │ │ │ // └───┴───┴───┘ └───┴───┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -424,11 +424,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef // │ │ │███│ │ │ │ │ │███│ │ │ // └─┴─┴───┴─┴─┘ └─┴─┴───┴─┴─┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -485,11 +485,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ // │ │ │ │ │ │ │ │ // └─┴───────┴─┘ └─┴───────┴─┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); diff --git a/src/tests/integration/resize_left.rs b/src/tests/integration/resize_left.rs index 87c746ca..2919d58b 100644 --- a/src/tests/integration/resize_left.rs +++ b/src/tests/integration/resize_left.rs @@ -1,6 +1,6 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; @@ -9,7 +9,7 @@ use crate::tests::utils::commands::{ 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -21,11 +21,11 @@ pub fn resize_left_with_pane_to_the_left() { // │ │█████│ │ │███████│ // └─────┴─────┘ └───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, RESIZE_LEFT, QUIT]); @@ -50,11 +50,11 @@ pub fn resize_left_with_pane_to_the_right() { // │█████│ │ │███│ │ // └─────┴─────┘ └───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -79,11 +79,11 @@ pub fn resize_left_with_panes_to_the_left_and_right() { // │ │█████│ │ │ │███│ │ // └─────┴─────┴─────┘ └─────┴───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -115,11 +115,11 @@ pub fn resize_left_with_multiple_panes_to_the_left() { // │ │█████│ │ │███████│ // └─────┴─────┘ └───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -154,11 +154,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_with_current_pane() { // │ │█████│ │ │███████│ // └─────┴─────┘ └───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -195,11 +195,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_with_current_pane() { // │█████│ │ │███│ │ // └─────┴─────┘ └───┴───────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -233,11 +233,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_bottom_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -273,11 +273,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_bottom_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -314,11 +314,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_current_pa // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -358,11 +358,11 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_current_p // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -404,11 +404,11 @@ pub fn resize_left_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abov // ├─────┼─────┤ ├───┴─┬─────┤ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -465,12 +465,12 @@ pub fn resize_left_with_panes_to_the_right_aligned_top_and_bottom_with_panes_abo // ├─────┼─────┤ ├───┴─┬─────┤ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { + let fake_win_size = PositionAndSize { // TODO: combine with above - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); diff --git a/src/tests/integration/resize_right.rs b/src/tests/integration/resize_right.rs index b2201591..7ea26761 100644 --- a/src/tests/integration/resize_right.rs +++ b/src/tests/integration/resize_right.rs @@ -1,6 +1,6 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; @@ -9,7 +9,7 @@ use crate::tests::utils::commands::{ 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -21,11 +21,11 @@ pub fn resize_right_with_pane_to_the_left() { // │ │█████│ │ │███│ // └─────┴─────┘ └───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_VERTICALLY, RESIZE_RIGHT, QUIT]); @@ -50,11 +50,11 @@ pub fn resize_right_with_pane_to_the_right() { // │█████│ │ │███████│ │ // └─────┴─────┘ └───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -79,11 +79,11 @@ pub fn resize_right_with_panes_to_the_left_and_right() { // │ │█████│ │ │ │███████│ │ // └─────┴─────┴─────┘ └─────┴───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -115,11 +115,11 @@ pub fn resize_right_with_multiple_panes_to_the_left() { // │ │█████│ │ │███│ // └─────┴─────┘ └───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -154,11 +154,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_with_current_pane() { // │ │█████│ │ │███│ // └─────┴─────┘ └───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -195,11 +195,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_with_current_pane() { // │█████│ │ │███████│ │ // └─────┴─────┘ └───────┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -233,11 +233,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_bottom_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -273,11 +273,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_bottom_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -314,11 +314,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_current_p // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -358,11 +358,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_current_ // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -404,11 +404,11 @@ pub fn resize_right_with_panes_to_the_left_aligned_top_and_bottom_with_panes_abo // ├─────┼─────┤ ├─────┬─┴───┤ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -465,11 +465,11 @@ pub fn resize_right_with_panes_to_the_right_aligned_top_and_bottom_with_panes_ab // ├─────┼─────┤ ├─────┬─┴───┤ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); diff --git a/src/tests/integration/resize_up.rs b/src/tests/integration/resize_up.rs index d4e75376..7cf6b481 100644 --- a/src/tests/integration/resize_up.rs +++ b/src/tests/integration/resize_up.rs @@ -1,6 +1,6 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; @@ -9,7 +9,7 @@ use crate::tests::utils::commands::{ 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: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } @@ -23,11 +23,11 @@ pub fn resize_up_with_pane_above() { // │███████████│ │███████████│ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[SPLIT_HORIZONTALLY, RESIZE_UP, QUIT]); @@ -54,11 +54,11 @@ pub fn resize_up_with_pane_below() { // │ │ │ │ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 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]); @@ -88,11 +88,11 @@ pub fn resize_up_with_panes_above_and_below() { // │ │ │ │ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -125,11 +125,11 @@ pub fn resize_up_with_multiple_panes_above() { // │███████████│ │███████████│ // └───────────┘ └───────────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -164,11 +164,11 @@ pub fn resize_up_with_panes_above_aligned_left_with_current_pane() { // │ │█████│ │ │█████│ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -207,11 +207,11 @@ pub fn resize_up_with_panes_below_aligned_left_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -249,11 +249,11 @@ pub fn resize_up_with_panes_above_aligned_right_with_current_pane() { // │█████│ │ │█████│ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -289,11 +289,11 @@ pub fn resize_up_with_panes_below_aligned_right_with_current_pane() { // │ │ │ │ │ │ // └─────┴─────┘ └─────┴─────┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -330,11 +330,11 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_current_pane() { // │ │███│ │ │ │███│ │ // └───┴───┴───┘ └───┴───┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -374,11 +374,11 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_current_pane() { // │ │ │ │ │ │ │ │ // └───┴───┴───┘ └───┴───┴───┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -420,11 +420,11 @@ pub fn resize_up_with_panes_above_aligned_left_and_right_with_panes_to_the_left_ // │ │ │███│ │ │ │ │ │███│ │ │ // └─┴─┴───┴─┴─┘ └─┴─┴───┴─┴─┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); @@ -481,11 +481,11 @@ pub fn resize_up_with_panes_below_aligned_left_and_right_with_to_the_left_and_ri // │ │ │ │ │ │ │ │ // └─┴───────┴─┘ └─┴───────┴─┘ // █ == focused pane - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 40, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 40, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); diff --git a/src/tests/integration/toggle_fullscreen.rs b/src/tests/integration/toggle_fullscreen.rs index ebe28320..d7fdc998 100644 --- a/src/tests/integration/toggle_fullscreen.rs +++ b/src/tests/integration/toggle_fullscreen.rs @@ -1,6 +1,6 @@ use ::insta::assert_snapshot; -use ::nix::pty::Winsize; +use crate::terminal_pane::PositionAndSize; use crate::tests::fakes::FakeInputOutput; use crate::tests::utils::get_output_frame_snapshots; use crate::{start, Opt}; @@ -10,17 +10,17 @@ use crate::tests::utils::commands::{ TOGGLE_ACTIVE_TERMINAL_FULLSCREEN, }; -fn get_fake_os_input(fake_win_size: &Winsize) -> FakeInputOutput { +fn get_fake_os_input(fake_win_size: &PositionAndSize) -> FakeInputOutput { FakeInputOutput::new(fake_win_size.clone()) } #[test] pub fn adding_new_terminal_in_fullscreen() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ @@ -45,11 +45,11 @@ pub fn adding_new_terminal_in_fullscreen() { #[test] pub fn move_focus_is_disabled_in_fullscreen() { - let fake_win_size = Winsize { - ws_col: 121, - ws_row: 20, - ws_xpixel: 0, - ws_ypixel: 0, + let fake_win_size = PositionAndSize { + columns: 121, + rows: 20, + x: 0, + y: 0, }; let mut fake_input_output = get_fake_os_input(&fake_win_size); fake_input_output.add_terminal_input(&[ diff --git a/src/tests/utils.rs b/src/tests/utils.rs index de19ff4f..4b399760 100644 --- a/src/tests/utils.rs +++ b/src/tests/utils.rs @@ -1,7 +1,10 @@ +use crate::terminal_pane::PositionAndSize; use crate::terminal_pane::TerminalPane; -use ::nix::pty::Winsize; -pub fn get_output_frame_snapshots(output_frames: &[Vec<u8>], win_size: &Winsize) -> Vec<String> { +pub fn get_output_frame_snapshots( + output_frames: &[Vec<u8>], + win_size: &PositionAndSize, +) -> Vec<String> { let mut vte_parser = vte::Parser::new(); let main_pid = 0; let x = 0; |
