diff options
| author | Aram Drevekenin <aram@poor.dev> | 2020-12-21 11:52:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-21 11:52:49 +0100 |
| commit | 4436c8923068ad0d3edd42172514aabd006b169a (patch) | |
| tree | 7778ca58b6b056ffc51904066ff1457a8ab2546a /src/tests | |
| parent | refactor(tabs): lay down infrastructure for status bar (#116) (diff) | |
| download | sl0ppij-4436c8923068ad0d3edd42172514aabd006b169a.tar.gz sl0ppij-4436c8923068ad0d3edd42172514aabd006b169a.tar.xz sl0ppij-4436c8923068ad0d3edd42172514aabd006b169a.zip | |
fix(compatibility): git log and git diff with scrollup (#118)
* fix(compatibility): git log and git diff with scrollup
* style(formatting): make rustfmt happy
Diffstat (limited to 'src/tests')
12 files changed, 336 insertions, 0 deletions
diff --git a/src/tests/fixtures/git_diff_scrollup b/src/tests/fixtures/git_diff_scrollup Binary files differnew file mode 100644 index 00000000..98d06baa --- /dev/null +++ b/src/tests/fixtures/git_diff_scrollup diff --git a/src/tests/fixtures/git_log b/src/tests/fixtures/git_log Binary files differnew file mode 100644 index 00000000..9b5bca62 --- /dev/null +++ b/src/tests/fixtures/git_log diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index 578e8fd2..e42a26fb 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -413,3 +413,51 @@ pub fn fish_paste_multiline() { assert_snapshot!(snapshot); } } + +#[test] +pub fn git_log() { + let fake_win_size = PositionAndSize { + columns: 149, + rows: 28, + x: 0, + y: 0, + }; + let fixture_name = "git_log"; + let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + start(Box::new(fake_input_output.clone()), Opt::default()); + 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); + } +} + +#[test] +pub fn git_diff_scrollup() { + // this tests makes sure that when we have a git diff that exceeds the screen size + // we are able to scroll up + let fake_win_size = PositionAndSize { + columns: 149, + rows: 28, + x: 0, + y: 0, + }; + let fixture_name = "git_diff_scrollup"; + let mut fake_input_output = get_fake_os_input(&fake_win_size, fixture_name); + fake_input_output.add_terminal_input(&[&COMMAND_TOGGLE, &COMMAND_TOGGLE, &QUIT]); + start(Box::new(fake_input_output.clone()), Opt::default()); + 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/snapshots/mosaic__tests__integration__compatibility__git_diff-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff-2.snap new file mode 100644 index 00000000..53a568d5 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff-2.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + + * wip: doesn't render when new tab is created? + + * wip: doesnt re-render when a new tab is spawned for now + + * wip: tabs now are a BTreeMap and we can switch between them in both directions + + * wip: I think that should also be here + + * wip: cleanup + + * Spawn a new terminal simultaneously with a new tab + + * Ensure proper Opening and Closing of tabs + + * cleanup + + * more cleanup + + * tests(snapshots): add 'loading' snapshot to each scenario + + * fix(tests): update snapshots + + * Add tests for tabs implementation + + * wip: added tests, moved tab related stuff to a separate file + +:█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff-3.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff-3.snap new file mode 100644 index 00000000..e50d9493 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff-3.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + * wip: doesn't render when new tab is created? + + * wip: doesnt re-render when a new tab is spawned for now + + * wip: tabs now are a BTreeMap and we can switch between them in both directions + + * wip: I think that should also be here + + * wip: cleanup + + * Spawn a new terminal simultaneously with a new tab + + * Ensure proper Opening and Closing of tabs + + * cleanup + + * more cleanup + + * tests(snapshots): add 'loading' snapshot to each scenario + + * fix(tests): update snapshots + + * Add tests for tabs implementation + + * wip: added tests, moved tab related stuff to a separate file + +: +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff.snap new file mode 100644 index 00000000..739c38e6 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +█ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-2.snap new file mode 100644 index 00000000..e1f541c2 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-2.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + +src/terminal_pane/scroll.rs +─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + +────────────────────────────────────────────────┐ +use crate::terminal_pane::terminal_character::{ │ +────────────────────────────────────────────────┘ +5 + CharacterStyles, TerminalCharacter, EMPTY_TERMINAL_CHARACTER, +}; + +use crate::utils::logging::debug_log_to_file; + +/* + * Scroll + * + +──────────────┐ +impl Scroll { │ +──────────────┘ +663 + pub fn move_current_buffer_to_alternative_buffer(&mut self) { + self.alternative_buffer = Some(self.canonical_lines.drain(..).collect()); + self.alternative_cursor_position = Some(self.cursor_position); + self.cursor_position.reset(); + self.clear_all(); + } +:█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-3.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-3.snap new file mode 100644 index 00000000..ba0e26d4 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup-3.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +src/terminal_pane/scroll.rs +─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── + +────────────────────────────────────────────────┐ +use crate::terminal_pane::terminal_character::{ │ +────────────────────────────────────────────────┘ +5 + CharacterStyles, TerminalCharacter, EMPTY_TERMINAL_CHARACTER, +}; + +use crate::utils::logging::debug_log_to_file; + +/* + * Scroll + * + +──────────────┐ +impl Scroll { │ +──────────────┘ +663 + pub fn move_current_buffer_to_alternative_buffer(&mut self) { + self.alternative_buffer = Some(self.canonical_lines.drain(..).collect()); + self.alternative_cursor_position = Some(self.cursor_position); + self.cursor_position.reset(); + self.clear_all(); + } +: +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup.snap new file mode 100644 index 00000000..739c38e6 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_diff_scrollup.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +█ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-2.snap new file mode 100644 index 00000000..53a568d5 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-2.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + + * wip: doesn't render when new tab is created? + + * wip: doesnt re-render when a new tab is spawned for now + + * wip: tabs now are a BTreeMap and we can switch between them in both directions + + * wip: I think that should also be here + + * wip: cleanup + + * Spawn a new terminal simultaneously with a new tab + + * Ensure proper Opening and Closing of tabs + + * cleanup + + * more cleanup + + * tests(snapshots): add 'loading' snapshot to each scenario + + * fix(tests): update snapshots + + * Add tests for tabs implementation + + * wip: added tests, moved tab related stuff to a separate file + +:█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-3.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-3.snap new file mode 100644 index 00000000..e50d9493 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log-3.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + * wip: doesn't render when new tab is created? + + * wip: doesnt re-render when a new tab is spawned for now + + * wip: tabs now are a BTreeMap and we can switch between them in both directions + + * wip: I think that should also be here + + * wip: cleanup + + * Spawn a new terminal simultaneously with a new tab + + * Ensure proper Opening and Closing of tabs + + * cleanup + + * more cleanup + + * tests(snapshots): add 'loading' snapshot to each scenario + + * fix(tests): update snapshots + + * Add tests for tabs implementation + + * wip: added tests, moved tab related stuff to a separate file + +: +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log.snap new file mode 100644 index 00000000..739c38e6 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__git_log.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- +█ + + + + + + + + + + + + + + + + + + + + + + + + + + + |
