summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-13 16:34:15 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-13 16:34:15 +0200
commitef6b979bfae82f64781d8b0ce0194c57111243d4 (patch)
treeb7f9acb63a9f7ca7fa4881d511ccb7b58ba24053 /src/testdir
parent03a9f848175b182372fb33403998059724a8bf31 (diff)
patch 8.2.0748: cannot get a list of all popupsv8.2.0748
Problem: Cannot get a list of all popups. Solution: Add popup_list(). Use it in the test runner.
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/runtest.vim3
-rw-r--r--src/testdir/test_popupwin.vim13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index b9d85f4bb1..b1e05288b1 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -188,8 +188,9 @@ func RunTheTest(test)
au!
au SwapExists * call HandleSwapExists()
- " Close any stray popup windows.
+ " Check for and close any stray popup windows.
if has('popupwin')
+ call assert_equal([], popup_list())
call popup_clear(1)
endif
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index 5eecb193c1..a664346df5 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -428,7 +428,7 @@ func Test_popup_nospace()
call delete('XtestPopupNospace')
endfunc
-func Test_popup_firstline()
+func Test_popup_firstline_dump()
CheckScreendump
let lines =<< trim END
@@ -449,7 +449,9 @@ func Test_popup_firstline()
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupFirstline')
+endfunc
+func Test_popup_firstline()
let winid = popup_create(['1111', '222222', '33333', '44444'], #{
\ maxheight: 2,
\ firstline: 3,
@@ -491,6 +493,7 @@ func Test_popup_firstline()
call popup_setoptions(winid, #{line: 3})
call assert_equal(0, popup_getoptions(winid).firstline)
call assert_equal(10, popup_getpos(winid).firstline)
+ call popup_close(winid)
" CTRL-D scrolls down half a page
let winid = popup_create(['xxx']->repeat(50), #{
@@ -826,10 +829,13 @@ func Test_popup_in_tab()
endfunc
func Test_popup_valid_arguments()
+ call assert_equal(0, len(popup_list()))
+
" Zero value is like the property wasn't there
let winid = popup_create("text", #{col: 0})
let pos = popup_getpos(winid)
call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col)
+ call assert_equal([winid], popup_list())
call popup_clear()
" using cursor column has minimum value of 1
@@ -1619,12 +1625,14 @@ func Test_popup_empty()
let pos = popup_getpos(winid)
call assert_equal(5, pos.width)
call assert_equal(5, pos.height)
+ call popup_close(winid)
let winid = popup_create([], #{border: []})
redraw
let pos = popup_getpos(winid)
call assert_equal(3, pos.width)
call assert_equal(3, pos.height)
+ call popup_close(winid)
endfunc
func Test_popup_never_behind()
@@ -3323,8 +3331,9 @@ func Test_popupwin_atcursor_far_right()
set signcolumn=yes
call setline(1, repeat('=', &columns))
normal! ggg$
- call popup_atcursor(repeat('x', 500), #{moved: 'any', border: []})
+ let winid = popup_atcursor(repeat('x', 500), #{moved: 'any', border: []})
+ call popup_close(winid)
bwipe!
set signcolumn&
endfunc