diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-01-27 13:16:59 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-01-27 13:16:59 +0000 |
commit | b0ad2d92fd19e673ddbbc66742bae3f71778efde (patch) | |
tree | 4029f2cb1c3d7b73cad2a52ede1586876949c774 /src/testdir/test_gui.vim | |
parent | e939f5ebbae8dd7825d62d84e0c9910fa1756a9c (diff) |
patch 8.2.4228: no tests for clicking in the GUI tablinev8.2.4228
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)
Diffstat (limited to 'src/testdir/test_gui.vim')
-rw-r--r-- | src/testdir/test_gui.vim | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 90552843d1..aeacb31aa5 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -1266,4 +1266,57 @@ func Test_gui_drop_files() 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 |