diff options
| author | Aram Drevekenin <aram@poor.dev> | 2020-11-30 09:40:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-30 09:40:24 +0100 |
| commit | c47fed927e8fad0395266fb30c58a094e430bee0 (patch) | |
| tree | 8e934b835157fe4adcb4ccb7ed4169e6d366582b /src/tests | |
| parent | fix(input): read stdin with lock (#72) (diff) | |
| download | sl0ppij-c47fed927e8fad0395266fb30c58a094e430bee0.tar.gz sl0ppij-c47fed927e8fad0395266fb30c58a094e430bee0.tar.xz sl0ppij-c47fed927e8fad0395266fb30c58a094e430bee0.zip | |
fic(compatibility): htop scrolling issues (#77)
* fix(compatibility): scrolling inside scroll region with 'M' esc dispatch
* style(format): make rustfmt happy
* fix(tests): send proper data
* fix(logs): do not crash if log file doesn't exist
Diffstat (limited to 'src/tests')
6 files changed, 89 insertions, 2 deletions
diff --git a/src/tests/fixtures/htop_scrolling b/src/tests/fixtures/htop_scrolling Binary files differnew file mode 100644 index 00000000..4e0df629 --- /dev/null +++ b/src/tests/fixtures/htop_scrolling diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index c244f5bf..cb378ef5 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -214,3 +214,26 @@ pub fn htop() { assert_snapshot!(snapshot); } } + +#[test] +pub fn htop_scrolling() { + let fake_win_size = PositionAndSize { + columns: 116, + rows: 28, + x: 0, + y: 0, + }; + let fixture_name = "htop_scrolling"; + 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__htop-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap index 2fa4647b..3754cdd4 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop-2.snap @@ -29,4 +29,4 @@ expression: snapshot 99272 aram 20 0 8456 4348 3320 R 1.3 0.0 0:00.13 htop 8611 aram 20 0 2944M 318M 130M S 1.3 2.0 8:17.90 /usr/lib/firefox/firefox -contentproc -childID 6 -i F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit -Bye from Mosaic! +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap new file mode 100644 index 00000000..c4f6568c --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling-2.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + 1 [||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 79, 382 thr; 1 running + 2 [ 0.0%] Load average: 1.40 1.43 1.38 + 3 [ 0.0%] Uptime: 2 days, 07:33:50 + 4 [ 0.0%] + Mem[|||||||||||||||||||||||||||||||||||||3.64G/15.3G] + Swp[ 0K/16.0G] + + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command + 123934 aram 20 0 8444 4384 3364 R 66.7 0.0 0:00.05 htop --delay=100000000000 + 1 root 20 0 171M 11616 8608 S 0.0 0.1 0:56.91 /sbin/init + 268 root 20 0 93324 34340 33072 S 0.0 0.2 0:01.05 /usr/lib/systemd/systemd-journald + 276 root 20 0 32648 10192 7240 S 0.0 0.1 0:01.13 /usr/lib/systemd/systemd-udevd + 286 root 20 0 78060 1132 996 S 0.0 0.0 0:00.00 /usr/bin/lvmetad -f + 343 dbus 20 0 6952 4384 3520 S 0.0 0.0 0:13.85 /usr/bin/dbus-daemon --system --address=systemd: -- + 344 root 20 0 14588 7512 6176 S 0.0 0.0 0:03.21 /usr/bin/connmand -n --nodnsproxy + 345 root 20 0 17696 8372 7128 S 0.0 0.1 0:00.67 /usr/lib/systemd/systemd-logind + 395 root 20 0 1635M 83324 44976 S 0.0 0.5 0:32.43 /usr/bin/dockerd -H fd:// + 396 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 397 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 398 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 399 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 412 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 441 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.35 /usr/bin/dockerd -H fd:// + 442 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.61 /usr/bin/dockerd -H fd:// + 444 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.13 /usr/bin/dockerd -H fd:// + 449 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.39 /usr/bin/dockerd -H fd:// +F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit +Bye from Mosaic!█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap new file mode 100644 index 00000000..fdf6cf89 --- /dev/null +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__htop_scrolling.snap @@ -0,0 +1,32 @@ +--- +source: src/tests/integration/compatibility.rs +expression: snapshot +--- + 1 [||||||||||||||||||||||||||||||||||||||||||100.0%] Tasks: 79, 382 thr; 1 running + 2 [ 0.0%] Load average: 1.40 1.43 1.38 + 3 [ 0.0%] Uptime: 2 days, 07:33:50 + 4 [ 0.0%] + Mem[|||||||||||||||||||||||||||||||||||||3.64G/15.3G] + Swp[ 0K/16.0G] + + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command + 123934 aram 20 0 8444 4384 3364 R 66.7 0.0 0:00.05 htop --delay=100000000000 + 1 root 20 0 171M 11616 8608 S 0.0 0.1 0:56.91 /sbin/init + 268 root 20 0 93324 34340 33072 S 0.0 0.2 0:01.05 /usr/lib/systemd/systemd-journald + 276 root 20 0 32648 10192 7240 S 0.0 0.1 0:01.13 /usr/lib/systemd/systemd-udevd + 286 root 20 0 78060 1132 996 S 0.0 0.0 0:00.00 /usr/bin/lvmetad -f + 343 dbus 20 0 6952 4384 3520 S 0.0 0.0 0:13.85 /usr/bin/dbus-daemon --system --address=systemd: -- + 344 root 20 0 14588 7512 6176 S 0.0 0.0 0:03.21 /usr/bin/connmand -n --nodnsproxy + 345 root 20 0 17696 8372 7128 S 0.0 0.1 0:00.67 /usr/lib/systemd/systemd-logind + 395 root 20 0 1635M 83324 44976 S 0.0 0.5 0:32.43 /usr/bin/dockerd -H fd:// + 396 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 397 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.01 /usr/bin/dockerd -H fd:// + 398 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 399 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 412 root 20 0 1635M 83324 44976 S 0.0 0.5 0:00.00 /usr/bin/dockerd -H fd:// + 441 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.35 /usr/bin/dockerd -H fd:// + 442 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.61 /usr/bin/dockerd -H fd:// + 444 root 20 0 1635M 83324 44976 S 0.0 0.5 0:33.13 /usr/bin/dockerd -H fd:// + 449 root 20 0 1635M 83324 44976 S 0.0 0.5 0:41.39 /usr/bin/dockerd -H fd:// +F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit +█ diff --git a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap index 8ca0fe37..9c90df81 100644 --- a/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap +++ b/src/tests/integration/snapshots/mosaic__tests__integration__compatibility__run_bandwhich_from_fish_shell-2.snap @@ -29,4 +29,4 @@ expression: snapshot │ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ Press <SPACE> to pause. Use <TAB> to rearrange tables. (DNS queries hidden). -Bye from Mosaic! +Bye from Mosaic!█ |
