Mercurial > vim
diff src/testdir/test_gui.vim @ 24998:3b1770226f85 v8.2.3036
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Commit: https://github.com/vim/vim/commit/7237cab8f1d1a4391372cafdb57f2d97f3b32d05
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Tue Jun 22 19:52:27 2021 +0200
patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Problem: Vim9: builtin function arguments not checked at compile time.
Solution: Add more argument type specs. Check arguments to test_setmouse()
and test_gui_mouse_event(). (Yegappan Lakshmanan, closes #8425)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 22 Jun 2021 20:00:05 +0200 |
parents | 4cb423b9250d |
children | 496221916885 |
line wrap: on
line diff
--- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -882,7 +882,7 @@ func Test_gui_mouse_event() new call setline(1, ['one two three', 'four five six']) - " place the cursor using left click + " place the cursor using left click in normal mode call cursor(1, 1) call test_gui_mouse_event(0, 2, 4, 0, 0) call test_gui_mouse_event(3, 2, 4, 0, 0) @@ -1092,9 +1092,70 @@ func Test_gui_mouse_event() set mouse& let &guioptions = save_guioptions + " Test invalid parameters for test_gui_mouse_event() + call assert_fails('call test_gui_mouse_event("", 1, 2, 3, 4)', 'E474:') + call assert_fails('call test_gui_mouse_event(0, "", 2, 3, 4)', 'E474:') + call assert_fails('call test_gui_mouse_event(0, 1, "", 3, 4)', 'E474:') + call assert_fails('call test_gui_mouse_event(0, 1, 2, "", 4)', 'E474:') + call assert_fails('call test_gui_mouse_event(0, 1, 2, 3, "")', 'E474:') + bw! call test_override('no_query_mouse', 0) set mousemodel& endfunc +" Test for 'guitablabel' and 'guitabtooltip' options +func TestGuiTabLabel() + call add(g:TabLabels, v:lnum + 100) + let bufnrlist = tabpagebuflist(v:lnum) + return bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) +endfunc + +func TestGuiTabToolTip() + call add(g:TabToolTips, v:lnum + 200) + let bufnrlist = tabpagebuflist(v:lnum) + return bufname(bufnrlist[tabpagewinnr(v:lnum) - 1]) +endfunc + +func Test_gui_tablabel_tooltip() + %bw! + " Removing the tabline at the end of this test, reduces the window height by + " one. Save and restore it after the test. + let save_lines = &lines + edit one + set modified + tabnew two + set modified + tabnew three + set modified + let g:TabLabels = [] + set guitablabel=%{TestGuiTabLabel()} + call test_override('starting', 1) + redrawtabline + call test_override('starting', 0) + call assert_true(index(g:TabLabels, 101) != -1) + call assert_true(index(g:TabLabels, 102) != -1) + call assert_true(index(g:TabLabels, 103) != -1) + set guitablabel& + unlet g:TabLabels + + if has('gui_gtk') + " Only on GTK+, the tooltip function is called even if the mouse is not + " on the tabline. on Win32 and Motif, the tooltip function is called only + " when the mouse pointer is over the tabline. + let g:TabToolTips = [] + set guitabtooltip=%{TestGuiTabToolTip()} + call test_override('starting', 1) + redrawtabline + call test_override('starting', 0) + call assert_true(index(g:TabToolTips, 201) != -1) + call assert_true(index(g:TabToolTips, 202) != -1) + call assert_true(index(g:TabToolTips, 203) != -1) + set guitabtooltip& + unlet g:TabToolTips + endif + %bw! + let &lines = save_lines +endfunc + " vim: shiftwidth=2 sts=2 expandtab