aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/basic.rs
diff options
context:
space:
mode:
authorBrooks Rady <b.j.rady@gmail.com>2021-04-22 00:25:43 +0100
committerGitHub <noreply@github.com>2021-04-22 00:25:43 +0100
commit19fc0496a34565049cf1085ebf7071b7a6d3ef3d (patch)
treef1ec6c15136949b9b5521275289a1bd7ab9ab194 /src/tests/integration/basic.rs
parentdocs(changelog): update status bar change (diff)
parentadd PGUP/PGDN to help info (diff)
downloadsl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.tar.gz
sl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.tar.xz
sl0ppij-19fc0496a34565049cf1085ebf7071b7a6d3ef3d.zip
feat(actions): allow scrolling by full pages
PR #298
Diffstat (limited to 'src/tests/integration/basic.rs')
-rw-r--r--src/tests/integration/basic.rs66
1 files changed, 64 insertions, 2 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
index 377e25b2..e57f8c75 100644
--- a/src/tests/integration/basic.rs
+++ b/src/tests/integration/basic.rs
@@ -3,8 +3,9 @@ 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,
- SPAWN_TERMINAL_IN_PANE_MODE, SPLIT_DOWN_IN_PANE_MODE, SPLIT_RIGHT_IN_PANE_MODE,
+ PANE_MODE, QUIT, SCROLL_DOWN_IN_SCROLL_MODE, SCROLL_MODE, SCROLL_PAGE_DOWN_IN_SCROLL_MODE,
+ SCROLL_PAGE_UP_IN_SCROLL_MODE, SCROLL_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,
};
use crate::tests::utils::{get_next_to_last_snapshot, get_output_frame_snapshots};
@@ -238,6 +239,67 @@ 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