summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-08-24 19:36:00 +0200
committerBram Moolenaar <Bram@vim.org>2019-08-24 19:36:00 +0200
commitf63962378dc32c7253e4825b4b0f414a81c1dd3e (patch)
tree46ec1a7ae20b1e6d2b5e3ecf3a4c241b9791639c /src/testdir
parent4645104be4c521dfdd43621c19e96bda3cac7be2 (diff)
patch 8.1.1920: cannot always close a popup when filter consumes all eventsv8.1.1920
Problem: Cannot close a popup by the X when a filter consumes all events. Solution: Check for a click on the close button before invoking filters. (closes #4858)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/dumps/Test_popupwin_close_04.dump10
-rw-r--r--src/testdir/dumps/Test_popupwin_close_05.dump10
-rw-r--r--src/testdir/test_popupwin.vim17
3 files changed, 37 insertions, 0 deletions
diff --git a/src/testdir/dumps/Test_popupwin_close_04.dump b/src/testdir/dumps/Test_popupwin_close_04.dump
new file mode 100644
index 0000000000..91d7f093e4
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_close_04.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @37|╔+0#0000001#ffd7ff255|═@5|X| +0#0000000#ffffff0@27
+|2| @37|║+0#0000001#ffd7ff255|b|a|r|f|o@1|║| +0#0000000#ffffff0@27
+|3| @37|╚+0#0000001#ffd7ff255|═@5|╝| +0#0000000#ffffff0@27
+|4| @73
+|5| |n+0#0000001#ffd7ff255|o| |b|o|r|d|e|r| |h|e|r|X| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@12|X| +0#0000000#ffffff0@38
+|6| @20| +0#0000001#ffd7ff255|o|n|l|y| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@38
+|7| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@38
+|8| @73
+|9| @73
+|:|c|a|l@1| |C|r|e|a|t|e|W|i|t|h|M|e|n|u|F|i|l|t|e|r|(|)| @28|1|,|1| @10|T|o|p|
diff --git a/src/testdir/dumps/Test_popupwin_close_05.dump b/src/testdir/dumps/Test_popupwin_close_05.dump
new file mode 100644
index 0000000000..75ce052f33
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_close_05.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @73
+|4| @73
+|5| |n+0#0000001#ffd7ff255|o| |b|o|r|d|e|r| |h|e|r|X| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@12|X| +0#0000000#ffffff0@38
+|6| @20| +0#0000001#ffd7ff255|o|n|l|y| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@38
+|7| @20| +0#0000001#ffd7ff255@13| +0#0000000#ffffff0@38
+|8| @73
+|9| @73
+|:|c|a|l@1| |C|r|e|a|t|e|W|i|t|h|M|e|n|u|F|i|l|t|e|r|(|)| @28|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index abae5dbef6..9471857874 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -420,6 +420,15 @@ func Test_popup_close_with_mouse()
call feedkeys("\<F4>\<LeftMouse>\<LeftRelease>", "xt")
endfunc
map <silent> <F4> :call test_setmouse(3, 17)<CR>
+ func CreateWithMenuFilter()
+ let winid = popup_create('barfoo', #{
+ \ close: 'button',
+ \ filter: 'popup_filter_menu',
+ \ border: [],
+ \ line: 1,
+ \ col: 40,
+ \ })
+ endfunc
END
call writefile(lines, 'XtestPopupClose')
let buf = RunVimInTerminal('-S XtestPopupClose', #{rows: 10})
@@ -431,6 +440,14 @@ func Test_popup_close_with_mouse()
call term_sendkeys(buf, ":call CloseWithClick()\<CR>")
call VerifyScreenDump(buf, 'Test_popupwin_close_03', {})
+ call term_sendkeys(buf, ":call CreateWithMenuFilter()\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_close_04', {})
+
+ " We have to send the actual mouse code, feedkeys() would be caught the
+ " filter.
+ call term_sendkeys(buf, "\<Esc>[<0;47;1M")
+ call VerifyScreenDump(buf, 'Test_popupwin_close_05', {})
+
" clean up
call StopVimInTerminal(buf)
call delete('XtestPopupClose')