diff src/testdir/test_terminal.vim @ 19552:d9b365f791d5 v8.2.0333

patch 8.2.0333: terminal in popup test is flaky Commit: https://github.com/vim/vim/commit/57c339569e96725e24e79944bf99f70c50afb5b1 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 29 16:09:16 2020 +0100 patch 8.2.0333: terminal in popup test is flaky Problem: Terminal in popup test is flaky. Solution: Make sure redraw is done before opening the popup.
author Bram Moolenaar <Bram@vim.org>
date Sat, 29 Feb 2020 16:15:04 +0100
parents 9e428147e4ee
children 47db1e17d0a4
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2339,29 +2339,28 @@ func Test_terminal_in_popup()
 	\ 'hi PopTerm ctermbg=grey',
 	\ 'func OpenTerm(setColor)',
 	\ "  let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})",
-	\ '  let s:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})',
+	\ '  let g:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})',
 	\ '  if a:setColor',
-	\ '    call win_execute(s:winid, "set wincolor=PopTerm")',
+	\ '    call win_execute(g:winid, "set wincolor=PopTerm")',
 	\ '  endif',
 	\ 'endfunc',
-	\ 'call OpenTerm(0)',
 	\ 'func HidePopup()',
-	\ '  call popup_hide(s:winid)',
+	\ '  call popup_hide(g:winid)',
 	\ 'endfunc',
 	\ 'func ClosePopup()',
-	\ '  call popup_close(s:winid)',
+	\ '  call popup_close(g:winid)',
 	\ 'endfunc',
 	\ 'func ReopenPopup()',
 	\ '  call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})',
 	\ 'endfunc',
-	\ 'sleep 10m',
-	\ 'redraw',
-	\ 'echo getwinvar(s:winid, "&buftype") win_gettype(s:winid)',
 	\ ]
   call writefile(lines, 'XtermPopup')
   let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
   call term_wait(buf, 100)
+  call term_sendkeys(buf, ":call OpenTerm(0)\<CR>")
+  call term_wait(buf, 100)
   call term_sendkeys(buf, ":\<CR>")
+  call term_sendkeys(buf, "\<C-W>:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\<CR>")
   call VerifyScreenDump(buf, 'Test_terminal_popup_1', {})
 
   call term_sendkeys(buf, ":q\<CR>")