mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
ui: use Window type in win_pos consistently with win_float_pos
Also check invalid positional arguments to screen:expect()
This commit is contained in:
parent
e2ccf47b5e
commit
3397b8c51a
@ -100,7 +100,7 @@ void raw_line(Integer grid, Integer row, Integer startcol,
|
|||||||
void event(char *name, Array args, bool *args_consumed)
|
void event(char *name, Array args, bool *args_consumed)
|
||||||
FUNC_API_NOEXPORT;
|
FUNC_API_NOEXPORT;
|
||||||
|
|
||||||
void win_pos(Integer grid, Integer win, Integer startrow,
|
void win_pos(Integer grid, Window win, Integer startrow,
|
||||||
Integer startcol, Integer width, Integer height)
|
Integer startcol, Integer width, Integer height)
|
||||||
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
FUNC_API_SINCE(6) FUNC_API_REMOTE_ONLY;
|
||||||
void win_float_pos(Integer grid, Window win, String anchor, Integer anchor_grid,
|
void win_float_pos(Integer grid, Window win, String anchor, Integer anchor_grid,
|
||||||
|
@ -76,7 +76,7 @@ describe('ext_multigrid', function()
|
|||||||
|
|
||||||
it('positions windows correctly', function()
|
it('positions windows correctly', function()
|
||||||
command('vsplit')
|
command('vsplit')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[3:--------------------------]{12:│}[2:--------------------------]|
|
[3:--------------------------]{12:│}[2:--------------------------]|
|
||||||
[3:--------------------------]{12:│}[2:--------------------------]|
|
[3:--------------------------]{12:│}[2:--------------------------]|
|
||||||
@ -118,15 +118,15 @@ describe('ext_multigrid', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq({
|
eq({
|
||||||
[2] = { win = 1000, startrow = 0, startcol = 27, width = 26, height = 12 },
|
[2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 },
|
||||||
[3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 }
|
[3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }
|
||||||
}, screen.win_position)
|
}, screen.win_position)
|
||||||
end)
|
end}
|
||||||
command('wincmd l')
|
command('wincmd l')
|
||||||
command('split')
|
command('split')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[3:--------------------------]{12:│}[4:--------------------------]|
|
[3:--------------------------]{12:│}[4:--------------------------]|
|
||||||
[3:--------------------------]{12:│}[4:--------------------------]|
|
[3:--------------------------]{12:│}[4:--------------------------]|
|
||||||
@ -168,16 +168,16 @@ describe('ext_multigrid', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq({
|
eq({
|
||||||
[2] = { win = 1000, startrow = 7, startcol = 27, width = 26, height = 5 },
|
[2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 },
|
||||||
[3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 },
|
[3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 },
|
||||||
[4] = { win = 1002, startrow = 0, startcol = 27, width = 26, height = 6 }
|
[4] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 }
|
||||||
}, screen.win_position)
|
}, screen.win_position)
|
||||||
end)
|
end}
|
||||||
command('wincmd h')
|
command('wincmd h')
|
||||||
command('q')
|
command('q')
|
||||||
screen:expect([[
|
screen:expect{grid=[[
|
||||||
## grid 1
|
## grid 1
|
||||||
[4:-----------------------------------------------------]|
|
[4:-----------------------------------------------------]|
|
||||||
[4:-----------------------------------------------------]|
|
[4:-----------------------------------------------------]|
|
||||||
@ -206,12 +206,12 @@ describe('ext_multigrid', function()
|
|||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
{1:~ }|
|
{1:~ }|
|
||||||
]], nil, nil, function()
|
]], condition=function()
|
||||||
eq({
|
eq({
|
||||||
[2] = { win = 1000, startrow = 7, startcol = 0, width = 53, height = 5 },
|
[2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 },
|
||||||
[4] = { win = 1002, startrow = 0, startcol = 0, width = 53, height = 6 }
|
[4] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 }
|
||||||
}, screen.win_position)
|
}, screen.win_position)
|
||||||
end)
|
end}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('split', function ()
|
describe('split', function ()
|
||||||
|
@ -316,9 +316,10 @@ local ext_keys = {
|
|||||||
-- cmdline_block: Expected ext_cmdline block (for function definitions)
|
-- cmdline_block: Expected ext_cmdline block (for function definitions)
|
||||||
-- wildmenu_items: Expected items for ext_wildmenu
|
-- wildmenu_items: Expected items for ext_wildmenu
|
||||||
-- wildmenu_pos: Expected position for ext_wildmenu
|
-- wildmenu_pos: Expected position for ext_wildmenu
|
||||||
function Screen:expect(expected, attr_ids, attr_ignore)
|
function Screen:expect(expected, attr_ids, attr_ignore, ...)
|
||||||
local grid, condition = nil, nil
|
local grid, condition = nil, nil
|
||||||
local expected_rows = {}
|
local expected_rows = {}
|
||||||
|
assert(next({...}) == nil, "invalid args to expect()")
|
||||||
if type(expected) == "table" then
|
if type(expected) == "table" then
|
||||||
assert(not (attr_ids ~= nil or attr_ignore ~= nil))
|
assert(not (attr_ids ~= nil or attr_ignore ~= nil))
|
||||||
local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true,
|
local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true,
|
||||||
|
Loading…
Reference in New Issue
Block a user