Skip to content

Commit 66f8311

Browse files
committed
patch 8.1.1263: mouse clicks in WinBar not tested
Problem: Mouse clicks in WinBar not tested. Solution: Add a test for clicking on the WinBar entries.
1 parent bb8476b commit 66f8311

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

src/testdir/test_winbar.vim

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,47 @@ func Test_add_remove_menu()
2121
aunmenu WinBar.Cont
2222
close
2323
endfunc
24+
25+
func Test_click_in_winbar()
26+
new
27+
amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
28+
amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
29+
amenu 1.30 WinBar.Close :close<CR>
30+
redraw
31+
32+
let save_mouse = &mouse
33+
set mouse=a
34+
35+
" Columns of the button edges:
36+
" _Next_ _Cont_ _Close_
37+
" 2 7 10 15 18 24
38+
let g:did_next = 0
39+
let g:did_cont = 0
40+
for col in [1, 8, 9, 16, 17, 25, 26]
41+
call test_setmouse(1, 1)
42+
call feedkeys("\<LeftMouse>", "xt")
43+
call assert_equal(0, g:did_next, 'col ' .. col)
44+
call assert_equal(0, g:did_cont, 'col ' .. col)
45+
endfor
46+
47+
for col in range(2, 7)
48+
let g:did_next = 0
49+
call test_setmouse(1, col)
50+
call feedkeys("\<LeftMouse>", "xt")
51+
call assert_equal(11, g:did_next, 'col ' .. col)
52+
endfor
53+
54+
for col in range(10, 15)
55+
let g:did_cont = 0
56+
call test_setmouse(1, col)
57+
call feedkeys("\<LeftMouse>", "xt")
58+
call assert_equal(12, g:did_cont, 'col ' .. col)
59+
endfor
60+
61+
let wincount = winnr('$')
62+
call test_setmouse(1, 20)
63+
call feedkeys("\<LeftMouse>", "xt")
64+
call assert_equal(wincount - 1, winnr('$'))
65+
66+
let &mouse = save_mouse
67+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ static char *(features[]) =
767767

768768
static int included_patches[] =
769769
{ /* Add new patch number below this line */
770+
/**/
771+
1263,
770772
/**/
771773
1262,
772774
/**/

0 commit comments

Comments
 (0)