]> granicus.if.org Git - vim/commitdiff
patch 8.1.1263: mouse clicks in WinBar not tested v8.1.1263
authorBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 14:06:12 +0000 (16:06 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 4 May 2019 14:06:12 +0000 (16:06 +0200)
Problem:    Mouse clicks in WinBar not tested.
Solution:   Add a test for clicking on the WinBar entries.

src/testdir/test_winbar.vim
src/version.c

index 19616073c09cba588a07a9a2f7555c693eff6dbe..fd44ac9bbbf9b271d06ba21ebe02e1b0bc86a0df 100644 (file)
@@ -21,3 +21,47 @@ func Test_add_remove_menu()
   aunmenu WinBar.Cont
   close
 endfunc
+
+func Test_click_in_winbar()
+  new
+  amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
+  amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
+  amenu 1.30 WinBar.Close :close<CR>
+  redraw
+
+  let save_mouse = &mouse
+  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_cont = 0
+  for col in [1, 8, 9, 16, 17, 25, 26]
+    call test_setmouse(1, 1)
+    call feedkeys("\<LeftMouse>", "xt")
+    call assert_equal(0, g:did_next, 'col ' .. col)
+    call assert_equal(0, g:did_cont, 'col ' .. col)
+  endfor
+
+  for col in range(2, 7)
+    let g:did_next = 0
+    call test_setmouse(1, col)
+    call feedkeys("\<LeftMouse>", "xt")
+    call assert_equal(11, g:did_next, 'col ' .. col)
+  endfor
+
+  for col in range(10, 15)
+    let g:did_cont = 0
+    call test_setmouse(1, col)
+    call feedkeys("\<LeftMouse>", "xt")
+    call assert_equal(12, g:did_cont, 'col ' .. col)
+  endfor
+
+  let wincount = winnr('$')
+  call test_setmouse(1, 20)
+  call feedkeys("\<LeftMouse>", "xt")
+  call assert_equal(wincount - 1, winnr('$'))
+
+  let &mouse = save_mouse
+endfunc
index 07f3962fb30dab29584bf4b9a569a35e67d98df4..f5faef3135d9247d453de9292654f07a0cde4540 100644 (file)
@@ -767,6 +767,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1263,
 /**/
     1262,
 /**/