# HG changeset patch # User Bram Moolenaar # Date 1668036604 -3600 # Node ID bf8e9ef40006639e4c42978be0674e4edc7932a9 # Parent 5acd6f02ea3556356157ed191039ec8bc8a5b49e patch 9.0.0849: terminal mouse test is a bit flaky Commit: https://github.com/vim/vim/commit/157241e8798fe1c14f3787ee341ffee2c403714a Author: James McCoy Date: Wed Nov 9 23:29:14 2022 +0000 patch 9.0.0849: terminal mouse test is a bit flaky Problem: Terminal mouse test is a bit flaky. Solution: Add WaitFor() calls. (James McCoy closes https://github.com/vim/vim/issues/11519) Tune wait times to reduce flakiness. diff --git a/src/testdir/test_terminal3.vim b/src/testdir/test_terminal3.vim --- 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)\") + call TermWait(buf, 800) + call term_sendkeys(buf, ":\") call TermWait(buf, 500) - call term_sendkeys(buf, ":\") - call TermWait(buf, 100) call term_sendkeys(buf, "\:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\") 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)\") - call TermWait(buf, 500) + call TermWait(buf, 800) call term_sendkeys(buf, ":set hlsearch\") - call TermWait(buf, 100) + call TermWait(buf, 500) call term_sendkeys(buf, "/edit\") 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, "\\") call TermWait(buf, 50) + call delete('Xbuf') call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\") 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, "\") call test_setmouse(2, 16) call term_sendkeys(buf, "\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") - 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, "\\\") call test_setmouse(1, 17) call term_sendkeys(buf, "\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") - 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, "\\\\\\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") - 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, "\\\\\\\") call test_setmouse(3, 13) call term_sendkeys(buf, "\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") - 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, "\\") call test_setmouse(2, 16) call term_sendkeys(buf, "\\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") - 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 '\") call test_setmouse(2, 22) call term_sendkeys(buf, "\"r\\") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\") - 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 --- 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,