1
0
forked from aniani/vim

patch 8.1.1837: popup test fails if clipboard is supported but not working

Problem:    Popup test fails if clipboard is supported but not working.
Solution:   Add the "clipboard_working" feature. Also use Check commands
            instead of "if" and "throw".  And remove stray ch_logfile().
This commit is contained in:
Bram Moolenaar
2019-08-10 22:21:48 +02:00
parent a9ab391a3a
commit 4999a7fb65
4 changed files with 53 additions and 92 deletions

View File

@@ -9603,6 +9603,7 @@ byte_offset Compiled with support for 'o' in 'statusline'
cindent Compiled with 'cindent' support. cindent Compiled with 'cindent' support.
clientserver Compiled with remote invocation support |clientserver|. clientserver Compiled with remote invocation support |clientserver|.
clipboard Compiled with 'clipboard' support. clipboard Compiled with 'clipboard' support.
clipboard_working Compiled with 'clipboard' support and it can be used.
cmdline_compl Compiled with |cmdline-completion| support. cmdline_compl Compiled with |cmdline-completion| support.
cmdline_hist Compiled with |cmdline-history| support. cmdline_hist Compiled with |cmdline-history| support.
cmdline_info Compiled with 'showcmd' and 'ruler' support. cmdline_info Compiled with 'showcmd' and 'ruler' support.

View File

@@ -6628,6 +6628,10 @@ f_has(typval_T *argvars, typval_T *rettv)
#if defined(FEAT_TERMINAL) && defined(MSWIN) #if defined(FEAT_TERMINAL) && defined(MSWIN)
else if (STRICMP(name, "conpty") == 0) else if (STRICMP(name, "conpty") == 0)
n = use_conpty(); n = use_conpty();
#endif
#ifdef FEAT_CLIPBOARD
else if (STRICMP(name, "clipboard_working") == 0)
n = clip_star.available;
#endif #endif
} }

View File

@@ -6,9 +6,8 @@ CheckFeature textprop
source screendump.vim source screendump.vim
func Test_simple_popup() func Test_simple_popup()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 100)) call setline(1, range(1, 100))
hi PopupColor1 ctermbg=lightblue hi PopupColor1 ctermbg=lightblue
@@ -77,9 +76,7 @@ func Test_simple_popup()
endfunc endfunc
func Test_popup_with_border_and_padding() func Test_popup_with_border_and_padding()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
for iter in range(0, 1) for iter in range(0, 1)
let lines =<< trim END let lines =<< trim END
@@ -191,9 +188,8 @@ func Test_popup_with_border_and_padding()
endfunc endfunc
func Test_popup_with_syntax_win_execute() func Test_popup_with_syntax_win_execute()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 100)) call setline(1, range(1, 100))
hi PopupColor ctermbg=lightblue hi PopupColor ctermbg=lightblue
@@ -216,9 +212,8 @@ func Test_popup_with_syntax_win_execute()
endfunc endfunc
func Test_popup_with_syntax_setbufvar() func Test_popup_with_syntax_setbufvar()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 100)) call setline(1, range(1, 100))
hi PopupColor ctermbg=lightgrey hi PopupColor ctermbg=lightgrey
@@ -241,9 +236,8 @@ func Test_popup_with_syntax_setbufvar()
endfunc endfunc
func Test_popup_with_matches() func Test_popup_with_matches()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, ['111 222 333', '444 555 666']) call setline(1, ['111 222 333', '444 555 666'])
let winid = popup_create([ let winid = popup_create([
@@ -267,9 +261,8 @@ func Test_popup_with_matches()
endfunc endfunc
func Test_popup_all_corners() func Test_popup_all_corners()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, repeat([repeat('-', 60)], 15)) call setline(1, repeat([repeat('-', 60)], 15))
set so=0 set so=0
@@ -316,9 +309,8 @@ func Test_popup_all_corners()
endfunc endfunc
func Test_popup_firstline() func Test_popup_firstline()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
call popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], #{ call popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], #{
@@ -346,9 +338,8 @@ func Test_popup_firstline()
endfunc endfunc
func Test_popup_drag() func Test_popup_drag()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
" create a popup that covers the command line " create a popup that covers the command line
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -385,9 +376,8 @@ func Test_popup_drag()
endfunc endfunc
func Test_popup_close_with_mouse() func Test_popup_close_with_mouse()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
" With border, can click on X " With border, can click on X
@@ -442,9 +432,8 @@ func Test_popup_close_with_mouse()
endfunction endfunction
func Test_popup_with_mask() func Test_popup_with_mask()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, repeat([join(range(1, 42), '')], 13)) call setline(1, repeat([join(range(1, 42), '')], 13))
hi PopupColor ctermbg=lightgrey hi PopupColor ctermbg=lightgrey
@@ -510,12 +499,9 @@ func Test_popup_with_mask()
endfunc endfunc
func Test_popup_select() func Test_popup_select()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps' CheckFeature clipboard_working
endif
if !has('clipboard')
throw 'Skipped: clipboard feature missing'
endif
" create a popup with some text to be selected " create a popup with some text to be selected
let lines =<< trim END let lines =<< trim END
set clipboard=autoselect set clipboard=autoselect
@@ -690,9 +676,8 @@ func Test_win_execute_not_allowed()
endfunc endfunc
func Test_popup_with_wrap() func Test_popup_with_wrap()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 100)) call setline(1, range(1, 100))
let winid = popup_create( let winid = popup_create(
@@ -709,9 +694,8 @@ func Test_popup_with_wrap()
endfunc endfunc
func Test_popup_without_wrap() func Test_popup_without_wrap()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 100)) call setline(1, range(1, 100))
let winid = popup_create( let winid = popup_create(
@@ -728,9 +712,8 @@ func Test_popup_without_wrap()
endfunc endfunc
func Test_popup_with_showbreak() func Test_popup_with_showbreak()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
set showbreak=>>\ set showbreak=>>\
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -749,9 +732,8 @@ func Test_popup_with_showbreak()
endfunc endfunc
func Test_popup_time() func Test_popup_time()
if !has('timers') CheckFeature timers
throw 'Skipped: timer feature not supported'
endif
topleft vnew topleft vnew
call setline(1, 'hello') call setline(1, 'hello')
@@ -1070,9 +1052,7 @@ func Test_popup_atcursor()
endfunc endfunc
func Test_popup_beval() func Test_popup_beval()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -1223,9 +1203,7 @@ func Test_popup_menu()
endfunc endfunc
func Test_popup_menu_screenshot() func Test_popup_menu_screenshot()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -1251,9 +1229,7 @@ func Test_popup_menu_screenshot()
endfunc endfunc
func Test_popup_menu_narrow() func Test_popup_menu_narrow()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -1274,9 +1250,7 @@ func Test_popup_menu_narrow()
endfunc endfunc
func Test_popup_title() func Test_popup_title()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
" Create a popup without title or border, a line of padding will be added to " Create a popup without title or border, a line of padding will be added to
" put the title on. " put the title on.
@@ -1333,9 +1307,8 @@ func Test_popup_empty()
endfunc endfunc
func Test_popup_never_behind() func Test_popup_never_behind()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
" +-----------------------------+ " +-----------------------------+
" | | | " | | |
" | | | " | | |
@@ -1616,12 +1589,8 @@ func Test_popup_moved()
endfunc endfunc
func Test_notifications() func Test_notifications()
if !has('timers') CheckFeature timers
throw 'Skipped: timer feature not supported' CheckScreendump
endif
if !CanRunVimInTerminal()
throw 'Skipped: cannot make screendumps'
endif
call writefile([ call writefile([
\ "call setline(1, range(1, 20))", \ "call setline(1, range(1, 20))",
@@ -1642,9 +1611,7 @@ func Test_notifications()
endfunc endfunc
func Test_popup_scrollbar() func Test_popup_scrollbar()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -1727,9 +1694,7 @@ func Test_popup_fitting_scrollbar()
endfunc endfunc
func Test_popup_settext() func Test_popup_settext()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
let opts = #{wrap: 0} let opts = #{wrap: 0}
@@ -1901,9 +1866,7 @@ func Test_popupwin_buf_close()
endfunc endfunc
func Test_popup_menu_with_maxwidth() func Test_popup_menu_with_maxwidth()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 10)) call setline(1, range(1, 10))
@@ -1942,9 +1905,7 @@ func Test_popup_menu_with_maxwidth()
endfunc endfunc
func Test_popup_menu_with_scrollbar() func Test_popup_menu_with_scrollbar()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
call setline(1, range(1, 20)) call setline(1, range(1, 20))
@@ -1988,9 +1949,7 @@ func Test_popup_menu_with_scrollbar()
endfunc endfunc
func Test_popup_menu_filter() func Test_popup_menu_filter()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let lines =<< trim END let lines =<< trim END
function! MyFilter(winid, key) abort function! MyFilter(winid, key) abort
@@ -2044,9 +2003,7 @@ func Test_popup_menu_filter()
endfunc endfunc
func Test_popup_cursorline() func Test_popup_cursorline()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
let winid = popup_create('some text', {}) let winid = popup_create('some text', {})
call assert_equal(0, popup_getoptions(winid).cursorline) call assert_equal(0, popup_getoptions(winid).cursorline)
@@ -2160,9 +2117,8 @@ func Test_popup_cursorline()
endfunc endfunc
func Test_previewpopup() func Test_previewpopup()
if !CanRunVimInTerminal() CheckScreendump
throw 'Skipped: cannot make screendumps'
endif
call writefile([ call writefile([
\ "!_TAG_FILE_ENCODING\tutf-8\t//", \ "!_TAG_FILE_ENCODING\tutf-8\t//",
\ "another\tXtagfile\t/^this is another", \ "another\tXtagfile\t/^this is another",
@@ -2194,8 +2150,6 @@ func Test_previewpopup()
\ 'very long line where the word is also another']) \ 'very long line where the word is also another'])
set previewpopup=height:4,width:40 set previewpopup=height:4,width:40
set path=. set path=.
call ch_logfile('logfile', 'w')
call ch_log('logfile started')
END END
call writefile(lines, 'XtestPreviewPopup') call writefile(lines, 'XtestPreviewPopup')
let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14}) let buf = RunVimInTerminal('-S XtestPreviewPopup', #{rows: 14})

View File

@@ -769,6 +769,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 */
/**/
1837,
/**/ /**/
1836, 1836,
/**/ /**/