annotate src/testdir/test_balloon.vim @ 16600:ff3c99bd1038 v8.1.1303

patch 8.1.1303: not possible to hide a balloon commit https://github.com/vim/vim/commit/be0a2597ae0d9eb0b8a8a2fc9ae1784faa929844 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 9 13:50:16 2019 +0200 patch 8.1.1303: not possible to hide a balloon Problem: Not possible to hide a balloon. Solution: Hide the balloon when balloon_show() is called with an empty string or list. Add balloon_gettext().
author Bram Moolenaar <Bram@vim.org>
date Thu, 09 May 2019 14:00:07 +0200
parents fd0d29d63b85
children 9c90cf08cfa8
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'.
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
16600
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
3 " Tests that only work in the terminal.
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
4 if has('balloon_eval_term') && !has('gui_running')
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 source screendump.vim
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 if !CanRunVimInTerminal()
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 finish
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 endif
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
11 let s:common_script = [
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 \ 'call setline(1, ["one one one", "two tXo two", "three three three"])',
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 \ 'set balloonevalterm balloonexpr=MyBalloonExpr() balloondelay=100',
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 \ 'func MyBalloonExpr()',
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
15 \ ' return "line " .. v:beval_lnum .. " column " .. v:beval_col .. ": " .. v:beval_text',
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 \ 'endfun',
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 \ 'redraw',
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
18 \ ]
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.
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
23 call writefile(s:common_script + [
16594
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 \ 'call test_setmouse(2, 6)',
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 \ 'call feedkeys("\<MouseMove>\<Ignore>", "xt")',
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \ ], 'XTest_beval')
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
16598
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
28 " 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
29 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
30 call term_wait(buf, 100)
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 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
32
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " clean up
6f52e82d9d4e patch 8.1.1300: in a terminal 'ballooneval' does not work right away
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 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
35 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
36 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
37
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
38 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
39 " 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
40 " 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
41 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
42 \ '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
43 \ '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
44 \ ], '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
45
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
46 " 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
47 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
48 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
49 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
50
fd0d29d63b85 patch 8.1.1302: v:beval_text is not tested in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 16594
diff changeset
51 " 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
52 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
53 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
54 endfunc
16600
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
55
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
56 endif
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
57
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
58 " Tests that only work in the GUI
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
59 if has('gui_running')
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
60
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
61 func Test_balloon_show_gui()
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
62 let msg = 'this this this this'
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
63 call balloon_show(msg)
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
64 call assert_equal(msg, balloon_gettext())
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
65 sleep 10m
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
66 call balloon_show('')
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
67
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
68 let msg = 'that that'
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
69 call balloon_show(msg)
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
70 call assert_equal(msg, balloon_gettext())
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
71 sleep 10m
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
72 call balloon_show('')
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
73 endfunc
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
74
ff3c99bd1038 patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents: 16598
diff changeset
75 endif