diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/terminal/helpers.lua | 6 | ||||
-rw-r--r-- | test/functional/terminal/window_spec.lua | 98 |
2 files changed, 101 insertions, 3 deletions
diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua index 7de0152de0..18f0b9e4c1 100644 --- a/test/functional/terminal/helpers.lua +++ b/test/functional/terminal/helpers.lua @@ -33,7 +33,7 @@ local function disable_mouse() feed_termcode('[?1002l') end local default_command = '["'..nvim_dir..'/tty-test'..'"]' -local function screen_setup(extra_rows, command, cols) +local function screen_setup(extra_rows, command, cols, opts) extra_rows = extra_rows and extra_rows or 0 command = command and command or default_command cols = cols and cols or 50 @@ -55,7 +55,7 @@ local function screen_setup(extra_rows, command, cols) [10] = {foreground = 121}, -- "Press ENTER" in embedded :terminal session. }) - screen:attach({rgb=false}) + screen:attach(opts or {rgb=false}) feed_command('enew | call termopen('..command..')') nvim('input', '<CR>') @@ -69,7 +69,7 @@ local function screen_setup(extra_rows, command, cols) -- tty-test puts the terminal into raw mode and echoes input. Tests work by -- feeding termcodes to control the display and asserting by screen:expect. - if command == default_command then + if command == default_command and opts == nil then -- Wait for "tty ready" to be printed before each test or the terminal may -- still be in canonical mode (will echo characters for example). local empty_line = (' '):rep(cols) diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index 842a81872e..242377f9bd 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -124,3 +124,101 @@ describe('terminal window', function() end) end) +describe('terminal window with multigrid', function() + local screen + + before_each(function() + clear() + screen = thelpers.screen_setup(0,nil,50,{ext_multigrid=true}) + end) + + it('resizes to requested size', function() + screen:expect([[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + {3:-- TERMINAL --} | + ## grid 2 + tty ready | + {1: } | + | + | + | + | + ]]) + + screen:try_resize_grid(2, 20, 10) + if iswin() then + screen:expect{any="rows: 10, cols: 20"} + else + screen:expect([[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + {3:-- TERMINAL --} | + ## grid 2 + tty ready | + rows: 10, cols: 20 | + {1: } | + | + | + | + | + | + | + | + ]]) + end + + screen:try_resize_grid(2, 70, 3) + if iswin() then + screen:expect{any="rows: 3, cols: 70"} + else + screen:expect([[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + {3:-- TERMINAL --} | + ## grid 2 + rows: 10, cols: 20 | + rows: 3, cols: 70 | + {1: } | + ]]) + end + + screen:try_resize_grid(2, 0, 0) + if iswin() then + screen:expect{any="rows: 6, cols: 50"} + else + screen:expect([[ + ## grid 1 + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + [2:--------------------------------------------------]| + {3:-- TERMINAL --} | + ## grid 2 + tty ready | + rows: 10, cols: 20 | + rows: 3, cols: 70 | + rows: 6, cols: 50 | + {1: } | + | + ]]) + end + end) +end) |