aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/integration/basic.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2020-09-15 20:15:08 +0200
committerAram Drevekenin <aram@poor.dev>2020-09-15 20:15:08 +0200
commit67076d68123fe73432a4e0afc374ee22710e0a9e (patch)
treeb5544f2217486164c02bbadd97ad0db6a21b76f5 /src/tests/integration/basic.rs
parenttests(restructure): integration folder (diff)
downloadsl0ppij-67076d68123fe73432a4e0afc374ee22710e0a9e.tar.gz
sl0ppij-67076d68123fe73432a4e0afc374ee22710e0a9e.tar.xz
sl0ppij-67076d68123fe73432a4e0afc374ee22710e0a9e.zip
tests(integration): resize left + up + down
Diffstat (limited to 'src/tests/integration/basic.rs')
-rw-r--r--src/tests/integration/basic.rs61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/tests/integration/basic.rs b/src/tests/integration/basic.rs
index cea78fe2..752d720b 100644
--- a/src/tests/integration/basic.rs
+++ b/src/tests/integration/basic.rs
@@ -133,3 +133,64 @@ pub fn split_terminals_horizontally() {
assert_snapshot!(snapshot);
}
}
+
+#[test]
+pub fn resize_right_and_up_on_the_same_axis() {
+ // this is a specific test to explicitly ensure that a tmux-like pane-container algorithm is not
+ // implemented (this test can never pass with such an algorithm)
+ //
+ // ┌─────┬─────┐ ┌─────┬─────┐
+ // │ │ │ │ │ │
+ // ├─────┼─────┤ ==resize=right==> ├─────┴─┬───┤ ==resize-left==>
+ // │█████│ │ │███████│ │
+ // └─────┴─────┘ └───────┴───┘
+ //
+ // ┌─────┬─────┐ ┌─────┬─────┐
+ // │ │ │ ├─────┤ │
+ // ├─────┼─────┤ ==resize=up==> │█████├─────┤
+ // │█████│ │ │█████│ │
+ // └─────┴─────┘ └─────┴─────┘
+ // █ == focused pane
+ let fake_win_size = Winsize { // TODO: combine with above
+ ws_col: 121,
+ ws_row: 40,
+ ws_xpixel: 0,
+ ws_ypixel: 0,
+ };
+ let mut fake_input_output = get_fake_os_input(&fake_win_size);
+
+ // (ctrl-b + ctrl-n + ctrl-p + ctrl-n + ctrl-p * 2 + ctrl-l + ctrl-h + ctrl-k + ctrl-q)
+ fake_input_output.add_terminal_input(&[2, 14, 16, 14, 16, 16, 12, 8, 11, 17]);
+
+ start(Box::new(fake_input_output.clone()));
+
+ let output_frames = fake_input_output.stdout_writer.output_frames.lock().unwrap();
+ let mut vte_parser = vte::Parser::new();
+ let main_pid = 0;
+ let x = 0;
+ let y = 0;
+ let mut terminal_output = TerminalOutput::new(main_pid, fake_win_size, x, y);
+
+ for frame in output_frames.iter() {
+ for byte in frame.iter() {
+ vte_parser.advance(&mut terminal_output, *byte);
+ }
+ let output_lines = terminal_output.read_buffer_as_lines();
+ let (cursor_x, cursor_y) = terminal_output.cursor_coordinates();
+ let mut snapshot = String::new();
+ for (line_index, line) in output_lines.iter().enumerate() {
+ for (character_index, terminal_character) in line.iter().enumerate() {
+ if line_index == cursor_y - 1 && character_index == cursor_x {
+ snapshot.push('█');
+ } else {
+ snapshot.push(terminal_character.character);
+ }
+ }
+ if line_index != output_lines.len() - 1 {
+ snapshot.push('\n');
+ }
+ }
+ assert_snapshot!(snapshot);
+ }
+}
+