" Tests specifically for the GUI
source shared.vim
source check.vim
CheckCanRunGui
source setup_gui.vim
func Setup()
call GUISetUpCommon()
endfunc
func TearDown()
call GUITearDownCommon()
endfunc
" Test for resetting "secure" flag after GUI has started.
" Must be run first, since it starts the GUI on Unix.
func Test_1_set_secure()
set exrc secure
gui -f
call assert_equal(1, has('gui_running'))
endfunc
" As for non-GUI, a balloon_show() test was already added with patch 8.0.0401
func Test_balloon_show()
CheckFeature balloon_eval
" This won't do anything but must not crash either.
call balloon_show('hi!')
endfunc
func Test_colorscheme()
call assert_equal('16777216', &t_Co)
let colorscheme_saved = exists('g:colors_name') ? g:colors_name : 'default'
let g:color_count = 0
augroup TestColors
au!
au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count
au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count
augroup END
colorscheme torte
redraw!
call assert_equal('dark', &background)
call assert_equal(1, g:before_colors)
call assert_equal(2, g:after_colors)
call assert_equal("\ntorte", execute('colorscheme'))
let a = substitute(execute('hi Search'), "\n\\s\\+", ' ', 'g')
call assert_match("\nSearch xxx term=reverse ctermfg=0 ctermbg=12 gui=bold guifg=Black guibg=Red", a)
call assert_fails('colorscheme does_not_exist', 'E185:')
exec 'colorscheme' colorscheme_saved
augroup TestColors
au!
augroup END
unlet g:color_count g:after_colors g:before_colors
redraw!
endfunc
func Test_getfontname_with_arg()
CheckX11BasedGui
if has('gui_athena') || has('gui_motif')
" Invalid font name. The result should be an empty string.
call assert_equal('', getfontname('notexist'))
" Valid font name. This is usually the real name of 7x13 by defaul