patch 8.1.1936: not enough tests for text property popup window
Problem: Not enough tests for text property popup window.
Solution: Add a few more tests. Make negative offset work. Close all
popups when window closes.
diff --git a/src/testdir/test_popupwin_textprop.vim b/src/testdir/test_popupwin_textprop.vim
index 2a4eb2c..8a68f15 100644
--- a/src/testdir/test_popupwin_textprop.vim
+++ b/src/testdir/test_popupwin_textprop.vim
@@ -45,6 +45,9 @@
call term_sendkeys(buf, "k2dd")
call VerifyScreenDump(buf, 'Test_popup_textprop_06', {})
+ call term_sendkeys(buf, "4\<C-E>")
+ call VerifyScreenDump(buf, 'Test_popup_textprop_07', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestTextpropPopup')
@@ -99,10 +102,72 @@
call term_sendkeys(buf, ":\<CR>")
call VerifyScreenDump(buf, 'Test_popup_textprop_corn_4', {})
+ call term_sendkeys(buf, ":vsplit foo\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_textprop_corn_5', {})
+
+ call term_sendkeys(buf, ":only!\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_textprop_corn_6', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestTextpropPopupCorners')
endfunc
+func Test_textprop_popup_offsets()
+ let lines =<< trim END
+ call setline(1, range(1, 100))
+ call setline(50, 'now working with some longer text here')
+ 50
+ normal zz
+ set scrolloff=0
+ call prop_type_add('popupMarker', #{highlight: 'DiffAdd'})
+ call prop_add(50, 23, #{
+ \ length: 6,
+ \ type: 'popupMarker',
+ \ })
+ let winid = popup_create('bottom left', #{
+ \ pos: 'botleft',
+ \ line: -1,
+ \ col: 2,
+ \ textprop: 'popupMarker',
+ \ padding: [0,1,0,1],
+ \ })
+ let winid = popup_create('bottom right', #{
+ \ pos: 'botright',
+ \ line: -1,
+ \ col: -2,
+ \ textprop: 'popupMarker',
+ \ border: [],
+ \ padding: [0,1,0,1],
+ \ })
+ let winid = popup_create('top left', #{
+ \ pos: 'topleft',
+ \ line: 1,
+ \ col: 2,
+ \ textprop: 'popupMarker',
+ \ border: [],
+ \ padding: [0,1,0,1],
+ \ })
+ let winid = popup_create('top right', #{
+ \ pos: 'topright',
+ \ line: 1,
+ \ col: -2,
+ \ textprop: 'popupMarker',
+ \ padding: [0,1,0,1],
+ \ })
+ END
+ call writefile(lines, 'XtestTextpropPopupOffset')
+ let buf = RunVimInTerminal('-S XtestTextpropPopupOffset', #{rows: 12})
+ call VerifyScreenDump(buf, 'Test_popup_textprop_off_1', {})
+
+ " test that removing the text property closes the popups
+ call term_sendkeys(buf, ":call prop_clear(50)\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_textprop_off_2', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestTextpropPopupOffset')
+endfunc
+
" vim: shiftwidth=2 sts=2