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