aboutsummaryrefslogtreecommitdiff
path: root/test/functional/terminal/window_split_tab_spec.lua
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-03-25 09:14:47 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-03-25 18:57:36 -0300
commit2aa2513b8e023a0d7bd2071299f0ea59a4d4ce25 (patch)
treeb684785ba9c769491e6ebdac8e21495cf22dbdd3 /test/functional/terminal/window_split_tab_spec.lua
parent710002c820e5a55e3b234074fefb84ab745e11a3 (diff)
downloadrneovim-2aa2513b8e023a0d7bd2071299f0ea59a4d4ce25.tar.gz
rneovim-2aa2513b8e023a0d7bd2071299f0ea59a4d4ce25.tar.bz2
rneovim-2aa2513b8e023a0d7bd2071299f0ea59a4d4ce25.zip
test: Add terminal tests
- Modify tty-test to allow easier control over the terminal - Add a new directory with various terminal tests/specifications - Remove a pending job/pty test. - Flush stdout in Screen:snapshot_util() (avoid waiting for the test to finish) - Replace libuv sigwinch watcher by a sigaction handler. libuv randomly fails to deliver signals on OSX. Might be related to the problem fixed by @bbcddc55ee1e5605657592644be0102ed3a5f104 (under the hoods, libuv uses a pipe to deliver signals to the main thread, which might be blocking in some situations)
Diffstat (limited to 'test/functional/terminal/window_split_tab_spec.lua')
-rw-r--r--test/functional/terminal/window_split_tab_spec.lua138
1 files changed, 138 insertions, 0 deletions
diff --git a/test/functional/terminal/window_split_tab_spec.lua b/test/functional/terminal/window_split_tab_spec.lua
new file mode 100644
index 0000000000..c102b1f133
--- /dev/null
+++ b/test/functional/terminal/window_split_tab_spec.lua
@@ -0,0 +1,138 @@
+local helpers = require('test.functional.helpers')
+local thelpers = require('test.functional.terminal.helpers')
+local clear, eq, curbuf = helpers.clear, helpers.eq, helpers.curbuf
+local feed, nvim = helpers.feed, helpers.nvim
+local feed_data = thelpers.feed_data
+
+describe('terminal', function()
+ local screen
+
+ before_each(function()
+ clear()
+ -- set the statusline to a constant value because of variables like pid
+ -- and current directory and to improve visibility of splits
+ nvim('set_option', 'statusline', '==========')
+ nvim('command', 'highlight StatusLine cterm=NONE')
+ nvim('command', 'highlight StatusLineNC cterm=NONE')
+ nvim('command', 'highlight VertSplit cterm=NONE')
+ screen = thelpers.screen_setup(3)
+ end)
+
+ after_each(function()
+ screen:detach()
+ end)
+
+ describe('when the screen is resized', function()
+ it('will forward a resize request to the program', function()
+ screen:try_resize(screen._width + 3, screen._height + 5)
+ screen:expect([[
+ tty ready |
+ rows: 14, cols: 53 |
+ {1: } |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ -- TERMINAL -- |
+ ]])
+ screen:try_resize(screen._width - 6, screen._height - 10)
+ screen:expect([[
+ tty ready |
+ rows: 14, cols: 53 |
+ rows: 4, cols: 47 |
+ {1: } |
+ -- TERMINAL -- |
+ ]])
+ end)
+ end)
+
+ describe('split horizontally', function()
+ before_each(function()
+ nvim('command', 'sp')
+ end)
+
+ local function reduce_height()
+ screen:expect([[
+ tty ready |
+ rows: 3, cols: 50 |
+ {1: } |
+ ~ |
+ ========== |
+ tty ready |
+ rows: 3, cols: 50 |
+ {2: } |
+ ========== |
+ -- TERMINAL -- |
+ ]])
+ end
+
+ it('uses the minimum height of all window displaying it', reduce_height)
+
+ describe('and then vertically', function()
+ before_each(function()
+ reduce_height()
+ nvim('command', 'vsp')
+ end)
+
+ local function reduce_width()
+ screen:expect([[
+ rows: 3, cols: 50 |rows: 3, cols: 50 |
+ rows: 3, cols: 24 |rows: 3, cols: 24 |
+ {1: } |{2: } |
+ ~ |~ |
+ ========== ========== |
+ rows: 3, cols: 50 |
+ rows: 3, cols: 24 |
+ {2: } |
+ ========== |
+ -- TERMINAL -- |
+ ]])
+ feed('<c-\\><c-n>gg')
+ screen:expect([[
+ ^tty ready |rows: 3, cols: 50 |
+ rows: 3, cols: 50 |rows: 3, cols: 24 |
+ rows: 3, cols: 24 |{2: } |
+ {2: } |~ |
+ ========== ========== |
+ rows: 3, cols: 50 |
+ rows: 3, cols: 24 |
+ {2: } |
+ ========== |
+ |
+ ]])
+ end
+
+ it('uses the minimum width of all window displaying it', reduce_width)
+
+ describe('and then closes one of the vertical splits with q:', function()
+ before_each(function()
+ reduce_width()
+ nvim('command', 'q')
+ feed('<c-w>ja')
+ end)
+
+ it('will restore the width', function()
+ screen:expect([[
+ rows: 3, cols: 24 |
+ rows: 3, cols: 50 |
+ {2: } |
+ ~ |
+ ========== |
+ rows: 3, cols: 24 |
+ rows: 3, cols: 50 |
+ {1: } |
+ ========== |
+ -- TERMINAL -- |
+ ]])
+ end)
+ end)
+ end)
+ end)
+end)