comparison src/testdir/test_terminal.vim @ 20514:eb8715fac6c3 v8.2.0811

patch 8.2.0811: terminal keycode test is flaky Commit: https://github.com/vim/vim/commit/9cdcd1d0dc3bbea41b731639fd2431c2ef5cffaa Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 22 14:44:26 2020 +0200 patch 8.2.0811: terminal keycode test is flaky Problem: Terminal keycode test is flaky. Solution: Use WaitForAssert()
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 May 2020 14:45:03 +0200
parents 357dea6b9fde
children bed30e6b5a09
comparison
equal deleted inserted replaced
20513:903e2ba583e5 20514:eb8715fac6c3
2491 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {}) 2491 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {})
2492 2492
2493 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>") 2493 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>")
2494 call TermWait(buf, 150) 2494 call TermWait(buf, 150)
2495 call term_sendkeys(buf, ":set hlsearch\<CR>") 2495 call term_sendkeys(buf, ":set hlsearch\<CR>")
2496 call TermWait(buf, 100)
2496 call term_sendkeys(buf, "/edit\<CR>") 2497 call term_sendkeys(buf, "/edit\<CR>")
2497 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {}) 2498 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {})
2498 2499
2499 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>") 2500 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>")
2500 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {}) 2501 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {})
2515 call term_sendkeys(buf, "A") 2516 call term_sendkeys(buf, "A")
2516 call VerifyScreenDump(buf, 'Test_terminal_popup_8', {}) 2517 call VerifyScreenDump(buf, 'Test_terminal_popup_8', {})
2517 2518
2518 call TermWait(buf, 50) 2519 call TermWait(buf, 50)
2519 call term_sendkeys(buf, ":q\<CR>") 2520 call term_sendkeys(buf, ":q\<CR>")
2520 call TermWait(buf, 100) " wait for terminal to vanish 2521 call TermWait(buf, 150) " wait for terminal to vanish
2521 2522
2522 call StopVimInTerminal(buf) 2523 call StopVimInTerminal(buf)
2523 call delete('Xtext') 2524 call delete('Xtext')
2524 call delete('XtermPopup') 2525 call delete('XtermPopup')
2525 endfunc 2526 endfunc
2702 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>'] 2703 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>']
2703 2704
2704 call term_sendkeys(buf, "i") 2705 call term_sendkeys(buf, "i")
2705 for i in range(len(keys)) 2706 for i in range(len(keys))
2706 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i]) 2707 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i])
2707 call term_wait(buf) 2708 call WaitForAssert({-> assert_equal(output[i], term_getline(buf, 1))})
2708 call assert_equal(output[i], term_getline(buf, 1))
2709 endfor 2709 endfor
2710 2710
2711 let keypad_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>", 2711 let keypad_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>",
2712 \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>", 2712 \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>",
2713 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"] 2713 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
2718 " TODO: Mysteriously keypad 3 and 9 do not work on some systems. 2718 " TODO: Mysteriously keypad 3 and 9 do not work on some systems.
2719 if keypad_output[i] == '3' || keypad_output[i] == '9' 2719 if keypad_output[i] == '3' || keypad_output[i] == '9'
2720 continue 2720 continue
2721 endif 2721 endif
2722 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i]) 2722 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i])
2723 call term_wait(buf) 2723 call WaitForAssert({-> assert_equal(keypad_output[i], term_getline(buf, 1))})
2724 call assert_equal(keypad_output[i], term_getline(buf, 1))
2725 endfor 2724 endfor
2726 2725
2727 call feedkeys("\<C-U>\<kEnter>\<BS>one\<C-W>.two", 'xt') 2726 call feedkeys("\<C-U>\<kEnter>\<BS>one\<C-W>.two", 'xt')
2728 call term_wait(buf) 2727 call WaitForAssert({-> assert_equal('two', term_getline(buf, 1))})
2729 call assert_equal('two', term_getline(buf, 1))
2730 2728
2731 call StopVimInTerminal(buf) 2729 call StopVimInTerminal(buf)
2732 endfunc 2730 endfunc
2733 2731
2734 " Test for using the mouse in a terminal 2732 " Test for using the mouse in a terminal