aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/basic.rs
diff options
context:
space:
mode:
authorHongjie Zhai <zhaihj@live.jp>2021-04-21 15:30:02 +0900
committerHongjie Zhai <zhaihj@live.jp>2021-04-21 15:30:02 +0900
commit9d8fbd2424a12fff085e0e8848793eecc514e9c7 (patch)
tree15648fe3fb5420edd6060a48350b9e21456dbef1 /src/tests/integration/basic.rs
parentcargo fmt (diff)
downloadsl0ppij-9d8fbd2424a12fff085e0e8848793eecc514e9c7.tar.gz
sl0ppij-9d8fbd2424a12fff085e0e8848793eecc514e9c7.tar.xz
sl0ppij-9d8fbd2424a12fff085e0e8848793eecc514e9c7.zip
add tests
Diffstat (limited to 'src/tests/integration/basic.rs')
-rw-r--r--src/tests/integration/basic.rs63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
index 377e25b2..55cea49f 100644
--- a/src/tests/integration/basic.rs
+++ b/src/tests/integration/basic.rs
@@ -4,6 +4,7 @@ use ::insta::assert_snapshot;
use crate::tests::fakes::FakeInputOutput;
use crate::tests::utils::commands::{
PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, SCROLL_MODE, SCROLL_UP_IN_SCROLL_MODE,
+ SCROLL_PAGE_DOWN_IN_SCROLL_MODE, SCROLL_PAGE_UP_IN_SCROLL_MODE,
SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
TOGGLE_ACTIVE_TERMINAL_FULLSCREEN_IN_PANE_MODE,
};
@@ -238,6 +239,68 @@ pub fn scrolling_down_inside_a_pane() {
}
#[test]
+pub fn scrolling_page_up_inside_a_pane() {
+ 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(&[
+ &PANE_MODE,
+ &SPLIT_DOWN_IN_PANE_MODE,
+ &SPLIT_RIGHT_IN_PANE_MODE,
+ &SCROLL_MODE,
+ &SCROLL_PAGE_UP_IN_SCROLL_MODE,
+ &QUIT,
+ ]);
+ start(Box::new(fake_input_output.clone()), CliArgs::default());
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
+ let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
+ let snapshot_before_quit =
+ get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
+ assert_snapshot!(snapshot_before_quit);
+}
+
+#[test]
+pub fn scrolling_page_down_inside_a_pane() {
+ 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(&[
+ &PANE_MODE,
+ &SPLIT_DOWN_IN_PANE_MODE,
+ &SPLIT_RIGHT_IN_PANE_MODE,
+ &SCROLL_MODE,
+ &SCROLL_PAGE_UP_IN_SCROLL_MODE,
+ &SCROLL_PAGE_UP_IN_SCROLL_MODE,
+ &SCROLL_PAGE_DOWN_IN_SCROLL_MODE,
+ &SCROLL_PAGE_DOWN_IN_SCROLL_MODE,
+ &QUIT,
+ ]);
+ start(Box::new(fake_input_output.clone()), CliArgs::default());
+ let output_frames = fake_input_output
+ .stdout_writer
+ .output_frames
+ .lock()
+ .unwrap();
+ let snapshots = get_output_frame_snapshots(&output_frames, &fake_win_size);
+ let snapshot_before_quit =
+ get_next_to_last_snapshot(snapshots).expect("could not find snapshot");
+ assert_snapshot!(snapshot_before_quit);
+}
+
+
+#[test]
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