comparison src/testdir/test_winbar.vim @ 16537:d9f659007109 v8.1.1272

patch 8.1.1272: click on WinBar of other window not tested commit https://github.com/vim/vim/commit/711f02da6559a3557a9d626d5923c6ea17bd1477 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 5 13:14:28 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 05 May 2019 13:15:08 +0200
parents 1bf49cd87e6b
children 6a99709c6ae3
comparison
equal deleted inserted replaced
16536:49cd31fd7dd0 16537:d9f659007109
25 aunmenu WinBar.Next 25 aunmenu WinBar.Next
26 aunmenu WinBar.Cont 26 aunmenu WinBar.Cont
27 close 27 close
28 endfunc 28 endfunc
29 29
30 func Test_click_in_winbar() 30 " Create a WinBar with three buttons.
31 new 31 " Columns of the button edges:
32 " _Next_ _Cont_ _Close_
33 " 2 7 10 15 18 24
34 func SetupWinbar()
32 amenu 1.10 WinBar.Next :let g:did_next = 11<CR> 35 amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
33 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR> 36 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
34 amenu 1.30 WinBar.Close :close<CR> 37 amenu 1.30 WinBar.Close :close<CR>
35 redraw 38 redraw
36 call assert_match('Next Cont Close', Screenline(1)) 39 call assert_match('Next Cont Close', Screenline(1))
40 endfunc
37 41
42 func Test_click_in_winbar()
43 new
44 call SetupWinbar()
38 let save_mouse = &mouse 45 let save_mouse = &mouse
39 set mouse=a 46 set mouse=a
40 47
41 " Columns of the button edges:
42 " _Next_ _Cont_ _Close_
43 " 2 7 10 15 18 24
44 let g:did_next = 0 48 let g:did_next = 0
45 let g:did_cont = 0 49 let g:did_cont = 0
46 for col in [1, 8, 9, 16, 17, 25, 26] 50 for col in [1, 8, 9, 16, 17, 25, 26]
47 call test_setmouse(1, col) 51 call test_setmouse(1, col)
48 call feedkeys("\<LeftMouse>", "xt") 52 call feedkeys("\<LeftMouse>", "xt")
69 call feedkeys("\<LeftMouse>", "xt") 73 call feedkeys("\<LeftMouse>", "xt")
70 call assert_equal(wincount - 1, winnr('$')) 74 call assert_equal(wincount - 1, winnr('$'))
71 75
72 let &mouse = save_mouse 76 let &mouse = save_mouse
73 endfunc 77 endfunc
78
79 func Test_click_in_other_winbar()
80 new
81 call SetupWinbar()
82 let save_mouse = &mouse
83 set mouse=a
84 let winid = win_getid()
85
86 split
87 let [row, col] = win_screenpos(winid)
88
89 " Click on Next button in other window
90 let g:did_next = 0
91 call test_setmouse(row, 5)
92 call feedkeys("\<LeftMouse>", "xt")
93 call assert_equal(11, g:did_next)
94
95 " Click on Cont button in other window from Visual mode
96 let g:did_cont = 0
97 call setline(1, 'select XYZ here')
98 call test_setmouse(row, 12)
99 call feedkeys("0fXvfZ\<LeftMouse>x", "xt")
100 call assert_equal(12, g:did_cont)
101 call assert_equal('select here', getline(1))
102
103 " Click on Close button in other window
104 let wincount = winnr('$')
105 let winid = win_getid()
106 call test_setmouse(row, 20)
107 call feedkeys("\<LeftMouse>", "xt")
108 call assert_equal(wincount - 1, winnr('$'))
109 call assert_equal(winid, win_getid())
110
111 bwipe!
112 endfunc