diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-03-20 09:40:45 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-04 20:47:51 +0530 |
| commit | 5d06a49f8aded46f45487e87ea31fd3d82dae1ab (patch) | |
| tree | f766bcd166814efcbd36706531b99ad29b5c2dc5 /src | |
| parent | Fix after rebase (diff) | |
| download | sl0ppij-5d06a49f8aded46f45487e87ea31fd3d82dae1ab.tar.gz sl0ppij-5d06a49f8aded46f45487e87ea31fd3d82dae1ab.tar.xz sl0ppij-5d06a49f8aded46f45487e87ea31fd3d82dae1ab.zip | |
fix fmt errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/tests/fakes.rs | 29 | ||||
| -rw-r--r-- | src/tests/integration/resize_down.rs | 78 |
2 files changed, 65 insertions, 42 deletions
diff --git a/src/tests/fakes.rs b/src/tests/fakes.rs index 16b98101..fcf0cefb 100644 --- a/src/tests/fakes.rs +++ b/src/tests/fakes.rs @@ -218,35 +218,6 @@ impl ServerOsApi for FakeInputOutput { fn box_clone(&self) -> Box<dyn ServerOsApi> { Box::new((*self).clone()) } - fn read_from_stdin(&self) -> Vec<u8> { - loop { - let last_snapshot_time = { *self.last_snapshot_time.lock().unwrap() }; - if last_snapshot_time.elapsed() > MIN_TIME_BETWEEN_SNAPSHOTS { - break; - } else { - ::std::thread::sleep(MIN_TIME_BETWEEN_SNAPSHOTS - last_snapshot_time.elapsed()); - } - } - let command = self - .stdin_commands - .lock() - .unwrap() - .pop_front() - .unwrap_or(vec![]); - if command == SLEEP { - std::thread::sleep(std::time::Duration::from_millis(200)); - } else if command == QUIT && self.sigwinch_event.is_some() { - let (lock, cvar) = &*self.should_trigger_sigwinch; - let mut should_trigger_sigwinch = lock.lock().unwrap(); - *should_trigger_sigwinch = true; - cvar.notify_one(); - ::std::thread::sleep(MIN_TIME_BETWEEN_SNAPSHOTS); // give some time for the app to resize before quitting - } - command - } - fn get_stdout_writer(&self) -> Box<dyn Write> { - Box::new(self.stdout_writer.clone()) - } fn kill(&mut self, fd: RawFd) -> Result<(), nix::Error> { self.io_events.lock().unwrap().push(IoEvent::Kill(fd)); Ok(()) diff --git a/src/tests/integration/resize_down.rs b/src/tests/integration/resize_down.rs index 850f6807..745ba109 100644 --- a/src/tests/integration/resize_down.rs +++ b/src/tests/integration/resize_down.rs @@ -43,7 +43,11 @@ pub fn resize_down_with_pane_above() { &SLEEP, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -83,7 +87,11 @@ pub fn resize_down_with_pane_below() { &SLEEP, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -129,7 +137,11 @@ pub fn resize_down_with_panes_above_and_below() { &SLEEP, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -174,7 +186,11 @@ pub fn resize_down_with_multiple_panes_above() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -221,7 +237,11 @@ pub fn resize_down_with_panes_above_aligned_left_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -267,7 +287,11 @@ pub fn resize_down_with_panes_below_aligned_left_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -311,7 +335,11 @@ pub fn resize_down_with_panes_above_aligned_right_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -356,7 +384,11 @@ pub fn resize_down_with_panes_below_aligned_right_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -404,7 +436,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -454,7 +490,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_current_pane() { &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -521,7 +561,11 @@ pub fn resize_down_with_panes_above_aligned_left_and_right_with_panes_to_the_lef &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -590,7 +634,11 @@ pub fn resize_down_with_panes_below_aligned_left_and_right_with_to_the_left_and_ &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer @@ -627,7 +675,11 @@ pub fn cannot_resize_down_when_pane_below_is_at_minimum_height() { &SLEEP, &QUIT, ]); - start(Box::new(fake_input_output.clone()), CliArgs::default(), Box::new(fake_input_output.clone())); + start( + Box::new(fake_input_output.clone()), + CliArgs::default(), + Box::new(fake_input_output.clone()), + ); let output_frames = fake_input_output .stdout_writer |
