annotate src/testdir/test_terminal3.vim @ 30940:5bc99d85f773 v9.0.0804

patch 9.0.0804: crash when trying to divide a number by -1 Commit: https://github.com/vim/vim/commit/cdef1cefa2a440911c727558562f83ed9b00e16b Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 20 14:17:18 2022 +0100 patch 9.0.0804: crash when trying to divide a number by -1 Problem: Crash when trying to divice the largest negative number by -1. Solution: Handle this case specifically.
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Oct 2022 15:30:03 +0200
parents c8ebe35b2475
children bf8e9ef40006
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for the terminal window.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " This is split in two, because it can take a lot of time.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " See test_terminal.vim and test_terminal2.vim for further tests.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 source check.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 CheckFeature terminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 source shared.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 source screendump.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 source mouse.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 source term_util.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let $PROMPT_COMMAND=''
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 func Test_terminal_altscreen()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 " somehow doesn't work on MS-Windows
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 let cmd = "cat Xtext\<CR>"
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 let buf = term_start(&shell, {})
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
21 call writefile(["\<Esc>[?1047h"], 'Xtext', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 call term_sendkeys(buf, cmd)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 call WaitForAssert({-> assert_equal(1, term_getaltscreen(buf))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call writefile(["\<Esc>[?1047l"], 'Xtext')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call term_sendkeys(buf, cmd)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 call WaitForAssert({-> assert_equal(0, term_getaltscreen(buf))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 call term_sendkeys(buf, "exit\r")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 exe buf . "bwipe!"
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 func Test_terminal_shell_option()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 if has('unix')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " exec is a shell builtin command, should fail without a shell.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 term exec ls runtest.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 term ++shell exec ls runtest.vim
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 elseif has('win32')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 " dir is a shell builtin command, should fail without a shell.
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
45 " However, if dir.exe (which might be provided by Cygwin/MSYS2) exists in
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
46 " the %PATH%, "term dir" succeeds unintentionally. Use dir.com instead.
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 try
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
48 term dir.com /b runtest.vim
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
49 call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 catch /CreateProcess/
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " ignore
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 endtry
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 bwipe!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
21524
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
55 " This should execute the dir builtin command even with ".com".
8c6433359913 patch 8.2.1312: MS-Windows: terminal test may fail if dir.exe exists
Bram Moolenaar <Bram@vim.org>
parents: 21427
diff changeset
56 term ++shell dir.com /b runtest.vim
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 bwipe!
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21524
diff changeset
59 else
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 21524
diff changeset
60 throw 'Skipped: does not work on this platform'
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 func Test_terminal_invalid_arg()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call assert_fails('terminal ++xyz', 'E181:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
68 " Check a terminal with different colors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
69 func Terminal_color(group_name, highlight_cmds, highlight_opt, open_cmds)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
70 CheckRunVimInTerminal
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
71 CheckUnix
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
72
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
73 let lines = [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
74 \ 'call setline(1, range(20))',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
75 \ 'func OpenTerm()',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
76 \ ' set noruler',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
77 \ " call term_start('cat', #{vertical: 1, " .. a:highlight_opt .. "})",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
78 \ ] + a:open_cmds + [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
79 \ 'endfunc',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
80 \ ] + a:highlight_cmds
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
81 call writefile(lines, 'XtermStart', 'D')
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
82 let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
83 call TermWait(buf, 100)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
84 call term_sendkeys(buf, ":call OpenTerm()\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
85 call TermWait(buf, 50)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
86 call term_sendkeys(buf, "hello\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
87 call VerifyScreenDump(buf, 'Test_terminal_color_' .. a:group_name, {})
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
88
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
89 call term_sendkeys(buf, "\<C-D>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
90 call TermWait(buf, 50)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
91 call StopVimInTerminal(buf)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
92 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
93
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
94 func Test_terminal_color_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
95 call Terminal_color("Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
96 \ "highlight Terminal ctermfg=blue ctermbg=yellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
97 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
98 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
99
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
100 func Test_terminal_color_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
101 call Terminal_color("MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
102 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
103 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
104 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
105
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
106 func Test_terminal_color_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
107 call Terminal_color("MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
108 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
109 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
110 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
111 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
112 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
113
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
114 func Test_terminal_color_group_over_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
115 call Terminal_color("MyTermCol_over_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
116 \ "highlight Terminal ctermfg=blue ctermbg=yellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
117 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
118 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
119 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
120
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
121 func Test_terminal_color_wincolor_over_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
122 call Terminal_color("MyWinCol_over_group", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
123 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
124 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
125 \ ], "term_highlight: 'MyTermCol',", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
126 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
127 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
128 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
129
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
130 func Test_terminal_color_wincolor_split()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
131 CheckRunVimInTerminal
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
132 CheckUnix
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
133
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
134 let lines = [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
135 \ 'call setline(1, range(20))',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
136 \ 'func OpenTerm()',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
137 \ ' set noruler',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
138 \ " call term_start('cat', #{vertical: 1, term_highlight: 'MyTermCol'})",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
139 \ 'endfunc',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
140 \ 'highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
141 \ 'highlight MyWinCol ctermfg=red ctermbg=darkyellow',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
142 \ 'highlight MyWinCol2 ctermfg=black ctermbg=blue',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
143 \ ]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
144 call writefile(lines, 'XtermStart', 'D')
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
145 let buf = RunVimInTerminal('-S XtermStart', #{rows: 15})
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
146 call TermWait(buf, 100)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
147 call term_sendkeys(buf, ":call OpenTerm()\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
148 call TermWait(buf, 50)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
149 call term_sendkeys(buf, "hello\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
150 call TermWait(buf, 50)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
151
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
152 call term_sendkeys(buf, "\<C-W>:split\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
153 call term_sendkeys(buf, "\<C-W>:set wincolor=MyWinCol\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
154 call VerifyScreenDump(buf, 'Test_terminal_wincolor_split_MyWinCol', {})
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
155
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
156 call term_sendkeys(buf, "\<C-W>b:2sb\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
157 call term_sendkeys(buf, "\<C-W>:set wincolor=MyWinCol2\<CR>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
158 call VerifyScreenDump(buf, 'Test_terminal_wincolor_split_MyWinCol2', {})
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
159
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
160 call term_sendkeys(buf, "\<C-D>")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
161 call TermWait(buf, 50)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
162 call StopVimInTerminal(buf)
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
163 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
164
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
165 func Test_terminal_color_transp_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
166 call Terminal_color("transp_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
167 \ "highlight Terminal ctermfg=blue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
168 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
169 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
170
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
171 func Test_terminal_color_transp_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
172 call Terminal_color("transp_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
173 \ "highlight MyTermCol ctermfg=darkgreen",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
174 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
175 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
176
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
177 func Test_terminal_color_transp_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
178 call Terminal_color("transp_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
179 \ "highlight MyWinCol ctermfg=red",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
180 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
181 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
182 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
183 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
184
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
185 func Test_terminal_color_gui_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
186 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
187 call Terminal_color("gui_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
188 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
189 \ "highlight Terminal guifg=#3344ff guibg=#b0a700",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
190 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
191 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
192
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
193 func Test_terminal_color_gui_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
194 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
195 call Terminal_color("gui_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
196 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
197 \ "highlight MyTermCol guifg=#007800 guibg=#6789ff",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
198 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
199 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
200
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
201 func Test_terminal_color_gui_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
202 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
203 call Terminal_color("gui_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
204 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
205 \ "highlight MyWinCol guifg=#fe1122 guibg=#818100",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
206 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
207 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
208 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
209 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
210
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
211 func Test_terminal_color_gui_transp_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
212 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
213 call Terminal_color("gui_transp_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
214 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
215 \ "highlight Terminal guifg=#3344ff",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
216 \ ], "", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
217 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
218
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
219 func Test_terminal_color_gui_transp_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
220 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
221 call Terminal_color("gui_transp_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
222 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
223 \ "highlight MyTermCol guifg=#007800",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
224 \ ], "term_highlight: 'MyTermCol',", [])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
225 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
226
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
227 func Test_terminal_color_gui_transp_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
228 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
229 call Terminal_color("gui_transp_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
230 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
231 \ "highlight MyWinCol guifg=#fe1122",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
232 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
233 \ 'set wincolor=MyWinCol',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
234 \ ])
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
235 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
236
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 func Test_terminal_in_popup()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 let text =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 some text
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 to edit
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 in a popup window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
245 call writefile(text, 'Xtext', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 let cmd = GetVimCommandCleanTerm()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 \ 'call setline(1, range(20))',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 \ 'hi PopTerm ctermbg=grey',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 \ 'func OpenTerm(setColor)',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 \ " set noruler",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 \ " let s:buf = term_start('" .. cmd .. " Xtext', #{hidden: 1, term_finish: 'close'})",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 \ ' let g:winid = popup_create(s:buf, #{minwidth: 45, minheight: 7, border: [], drag: 1, resize: 1})',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 \ ' if a:setColor',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 \ ' call win_execute(g:winid, "set wincolor=PopTerm")',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 \ ' endif',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 \ 'func HidePopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 \ ' call popup_hide(g:winid)',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 \ 'func ClosePopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 \ ' call popup_close(g:winid)',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 \ 'func ReopenPopup()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 \ ' call popup_create(s:buf, #{minwidth: 40, minheight: 6, border: []})',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 \ ]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
268 call writefile(lines, 'XtermPopup', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 call term_sendkeys(buf, ":call OpenTerm(0)\<CR>")
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
272 call TermWait(buf, 500)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 call term_sendkeys(buf, ":\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 call term_sendkeys(buf, "\<C-W>:echo getwinvar(g:winid, \"&buftype\") win_gettype(g:winid)\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 call VerifyScreenDump(buf, 'Test_terminal_popup_1', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 call term_sendkeys(buf, ":q\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 call VerifyScreenDump(buf, 'Test_terminal_popup_2', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 call term_sendkeys(buf, ":call OpenTerm(1)\<CR>")
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
282 call TermWait(buf, 500)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 call term_sendkeys(buf, ":set hlsearch\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 call term_sendkeys(buf, "/edit\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 call VerifyScreenDump(buf, 'Test_terminal_popup_3', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 call term_sendkeys(buf, "\<C-W>:call HidePopup()\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 call VerifyScreenDump(buf, 'Test_terminal_popup_4', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 call term_sendkeys(buf, "\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 call term_sendkeys(buf, "\<C-W>:call ClosePopup()\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 call VerifyScreenDump(buf, 'Test_terminal_popup_5', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 call term_sendkeys(buf, "\<C-W>:call ReopenPopup()\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 call VerifyScreenDump(buf, 'Test_terminal_popup_6', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 " Go to terminal-Normal mode and visually select text.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 call term_sendkeys(buf, "\<C-W>Ngg/in\<CR>vww")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 call VerifyScreenDump(buf, 'Test_terminal_popup_7', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 " Back to job mode, redraws
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 call term_sendkeys(buf, "A")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 call VerifyScreenDump(buf, 'Test_terminal_popup_8', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 call term_sendkeys(buf, ":q\<CR>")
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
309 call TermWait(buf, 250) " wait for terminal to vanish
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313
23229
b545334ae654 patch 8.2.2160: various typos
Bram Moolenaar <Bram@vim.org>
parents: 22780
diff changeset
314 " Check a terminal in popup window uses the default minimum size.
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 func Test_terminal_in_popup_min_size()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 let text =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 another text
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 to show
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 in a popup window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
323 call writefile(text, 'Xtext', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 \ 'call setline(1, range(20))',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 \ 'func OpenTerm()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 \ " let s:buf = term_start('cat Xtext', #{hidden: 1})",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 \ ' let g:winid = popup_create(s:buf, #{ border: []})',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 \ 'endfunc',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 \ ]
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
331 call writefile(lines, 'XtermPopup', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 call term_sendkeys(buf, ":set noruler\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 call term_sendkeys(buf, ":call OpenTerm()\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 call term_sendkeys(buf, ":\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 call VerifyScreenDump(buf, 'Test_terminal_popup_m1', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 call term_sendkeys(buf, ":q\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 call TermWait(buf, 50) " wait for terminal to vanish
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 " Check a terminal in popup window with different colors
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
347 func Terminal_in_popup_color(group_name, highlight_cmds, highlight_opt, popup_cmds, popup_opt)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 let lines = [
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 \ 'call setline(1, range(20))',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 \ 'func OpenTerm()',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 \ " let s:buf = term_start('cat', #{hidden: 1, "
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 \ .. a:highlight_opt .. "})",
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
356 \ ' let g:winid = popup_create(s:buf, #{border: [], '
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
357 \ .. a:popup_opt .. '})',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
358 \ ] + a:popup_cmds + [
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 \ 'endfunc',
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
360 \ ] + a:highlight_cmds
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
361 call writefile(lines, 'XtermPopup', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 let buf = RunVimInTerminal('-S XtermPopup', #{rows: 15})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 call TermWait(buf, 100)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 call term_sendkeys(buf, ":set noruler\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 call term_sendkeys(buf, ":call OpenTerm()\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 call term_sendkeys(buf, "hello\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 call VerifyScreenDump(buf, 'Test_terminal_popup_' .. a:group_name, {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 call term_sendkeys(buf, "\<C-D>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 call TermWait(buf, 50)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 call term_sendkeys(buf, ":q\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 call TermWait(buf, 50) " wait for terminal to vanish
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
377 func Test_terminal_in_popup_color_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
378 call Terminal_in_popup_color("Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
379 \ "highlight Terminal ctermfg=blue ctermbg=yellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
380 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
381 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
382
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
383 func Test_terminal_in_popup_color_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
384 call Terminal_in_popup_color("MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
385 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
386 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
387 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
388
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
389 func Test_terminal_in_popup_color_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
390 call Terminal_in_popup_color("MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
391 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
392 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
393 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
394 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
395 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
396
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
397 func Test_terminal_in_popup_color_popup_highlight()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
398 call Terminal_in_popup_color("MyPopupHlCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
399 \ "highlight MyPopupHlCol ctermfg=cyan ctermbg=green",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
400 \ ], "", [], "highlight: 'MyPopupHlCol'")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
401 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
402
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
403 func Test_terminal_in_popup_color_group_over_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
404 call Terminal_in_popup_color("MyTermCol_over_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
405 \ "highlight Terminal ctermfg=blue ctermbg=yellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
406 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
407 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
408 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
409
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
410 func Test_terminal_in_popup_color_wincolor_over_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
411 call Terminal_in_popup_color("MyWinCol_over_group", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
412 \ "highlight MyTermCol ctermfg=darkgreen ctermbg=lightblue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
413 \ "highlight MyWinCol ctermfg=red ctermbg=darkyellow",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
414 \ ], "term_highlight: 'MyTermCol',", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
415 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
416 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
417 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
418
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
419 func Test_terminal_in_popup_color_transp_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
420 call Terminal_in_popup_color("transp_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
421 \ "highlight Terminal ctermfg=blue",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
422 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
423 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
424
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
425 func Test_terminal_in_popup_color_transp_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
426 call Terminal_in_popup_color("transp_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
427 \ "highlight MyTermCol ctermfg=darkgreen",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
428 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
429 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
430
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
431 func Test_terminal_in_popup_color_transp_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
432 call Terminal_in_popup_color("transp_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
433 \ "highlight MyWinCol ctermfg=red",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
434 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
435 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
436 \ ], "")
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
439 func Test_terminal_in_popup_color_transp_popup_highlight()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
440 call Terminal_in_popup_color("transp_MyPopupHlCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
441 \ "highlight MyPopupHlCol ctermfg=cyan",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
442 \ ], "", [], "highlight: 'MyPopupHlCol'")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
443 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
444
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
445 func Test_terminal_in_popup_color_gui_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
446 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
447 call Terminal_in_popup_color("gui_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
448 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
449 \ "highlight Terminal guifg=#3344ff guibg=#b0a700",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
450 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
451 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
452
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
453 func Test_terminal_in_popup_color_gui_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
454 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
455 call Terminal_in_popup_color("gui_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
456 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
457 \ "highlight MyTermCol guifg=#007800 guibg=#6789ff",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
458 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
459 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
460
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
461 func Test_terminal_in_popup_color_gui_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
462 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
463 call Terminal_in_popup_color("gui_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
464 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
465 \ "highlight MyWinCol guifg=#fe1122 guibg=#818100",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
466 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
467 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
468 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
469 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
470
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
471 func Test_terminal_in_popup_color_gui_popup_highlight()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
472 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
473 call Terminal_in_popup_color("gui_MyPopupHlCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
474 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
475 \ "highlight MyPopupHlCol guifg=#00e8f0 guibg=#126521",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
476 \ ], "", [], "highlight: 'MyPopupHlCol'")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
477 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
478
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
479 func Test_terminal_in_popup_color_gui_transp_Terminal()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
480 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
481 call Terminal_in_popup_color("gui_transp_Terminal", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
482 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
483 \ "highlight Terminal guifg=#3344ff",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
484 \ ], "", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
485 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
486
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
487 func Test_terminal_in_popup_color_gui_transp_group()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
488 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
489 call Terminal_in_popup_color("gui_transp_MyTermCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
490 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
491 \ "highlight MyTermCol guifg=#007800",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
492 \ ], "term_highlight: 'MyTermCol',", [], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
493 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
494
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
495 func Test_terminal_in_popup_color_gui_transp_wincolor()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
496 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
497 call Terminal_in_popup_color("gui_transp_MyWinCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
498 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
499 \ "highlight MyWinCol guifg=#fe1122",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
500 \ ], "", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
501 \ 'call setwinvar(g:winid, "&wincolor", "MyWinCol")',
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
502 \ ], "")
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
503 endfunc
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
504
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
505 func Test_terminal_in_popup_color_gui_transp_popup_highlight()
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
506 CheckFeature termguicolors
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
507 call Terminal_in_popup_color("gui_transp_MyPopupHlCol", [
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
508 \ "set termguicolors",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
509 \ "highlight MyPopupHlCol guifg=#00e8f0",
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
510 \ ], "", [], "highlight: 'MyPopupHlCol'")
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
512
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
513 func Test_double_popup_terminal()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
514 let buf1 = term_start(&shell, #{hidden: 1})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
515 let win1 = popup_create(buf1, {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516 let buf2 = term_start(&shell, #{hidden: 1})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
517 call assert_fails('call popup_create(buf2, {})', 'E861:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
518 call popup_close(win1)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 exe buf1 .. 'bwipe!'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 exe buf2 .. 'bwipe!'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522
28580
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
523 func Test_escape_popup_terminal()
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
524 set hidden
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
525
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
526 " Cannot escape a terminal popup window using win_gotoid
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
527 let prev_win = win_getid()
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
528 eval term_start('sh', #{hidden: 1, term_finish: 'close'})->popup_create({})
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
529 call assert_fails("call win_gotoid(" .. prev_win .. ")", 'E863:')
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
530
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
531 call popup_clear(1)
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
532 set hidden&
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
533 endfunc
39df510f97c3 patch 8.2.4814: possible to leave a popup window with win_gotoid()
Bram Moolenaar <Bram@vim.org>
parents: 27120
diff changeset
534
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535 func Test_issue_5607()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
536 let wincount = winnr('$')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
537 exe 'terminal' &shell &shellcmdflag 'exit'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
538 let job = term_getjob(bufnr())
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539 call WaitForAssert({-> assert_equal("dead", job_status(job))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541 let old_wincolor = &wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 try
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 set wincolor=
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 finally
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 let &wincolor = old_wincolor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546 bw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 endtry
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 func Test_hidden_terminal()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 let buf = term_start(&shell, #{hidden: 1})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 call assert_equal('', bufname('^$'))
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 call StopShellInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 func Test_term_nasty_callback()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557 CheckExecutable sh
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
559 set hidden
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 let g:buf0 = term_start('sh', #{hidden: 1, term_finish: 'close'})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 call popup_create(g:buf0, {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 call assert_fails("call term_start(['sh', '-c'], #{curwin: 1})", 'E863:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 call popup_clear(1)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 set hidden&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 func Test_term_and_startinsert()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 let lines =<< trim EOL
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 put='some text'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 startinsert
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 EOL
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
577 call writefile(lines, 'XTest_startinsert', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 let buf = RunVimInTerminal('-S XTest_startinsert', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580 call term_sendkeys(buf, "exit\r")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 call WaitForAssert({-> assert_equal("some text", term_getline(buf, 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 call term_sendkeys(buf, "0l")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 call term_sendkeys(buf, "A<\<Esc>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 call WaitForAssert({-> assert_equal("some text<", term_getline(buf, 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 " Test for passing invalid arguments to terminal functions
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 func Test_term_func_invalid_arg()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 call assert_fails('let b = term_getaltscreen([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 call assert_fails('let a = term_getattr(1, [])', 'E730:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 call assert_fails('let c = term_getcursor([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 call assert_fails('let l = term_getline([], 1)', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 call assert_fails('let l = term_getscrolled([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 call assert_fails('let s = term_getsize([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 call assert_fails('let s = term_getstatus([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 call assert_fails('let s = term_scrape([], 1)', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 call assert_fails('call term_sendkeys([], "a")', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 call assert_fails('call term_setapi([], "")', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 call assert_fails('call term_setrestore([], "")', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 call assert_fails('call term_setkill([], "")', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 if has('gui') || has('termguicolors')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 call assert_fails('let p = term_getansicolors([])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 call assert_fails('call term_setansicolors([], [])', 'E745:')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 endif
23984
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
607 let buf = term_start('echo')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
608 call assert_fails('call term_setapi(' .. buf .. ', {})', 'E731:')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
609 call assert_fails('call term_setkill(' .. buf .. ', {})', 'E731:')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
610 call assert_fails('call term_setrestore(' .. buf .. ', {})', 'E731:')
e27b5529dc6a patch 8.2.2534: missing test coverage
Bram Moolenaar <Bram@vim.org>
parents: 23406
diff changeset
611 exe buf . "bwipe!"
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 " Test for sending various special keycodes to a terminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 func Test_term_keycode_translation()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 let buf = RunVimInTerminal('', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 call term_sendkeys(buf, ":set nocompatible\<CR>")
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
620 call term_sendkeys(buf, ":set timeoutlen=20\<CR>")
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 let keys = ["\<F1>", "\<F2>", "\<F3>", "\<F4>", "\<F5>", "\<F6>", "\<F7>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 \ "\<F8>", "\<F9>", "\<F10>", "\<F11>", "\<F12>", "\<Home>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 \ "\<S-Home>", "\<C-Home>", "\<End>", "\<S-End>", "\<C-End>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625 \ "\<Ins>", "\<Del>", "\<Left>", "\<S-Left>", "\<C-Left>", "\<Right>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 \ "\<S-Right>", "\<C-Right>", "\<Up>", "\<S-Up>", "\<Down>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627 \ "\<S-Down>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 let output = ['<F1>', '<F2>', '<F3>', '<F4>', '<F5>', '<F6>', '<F7>',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 \ '<F8>', '<F9>', '<F10>', '<F11>', '<F12>', '<Home>', '<S-Home>',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 \ '<C-Home>', '<End>', '<S-End>', '<C-End>', '<Insert>', '<Del>',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 \ '<Left>', '<S-Left>', '<C-Left>', '<Right>', '<S-Right>',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
632 \ '<C-Right>', '<Up>', '<S-Up>', '<Down>', '<S-Down>']
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
633
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 call term_sendkeys(buf, "i")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 for i in range(len(keys))
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 call term_sendkeys(buf, "\<C-U>\<C-K>" .. keys[i])
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
637 call WaitForAssert({-> assert_equal(output[i], term_getline(buf, 1))}, 200)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 let keypad_keys = ["\<k0>", "\<k1>", "\<k2>", "\<k3>", "\<k4>", "\<k5>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 \ "\<k6>", "\<k7>", "\<k8>", "\<k9>", "\<kPoint>", "\<kPlus>",
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 \ "\<kMinus>", "\<kMultiply>", "\<kDivide>"]
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 let keypad_output = ['0', '1', '2', '3', '4', '5',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 \ '6', '7', '8', '9', '.', '+',
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 \ '-', '*', '/']
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 for i in range(len(keypad_keys))
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 " TODO: Mysteriously keypad 3 and 9 do not work on some systems.
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648 if keypad_output[i] == '3' || keypad_output[i] == '9'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 continue
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650 endif
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651 call term_sendkeys(buf, "\<C-U>" .. keypad_keys[i])
23406
24ce202a7d68 patch 8.2.2246: cursor keys not recognized at the hit-Enter prompt
Bram Moolenaar <Bram@vim.org>
parents: 23229
diff changeset
652 call WaitForAssert({-> assert_equal(keypad_output[i], term_getline(buf, 1))}, 100)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653 endfor
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 call feedkeys("\<C-U>\<kEnter>\<BS>one\<C-W>.two", 'xt')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 call WaitForAssert({-> assert_equal('two', term_getline(buf, 1))})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 " Test for using the mouse in a terminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662 func Test_term_mouse()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 let save_clipboard = &clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 set mouse=a term=xterm ttymouse=sgr mousetime=200 clipboard=
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
671
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 one two three four five
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 red green yellow red blue
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
675 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
677 call writefile(lines, 'Xtest_mouse', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679 " Create a terminal window running Vim for the test with mouse enabled
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680 let prev_win = win_getid()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 let buf = RunVimInTerminal('Xtest_mouse -n', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
682 call term_sendkeys(buf, ":set nocompatible\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683 call term_sendkeys(buf, ":set mouse=a term=xterm ttymouse=sgr\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684 call term_sendkeys(buf, ":set clipboard=\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685 call term_sendkeys(buf, ":set mousemodel=extend\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
686 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
689 " Use the mouse to enter the terminal window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 call win_gotoid(prev_win)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691 call feedkeys(MouseLeftClickCode(1, 1), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692 call feedkeys(MouseLeftReleaseCode(1, 1), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 call assert_equal(1, getwininfo(win_getid())[0].terminal)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695 " Test for <LeftMouse> click/release
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 call test_setmouse(2, 5)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697 call feedkeys("\<LeftMouse>\<LeftRelease>", 'xt')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 call test_setmouse(3, 8)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
700 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 call term_sendkeys(buf, ":call writefile([json_encode(getpos('.'))], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
702 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 let pos = json_decode(readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 call assert_equal([3, 8], pos[1:2])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 " Test for selecting text using mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 call test_setmouse(2, 11)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 call term_sendkeys(buf, "\<LeftMouse>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 call test_setmouse(2, 16)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 call term_sendkeys(buf, "\<LeftRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
712 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
713 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
714 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 call assert_equal('yellow', readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
717 " Test for selecting text using double click
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 call test_setmouse(1, 11)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 call test_setmouse(1, 17)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 call term_sendkeys(buf, "\<LeftRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
723 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
725 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726 call assert_equal('three four', readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 " Test for selecting a line using triple click
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
729 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 call test_setmouse(3, 2)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
731 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
732 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
734 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735 call assert_equal("vim emacs sublime nano\n", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736
26193
c83460a14407 patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents: 24273
diff changeset
737 " Test for selecting a block using quadruple click
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
738 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 call test_setmouse(1, 11)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>\<LeftRelease>\<LeftMouse>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 call test_setmouse(3, 13)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
742 call term_sendkeys(buf, "\<LeftRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
743 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
744 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
745 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746 call assert_equal("ree\nyel\nsub", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748 " Test for extending a selection using right click
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 call test_setmouse(2, 9)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751 call term_sendkeys(buf, "\<LeftMouse>\<LeftRelease>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 call test_setmouse(2, 16)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
753 call term_sendkeys(buf, "\<RightMouse>\<RightRelease>y")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
754 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
755 call term_sendkeys(buf, ":call writefile([@\"], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
756 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 call assert_equal("n yellow", readfile('Xbuf')[0])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 " Test for pasting text using middle click
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 call term_sendkeys(buf, ":let @r='bright '\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 call test_setmouse(2, 22)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 call term_sendkeys(buf, "\"r\<MiddleMouse>\<MiddleRelease>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
764 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 call term_sendkeys(buf, ":call writefile([getline(2)], 'Xbuf')\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
766 call TermWait(buf, 50)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 call assert_equal("red bright blue", readfile('Xbuf')[0][-15:])
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 " cleanup
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
770 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 let &mouse = save_mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 let &term = save_term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 let &ttymouse = save_ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 let &clipboard = save_clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 set mousetime&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 call delete('Xbuf')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
780 " Test for sync buffer cwd with shell's pwd
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
781 func Test_terminal_sync_shell_dir()
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
782 CheckUnix
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
783 " The test always use sh (see src/testdir/unix.vim).
27120
2961745336b8 patch 8.2.4089: terminal test for current directory fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 27098
diff changeset
784 " BSD's sh doesn't seem to play well with the OSC 7 escape sequence.
2961745336b8 patch 8.2.4089: terminal test for current directory fails on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 27098
diff changeset
785 CheckNotBSD
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
786
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
787 set asd
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
788 " , is
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
789 " 1. a valid character for directory names
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
790 " 2. a reserved character in url-encoding
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
791 let chars = ",a"
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
792 " "," is url-encoded as '%2C'
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
793 let chars_url = "%2Ca"
27098
8bb07c88ac27 patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 26608
diff changeset
794 let tmpfolder = fnamemodify(tempname(),':h') .. '/' .. chars
8bb07c88ac27 patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 26608
diff changeset
795 let tmpfolder_url = fnamemodify(tempname(),':h') .. '/' .. chars_url
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
796 call mkdir(tmpfolder, "p")
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
797 let buf = Run_shell_in_terminal({})
27098
8bb07c88ac27 patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 26608
diff changeset
798 call term_sendkeys(buf, "echo $'\\e\]7;file://" .. tmpfolder_url .. "\\a'\<CR>")
8bb07c88ac27 patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 26608
diff changeset
799 "call term_sendkeys(buf, "cd " .. tmpfolder .. "\<CR>")
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
800 call TermWait(buf)
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
801 if has("mac")
27098
8bb07c88ac27 patch 8.2.4078: terminal test for current directory not used on FreeBSD
Bram Moolenaar <Bram@vim.org>
parents: 26608
diff changeset
802 let expected = "/private" .. tmpfolder
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
803 else
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
804 let expected = tmpfolder
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
805 endif
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
806 call assert_equal(expected, getcwd(winnr()))
24273
477b0a892a85 patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents: 24268
diff changeset
807
477b0a892a85 patch 8.2.2678: test for 'autoshelldir' does not reset the option
Bram Moolenaar <Bram@vim.org>
parents: 24268
diff changeset
808 set noasd
24268
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
809 endfunc
9257f3980f4a patch 8.2.2675: directory change in a terminal window shell is not followed
Bram Moolenaar <Bram@vim.org>
parents: 23984
diff changeset
810
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 " Test for modeless selection in a terminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 func Test_term_modeless_selection()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 CheckUnix
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 CheckNotGui
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815 CheckRunVimInTerminal
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 CheckFeature clipboard_working
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 let save_mouse = &mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 let save_term = &term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 let save_ttymouse = &ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 set mouse=a term=xterm ttymouse=sgr mousetime=200
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 set clipboard=autoselectml
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 let lines =<< trim END
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 one two three four five
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 red green yellow red blue
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 vim emacs sublime nano
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 END
30865
c8ebe35b2475 patch 9.0.0767: too many delete() calls in tests
Bram Moolenaar <Bram@vim.org>
parents: 28580
diff changeset
829 call writefile(lines, 'Xtest_modeless', 'D')
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831 " Create a terminal window running Vim for the test with mouse disabled
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
832 let prev_win = win_getid()
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 let buf = RunVimInTerminal('Xtest_modeless -n', {})
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834 call term_sendkeys(buf, ":set nocompatible\<CR>")
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 call term_sendkeys(buf, ":set mouse=\<CR>")
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
836 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 redraw!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 " Use the mouse to enter the terminal window
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 call win_gotoid(prev_win)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 call feedkeys(MouseLeftClickCode(1, 1), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 call feedkeys(MouseLeftReleaseCode(1, 1), 'x')
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
843 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 call assert_equal(1, getwininfo(win_getid())[0].terminal)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 " Test for copying a modeless selection to clipboard
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 let @* = 'clean'
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 " communicating with X server may take a little time
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 sleep 100m
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 call feedkeys(MouseLeftClickCode(2, 3), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851 call feedkeys(MouseLeftDragCode(2, 11), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852 call feedkeys(MouseLeftReleaseCode(2, 11), 'x')
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 call assert_equal("d green y", @*)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 " cleanup
21897
e0af4660dfc7 patch 8.2.1498: on slow systems tests can be flaky
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
856 call TermWait(buf)
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 call StopVimInTerminal(buf)
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 let &mouse = save_mouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 let &term = save_term
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 let &ttymouse = save_ttymouse
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 set mousetime& clipboard&
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 new | only!
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863 endfunc
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864
21295
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
865 func Test_terminal_getwinpos()
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
866 CheckRunVimInTerminal
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
867
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
868 " split, go to the bottom-right window
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
869 split
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
870 wincmd j
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
871 set splitright
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
872
21427
299cf1c2a37d patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 21295
diff changeset
873 let buf = RunVimInTerminal('', {'cols': 60})
299cf1c2a37d patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 21295
diff changeset
874 call TermWait(buf, 100)
299cf1c2a37d patch 8.2.1264: terminal getwinpos() test is a bit flaky
Bram Moolenaar <Bram@vim.org>
parents: 21295
diff changeset
875 call term_sendkeys(buf, ":echo getwinpos(500)\<CR>")
21295
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
876
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
877 " Find the output of getwinpos() in the bottom line.
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
878 let rows = term_getsize(buf)[0]
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
879 call WaitForAssert({-> assert_match('\[\d\+, \d\+\]', term_getline(buf, rows))})
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
880 let line = term_getline(buf, rows)
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
881 let xpos = str2nr(substitute(line, '\[\(\d\+\), \d\+\]', '\1', ''))
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
882 let ypos = str2nr(substitute(line, '\[\d\+, \(\d\+\)\]', '\1', ''))
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
883
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
884 " Position must be bigger than the getwinpos() result of Vim itself.
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
885 " The calculation in the console assumes a 10 x 7 character cell.
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
886 " In the GUI it can be more, let's assume a 20 x 14 cell.
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
887 " And then add 100 / 200 tolerance.
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
888 let [xroot, yroot] = getwinpos()
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
889 let winpos = 50->getwinpos()
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
890 call assert_equal(xroot, winpos[0])
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
891 call assert_equal(yroot, winpos[1])
22093
b85e13213b11 patch 8.2.1596: using win_screenpos('.') in tests works but is wrong
Bram Moolenaar <Bram@vim.org>
parents: 21897
diff changeset
892 let [winrow, wincol] = win_screenpos(0)
21295
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
893 let xoff = wincol * (has('gui_running') ? 14 : 7) + 100
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
894 let yoff = winrow * (has('gui_running') ? 20 : 10) + 200
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
895 call assert_inrange(xroot + 2, xroot + xoff, xpos)
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
896 call assert_inrange(yroot + 2, yroot + yoff, ypos)
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
897
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
898 call TermWait(buf)
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
899 call term_sendkeys(buf, ":q\<CR>")
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
900 call StopVimInTerminal(buf)
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
901 set splitright&
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
902 only!
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
903 endfunc
3e0d4782d0c6 patch 8.2.1198: terminal2 test sometimes hangs in the GUI on Travis
Bram Moolenaar <Bram@vim.org>
parents: 21253
diff changeset
904
26608
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
905 func Test_terminal_term_start_error()
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
906 func s:term_start_error() abort
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
907 try
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
908 return term_start([[]])
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
909 catch
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
910 return v:exception
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
911 finally
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
912 "
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
913 endtry
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
914 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
915 autocmd WinEnter * call type(0)
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
916
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
917 " Must not crash in s:term_start_error, nor the exception thrown.
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
918 let result = s:term_start_error()
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
919 call assert_match('^Vim(return):E730:', result)
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
920
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
921 autocmd! WinEnter
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
922 delfunc s:term_start_error
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
923 endfunc
1eb62546e20c patch 8.2.3833: error from term_start() not caught by try/catch
Bram Moolenaar <Bram@vim.org>
parents: 26193
diff changeset
924
21253
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925
ffa6b82fa993 patch 8.2.1177: terminal2 test sometimes hangs in the GUI
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 " vim: shiftwidth=2 sts=2 expandtab