mirror of
https://github.com/neovim/neovim.git
synced 2026-02-20 01:09:56 +10:00
vim-patch:8.2.4052: not easy to resize a window from a plugin (#17028)
This commit is contained in:
@@ -939,4 +939,104 @@ func Test_window_resize()
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_win_move_separator()
|
||||
edit a
|
||||
leftabove vsplit b
|
||||
let w = winwidth(0)
|
||||
" check win_move_separator from left window on left window
|
||||
call assert_equal(1, winnr())
|
||||
for offset in range(5)
|
||||
call assert_true(win_move_separator(0, offset))
|
||||
call assert_equal(w + offset, winwidth(0))
|
||||
call assert_true(0->win_move_separator(-offset))
|
||||
call assert_equal(w, winwidth(0))
|
||||
endfor
|
||||
" check win_move_separator from right window on left window number
|
||||
wincmd l
|
||||
call assert_notequal(1, winnr())
|
||||
for offset in range(5)
|
||||
call assert_true(1->win_move_separator(offset))
|
||||
call assert_equal(w + offset, winwidth(1))
|
||||
call assert_true(win_move_separator(1, -offset))
|
||||
call assert_equal(w, winwidth(1))
|
||||
endfor
|
||||
" check win_move_separator from right window on left window ID
|
||||
let id = win_getid(1)
|
||||
for offset in range(5)
|
||||
call assert_true(win_move_separator(id, offset))
|
||||
call assert_equal(w + offset, winwidth(id))
|
||||
call assert_true(id->win_move_separator(-offset))
|
||||
call assert_equal(w, winwidth(id))
|
||||
endfor
|
||||
" check that win_move_separator doesn't error with offsets beyond moving
|
||||
" possibility
|
||||
call assert_true(win_move_separator(id, 5000))
|
||||
call assert_true(winwidth(id) > w)
|
||||
call assert_true(win_move_separator(id, -5000))
|
||||
call assert_true(winwidth(id) < w)
|
||||
" check that win_move_separator returns false for an invalid window
|
||||
wincmd =
|
||||
let w = winwidth(0)
|
||||
call assert_false(win_move_separator(-1, 1))
|
||||
call assert_equal(w, winwidth(0))
|
||||
" check that win_move_separator returns false for a floating window
|
||||
let id = nvim_open_win(
|
||||
\ 0, 0, #{relative: 'editor', row: 2, col: 2, width: 5, height: 3})
|
||||
let w = winwidth(id)
|
||||
call assert_false(win_move_separator(id, 1))
|
||||
call assert_equal(w, winwidth(id))
|
||||
call nvim_win_close(id, 1)
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_win_move_statusline()
|
||||
edit a
|
||||
leftabove split b
|
||||
let h = winheight(0)
|
||||
" check win_move_statusline from top window on top window
|
||||
call assert_equal(1, winnr())
|
||||
for offset in range(5)
|
||||
call assert_true(win_move_statusline(0, offset))
|
||||
call assert_equal(h + offset, winheight(0))
|
||||
call assert_true(0->win_move_statusline(-offset))
|
||||
call assert_equal(h, winheight(0))
|
||||
endfor
|
||||
" check win_move_statusline from bottom window on top window number
|
||||
wincmd j
|
||||
call assert_notequal(1, winnr())
|
||||
for offset in range(5)
|
||||
call assert_true(1->win_move_statusline(offset))
|
||||
call assert_equal(h + offset, winheight(1))
|
||||
call assert_true(win_move_statusline(1, -offset))
|
||||
call assert_equal(h, winheight(1))
|
||||
endfor
|
||||
" check win_move_statusline from bottom window on top window ID
|
||||
let id = win_getid(1)
|
||||
for offset in range(5)
|
||||
call assert_true(win_move_statusline(id, offset))
|
||||
call assert_equal(h + offset, winheight(id))
|
||||
call assert_true(id->win_move_statusline(-offset))
|
||||
call assert_equal(h, winheight(id))
|
||||
endfor
|
||||
" check that win_move_statusline doesn't error with offsets beyond moving
|
||||
" possibility
|
||||
call assert_true(win_move_statusline(id, 5000))
|
||||
call assert_true(winheight(id) > h)
|
||||
call assert_true(win_move_statusline(id, -5000))
|
||||
call assert_true(winheight(id) < h)
|
||||
" check that win_move_statusline returns false for an invalid window
|
||||
wincmd =
|
||||
let h = winheight(0)
|
||||
call assert_false(win_move_statusline(-1, 1))
|
||||
call assert_equal(h, winheight(0))
|
||||
" check that win_move_statusline returns false for a floating window
|
||||
let id = nvim_open_win(
|
||||
\ 0, 0, #{relative: 'editor', row: 2, col: 2, width: 5, height: 3})
|
||||
let h = winheight(id)
|
||||
call assert_false(win_move_statusline(id, 1))
|
||||
call assert_equal(h, winheight(id))
|
||||
call nvim_win_close(id, 1)
|
||||
%bwipe!
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user