annotate src/testdir/test_balloon.vim @ 18447:d978101d8bfd

Added tag v8.1.2217 for changeset b026f4524f25f5c4dfeff7159cf4aa3225c09cc1
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Oct 2019 12:30:07 +0200
parents 0da9bc55c31a
children 81272918c0ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for 'balloonevalterm'.
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
2 " A few tests only work in the terminal.
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
4 source check.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17282
diff changeset
5 CheckNotGui
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
6 CheckFeature balloon_eval_term
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 source screendump.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17282
diff changeset
9 CheckScreendump
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
11 let s:common_script =<< trim [CODE]
16720
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
12 call setline(1, ["one one one", "two tXo two", "three three three"])
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
13 set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
14 func MyBalloonExpr()
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
15 return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
16 endfun
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
17 redraw
9c90cf08cfa8 patch 8.1.1362: code and data in tests can be hard to read
Bram Moolenaar <Bram@vim.org>
parents: 16600
diff changeset
18 [CODE]
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
19
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
20 func Test_balloon_eval_term()
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
21 " Use <Ignore> after <MouseMove> to return from vgetc() without removing
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
22 " the balloon.
17282
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
23 let xtra_lines =<< trim [CODE]
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
24 set updatetime=300
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
25 au CursorHold * echo 'hold fired'
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
26 func Trigger()
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
27 call test_setmouse(2, 6)
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
28 call feedkeys("\<MouseMove>\<Ignore>", "xt")
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
29 endfunc
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
30 [CODE]
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
31 call writefile(s:common_script + xtra_lines, 'XTest_beval')
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
33 " Check that the balloon shows up after a mouse move
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 let buf = RunVimInTerminal('-S XTest_beval', {'rows': 10, 'cols': 50})
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 call term_wait(buf, 100)
17282
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
36 call term_sendkeys(buf, 'll')
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
37 call term_sendkeys(buf, ":call Trigger()\<CR>")
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 call VerifyScreenDump(buf, 'Test_balloon_eval_term_01', {})
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
17282
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
40 " Make sure the balloon still shows after 'updatetime' passed and CursorHold
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
41 " was triggered.
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
42 call term_wait(buf, 300)
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
43 call VerifyScreenDump(buf, 'Test_balloon_eval_term_01a', {})
6f1679e1082d patch 8.1.1640: the CursorHold autocommand takes down a balloon
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
44
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 " clean up
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 call StopVimInTerminal(buf)
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 call delete('XTest_beval')
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 endfunc
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
49
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
50 func Test_balloon_eval_term_visual()
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
51 " Use <Ignore> after <MouseMove> to return from vgetc() without removing
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
52 " the balloon.
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
53 call writefile(s:common_script + [
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
54 \ 'call test_setmouse(3, 6)',
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
55 \ 'call feedkeys("3Gevfr\<MouseMove>\<Ignore>", "xt")',
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
56 \ ], 'XTest_beval_visual')
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
57
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
58 " Check that the balloon shows up after a mouse move
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
59 let buf = RunVimInTerminal('-S XTest_beval_visual', {'rows': 10, 'cols': 50})
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
60 call term_wait(buf, 100)
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
61 call VerifyScreenDump(buf, 'Test_balloon_eval_term_02', {})
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
62
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
63 " clean up
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
64 call StopVimInTerminal(buf)
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
65 call delete('XTest_beval_visual')
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
66 endfunc