Mercurial > vim
annotate src/testdir/test_termcodes.vim @ 16346:2fb516abde42 v8.1.1178
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
commit https://github.com/vim/vim/commit/4945219b99f8e191c599f80dedc0c4be02ed821e
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 17 16:27:02 2019 +0200
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Problem: When mouse click tests fails value of 'ttytype' is unknown.
Solution: Add a message to the assert.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 17 Apr 2019 16:30:08 +0200 |
parents | 06f3eb443e93 |
children | 5f3a86ba4261 |
rev | line source |
---|---|
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 " Tests for decoding escape sequences sent by the terminal. |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 " This only works for Unix in a terminal |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 if has('gui_running') || !has('unix') |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 finish |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 endif |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
8 " Helper function to emit a terminal escape code. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
9 func TerminalEscapeCode(code_xterm, code_sgr, row, col, m) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
10 if &ttymouse ==# 'xterm' |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
11 " need to use byte encoding here. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
12 let str = list2str([a:code_xterm, a:col + 0x20, a:row + 0x20]) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
13 if has('iconv') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
14 let bytes = iconv(str, 'utf-8', 'latin1') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
15 else |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
16 " Hopefully the numbers are not too big. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
17 let bytes = str |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
18 endif |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
19 call feedkeys("\<Esc>[M" .. bytes, 'Lx!') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
20 elseif &ttymouse ==# 'sgr' |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
21 call feedkeys(printf("\<Esc>[<%d;%d;%d%s", a:code_sgr, a:col, a:row, a:m), 'Lx!') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
22 endif |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
23 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
24 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
25 func MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
26 call TerminalEscapeCode(0x20, 0, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
27 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
28 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
29 func MouseLeftRelease(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
30 call TerminalEscapeCode(0x23, 3, a:row, a:col, 'm') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
31 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
32 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
33 func MouseLeftDrag(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
34 call TerminalEscapeCode(0x43, 0x20, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
35 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
36 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
37 func MouseWheelUp(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
38 call TerminalEscapeCode(0x40, 0x40, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
39 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
40 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
41 func MouseWheelDown(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
42 call TerminalEscapeCode(0x41, 0x41, a:row, a:col, 'M') |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
43 endfunc |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
44 |
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
45 func Test_xterm_mouse_click() |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
46 new |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
47 let save_mouse = &mouse |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 let save_term = &term |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
49 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
50 set mouse=a term=xterm |
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
51 call setline(1, ['line 1', 'line 2', 'line 3 is a bit longer']) |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
53 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
54 let msg = 'ttymouse=' .. ttymouse_val |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
55 exe 'set ttymouse=' . ttymouse_val |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
56 go |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
57 call assert_equal([0, 1, 1, 0], getpos('.'), msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
58 let row = 2 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
59 let col = 6 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
60 call MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
61 call MouseLeftRelease(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
62 call assert_equal([0, 2, 6, 0], getpos('.'), msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
63 endfor |
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
64 |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 let &mouse = save_mouse |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
66 let &term = save_term |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 let &ttymouse = save_ttymouse |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
68 bwipe! |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 endfunc |
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
70 |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
71 func Test_xterm_mouse_wheel() |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
72 new |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
73 let save_mouse = &mouse |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
74 let save_term = &term |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
75 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
76 set mouse=a term=xterm |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
77 call setline(1, range(1, 100)) |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
78 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
79 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
80 let msg = 'ttymouse=' .. ttymouse_val |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
81 exe 'set ttymouse=' . ttymouse_val |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
82 go |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
83 call assert_equal(1, line('w0'), msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
84 call assert_equal([0, 1, 1, 0], getpos('.'), msg) |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
85 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
86 call MouseWheelDown(1, 1) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
87 call assert_equal(4, line('w0'), msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
88 call assert_equal([0, 4, 1, 0], getpos('.'), msg) |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
89 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
90 call MouseWheelDown(1, 1) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
91 call assert_equal(7, line('w0'), msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
92 call assert_equal([0, 7, 1, 0], getpos('.'), msg) |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
93 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
94 call MouseWheelUp(1, 1) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
95 call assert_equal(4, line('w0'), msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
96 call assert_equal([0, 7, 1, 0], getpos('.'), msg) |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
97 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
98 call MouseWheelUp(1, 1) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
99 call assert_equal(1, line('w0'), msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
100 call assert_equal([0, 7, 1, 0], getpos('.'), msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
101 endfor |
16265
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
102 |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
103 let &mouse = save_mouse |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
104 let &term = save_term |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
105 let &ttymouse = save_ttymouse |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
106 bwipe! |
7feb5b90be5f
patch 8.1.1137: xterm mouse wheel escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16263
diff
changeset
|
107 endfunc |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
108 |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
109 func Test_xterm_mouse_drag_window_separator() |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
110 let save_mouse = &mouse |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
111 let save_term = &term |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
112 let save_ttymouse = &ttymouse |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
113 set mouse=a term=xterm |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
114 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
115 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
116 let msg = 'ttymouse=' .. ttymouse_val |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
117 exe 'set ttymouse=' . ttymouse_val |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
118 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
119 " Split horizontally and test dragging the horizontal window separator. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
120 split |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
121 let rowseparator = winheight(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
122 let row = rowseparator |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
123 let col = 1 |
16310
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
124 |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
125 " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
126 if ttymouse_val !=# 'xterm' || row <= 223 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
127 call MouseLeftClick(row, col) |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
128 let row -= 1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
129 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
130 call assert_equal(rowseparator - 1, winheight(0) + 1, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
131 let row += 1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
132 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
133 call assert_equal(rowseparator, winheight(0) + 1, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
134 call MouseLeftRelease(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
135 call assert_equal(rowseparator, winheight(0) + 1, msg) |
16310
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
136 endif |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
137 bwipe! |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
138 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
139 " Split vertically and test dragging the vertical window separator. |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
140 vsplit |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
141 let colseparator = winwidth(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
142 let row = 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
143 let col = colseparator |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
144 |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
145 " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
146 if ttymouse_val !=# 'xterm' || col <= 223 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
147 call MouseLeftClick(row, col) |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
148 let col -= 1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
149 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
150 call assert_equal(colseparator - 1, winwidth(0) + 1, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
151 let col += 1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
152 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
153 call assert_equal(colseparator, winwidth(0) + 1, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
154 call MouseLeftRelease(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
155 call assert_equal(colseparator, winwidth(0) + 1, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
156 endif |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
157 bwipe! |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
158 endfor |
16275
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
159 |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
160 let &mouse = save_mouse |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
161 let &term = save_term |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
162 let &ttymouse = save_ttymouse |
ed5172ae1c32
patch 8.1.1142: no test for dragging the window separators with the mouse
Bram Moolenaar <Bram@vim.org>
parents:
16265
diff
changeset
|
163 endfunc |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
164 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
165 func Test_xterm_mouse_drag_statusline() |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
166 let save_mouse = &mouse |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
167 let save_term = &term |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
168 let save_ttymouse = &ttymouse |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
169 let save_laststatus = &laststatus |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
170 set mouse=a term=xterm laststatus=2 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
171 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
172 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
173 let msg = 'ttymouse=' .. ttymouse_val |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
174 exe 'set ttymouse=' . ttymouse_val |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
175 |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
176 call assert_equal(1, &cmdheight, msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
177 let rowstatusline = winheight(0) + 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
178 let row = rowstatusline |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
179 let col = 1 |
16310
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
180 |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
181 if ttymouse_val ==# 'xterm' && row > 223 |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
182 " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
183 continue |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
184 endif |
5b8b849dc3aa
patch 8.1.1160: termcodes test would fail in a very big terminal
Bram Moolenaar <Bram@vim.org>
parents:
16300
diff
changeset
|
185 |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
186 call MouseLeftClick(row, col) |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
187 let row -= 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
188 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
189 call assert_equal(2, &cmdheight, msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
190 call assert_equal(rowstatusline - 1, winheight(0) + 1, msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
191 let row += 1 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
192 call MouseLeftDrag(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
193 call assert_equal(1, &cmdheight, msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
194 call assert_equal(rowstatusline, winheight(0) + 1, msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
195 call MouseLeftRelease(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
196 call assert_equal(1, &cmdheight, msg) |
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
197 call assert_equal(rowstatusline, winheight(0) + 1, msg) |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
198 endfor |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
199 |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
200 let &mouse = save_mouse |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
201 let &term = save_term |
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
202 let &ttymouse = save_ttymouse |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
203 let &laststatus = save_laststatus |
16300
f3d579f009d1
patch 8.1.1155: termcodes tests can be improved
Bram Moolenaar <Bram@vim.org>
parents:
16275
diff
changeset
|
204 endfunc |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
205 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
206 func Test_xterm_mouse_click_tab() |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
207 let save_mouse = &mouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
208 let save_term = &term |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
209 let save_ttymouse = &ttymouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
210 set mouse=a term=xterm |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
211 let row = 1 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
212 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
213 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
214 let msg = 'ttymouse=' .. ttymouse_val |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
215 exe 'set ttymouse=' . ttymouse_val |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
216 e Xfoo |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
217 tabnew Xbar |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
218 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
219 let a = split(execute(':tabs'), "\n") |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
220 call assert_equal(['Tab page 1', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
221 \ ' Xfoo', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
222 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
223 \ '> Xbar'], a, msg) |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
224 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
225 " Test clicking on tab names in the tabline at the top. |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
226 let col = 2 |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
227 redraw |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
228 call MouseLeftClick(row, col) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
229 call MouseLeftRelease(row, col) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
230 let a = split(execute(':tabs'), "\n") |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
231 call assert_equal(['Tab page 1', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
232 \ '> Xfoo', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
233 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
234 \ ' Xbar'], a, msg) |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
235 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
236 let col = 9 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
237 call MouseLeftClick(row, col) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
238 call MouseLeftRelease(row, col) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
239 let a = split(execute(':tabs'), "\n") |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
240 call assert_equal(['Tab page 1', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
241 \ ' Xfoo', |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
242 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
243 \ '> Xbar'], a, msg) |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
244 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
245 %bwipe! |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
246 endfor |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
247 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
248 let &mouse = save_mouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
249 let &term = save_term |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
250 let &ttymouse = save_ttymouse |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16310
diff
changeset
|
251 endfunc |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
252 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
253 func Test_xterm_mouse_click_X_to_close_tab() |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
254 let save_mouse = &mouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
255 let save_term = &term |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
256 let save_ttymouse = &ttymouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
257 set mouse=a term=xterm |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
258 let row = 1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
259 let col = &columns |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
260 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
261 for ttymouse_val in ['xterm', 'sgr'] |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
262 if ttymouse_val ==# 'xterm' && col > 223 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
263 " When 'ttymouse' is 'xterm', row/col bigger than 223 are not supported. |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
264 continue |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
265 endif |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
266 let msg = 'ttymouse=' .. ttymouse_val |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
267 exe 'set ttymouse=' . ttymouse_val |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
268 e Xtab1 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
269 tabnew Xtab2 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
270 tabnew Xtab3 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
271 tabn 2 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
272 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
273 let a = split(execute(':tabs'), "\n") |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
274 call assert_equal(['Tab page 1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
275 \ ' Xtab1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
276 \ 'Tab page 2', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
277 \ '> Xtab2', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
278 \ 'Tab page 3', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
279 \ ' Xtab3'], a, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
280 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
281 " Click on "X" in tabline to close current tab i.e. Xtab2. |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
282 redraw |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
283 call MouseLeftClick(row, col) |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
284 call MouseLeftRelease(row, col) |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
285 let a = split(execute(':tabs'), "\n") |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
286 call assert_equal(['Tab page 1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
287 \ ' Xtab1', |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
288 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
289 \ '> Xtab3'], a, msg) |
16324
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
290 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
291 %bwipe! |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
292 endfor |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
293 |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
294 let &mouse = save_mouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
295 let &term = save_term |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
296 let &ttymouse = save_ttymouse |
6b2412d0509f
patch 8.1.1167: no test for closing tab by click in tabline
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
297 endfunc |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
298 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
299 func Test_xterm_mouse_drag_to_move_tab() |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
300 let save_mouse = &mouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
301 let save_term = &term |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
302 let save_ttymouse = &ttymouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
303 " Set 'mousetime' to 1 to avoid recognizing a double-click in the loop |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
304 set mouse=a term=xterm mousetime=1 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
305 let row = 1 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
306 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
307 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
308 let msg = 'ttymouse=' .. ttymouse_val |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
309 exe 'set ttymouse=' . ttymouse_val |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
310 e Xtab1 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
311 tabnew Xtab2 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
312 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
313 let a = split(execute(':tabs'), "\n") |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
314 call assert_equal(['Tab page 1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
315 \ ' Xtab1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
316 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
317 \ '> Xtab2'], a, msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
318 redraw |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
319 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
320 " Click in tab2 and drag it to tab1. |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
321 " Check getcharmod() to verify that click is not |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
322 " interpreted as a spurious double-click. |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
323 call MouseLeftClick(row, 10) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
324 call assert_equal(0, getcharmod(), msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
325 for col in [9, 8, 7, 6] |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
326 call MouseLeftDrag(row, col) |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
327 endfor |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
328 call MouseLeftRelease(row, col) |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
329 let a = split(execute(':tabs'), "\n") |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
330 call assert_equal(['Tab page 1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
331 \ '> Xtab2', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
332 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
333 \ ' Xtab1'], a, msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
334 |
16342
06f3eb443e93
patch 8.1.1176: test for dragging a tab is flaky
Bram Moolenaar <Bram@vim.org>
parents:
16340
diff
changeset
|
335 " brief sleep to avoid causing a double-click |
06f3eb443e93
patch 8.1.1176: test for dragging a tab is flaky
Bram Moolenaar <Bram@vim.org>
parents:
16340
diff
changeset
|
336 sleep 20m |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
337 %bwipe! |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
338 endfor |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
339 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
340 let &mouse = save_mouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
341 let &term = save_term |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
342 let &ttymouse = save_ttymouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
343 set mousetime& |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
344 endfunc |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
345 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
346 func Test_xterm_mouse_double_click_to_create_tab() |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
347 let save_mouse = &mouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
348 let save_term = &term |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
349 let save_ttymouse = &ttymouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
350 " Set 'mousetime' to a small value, so that double-click works but we don't |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
351 " have to wait long to avoid a triple-click. |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
352 set mouse=a term=xterm mousetime=100 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
353 let row = 1 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
354 let col = 10 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
355 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
356 for ttymouse_val in ['xterm', 'sgr'] |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
357 let msg = 'ttymouse=' .. ttymouse_val |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
358 exe 'set ttymouse=' . ttymouse_val |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
359 e Xtab1 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
360 tabnew Xtab2 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
361 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
362 let a = split(execute(':tabs'), "\n") |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
363 call assert_equal(['Tab page 1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
364 \ ' Xtab1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
365 \ 'Tab page 2', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
366 \ '> Xtab2'], a, msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
367 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
368 redraw |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
369 call MouseLeftClick(row, col) |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
370 " Check getcharmod() to verify that first click is not |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
371 " interpreted as a spurious double-click. |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
372 call assert_equal(0, getcharmod(), msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
373 call MouseLeftRelease(row, col) |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
374 call MouseLeftClick(row, col) |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
375 call assert_equal(32, getcharmod(), msg) " double-click |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
376 call MouseLeftRelease(row, col) |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
377 let a = split(execute(':tabs'), "\n") |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
378 call assert_equal(['Tab page 1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
379 \ ' Xtab1', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
380 \ 'Tab page 2', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
381 \ '> [No Name]', |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
382 \ 'Tab page 3', |
16346
2fb516abde42
patch 8.1.1178: when mouse click tests fails value of 'ttytype' is unknown
Bram Moolenaar <Bram@vim.org>
parents:
16342
diff
changeset
|
383 \ ' Xtab2'], a, msg) |
16340
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
384 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
385 if ttymouse_val !=# 'sgr' |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
386 " We need to sleep, or else MouseLeftClick() in next loop |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
387 " iteration will be interpreted as a spurious triple-click. |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
388 sleep 100m |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
389 endif |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
390 %bwipe! |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
391 endfor |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
392 |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
393 let &mouse = save_mouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
394 let &term = save_term |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
395 let &ttymouse = save_ttymouse |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
396 set mousetime& |
2f70fc41ff7e
patch 8.1.1175: no test for dragging a tab and double click for new tab
Bram Moolenaar <Bram@vim.org>
parents:
16324
diff
changeset
|
397 endfunc |