diff options
author | James McCoy <jamessan@jamessan.com> | 2022-11-09 23:29:14 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-09 23:29:14 +0000 |
commit | 157241e8798fe1c14f3787ee341ffee2c403714a (patch) | |
tree | 9b67d8205bff12854a84ed3111bd33ce756d0c69 | |
parent | 76db9e076318cb0ae846f43b7549ad4f2d234c0b (diff) | |
download | vim-git-157241e8798fe1c14f3787ee341ffee2c403714a.tar.gz |
patch 9.0.0849: terminal mouse test is a bit flakyv9.0.0849
Problem: Terminal mouse test is a bit flaky.
Solution: Add WaitFor() calls. (James McCoy closes #11519) Tune wait times
to reduce flakiness.
-rw-r--r-- | src/testdir/test_terminal3.vim | 39 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 24 insertions, 17 deletions
diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim index 5b143719b..59fba9679 100644 --- a/src/testdir/test_terminal3.vim +++ b/src/testdir/test_terminal3.vim @@ -267,11 +267,11 @@ func Test_terminal_in_popup() \ ] call writefile(lines, 'XtermPopup', 'D') let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) - call TermWait(buf, 100) + call TermWait(buf, 200) call term_sendkeys(buf, ":call OpenTerm(0)\<CR>") - call TermWait(buf, 500) + call TermWait(buf, 800) call term_sendkeys(buf, ":\<CR>") - call TermWait(buf, 100) + call TermWait(buf, 500) call term_sendkeys(buf, "\<C-W>:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\<CR>") call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) @@ -279,9 +279,9 @@ func Test_terminal_in_popup() call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") - call TermWait(buf, 500) + call TermWait(buf, 800) call term_sendkeys(buf, ":set hlsearch\<CR>") - call TermWait(buf, 100) + call TermWait(buf, 500) call term_sendkeys(buf, "/edit\<CR>") call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) @@ -686,6 +686,8 @@ func Test_term_mouse() call TermWait(buf) redraw! + let XbufExists = {-> filereadable('Xbuf')} + " Use the mouse to enter the terminal window call win_gotoid(prev_win) call feedkeys(MouseLeftClickCode(1, 1), 'x') @@ -698,73 +700,76 @@ func Test_term_mouse() call test_setmouse(3, 8) call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") call TermWait(buf, 50) + call delete('Xbuf') call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\<CR>") call TermWait(buf, 50) + call WaitFor(XbufExists) let pos = json_decode(readfile('Xbuf')[0]) call assert_equal([3, 8], pos[1:2]) + call delete('Xbuf') " Test for selecting text using mouse - call delete('Xbuf') call test_setmouse(2, 11) call term_sendkeys(buf, "\<LeftMouse>") call test_setmouse(2, 16) call term_sendkeys(buf, "\<LeftRelease>y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal('yellow', readfile('Xbuf')[0]) + call delete('Xbuf') " Test for selecting text using double click - call delete('Xbuf') call test_setmouse(1, 11) call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>") call test_setmouse(1, 17) call term_sendkeys(buf, "\<LeftRelease>y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal('three four', readfile('Xbuf')[0]) + call delete('Xbuf') " Test for selecting a line using triple click - call delete('Xbuf') call test_setmouse(3, 2) call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0]) + call delete('Xbuf') " Test for selecting a block using quadruple click - call delete('Xbuf') call test_setmouse(1, 11) call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>") call test_setmouse(3, 13) call term_sendkeys(buf, "\<LeftRelease>y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) + call delete('Xbuf') " Test for extending a selection using right click - call delete('Xbuf') call test_setmouse(2, 9) call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>") call test_setmouse(2, 16) call term_sendkeys(buf, "\<RightMouse>\<RightRelease>y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal("n yellow", readfile('Xbuf')[0]) + call delete('Xbuf') " Test for pasting text using middle click - call delete('Xbuf') call term_sendkeys(buf, ":let @r='bright '\<CR>") call test_setmouse(2, 22) call term_sendkeys(buf, "\"r\<MiddleMouse>\<MiddleRelease>") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>") - call TermWait(buf, 50) + call WaitFor(XbufExists) call assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) + call delete('Xbuf') " cleanup call TermWait(buf) diff --git a/src/version.c b/src/version.c index b1333d284..6884514cd 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 849, +/**/ 848, /**/ 847, |