mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.1900: sign test fails in the GUI
Problem: Sign test fails in the GUI. Solution: Catch and ignore the exception.
This commit is contained in:
@@ -14,14 +14,8 @@ func Test_sign()
|
|||||||
" icon is ignored when not supported. "(not supported)" is shown after
|
" icon is ignored when not supported. "(not supported)" is shown after
|
||||||
" the icon name when listing signs.
|
" the icon name when listing signs.
|
||||||
sign define Sign1 text=x
|
sign define Sign1 text=x
|
||||||
try
|
|
||||||
sign define Sign2 text=xy texthl=Title linehl=Error
|
call Sign_command_ignore_error('sign define Sign2 text=xy texthl=Title linehl=Error icon=../../pixmaps/stock_vim_find_help.png')
|
||||||
\ icon=../../pixmaps/stock_vim_find_help.png
|
|
||||||
catch /E255:/
|
|
||||||
" Ignore error: E255: Couldn't read in sign data!
|
|
||||||
" This error can happen when running in the GUI.
|
|
||||||
" Some gui like Motif do not support the png icon format.
|
|
||||||
endtry
|
|
||||||
|
|
||||||
" Test listing signs.
|
" Test listing signs.
|
||||||
let a=execute('sign list')
|
let a=execute('sign list')
|
||||||
@@ -103,12 +97,7 @@ func Test_sign()
|
|||||||
edit foo
|
edit foo
|
||||||
call setline(1, ['A', 'B', 'C', 'D'])
|
call setline(1, ['A', 'B', 'C', 'D'])
|
||||||
|
|
||||||
try
|
call Sign_command_ignore_error('sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist icon=doesnotexist.xpm')
|
||||||
sign define Sign3 text=y texthl=DoesNotExist linehl=DoesNotExist
|
|
||||||
\ icon=doesnotexist.xpm
|
|
||||||
catch /E255:/
|
|
||||||
" ignore error: E255: it can happens for guis.
|
|
||||||
endtry
|
|
||||||
|
|
||||||
let fn = expand('%:p')
|
let fn = expand('%:p')
|
||||||
exe 'sign place 43 line=2 name=Sign3 file=' . fn
|
exe 'sign place 43 line=2 name=Sign3 file=' . fn
|
||||||
@@ -377,6 +366,25 @@ func Test_sign_delete_buffer()
|
|||||||
sign undefine Sign
|
sign undefine Sign
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Ignore error: E255: Couldn't read in sign data!
|
||||||
|
" This error can happen when running in the GUI.
|
||||||
|
" Some gui like Motif do not support the png icon format.
|
||||||
|
func Sign_command_ignore_error(cmd)
|
||||||
|
try
|
||||||
|
exe a:cmd
|
||||||
|
catch /E255:/
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
" ignore error: E255: Couldn't read in sign data!
|
||||||
|
" This error can happen when running in gui.
|
||||||
|
func Sign_define_ignore_error(name, attr)
|
||||||
|
try
|
||||||
|
call sign_define(a:name, a:attr)
|
||||||
|
catch /E255:/
|
||||||
|
endtry
|
||||||
|
endfunc
|
||||||
|
|
||||||
" Test for Vim script functions for managing signs
|
" Test for Vim script functions for managing signs
|
||||||
func Test_sign_funcs()
|
func Test_sign_funcs()
|
||||||
" Remove all the signs
|
" Remove all the signs
|
||||||
@@ -393,12 +401,7 @@ func Test_sign_funcs()
|
|||||||
call sign_define("sign2")
|
call sign_define("sign2")
|
||||||
let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange',
|
let attr = {'text' : '!!', 'linehl' : 'DiffAdd', 'texthl' : 'DiffChange',
|
||||||
\ 'icon' : 'sign2.ico'}
|
\ 'icon' : 'sign2.ico'}
|
||||||
try
|
call Sign_define_ignore_error("sign2", attr)
|
||||||
call sign_define("sign2", attr)
|
|
||||||
catch /E255:/
|
|
||||||
" ignore error: E255: Couldn't read in sign data!
|
|
||||||
" This error can happen when running in gui.
|
|
||||||
endtry
|
|
||||||
call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange',
|
call assert_equal([{'name' : 'sign2', 'texthl' : 'DiffChange',
|
||||||
\ 'linehl' : 'DiffAdd', 'text' : '!!', 'icon' : 'sign2.ico'}],
|
\ 'linehl' : 'DiffAdd', 'text' : '!!', 'icon' : 'sign2.ico'}],
|
||||||
\ sign_getdefined("sign2"))
|
\ sign_getdefined("sign2"))
|
||||||
@@ -518,7 +521,7 @@ func Test_sign_funcs()
|
|||||||
call assert_fails('call sign_undefine({})', 'E731:')
|
call assert_fails('call sign_undefine({})', 'E731:')
|
||||||
|
|
||||||
" Test for using '.' as the line number for sign_place()
|
" Test for using '.' as the line number for sign_place()
|
||||||
call sign_define("sign1", attr)
|
call Sign_define_ignore_error("sign1", attr)
|
||||||
call cursor(22, 1)
|
call cursor(22, 1)
|
||||||
call assert_equal(15, sign_place(15, '', 'sign1', 'Xsign',
|
call assert_equal(15, sign_place(15, '', 'sign1', 'Xsign',
|
||||||
\ {'lnum' : '.'}))
|
\ {'lnum' : '.'}))
|
||||||
|
@@ -765,6 +765,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 */
|
||||||
|
/**/
|
||||||
|
1900,
|
||||||
/**/
|
/**/
|
||||||
1899,
|
1899,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user