patch 8.2.4228: no tests for clicking in the GUI tabline
Problem: No tests for clicking in the GUI tabline.
Solution: Add test functions to generate the events. Add tests using the
functions. (Yegappan Lakshmanan, closes #9638)
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 57115de..ea217d9 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -1464,4 +1464,50 @@
set diffopt&vim
endfunc
+" Test for using the 'zi' command to invert 'foldenable' in diff windows (test
+" for the issue fixed by patch 6.2.317)
+func Test_diff_foldinvert()
+ %bw!
+ edit Xfile1
+ new Xfile2
+ new Xfile3
+ windo diffthis
+ " open a non-diff window
+ botright new
+ 1wincmd w
+ call assert_true(getwinvar(1, '&foldenable'))
+ call assert_true(getwinvar(2, '&foldenable'))
+ call assert_true(getwinvar(3, '&foldenable'))
+ normal zi
+ call assert_false(getwinvar(1, '&foldenable'))
+ call assert_false(getwinvar(2, '&foldenable'))
+ call assert_false(getwinvar(3, '&foldenable'))
+ normal zi
+ call assert_true(getwinvar(1, '&foldenable'))
+ call assert_true(getwinvar(2, '&foldenable'))
+ call assert_true(getwinvar(3, '&foldenable'))
+
+ " If the current window has 'noscrollbind', then 'zi' should not change
+ " 'foldenable' in other windows.
+ 1wincmd w
+ set noscrollbind
+ normal zi
+ call assert_false(getwinvar(1, '&foldenable'))
+ call assert_true(getwinvar(2, '&foldenable'))
+ call assert_true(getwinvar(3, '&foldenable'))
+
+ " 'zi' should not change the 'foldenable' for windows with 'noscrollbind'
+ 1wincmd w
+ set scrollbind
+ normal zi
+ call setwinvar(2, '&scrollbind', v:false)
+ normal zi
+ call assert_false(getwinvar(1, '&foldenable'))
+ call assert_true(getwinvar(2, '&foldenable'))
+ call assert_false(getwinvar(3, '&foldenable'))
+
+ %bw!
+ set scrollbind&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 9055284..aeacb31 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -1266,4 +1266,57 @@
cunmap <buffer> <F4>
endfunc
+" Test for generating a GUI tabline event to select a tab page
+func Test_gui_tabline_event()
+ %bw!
+ edit Xfile1
+ tabedit Xfile2
+ tabedit Xfile3
+
+ tabfirst
+ call assert_equal(v:true, test_gui_tabline_event(2))
+ call feedkeys("y", "Lx!")
+ call assert_equal(2, tabpagenr())
+ call assert_equal(v:true, test_gui_tabline_event(3))
+ call feedkeys("y", "Lx!")
+ call assert_equal(3, tabpagenr())
+ call assert_equal(v:false, test_gui_tabline_event(3))
+
+ " From the cmdline window, tabline event should not be handled
+ call feedkeys("q::let t = test_gui_tabline_event(2)\<CR>:q\<CR>", 'x!')
+ call assert_equal(v:false, t)
+
+ %bw!
+endfunc
+
+" Test for generating a GUI tabline menu event to execute an action
+func Test_gui_tabmenu_event()
+ %bw!
+
+ " Try to close the last tab page
+ call test_gui_tabmenu_event(1, 1)
+ call feedkeys("y", "Lx!")
+
+ edit Xfile1
+ tabedit Xfile2
+ call test_gui_tabmenu_event(1, 1)
+ call feedkeys("y", "Lx!")
+ call assert_equal(1, tabpagenr('$'))
+ call assert_equal('Xfile2', bufname())
+
+ call test_gui_tabmenu_event(1, 2)
+ call feedkeys("y", "Lx!")
+ call assert_equal(2, tabpagenr('$'))
+
+ " If tabnr is 0, then the current tabpage should be used.
+ call test_gui_tabmenu_event(0, 2)
+ call feedkeys("y", "Lx!")
+ call assert_equal(3, tabpagenr('$'))
+ call test_gui_tabmenu_event(0, 1)
+ call feedkeys("y", "Lx!")
+ call assert_equal(2, tabpagenr('$'))
+
+ %bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 4a09964..9fcc9fd 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -891,6 +891,7 @@
func Test_normal_z_error()
call assert_beeps('normal! z2p')
call assert_beeps('normal! zq')
+ call assert_beeps('normal! cz1')
endfunc
func Test_normal15_z_scroll_vert()
@@ -930,7 +931,7 @@
call assert_equal(10, winheight(0))
exe "norm! z12\<cr>"
call assert_equal(12, winheight(0))
- exe "norm! z10\<cr>"
+ exe "norm! z15\<Del>0\<cr>"
call assert_equal(10, winheight(0))
" Test for z.