forked from aniani/vim
patch 8.1.1272: click on WinBar of other window not tested
Problem: Click on WinBar of other window not tested. Solution: Add a test case.
This commit is contained in:
@@ -27,20 +27,24 @@ func Test_add_remove_menu()
|
|||||||
close
|
close
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_click_in_winbar()
|
" Create a WinBar with three buttons.
|
||||||
new
|
" Columns of the button edges:
|
||||||
|
" _Next_ _Cont_ _Close_
|
||||||
|
" 2 7 10 15 18 24
|
||||||
|
func SetupWinbar()
|
||||||
amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
|
amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
|
||||||
amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
|
amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
|
||||||
amenu 1.30 WinBar.Close :close<CR>
|
amenu 1.30 WinBar.Close :close<CR>
|
||||||
redraw
|
redraw
|
||||||
call assert_match('Next Cont Close', Screenline(1))
|
call assert_match('Next Cont Close', Screenline(1))
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_click_in_winbar()
|
||||||
|
new
|
||||||
|
call SetupWinbar()
|
||||||
let save_mouse = &mouse
|
let save_mouse = &mouse
|
||||||
set mouse=a
|
set mouse=a
|
||||||
|
|
||||||
" Columns of the button edges:
|
|
||||||
" _Next_ _Cont_ _Close_
|
|
||||||
" 2 7 10 15 18 24
|
|
||||||
let g:did_next = 0
|
let g:did_next = 0
|
||||||
let g:did_cont = 0
|
let g:did_cont = 0
|
||||||
for col in [1, 8, 9, 16, 17, 25, 26]
|
for col in [1, 8, 9, 16, 17, 25, 26]
|
||||||
@@ -71,3 +75,38 @@ func Test_click_in_winbar()
|
|||||||
|
|
||||||
let &mouse = save_mouse
|
let &mouse = save_mouse
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_click_in_other_winbar()
|
||||||
|
new
|
||||||
|
call SetupWinbar()
|
||||||
|
let save_mouse = &mouse
|
||||||
|
set mouse=a
|
||||||
|
let winid = win_getid()
|
||||||
|
|
||||||
|
split
|
||||||
|
let [row, col] = win_screenpos(winid)
|
||||||
|
|
||||||
|
" Click on Next button in other window
|
||||||
|
let g:did_next = 0
|
||||||
|
call test_setmouse(row, 5)
|
||||||
|
call feedkeys("\<LeftMouse>", "xt")
|
||||||
|
call assert_equal(11, g:did_next)
|
||||||
|
|
||||||
|
" Click on Cont button in other window from Visual mode
|
||||||
|
let g:did_cont = 0
|
||||||
|
call setline(1, 'select XYZ here')
|
||||||
|
call test_setmouse(row, 12)
|
||||||
|
call feedkeys("0fXvfZ\<LeftMouse>x", "xt")
|
||||||
|
call assert_equal(12, g:did_cont)
|
||||||
|
call assert_equal('select here', getline(1))
|
||||||
|
|
||||||
|
" Click on Close button in other window
|
||||||
|
let wincount = winnr('$')
|
||||||
|
let winid = win_getid()
|
||||||
|
call test_setmouse(row, 20)
|
||||||
|
call feedkeys("\<LeftMouse>", "xt")
|
||||||
|
call assert_equal(wincount - 1, winnr('$'))
|
||||||
|
call assert_equal(winid, win_getid())
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
endfunc
|
||||||
|
@@ -767,6 +767,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1272,
|
||||||
/**/
|
/**/
|
||||||
1271,
|
1271,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user