To: vim_dev@googlegroups.com Subject: Patch 9.0.0849 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0849 Problem: Terminal mouse test is a bit flaky. Solution: Add WaitFor() calls. (James McCoy closes #11519) Tune wait times to reduce flakiness. Files: src/testdir/test_terminal3.vim *** ../vim-9.0.0848/src/testdir/test_terminal3.vim 2022-10-15 20:52:22.563752598 +0100 --- src/testdir/test_terminal3.vim 2022-11-09 23:27:26.215119266 +0000 *************** *** 267,277 **** \ ] call writefile(lines, 'XtermPopup', 'D') let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) ! call TermWait(buf, 100) call term_sendkeys(buf, ":call OpenTerm(0)\") ! 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', {}) --- 267,277 ---- \ ] call writefile(lines, 'XtermPopup', 'D') let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15}) ! 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, "\:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\") call VerifyScreenDump(buf, 'Test_terminal_popup_1', {}) *************** *** 279,287 **** call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) call term_sendkeys(buf, ":call OpenTerm(1)\") ! call TermWait(buf, 500) call term_sendkeys(buf, ":set hlsearch\") ! call TermWait(buf, 100) call term_sendkeys(buf, "/edit\") call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) --- 279,287 ---- call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) call term_sendkeys(buf, ":call OpenTerm(1)\") ! call TermWait(buf, 800) call term_sendkeys(buf, ":set hlsearch\") ! call TermWait(buf, 500) call term_sendkeys(buf, "/edit\") call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) *************** *** 686,691 **** --- 686,693 ---- 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,770 **** call test_setmouse(3, 8) call term_sendkeys(buf, "\\") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\") call TermWait(buf, 50) let pos = json_decode(readfile('Xbuf')[0]) call assert_equal([3, 8], pos[1:2]) " 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 assert_equal('yellow', readfile('Xbuf')[0]) " 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 assert_equal('three four', readfile('Xbuf')[0]) " 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 assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0]) " 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 assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) " 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 assert_equal("n yellow", readfile('Xbuf')[0]) " 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 assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) " cleanup call TermWait(buf) --- 700,775 ---- 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 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 WaitFor(XbufExists) call assert_equal('yellow', readfile('Xbuf')[0]) + call delete('Xbuf') " Test for selecting text using double click 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 WaitFor(XbufExists) call assert_equal('three four', readfile('Xbuf')[0]) + call delete('Xbuf') " Test for selecting a line using triple click call test_setmouse(3, 2) call term_sendkeys(buf, "\\\\\\y") call TermWait(buf, 50) call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\") ! 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 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 WaitFor(XbufExists) call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0]) + call delete('Xbuf') " Test for extending a selection using right click 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 WaitFor(XbufExists) call assert_equal("n yellow", readfile('Xbuf')[0]) + call delete('Xbuf') " Test for pasting text using middle click 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 WaitFor(XbufExists) call assert_equal("red bright blue", readfile('Xbuf')[0][-15:]) + call delete('Xbuf') " cleanup call TermWait(buf) *** ../vim-9.0.0848/src/version.c 2022-11-09 16:29:20.396373252 +0000 --- src/version.c 2022-11-09 21:46:14.074770024 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 849, /**/ -- hundred-and-one symptoms of being an internet addict: 37. You start looking for hot HTML addresses in public restrooms. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///