0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.1544: some balloon tests don't run when they can

Problem:    Some balloon tests don't run when they can.
Solution:   Split GUI balloon tests off into a separate file. (Ozaki Kiichi,
            closes #4538)  Change the feature check into a command for
            consistency.
This commit is contained in:
Bram Moolenaar 2019-06-15 17:58:09 +02:00
parent b6e3b88ec8
commit b46fecd345
56 changed files with 164 additions and 181 deletions

View File

@ -120,6 +120,7 @@ SRC_ALL = \
src/testdir/sautest/autoload/*.vim \ src/testdir/sautest/autoload/*.vim \
src/testdir/runtest.vim \ src/testdir/runtest.vim \
src/testdir/summarize.vim \ src/testdir/summarize.vim \
src/testdir/check.vim \
src/testdir/shared.vim \ src/testdir/shared.vim \
src/testdir/screendump.vim \ src/testdir/screendump.vim \
src/testdir/view_util.vim \ src/testdir/view_util.vim \

View File

@ -65,6 +65,7 @@ NEW_TESTS = \
test_backspace_opt \ test_backspace_opt \
test_backup \ test_backup \
test_balloon \ test_balloon \
test_balloon_gui \
test_behave \ test_behave \
test_blob \ test_blob \
test_blockedit \ test_blockedit \
@ -297,6 +298,7 @@ NEW_TESTS_RES = \
test_autoload.res \ test_autoload.res \
test_backspace_opt.res \ test_backspace_opt.res \
test_balloon.res \ test_balloon.res \
test_balloon_gui.res \
test_blob.res \ test_blob.res \
test_blockedit.res \ test_blockedit.res \
test_breakindent.res \ test_breakindent.res \

23
src/testdir/check.vim Normal file
View File

@ -0,0 +1,23 @@
" Command to check for the presence of a feature.
command -nargs=1 CheckFeature call CheckFeature(<f-args>)
func CheckFeature(name)
if !has(a:name)
throw 'Skipped: ' .. a:name .. ' feature missing'
endif
endfunc
" Command to check for the presence of a working option.
command -nargs=1 CheckOption call CheckOption(<f-args>)
func CheckOption(name)
if !exists('+' .. a:name)
throw 'Skipped: ' .. a:name .. ' option not supported'
endif
endfunc
" Command to check for the presence of a function.
command -nargs=1 CheckFunction call CheckFunction(<f-args>)
func CheckFunction(name)
if !exists('*' .. a:name)
throw 'Skipped: ' .. a:name .. ' function missing'
endif
endfunc

View File

@ -2,9 +2,8 @@
" NOTE: This just checks if the code works. If you know Arabic please add " NOTE: This just checks if the code works. If you know Arabic please add
" functional tests that check the shaping works with real text. " functional tests that check the shaping works with real text.
if !has('arabic') source check.vim
throw 'Skipped: arabic feature missing' CheckFeature arabic
endif
source view_util.vim source view_util.vim

View File

@ -1,11 +1,12 @@
" Tests for 'balloonevalterm'. " Tests for 'balloonevalterm'.
" A few tests only work in the terminal.
if !has('balloon_eval_term') if has('gui_running')
throw 'Skipped: balloon_eval_term feature missing' throw 'Skipped: only work in the terminal'
endif endif
" A few tests only work in the terminal. source check.vim
if !has('gui_running') CheckFeature balloon_eval_term
source screendump.vim source screendump.vim
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
@ -56,24 +57,3 @@ func Test_balloon_eval_term_visual()
call StopVimInTerminal(buf) call StopVimInTerminal(buf)
call delete('XTest_beval_visual') call delete('XTest_beval_visual')
endfunc endfunc
endif
" Tests that only work in the GUI
if has('gui_running')
func Test_balloon_show_gui()
let msg = 'this this this this'
call balloon_show(msg)
call assert_equal(msg, balloon_gettext())
sleep 10m
call balloon_show('')
let msg = 'that that'
call balloon_show(msg)
call assert_equal(msg, balloon_gettext())
sleep 10m
call balloon_show('')
endfunc
endif

View File

@ -0,0 +1,22 @@
" Tests for 'ballooneval' in the GUI.
if !has('gui_running')
throw 'Skipped: only works in the GUI'
endif
source check.vim
CheckFeature balloon_eval
func Test_balloon_show_gui()
let msg = 'this this this this'
call balloon_show(msg)
call assert_equal(msg, balloon_gettext())
sleep 10m
call balloon_show('')
let msg = 'that that'
call balloon_show(msg)
call assert_equal(msg, balloon_gettext())
sleep 10m
call balloon_show('')
endfunc

View File

@ -1,8 +1,7 @@
" Tests for encryption. " Tests for encryption.
if !has('cryptv') source check.vim
throw 'Skipped, encryption feature missing' CheckFeature cryptv
endif
func Common_head_only(text) func Common_head_only(text)
" This was crashing Vim " This was crashing Vim

View File

@ -1,10 +1,11 @@
" Test for cscope commands. " Test for cscope commands.
if !has('cscope') || !has('quickfix') source check.vim
throw 'Skipped, cscope or quickfix feature missing' CheckFeature cscope
endif CheckFeature quickfix
if !executable('cscope') if !executable('cscope')
throw 'Skipped, cscope program missing' throw 'Skipped: cscope program missing'
endif endif
func CscopeSetupOrClean(setup) func CscopeSetupOrClean(setup)

View File

@ -1,8 +1,7 @@
" Tests for digraphs " Tests for digraphs
if !has("digraphs") source check.vim
throw 'Skipped, digraphs feature missing' CheckFeature digraphs
endif
func Put_Dig(chars) func Put_Dig(chars)
exe "norm! o\<c-k>".a:chars exe "norm! o\<c-k>".a:chars

View File

@ -1,8 +1,7 @@
" test float functions " test float functions
if !has('float') source check.vim
throw 'Skipped, float feature missing' CheckFeature float
end
func Test_abs() func Test_abs()
call assert_equal('1.23', string(abs(1.23))) call assert_equal('1.23', string(abs(1.23)))

View File

@ -2,7 +2,7 @@
source shared.vim source shared.vim
if !CanRunGui() if !CanRunGui()
throw 'Skipped, cannot run GUI' throw 'Skipped: cannot run GUI'
endif endif
source setup_gui.vim source setup_gui.vim

View File

@ -3,7 +3,7 @@
source shared.vim source shared.vim
if !CanRunGui() if !CanRunGui()
throw 'Skipped, cannot run GUI' throw 'Skipped: cannot run GUI'
endif endif
source setup_gui.vim source setup_gui.vim

View File

@ -1,8 +1,7 @@
" Tests for the history functions " Tests for the history functions
if !has('cmdline_hist') source check.vim
throw 'Skipped, cmdline_hist feature missing' CheckFeature cmdline_hist
endif
set history=7 set history=7

View File

@ -1,8 +1,7 @@
" tests for 'langmap' " tests for 'langmap'
if !has('langmap') source check.vim
throw 'Skipped, langmap feature missing' CheckFeature langmap
endif
func Test_langmap() func Test_langmap()
new new

View File

@ -3,12 +3,9 @@
set encoding=latin1 set encoding=latin1
scriptencoding latin1 scriptencoding latin1
if !exists("+linebreak") source check.vim
throw 'Skipped, linebreak option missing' CheckOption linebreak
endif CheckFeature conceal
if !has("conceal")
throw 'Skipped, conceal feature missing'
endif
source view_util.vim source view_util.vim

View File

@ -3,15 +3,10 @@
set encoding=utf-8 set encoding=utf-8
scriptencoding utf-8 scriptencoding utf-8
if !exists("+linebreak") source check.vim
throw 'Skipped, linebreak option missing' CheckOption linebreak
endif CheckFeature conceal
if !has("conceal") CheckFeature signs
throw 'Skipped, conceal feature missing'
endif
if !has("signs")
throw 'Skipped, signs feature missing'
endif
source view_util.vim source view_util.vim

View File

@ -1,8 +1,7 @@
" Tests for Lua. " Tests for Lua.
if !has('lua') source check.vim
throw 'Skipped, lua feature missing' CheckFeature lua
endif
func TearDown() func TearDown()
" Run garbage collection after each test to exercise luaV_setref(). " Run garbage collection after each test to exercise luaV_setref().

View File

@ -4,7 +4,7 @@ source shared.vim
let s:python = PythonProg() let s:python = PythonProg()
if s:python == '' if s:python == ''
throw 'Skipped, python program missing' throw 'Skipped: python program missing'
endif endif
let s:script = 'test_makeencoding.py' let s:script = 'test_makeencoding.py'

View File

@ -1,8 +1,7 @@
" Test for matchadd() and conceal feature " Test for matchadd() and conceal feature
if !has('conceal') source check.vim
throw 'Skipped, conceal feature missing' CheckFeature conceal
endif
if !has('gui_running') && has('unix') if !has('gui_running') && has('unix')
set term=ansi set term=ansi

View File

@ -1,8 +1,7 @@
" Test for matchadd() and conceal feature using utf-8. " Test for matchadd() and conceal feature using utf-8.
if !has('conceal') source check.vim
throw 'Skipped, conceal feature missing' CheckFeature conceal
endif
if !has('gui_running') && has('unix') if !has('gui_running') && has('unix')
set term=ansi set term=ansi

View File

@ -1,15 +1,15 @@
" Tests for memory usage. " Tests for memory usage.
if !has('terminal') source check.vim
throw 'Skipped, terminal feature missing' CheckFeature terminal
endif
if has('gui_running') if has('gui_running')
throw 'Skipped, does not work in GUI' throw 'Skipped: does not work in GUI'
endif endif
if execute('version') =~# '-fsanitize=[a-z,]*\<address\>' if execute('version') =~# '-fsanitize=[a-z,]*\<address\>'
" Skip tests on Travis CI ASAN build because it's difficult to estimate " Skip tests on Travis CI ASAN build because it's difficult to estimate
" memory usage. " memory usage.
throw 'Skipped, does not work with ASAN' throw 'Skipped: does not work with ASAN'
endif endif
source shared.vim source shared.vim
@ -20,7 +20,7 @@ endfunc
if has('win32') if has('win32')
if !executable('wmic') if !executable('wmic')
throw 'Skipped, wmic program missing' throw 'Skipped: wmic program missing'
endif endif
func s:memory_usage(pid) abort func s:memory_usage(pid) abort
let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid) let cmd = printf('wmic process where processid=%d get WorkingSetSize', a:pid)
@ -28,13 +28,13 @@ if has('win32')
endfunc endfunc
elseif has('unix') elseif has('unix')
if !executable('ps') if !executable('ps')
throw 'Skipped, ps program missing' throw 'Skipped: ps program missing'
endif endif
func s:memory_usage(pid) abort func s:memory_usage(pid) abort
return s:pick_nr(system('ps -o rss= -p ' . a:pid)) return s:pick_nr(system('ps -o rss= -p ' . a:pid))
endfunc endfunc
else else
throw 'Skipped, not win32 or unix' throw 'Skipped: not win32 or unix'
endif endif
" Wait for memory usage to level off. " Wait for memory usage to level off.

View File

@ -1,8 +1,7 @@
" Test that the system menu can be loaded. " Test that the system menu can be loaded.
if !has('menu') source check.vim
throw 'Skipped, menu feature missing' CheckFeature menu
endif
func Test_load_menu() func Test_load_menu()
try try

View File

@ -3,9 +3,8 @@
set encoding=latin1 set encoding=latin1
scriptencoding latin1 scriptencoding latin1
if !has('mksession') source check.vim
throw 'Skipped, mksession feature missing' CheckFeature mksession
endif
source shared.vim source shared.vim

View File

@ -3,9 +3,8 @@
set encoding=utf-8 set encoding=utf-8
scriptencoding utf-8 scriptencoding utf-8
if !has('mksession') source check.vim
throw 'Skipped, mksession feature missing' CheckFeature mksession
endif
func Test_mksession_utf8() func Test_mksession_utf8()
tabnew tabnew

View File

@ -1,14 +1,13 @@
" Test the netbeans interface. " Test the netbeans interface.
if !has('netbeans_intg') source check.vim
throw 'Skipped, netbeans_intg feature missing' CheckFeature netbeans_intg
endif
source shared.vim source shared.vim
let s:python = PythonProg() let s:python = PythonProg()
if s:python == '' if s:python == ''
throw 'Skipped, python program missing' throw 'Skipped: python program missing'
endif endif
" Run "testfunc" after sarting the server and stop the server afterwards. " Run "testfunc" after sarting the server and stop the server afterwards.

View File

@ -2,10 +2,10 @@
" Bracketed paste only works with "xterm". Not in GUI or Windows console. " Bracketed paste only works with "xterm". Not in GUI or Windows console.
if has('win32') if has('win32')
throw 'Skipped, does not work on MS-Windows' throw 'Skipped: does not work on MS-Windows'
endif endif
if has('gui_running') if has('gui_running')
throw 'Skipped, does not work in the GUI' throw 'Skipped: does not work in the GUI'
endif endif
set term=xterm set term=xterm

View File

@ -1,8 +1,7 @@
" Tests for Perl interface " Tests for Perl interface
if !has('perl') source check.vim
throw 'Skipped, perl feature missing' CheckFeature perl
end
" FIXME: RunTest don't see any error when Perl abort... " FIXME: RunTest don't see any error when Perl abort...
perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" }; perl $SIG{__WARN__} = sub { die "Unexpected warnings from perl: @_" };

View File

@ -1,8 +1,7 @@
" Tests for popup windows " Tests for popup windows
if !has('textprop') source check.vim
throw 'Skipped: textprop feature missing' CheckFeature textprop
endif
source screendump.vim source screendump.vim
@ -515,7 +514,7 @@ endfunc
func Test_popup_time() func Test_popup_time()
if !has('timers') if !has('timers')
throw 'Skipped, timer feature not supported' throw 'Skipped: timer feature not supported'
endif endif
topleft vnew topleft vnew
call setline(1, 'hello') call setline(1, 'hello')
@ -1176,7 +1175,7 @@ endfunc
func Test_notifications() func Test_notifications()
if !has('timers') if !has('timers')
throw 'Skipped, timer feature not supported' throw 'Skipped: timer feature not supported'
endif endif
if !CanRunVimInTerminal() if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps' throw 'Skipped: cannot make screendumps'

View File

@ -1,8 +1,7 @@
" Test Vim profiler " Test Vim profiler
if !has('profile') source check.vim
throw 'Skipped, profile feature missing' CheckFeature profile
endif
func Test_profile_func() func Test_profile_func()
let lines =<< trim [CODE] let lines =<< trim [CODE]

View File

@ -1,8 +1,7 @@
" Tests for setting 'buftype' to "prompt" " Tests for setting 'buftype' to "prompt"
if !has('channel') source check.vim
throw 'Skipped, channel feature missing' CheckFeature channel
endif
source shared.vim source shared.vim
source screendump.vim source screendump.vim

View File

@ -1,9 +1,8 @@
" Test for python 2 commands. " Test for python 2 commands.
" TODO: move tests from test87.in here. " TODO: move tests from test87.in here.
if !has('python') source check.vim
throw 'Skipped, python feature missing' CheckFeature python
endif
func Test_pydo() func Test_pydo()
" Check deleting lines does not trigger ml_get error. " Check deleting lines does not trigger ml_get error.

View File

@ -1,9 +1,8 @@
" Test for python 3 commands. " Test for python 3 commands.
" TODO: move tests from test88.in here. " TODO: move tests from test88.in here.
if !has('python3') source check.vim
throw 'Skipped, python3 feature missing' CheckFeature python3
endif
func Test_py3do() func Test_py3do()
" Check deleting lines does not trigger an ml_get error. " Check deleting lines does not trigger an ml_get error.

View File

@ -1,9 +1,8 @@
" Test for pyx* commands and functions with Python 2. " Test for pyx* commands and functions with Python 2.
set pyx=2 set pyx=2
if !has('python') source check.vim
throw 'Skipped, python feature missing' CheckFeature python
endif
let s:py2pattern = '^2\.[0-7]\.\d\+' let s:py2pattern = '^2\.[0-7]\.\d\+'
let s:py3pattern = '^3\.\d\+\.\d\+' let s:py3pattern = '^3\.\d\+\.\d\+'

View File

@ -1,9 +1,8 @@
" Test for pyx* commands and functions with Python 3. " Test for pyx* commands and functions with Python 3.
set pyx=3 set pyx=3
if !has('python3') source check.vim
throw 'Skipped, python3 feature missing' CheckFeature python3
endif
let s:py2pattern = '^2\.[0-7]\.\d\+' let s:py2pattern = '^2\.[0-7]\.\d\+'
let s:py3pattern = '^3\.\d\+\.\d\+' let s:py3pattern = '^3\.\d\+\.\d\+'

View File

@ -1,8 +1,7 @@
" Test for the quickfix feature. " Test for the quickfix feature.
if !has('quickfix') source check.vim
throw 'Skipped, quickfix feature missing' CheckFeature quickfix
endif
set encoding=utf-8 set encoding=utf-8

View File

@ -2,7 +2,7 @@
source shared.vim source shared.vim
if !WorkingClipboard() if !WorkingClipboard()
throw 'Skipped, no working clipboard' throw 'Skipped: no working clipboard'
endif endif
source shared.vim source shared.vim

View File

@ -1,11 +1,8 @@
" Tests for reltime() " Tests for reltime()
if !has('reltime') source check.vim
throw 'Skipped, reltime feature missing' CheckFeature reltime
endif CheckFeature float
if !has('float')
throw 'Skipped, float feature missing'
endif
func Test_reltime() func Test_reltime()
let now = reltime() let now = reltime()

View File

@ -1,8 +1,7 @@
" Tests for ruby interface " Tests for ruby interface
if !has('ruby') source check.vim
throw 'Skipped, ruby feature missing' CheckFeature ruby
end
func Test_ruby_change_buffer() func Test_ruby_change_buffer()
call setline(line('$'), ['1 line 1']) call setline(line('$'), ['1 line 1'])

View File

@ -1,11 +1,8 @@
" Tests for the sha256() function. " Tests for the sha256() function.
if !has('cryptv') source check.vim
throw 'Skipped, cryptv feature missing' CheckFeature cryptv
endif CheckFunction sha256
if !exists('*sha256')
throw 'Skipped, sha256 function missing'
endif
function Test_sha256() function Test_sha256()
" test for empty string: " test for empty string:

View File

@ -2,7 +2,7 @@
" Only for use on Win32 systems! " Only for use on Win32 systems!
if !has('win32') if !has('win32')
throw 'Skipped, not on MS-Windows' throw 'Skipped: not on MS-Windows'
endif endif
func TestIt(file, bits, expected) func TestIt(file, bits, expected)

View File

@ -1,7 +1,7 @@
" Test signal handling. " Test signal handling.
if !has('unix') if !has('unix')
throw 'Skipped, not on Unix' throw 'Skipped: not on Unix'
endif endif
source shared.vim source shared.vim

View File

@ -1,8 +1,7 @@
" Test for signs " Test for signs
if !has('signs') source check.vim
throw 'Skipped, signs feature missing' CheckFeature signs
endif
func Test_sign() func Test_sign()
new new

View File

@ -1,8 +1,7 @@
" Test spell checking " Test spell checking
if !has('spell') source check.vim
throw 'Skipped, spell feature missing' CheckFeature spell
endif
func TearDown() func TearDown()
set nospell set nospell

View File

@ -1,8 +1,7 @@
" Test for syntax and syntax iskeyword option " Test for syntax and syntax iskeyword option
if !has("syntax") source check.vim
throw 'Skipped, syntax feature missing' CheckFeature syntax
endif
source view_util.vim source view_util.vim
source screendump.vim source screendump.vim

View File

@ -1,8 +1,7 @@
" Tests for the Tcl interface. " Tests for the Tcl interface.
if !has('tcl') source check.vim
throw 'Skipped, tcl feature missing' CheckFeature tcl
end
" Helper function as there is no builtin tcleval() function similar " Helper function as there is no builtin tcleval() function similar
" to perleval, luaevel(), pyeval(), etc. " to perleval, luaevel(), pyeval(), etc.

View File

@ -2,10 +2,10 @@
" This only works for Unix in a terminal " This only works for Unix in a terminal
if has('gui_running') if has('gui_running')
throw 'Skipped, does not work in the GUI' throw 'Skipped: does not work in the GUI'
endif endif
if !has('unix') if !has('unix')
throw 'Skipped, not on Unix' throw 'Skipped: not on Unix'
endif endif
source shared.vim source shared.vim

View File

@ -1,8 +1,7 @@
" Tests for the terminal window. " Tests for the terminal window.
if !has('terminal') source check.vim
throw 'Skipped, terminal feature missing' CheckFeature terminal
endif
source shared.vim source shared.vim
source screendump.vim source screendump.vim

View File

@ -2,9 +2,8 @@
" leaks under valgrind. That is because when fork/exec fails memory is not " leaks under valgrind. That is because when fork/exec fails memory is not
" freed. Since the process exists right away it's not a real leak. " freed. Since the process exists right away it's not a real leak.
if !has('terminal') source check.vim
throw 'Skipped, terminal feature missing' CheckFeature terminal
endif
source shared.vim source shared.vim

View File

@ -1,8 +1,7 @@
" Test for textobjects " Test for textobjects
if !has('textobjects') source check.vim
throw 'Skipped, textobjects feature missing' CheckFeature textobjects
endif
func CpoM(line, useM, expected) func CpoM(line, useM, expected)
new new

View File

@ -1,9 +1,8 @@
" Tests for defining text property types and adding text properties to the " Tests for defining text property types and adding text properties to the
" buffer. " buffer.
if !has('textprop') source check.vim
throw 'Skipped, textprop feature missing' CheckFeature textprop
endif
source screendump.vim source screendump.vim

View File

@ -1,8 +1,7 @@
" Test for timers " Test for timers
if !has('timers') source check.vim
throw 'Skipped, timers feature missing' CheckFeature timers
endif
source shared.vim source shared.vim
source screendump.vim source screendump.vim

View File

@ -1,8 +1,7 @@
" Test for variable tabstops " Test for variable tabstops
if !has("vartabs") source check.vim
throw 'Skipped, vartabs feature missing' CheckFeature vartabs
endif
source view_util.vim source view_util.vim

View File

@ -1,8 +1,7 @@
" Test WinBar " Test WinBar
if !has('menu') source check.vim
throw 'Skipped, menu feature missing' CheckFeature menu
endif
source shared.vim source shared.vim

View File

@ -1,7 +1,7 @@
" Test for $HOME on Windows. " Test for $HOME on Windows.
if !has('win32') if !has('win32')
throw 'Skipped, not on MS-Windows' throw 'Skipped: not on MS-Windows'
endif endif
let s:env = {} let s:env = {}

View File

@ -2,7 +2,7 @@
if empty($XXD) && executable('..\xxd\xxd.exe') if empty($XXD) && executable('..\xxd\xxd.exe')
let s:xxd_cmd = '..\xxd\xxd.exe' let s:xxd_cmd = '..\xxd\xxd.exe'
elseif empty($XXD) || !executable($XXD) elseif empty($XXD) || !executable($XXD)
throw 'Skipped, xxd program missing' throw 'Skipped: xxd program missing'
else else
let s:xxd_cmd = $XXD let s:xxd_cmd = $XXD
endif endif

View File

@ -777,6 +777,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1544,
/**/ /**/
1543, 1543,
/**/ /**/