diff options
Diffstat (limited to 'test/functional/ui/float_spec.lua')
-rw-r--r-- | test/functional/ui/float_spec.lua | 247 |
1 files changed, 247 insertions, 0 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 6610d25afb..fa4937cec3 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -9909,6 +9909,253 @@ describe('float window', function() ]]) eq({"%f", ""}, res) end) + + it('winborder option', function() + local buf = api.nvim_create_buf(false,false) + local config = {relative='editor', width=4, height=4, row=2, col=2} + command('set winborder=single') + api.nvim_open_win(buf, true, config) + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:----------------------------------------]|*6 + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }|*5 + ## grid 3 + | + ## grid 4 + {5:┌────┐}| + {5:│}{1:^ }{5:│}| + {5:│}{2:~ }{5:│}|*3 + {5:└────┘}| + ]], float_pos={ + [4] = {1001, "NW", 1, 2, 2, true, 50}; + }, win_viewport={ + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [4] = {win = 1001, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }, win_viewport_margins={ + [2] = { + bottom = 0, + left = 0, + right = 0, + top = 0, + win = 1000 + }, + [4] = { + bottom = 1, + left = 1, + right = 1, + top = 1, + win = 1001 + } + } + }) + else + screen:expect({ + grid = [[ + {5:┌────┐} | + {0:~ }{5:│}{1:^ }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }|*3 + {0:~ }{5:└────┘}{0: }| + | + ]] + }) + end + command('fclose') + + command('set winborder=double') + api.nvim_open_win(buf, true, config) + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:----------------------------------------]|*6 + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }|*5 + ## grid 3 + | + ## grid 5 + {5:╔════╗}| + {5:║}{1:^ }{5:║}| + {5:║}{2:~ }{5:║}|*3 + {5:╚════╝}| + ]], float_pos={ + [5] = {1002, "NW", 1, 2, 2, true, 50}; + }, win_viewport={ + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [5] = {win = 1002, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }, win_viewport_margins={ + [2] = { + bottom = 0, + left = 0, + right = 0, + top = 0, + win = 1000 + }, + [5] = { + bottom = 1, + left = 1, + right = 1, + top = 1, + win = 1002 + } + } + }) + else + screen:expect({ + grid = [[ + {5:╔════╗} | + {0:~ }{5:║}{1:^ }{5:║}{0: }| + {0:~ }{5:║}{2:~ }{5:║}{0: }|*3 + {0:~ }{5:╚════╝}{0: }| + | + ]] + }) + end + command('fclose!') + + command('set winborder=none') + api.nvim_buf_set_lines(buf, 0, -1, false, {'none border'}) + api.nvim_open_win(buf, true, config) + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:----------------------------------------]|*6 + [3:----------------------------------------]| + ## grid 2 + | + {0:~ }|*5 + ## grid 3 + | + ## grid 6 + {1:^none}| + {1: bor}| + {1:der }| + {2:~ }| + ]], + win_pos = { + [2] = { + height = 6, + startcol = 0, + startrow = 0, + width = 40, + win = 1000 + } + }, + float_pos = { + [6] = {1003, "NW", 1, 2, 2, true, 50}; + }, + win_viewport = { + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [6] = {win = 1003, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }, + win_viewport_margins = { + [2] = { + bottom = 0, + left = 0, + right = 0, + top = 0, + win = 1000 + }, + [6] = { + bottom = 0, + left = 0, + right = 0, + top = 0, + win = 1003 + } + }, + }) + else + screen:expect([[ + | + {0:~ }| + {0:~ }{1:^none}{0: }| + {0:~ }{1: bor}{0: }| + {0:~ }{1:der }{0: }| + {0:~ }{2:~ }{0: }| + | + ]]) + end + command('fclose!') + + -- respect config.border + command('set winborder=rounded') + config.border = 'single' + api.nvim_open_win(buf, false, config) + if multigrid then + screen:expect({ + grid = [[ + ## grid 1 + [2:----------------------------------------]|*6 + [3:----------------------------------------]| + ## grid 2 + ^ | + {0:~ }|*5 + ## grid 3 + | + ## grid 7 + {5:┌────┐}| + {5:│}{1:none}{5:│}| + {5:│}{1: bor}{5:│}| + {5:│}{1:der }{5:│}| + {5:│}{2:~ }{5:│}| + {5:└────┘}| + ]], + win_pos = { + [2] = { + height = 6, + startcol = 0, + startrow = 0, + width = 40, + win = 1000 + } + }, + float_pos = { + [7] = {1004, "NW", 1, 2, 2, true, 50}; + }, + win_viewport = { + [2] = {win = 1000, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + [7] = {win = 1004, topline = 0, botline = 2, curline = 0, curcol = 0, linecount = 1, sum_scroll_delta = 0}; + }, + win_viewport_margins = { + [2] = { + bottom = 0, + left = 0, + right = 0, + top = 0, + win = 1000 + }, + [7] = { + bottom = 1, + left = 1, + right = 1, + top = 1, + win = 1004 + } + }, + }) + else + screen:expect([[ + ^ {5:┌────┐} | + {0:~ }{5:│}{1:none}{5:│}{0: }| + {0:~ }{5:│}{1: bor}{5:│}{0: }| + {0:~ }{5:│}{1:der }{5:│}{0: }| + {0:~ }{5:│}{2:~ }{5:│}{0: }| + {0:~ }{5:└────┘}{0: }| + | + ]]) + end + + -- it is currently not supported. + eq('Vim(set):E474: Invalid argument: winborder=custom', pcall_err(command, 'set winborder=custom')) + end) end describe('with ext_multigrid', function() |