diff --git a/test/listview_output_cursor.0 b/test/listview_output_cursor.0 new file mode 100644 index 00000000..1e38f6b4 --- /dev/null +++ b/test/listview_output_cursor.0 @@ -0,0 +1,70 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋+Hello x┋ +A └┛ alt +S 2 ┋World! x┋ +A └┛ alt +S 3 ┋ x┋ +A └┛ alt +S 4 ┋ x┋ +A └┛ alt +S 5 ┋ x┋ +A └┛ alt +S 6 ┋ x┋ +A └┛ alt +S 7 ┋ x┋ +A └┛ alt +S 8 ┋ x┋ +A └┛ alt +S 9 ┋ x┋ +A └┛ alt +S 10 ┋ x┋ +A └┛ alt +S 11 ┋ x┋ +A └┛ alt +S 12 ┋ x┋ +A └┛ alt +S 13 ┋ x┋ +A └┛ alt +S 14 ┋ x┋ +A └┛ alt +S 15 ┋ x┋ +A └┛ alt +S 16 ┋ x┋ +A └┛ alt +S 17 ┋ x┋ +A └┛ alt +S 18 ┋ x┋ +A └┛ alt +S 19 ┋ x┋ +A └┛ alt +S 20 ┋ x┋ +A └┛ alt +S 21 ┋ x┋ +A └┛ alt +S 22 ┋ x┋ +A └┛ alt +S 23 ┋ x┋ +A └┛ alt +S 24 ┋ x ┋ +A ···············································································└ backspace +A └┛ alt +A ···············································································└ backspace +CSI Set Replace mode +S 24 ┋ ┋ +CSI Reset Replace mode +S 24 ┋ ┋ +A ···············································································└ carriage-return +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.1 b/test/listview_output_cursor.1 new file mode 100644 index 00000000..26594ccd --- /dev/null +++ b/test/listview_output_cursor.1 @@ -0,0 +1,70 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋Hello x┋ +A └┛ alt +S 2 ┋World! x┋ +A └┛ alt +S 3 ┋2 x┋ +A └┛ alt +S 4 ┋3 x┋ +A └┛ alt +S 5 ┋4 x┋ +A └┛ alt +S 6 ┋+5 x┋ +A └┛ alt +S 7 ┋6 x┋ +A └┛ alt +S 8 ┋7 x┋ +A └┛ alt +S 9 ┋8 x┋ +A └┛ alt +S 10 ┋9 x┋ +A └┛ alt +S 11 ┋10 x┋ +A └┛ alt +S 12 ┋11 x┋ +A └┛ alt +S 13 ┋12 x┋ +A └┛ alt +S 14 ┋13 x┋ +A └┛ alt +S 15 ┋14 x┋ +A └┛ alt +S 16 ┋15 x┋ +A └┛ alt +S 17 ┋16 x┋ +A └┛ alt +S 18 ┋17 x┋ +A └┛ alt +S 19 ┋18 x┋ +A └┛ alt +S 20 ┋19 x┋ +A └┛ alt +S 21 ┋ x┋ +A └┛ alt +S 22 ┋ x┋ +A └┛ alt +S 23 ┋ x┋ +A └┛ alt +S 24 ┋ x ┋ +A ···············································································└ backspace +A └┛ alt +A ···············································································└ backspace +CSI Set Replace mode +S 24 ┋ ┋ +CSI Reset Replace mode +S 24 ┋ ┋ +A ···············································································└ carriage-return +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.2 b/test/listview_output_cursor.2 new file mode 100644 index 00000000..0c8fd608 --- /dev/null +++ b/test/listview_output_cursor.2 @@ -0,0 +1,70 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋Hello x┋ +A └┛ alt +S 2 ┋World! x┋ +A └┛ alt +S 3 ┋2 x┋ +A └┛ alt +S 4 ┋+3 x┋ +A └┛ alt +S 5 ┋4 x┋ +A └┛ alt +S 6 ┋5 x┋ +A └┛ alt +S 7 ┋6 x┋ +A └┛ alt +S 8 ┋7 x┋ +A └┛ alt +S 9 ┋8 x┋ +A └┛ alt +S 10 ┋9 x┋ +A └┛ alt +S 11 ┋10 x┋ +A └┛ alt +S 12 ┋11 x┋ +A └┛ alt +S 13 ┋12 x┋ +A └┛ alt +S 14 ┋13 x┋ +A └┛ alt +S 15 ┋14 x┋ +A └┛ alt +S 16 ┋15 x┋ +A └┛ alt +S 17 ┋16 x┋ +A └┛ alt +S 18 ┋17 x┋ +A └┛ alt +S 19 ┋18 x┋ +A └┛ alt +S 20 ┋19 x┋ +A └┛ alt +S 21 ┋ x┋ +A └┛ alt +S 22 ┋ x┋ +A └┛ alt +S 23 ┋ x┋ +A └┛ alt +S 24 ┋ x ┋ +A ···············································································└ backspace +A └┛ alt +A ···············································································└ backspace +CSI Set Replace mode +S 24 ┋ ┋ +CSI Reset Replace mode +S 24 ┋ ┋ +A ···············································································└ carriage-return +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.3 b/test/listview_output_cursor.3 new file mode 100644 index 00000000..62ae2345 --- /dev/null +++ b/test/listview_output_cursor.3 @@ -0,0 +1,25 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋World! x┋ +A └┛ alt +S 2 ┋2 x┋ +A └┛ alt +S 3 ┋3 x┋ +A └┛ alt +S 4 ┋+4 x┋ +A └┛ alt +S 5 ┋5 x┋ +A └┛ alt +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.4 b/test/listview_output_cursor.4 new file mode 100644 index 00000000..3980a0ba --- /dev/null +++ b/test/listview_output_cursor.4 @@ -0,0 +1,25 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋Hello x┋ +A └┛ alt +S 2 ┋World! x┋ +A └┛ alt +S 3 ┋2 x┋ +A └┛ alt +S 4 ┋+3 x┋ +A └┛ alt +S 5 ┋4 x┋ +A └┛ alt +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.5 b/test/listview_output_cursor.5 new file mode 100644 index 00000000..f25061e7 --- /dev/null +++ b/test/listview_output_cursor.5 @@ -0,0 +1,35 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋+18 x┋ +A └┛ alt +S 2 ┋19 x┋ +A └┛ alt +S 3 ┋20 x┋ +A └┛ alt +S 4 ┋21 x┋ +A └┛ alt +S 5 ┋22 x┋ +A └┛ alt +S 6 ┋23 x┋ +A └┛ alt +S 7 ┋24 x┋ +A └┛ alt +S 8 ┋25 x┋ +A └┛ alt +S 9 ┋26 x┋ +A └┛ alt +S 10 ┋27 x┋ +A └┛ alt +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/listview_output_cursor.6 b/test/listview_output_cursor.6 new file mode 100644 index 00000000..9706e382 --- /dev/null +++ b/test/listview_output_cursor.6 @@ -0,0 +1,35 @@ +CTRL Use alt charset +CTRL save cursor +CSI Use alternate screen buffer +CSI set scrolling region 1-24 +S -1 ┋ ┋ +A └ normal +CSI Reset Replace mode +CSI Erase all +S 1 ┋9 x┋ +A └┛ alt +S 2 ┋10 x┋ +A └┛ alt +S 3 ┋11 x┋ +A └┛ alt +S 4 ┋12 x┋ +A └┛ alt +S 5 ┋13 x┋ +A └┛ alt +S 6 ┋14 x┋ +A └┛ alt +S 7 ┋15 x┋ +A └┛ alt +S 8 ┋16 x┋ +A └┛ alt +S 9 ┋+17 x┋ +A └┛ alt +S 10 ┋18 x┋ +A └┛ alt +CSI Erase all +CSI Use normal screen buffer +CTRL restore cursor +S 24 ┋ ┋ +A └ carriage-return +CSI Normal cursor keys +CTRL Normal keypad diff --git a/test/test_listview.sh b/test/test_listview.sh index 38634da9..5529008d 100644 --- a/test/test_listview.sh +++ b/test/test_listview.sh @@ -34,3 +34,50 @@ run_test ./scripty -n -e ${srcdir}/listview_output.6 -- \ ./drive_listview -y 1 -r 50 -h -1 -t 1 < /dev/null on_error_fail_with "Listview didn't move down (2)?" + +### +# Cursor mode tests +### + +# Cursor appears on first line +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.0 -- \ + ./drive_listview -c < /dev/null + +on_error_fail_with "Listview Cursor Mode: Didn't enable (not selectable)" + +# Move down within visible area between top (at 0) and tail space +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.1 -- \ + ./drive_listview -r 20 -c -k jjjjj < /dev/null + +on_error_fail_with "Listview Cursor Mode: Didn-t move cursor down?" + +# Move up within visible area between top (at 0) and tail space +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.2 -- \ + ./drive_listview -r 20 -c -k jjjjjkk < /dev/null + +on_error_fail_with "Listview Cursor Mode: Didn't move cursor up?" + + +# Scroll file when reaching tail space +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.3 -- \ + ./drive_listview -r 30 -h 5 -c -k jjjj < /dev/null + +on_error_fail_with "Listview Cursor Mode: Didn't scroll down when reaching tail space?" + +# Do not scroll up when moving up after reaching tail space +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.4 -- \ + ./drive_listview -r 30 -h 5 -c -k jjjjk < /dev/null + +on_error_fail_with "Listview Cursor Mode: scrolled when moving up from tail space?" + +# Page down move +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.5 -- \ + ./drive_listview -r 30 -h 10 -c -k ' ' < /dev/null + +on_error_fail_with "Listview Cursor Mode: didn't moved down on page jump?" + +# Page up move +run_test ./scripty -n -e ${srcdir}/listview_output_cursor.6 -- \ + ./drive_listview -r 30 -h 10 -c -k ' b' < /dev/null + +on_error_fail_with "Listview Cursor Mode: didn't moved up on page jump?"