Skip to content

Commit a4b4426

Browse files
committed
patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Problem: Terminal2 test sometimes hangs in the GUI on Travis. Solution: Move test function to terminal3 to see if the problem moves too.
1 parent c212dd0 commit a4b4426

3 files changed

Lines changed: 46 additions & 44 deletions

File tree

src/testdir/test_terminal2.vim

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -536,49 +536,5 @@ func Test_term_gettty()
536536
exe buf . 'bwipe'
537537
endfunc
538538

539-
func Test_terminal_getwinpos()
540-
CheckRunVimInTerminal
541-
542-
" split, go to the bottom-right window
543-
split
544-
wincmd j
545-
set splitright
546-
547-
call writefile([
548-
\ 'echo getwinpos()',
549-
\ ], 'XTest_getwinpos')
550-
let buf = RunVimInTerminal('-S XTest_getwinpos', {'cols': 60})
551-
call TermWait(buf)
552-
553-
" Find the output of getwinpos() in the bottom line.
554-
let rows = term_getsize(buf)[0]
555-
call WaitForAssert({-> assert_match('\[\d\+, \d\+\]', term_getline(buf, rows))})
556-
let line = term_getline(buf, rows)
557-
let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', ''))
558-
let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', ''))
559-
560-
" Position must be bigger than the getwinpos() result of Vim itself.
561-
" The calculation in the console assumes a 10 x 7 character cell.
562-
" In the GUI it can be more, let's assume a 20 x 14 cell.
563-
" And then add 100 / 200 tolerance.
564-
let [xroot, yroot] = getwinpos()
565-
let winpos = 50->getwinpos()
566-
call assert_equal(xroot, winpos[0])
567-
call assert_equal(yroot, winpos[1])
568-
let [winrow, wincol] = win_screenpos('.')
569-
let xoff = wincol * (has('gui_running') ? 14 : 7) + 100
570-
let yoff = winrow * (has('gui_running') ? 20 : 10) + 200
571-
call assert_inrange(xroot + 2, xroot + xoff, xpos)
572-
call assert_inrange(yroot + 2, yroot + yoff, ypos)
573-
574-
call TermWait(buf)
575-
call term_sendkeys(buf, ":q\<CR>")
576-
call StopVimInTerminal(buf)
577-
call delete('XTest_getwinpos')
578-
exe buf . 'bwipe!'
579-
set splitright&
580-
only!
581-
endfunc
582-
583539

584540
" vim: shiftwidth=2 sts=2 expandtab

src/testdir/test_terminal3.vim

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,5 +519,49 @@ func Test_term_modeless_selection()
519519
new | only!
520520
endfunc
521521

522+
func Test_terminal_getwinpos()
523+
CheckRunVimInTerminal
524+
525+
" split, go to the bottom-right window
526+
split
527+
wincmd j
528+
set splitright
529+
530+
call writefile([
531+
\ 'echo getwinpos()',
532+
\ ], 'XTest_getwinpos')
533+
let buf = RunVimInTerminal('-S XTest_getwinpos', {'cols': 60})
534+
call TermWait(buf)
535+
536+
" Find the output of getwinpos() in the bottom line.
537+
let rows = term_getsize(buf)[0]
538+
call WaitForAssert({-> assert_match('\[\d\+, \d\+\]', term_getline(buf, rows))})
539+
let line = term_getline(buf, rows)
540+
let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', ''))
541+
let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', ''))
542+
543+
" Position must be bigger than the getwinpos() result of Vim itself.
544+
" The calculation in the console assumes a 10 x 7 character cell.
545+
" In the GUI it can be more, let's assume a 20 x 14 cell.
546+
" And then add 100 / 200 tolerance.
547+
let [xroot, yroot] = getwinpos()
548+
let winpos = 50->getwinpos()
549+
call assert_equal(xroot, winpos[0])
550+
call assert_equal(yroot, winpos[1])
551+
let [winrow, wincol] = win_screenpos('.')
552+
let xoff = wincol * (has('gui_running') ? 14 : 7) + 100
553+
let yoff = winrow * (has('gui_running') ? 20 : 10) + 200
554+
call assert_inrange(xroot + 2, xroot + xoff, xpos)
555+
call assert_inrange(yroot + 2, yroot + yoff, ypos)
556+
557+
call TermWait(buf)
558+
call term_sendkeys(buf, ":q\<CR>")
559+
call StopVimInTerminal(buf)
560+
call delete('XTest_getwinpos')
561+
exe buf . 'bwipe!'
562+
set splitright&
563+
only!
564+
endfunc
565+
522566

523567
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1198,
757759
/**/
758760
1197,
759761
/**/

0 commit comments

Comments
 (0)