mirror of
https://github.com/zoriya/vim.git
synced 2025-12-21 06:35:17 +00:00
patch 8.2.3526: tests have clumsy check for X11 based GUI
Problem: Tests have clumsy check for X11 based GUI. Solution: Add CheckX11BasedGui.
This commit is contained in:
@@ -217,6 +217,14 @@ func CheckNotAsan()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Command to check for X11 based GUI
|
||||||
|
command CheckX11BasedGui call CheckX11BasedGui()
|
||||||
|
func CheckX11BasedGui()
|
||||||
|
if !g:x11_based_gui
|
||||||
|
throw 'Skipped: requires X11 based GUI'
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Command to check for satisfying any of the conditions.
|
" Command to check for satisfying any of the conditions.
|
||||||
" e.g. CheckAnyOf Feature:bsd Feature:sun Linux
|
" e.g. CheckAnyOf Feature:bsd Feature:sun Linux
|
||||||
command -nargs=+ CheckAnyOf call CheckAnyOf(<f-args>)
|
command -nargs=+ CheckAnyOf call CheckAnyOf(<f-args>)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ let g:x11_based_gui = has('gui_athena') || has('gui_motif')
|
|||||||
|
|
||||||
" Reasons for 'skipped'.
|
" Reasons for 'skipped'.
|
||||||
let g:not_supported = "Skipped: Feature/Option not supported by this GUI: "
|
let g:not_supported = "Skipped: Feature/Option not supported by this GUI: "
|
||||||
let g:not_implemented = "Skipped: Test not implemented yet for this GUI"
|
|
||||||
let g:not_hosted = "Skipped: Test not hosted by the system/environment"
|
let g:not_hosted = "Skipped: Test not hosted by the system/environment"
|
||||||
|
|
||||||
" For KDE set a font, empty 'guifont' may cause a hang.
|
" For KDE set a font, empty 'guifont' may cause a hang.
|
||||||
|
|||||||
@@ -61,11 +61,9 @@ func Test_colorscheme()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getfontname_with_arg()
|
func Test_getfontname_with_arg()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
if !g:x11_based_gui
|
if has('gui_athena') || has('gui_motif')
|
||||||
let skipped = g:not_implemented
|
|
||||||
elseif has('gui_athena') || has('gui_motif')
|
|
||||||
" Invalid font name. The result should be an empty string.
|
" Invalid font name. The result should be an empty string.
|
||||||
call assert_equal('', getfontname('notexist'))
|
call assert_equal('', getfontname('notexist'))
|
||||||
|
|
||||||
@@ -82,20 +80,14 @@ func Test_getfontname_with_arg()
|
|||||||
let fname = 'Bitstream Vera Sans Mono 12'
|
let fname = 'Bitstream Vera Sans Mono 12'
|
||||||
call assert_equal(fname, getfontname(fname))
|
call assert_equal(fname, getfontname(fname))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getfontname_without_arg()
|
func Test_getfontname_without_arg()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
let fname = getfontname()
|
let fname = getfontname()
|
||||||
|
|
||||||
if !g:x11_based_gui
|
if has('gui_kde')
|
||||||
let skipped = g:not_implemented
|
|
||||||
elseif has('gui_kde')
|
|
||||||
" 'expected' is the value specified by SetUp() above.
|
" 'expected' is the value specified by SetUp() above.
|
||||||
call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
|
call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
|
||||||
elseif has('gui_athena') || has('gui_motif')
|
elseif has('gui_athena') || has('gui_motif')
|
||||||
@@ -106,10 +98,6 @@ func Test_getfontname_without_arg()
|
|||||||
" 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
|
" 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
|
||||||
call assert_equal('Monospace 10', fname)
|
call assert_equal('Monospace 10', fname)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_getwinpos()
|
func Test_getwinpos()
|
||||||
@@ -120,48 +108,41 @@ func Test_getwinpos()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_quoteplus()
|
func Test_quoteplus()
|
||||||
|
CheckX11BasedGui
|
||||||
|
|
||||||
let g:test_is_flaky = 1
|
let g:test_is_flaky = 1
|
||||||
let skipped = ''
|
|
||||||
|
|
||||||
if !g:x11_based_gui
|
let quoteplus_saved = @+
|
||||||
let skipped = g:not_supported . 'quoteplus'
|
|
||||||
else
|
|
||||||
let quoteplus_saved = @+
|
|
||||||
|
|
||||||
let test_call = 'Can you hear me?'
|
let test_call = 'Can you hear me?'
|
||||||
let test_response = 'Yes, I can.'
|
let test_response = 'Yes, I can.'
|
||||||
let vim_exe = GetVimCommand()
|
let vim_exe = GetVimCommand()
|
||||||
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
|
let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
|
||||||
\ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
|
\ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
|
||||||
" Ignore the "failed to create input context" error.
|
" Ignore the "failed to create input context" error.
|
||||||
let cmd = 'call test_ignore_error("E285") | '
|
let cmd = 'call test_ignore_error("E285") | '
|
||||||
\ . 'gui -f | '
|
\ . 'gui -f | '
|
||||||
\ . 'call feedkeys("'
|
\ . 'call feedkeys("'
|
||||||
\ . '\"+p'
|
\ . '\"+p'
|
||||||
\ . ':s/' . test_call . '/' . test_response . '/\<CR>'
|
\ . ':s/' . test_call . '/' . test_response . '/\<CR>'
|
||||||
\ . '\"+yis'
|
\ . '\"+yis'
|
||||||
\ . ':q!\<CR>", "tx")'
|
\ . ':q!\<CR>", "tx")'
|
||||||
let run_vimtest = printf(testee, cmd)
|
let run_vimtest = printf(testee, cmd)
|
||||||
|
|
||||||
" Set the quoteplus register to test_call, and another gvim will launched.
|
" Set the quoteplus register to test_call, and another gvim will launched.
|
||||||
" Then, it first tries to paste the content of its own quotedplus register
|
" Then, it first tries to paste the content of its own quotedplus register
|
||||||
" onto it. Second, it tries to substitute test_response for the pasted
|
" onto it. Second, it tries to substitute test_response for the pasted
|
||||||
" sentence. If the sentence is identical to test_call, the substitution
|
" sentence. If the sentence is identical to test_call, the substitution
|
||||||
" should succeed. Third, it tries to yank the result of the substitution
|
" should succeed. Third, it tries to yank the result of the substitution
|
||||||
" to its own quoteplus register, and last it quits. When system()
|
" to its own quoteplus register, and last it quits. When system()
|
||||||
" returns, the content of the quoteplus register should be identical to
|
" returns, the content of the quoteplus register should be identical to
|
||||||
" test_response if those quoteplus registers are synchronized properly
|
" test_response if those quoteplus registers are synchronized properly
|
||||||
" with/through the X11 clipboard.
|
" with/through the X11 clipboard.
|
||||||
let @+ = test_call
|
let @+ = test_call
|
||||||
call system(run_vimtest)
|
call system(run_vimtest)
|
||||||
call assert_equal(test_response, @+)
|
call assert_equal(test_response, @+)
|
||||||
|
|
||||||
let @+ = quoteplus_saved
|
let @+ = quoteplus_saved
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_background()
|
func Test_set_background()
|
||||||
@@ -333,8 +314,29 @@ func Test_set_guicursor()
|
|||||||
let &guicursor = guicursor_saved
|
let &guicursor = guicursor_saved
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_set_guifont_errors()
|
||||||
|
if has('win32')
|
||||||
|
" Invalid font names are accepted in GTK GUI
|
||||||
|
call assert_fails('set guifont=xa1bc23d7f', 'E596:')
|
||||||
|
endif
|
||||||
|
|
||||||
|
" This only works if 'renderoptions' exists and does not work for Windows XP
|
||||||
|
" and older.
|
||||||
|
if exists('+renderoptions') && windowsversion() !~ '^[345]\.'
|
||||||
|
" doing this four times used to cause a crash
|
||||||
|
set renderoptions=type:directx
|
||||||
|
for i in range(5)
|
||||||
|
set guifont=
|
||||||
|
endfor
|
||||||
|
set renderoptions=
|
||||||
|
for i in range(5)
|
||||||
|
set guifont=
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_set_guifont()
|
func Test_set_guifont()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
let guifont_saved = &guifont
|
let guifont_saved = &guifont
|
||||||
if has('xfontset')
|
if has('xfontset')
|
||||||
@@ -343,9 +345,7 @@ func Test_set_guifont()
|
|||||||
set guifontset=
|
set guifontset=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !g:x11_based_gui
|
if has('gui_athena') || has('gui_motif')
|
||||||
let skipped = g:not_implemented
|
|
||||||
elseif has('gui_athena') || has('gui_motif')
|
|
||||||
" Non-empty font list with invalid font names.
|
" Non-empty font list with invalid font names.
|
||||||
"
|
"
|
||||||
" This test is twofold: (1) It checks if the command fails as expected
|
" This test is twofold: (1) It checks if the command fails as expected
|
||||||
@@ -384,33 +384,10 @@ func Test_set_guifont()
|
|||||||
call assert_equal('Monospace 10', getfontname())
|
call assert_equal('Monospace 10', getfontname())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if has('win32')
|
|
||||||
" Invalid font names are accepted in GTK GUI
|
|
||||||
call assert_fails('set guifont=xa1bc23d7f', 'E596:')
|
|
||||||
endif
|
|
||||||
|
|
||||||
" This only works if 'renderoptions' exists and does not work for Windows XP
|
|
||||||
" and older.
|
|
||||||
if exists('+renderoptions') && windowsversion() !~ '^[345]\.'
|
|
||||||
" doing this four times used to cause a crash
|
|
||||||
set renderoptions=type:directx
|
|
||||||
for i in range(5)
|
|
||||||
set guifont=
|
|
||||||
endfor
|
|
||||||
set renderoptions=
|
|
||||||
for i in range(5)
|
|
||||||
set guifont=
|
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has('xfontset')
|
if has('xfontset')
|
||||||
let &guifontset = guifontset_saved
|
let &guifontset = guifontset_saved
|
||||||
endif
|
endif
|
||||||
let &guifont = guifont_saved
|
let &guifont = guifont_saved
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guifontset()
|
func Test_set_guifontset()
|
||||||
@@ -485,12 +462,11 @@ func Test_set_guifontset()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guifontwide()
|
func Test_set_guifontwide()
|
||||||
call assert_fails('set guifontwide=*', 'E533:')
|
CheckX11BasedGui
|
||||||
let skipped = ''
|
|
||||||
|
|
||||||
if !g:x11_based_gui
|
call assert_fails('set guifontwide=*', 'E533:')
|
||||||
let skipped = g:not_implemented
|
|
||||||
elseif has('gui_gtk')
|
if has('gui_gtk')
|
||||||
let guifont_saved = &guifont
|
let guifont_saved = &guifont
|
||||||
let guifontwide_saved = &guifontwide
|
let guifontwide_saved = &guifontwide
|
||||||
|
|
||||||
@@ -561,51 +537,31 @@ func Test_set_guifontwide()
|
|||||||
let &encoding = encoding_saved
|
let &encoding = encoding_saved
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guiligatures()
|
func Test_set_guiligatures()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
if !g:x11_based_gui
|
if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
||||||
let skipped = g:not_supported . 'guiligatures'
|
" Try correct value
|
||||||
else
|
set guiligatures=<>=ab
|
||||||
if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
|
call assert_equal("<>=ab", &guiligatures)
|
||||||
" Try correct value
|
" Try to throw error
|
||||||
set guiligatures=<>=ab
|
try
|
||||||
call assert_equal("<>=ab", &guiligatures)
|
set guiligatures=<>=šab
|
||||||
" Try to throw error
|
call assert_report("'set guiligatures=<>=šab should have failed")
|
||||||
try
|
catch
|
||||||
set guiligatures=<>=šab
|
call assert_exception('E1243:')
|
||||||
call assert_report("'set guiligatures=<>=šab should have failed")
|
endtry
|
||||||
catch
|
|
||||||
call assert_exception('E1243:')
|
|
||||||
endtry
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
endif
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guiheadroom()
|
func Test_set_guiheadroom()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
if !g:x11_based_gui
|
" Since this script is to be read together with '-U NONE', the default
|
||||||
let skipped = g:not_supported . 'guiheadroom'
|
" value must be preserved.
|
||||||
else
|
call assert_equal(50, &guiheadroom)
|
||||||
" Since this script is to be read together with '-U NONE', the default
|
|
||||||
" value must be preserved.
|
|
||||||
call assert_equal(50, &guiheadroom)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guioptions()
|
func Test_set_guioptions()
|
||||||
|
|||||||
@@ -22,19 +22,11 @@ call test_ignore_error('E285:')
|
|||||||
gui -f
|
gui -f
|
||||||
|
|
||||||
func Test_set_guiheadroom()
|
func Test_set_guiheadroom()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
if !g:x11_based_gui
|
" The 'expected' value must be consistent with the value specified with
|
||||||
let skipped = g:not_supported . 'guiheadroom'
|
" gui_init.vim.
|
||||||
else
|
call assert_equal(0, &guiheadroom)
|
||||||
" The 'expected' value must be consistent with the value specified with
|
|
||||||
" gui_init.vim.
|
|
||||||
call assert_equal(0, &guiheadroom)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guioptions_for_M()
|
func Test_set_guioptions_for_M()
|
||||||
@@ -44,19 +36,11 @@ func Test_set_guioptions_for_M()
|
|||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Test_set_guioptions_for_p()
|
func Test_set_guioptions_for_p()
|
||||||
let skipped = ''
|
CheckX11BasedGui
|
||||||
|
|
||||||
if !g:x11_based_gui
|
sleep 200ms
|
||||||
let skipped = g:not_supported . '''p'' of guioptions'
|
" Check if the 'p' option is included.
|
||||||
else
|
call assert_match('.*p.*', &guioptions)
|
||||||
sleep 200ms
|
|
||||||
" Check if the 'p' option is included.
|
|
||||||
call assert_match('.*p.*', &guioptions)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(skipped)
|
|
||||||
throw skipped
|
|
||||||
endif
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
|||||||
@@ -757,6 +757,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 */
|
||||||
|
/**/
|
||||||
|
3526,
|
||||||
/**/
|
/**/
|
||||||
3525,
|
3525,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user