annotate src/testdir/test_winbar.vim @ 23217:0e4b3e7010df v8.2.2154

patch 8.2.2154: popupwin test for terminal buffer fails sometimes Commit: https://github.com/vim/vim/commit/0353f56ddb379e7f1a68172fa4743355e04df21e Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 17 22:27:38 2020 +0100 patch 8.2.2154: popupwin test for terminal buffer fails sometimes Problem: Popupwin test for terminal buffer fails sometimes. Solution: Wait for the prompt to appear.
author Bram Moolenaar <Bram@vim.org>
date Thu, 17 Dec 2020 22:30:04 +0100
parents ff21e2962490
children 6062e10a7e72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test WinBar
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature menu
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
16525
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
6 source shared.vim
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
7
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 func Test_add_remove_menu()
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 new
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
16525
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
12 redraw
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
13 call assert_match('Next Cont', Screenline(1))
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
14
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 emenu WinBar.Next
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal(11, g:did_next)
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 emenu WinBar.Cont
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 call assert_equal(12, g:did_cont)
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 wincmd w
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
21 call assert_fails('emenu WinBar.Next', 'E334:')
12487
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 wincmd p
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 aunmenu WinBar.Next
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 aunmenu WinBar.Cont
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 close
3f16cf18386c patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 endfunc
16519
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
28
16537
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
29 " Create a WinBar with three buttons.
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
30 " Columns of the button edges:
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
31 " _Next_ _Cont_ _Close_
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
32 " 2 7 10 15 18 24
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
33 func SetupWinbar()
16519
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
34 amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
35 amenu 1.20 WinBar.Cont :let g:did_cont = 12<CR>
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
36 amenu 1.30 WinBar.Close :close<CR>
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
37 redraw
16525
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
38 call assert_match('Next Cont Close', Screenline(1))
16537
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
39 endfunc
16519
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
40
16537
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
41 func Test_click_in_winbar()
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
42 new
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
43 call SetupWinbar()
16519
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
44 let save_mouse = &mouse
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
45 set mouse=a
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
46
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
47 let g:did_next = 0
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
48 let g:did_cont = 0
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
49 for col in [1, 8, 9, 16, 17, 25, 26]
16525
1bf49cd87e6b patch 8.1.1266: winbar test doesn't test enough
Bram Moolenaar <Bram@vim.org>
parents: 16519
diff changeset
50 call test_setmouse(1, col)
16519
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
51 call feedkeys("\<LeftMouse>", "xt")
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
52 call assert_equal(0, g:did_next, 'col ' .. col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
53 call assert_equal(0, g:did_cont, 'col ' .. col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
54 endfor
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
55
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
56 for col in range(2, 7)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
57 let g:did_next = 0
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
58 call test_setmouse(1, col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
59 call feedkeys("\<LeftMouse>", "xt")
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
60 call assert_equal(11, g:did_next, 'col ' .. col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
61 endfor
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
62
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
63 for col in range(10, 15)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
64 let g:did_cont = 0
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
65 call test_setmouse(1, col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
66 call feedkeys("\<LeftMouse>", "xt")
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
67 call assert_equal(12, g:did_cont, 'col ' .. col)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
68 endfor
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
69
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
70 let wincount = winnr('$')
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
71 call test_setmouse(1, 20)
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
72 call feedkeys("\<LeftMouse>", "xt")
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
73 call assert_equal(wincount - 1, winnr('$'))
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
74
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
75 let &mouse = save_mouse
a147acab726f patch 8.1.1263: mouse clicks in WinBar not tested
Bram Moolenaar <Bram@vim.org>
parents: 12487
diff changeset
76 endfunc
16537
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
77
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
78 func Test_click_in_other_winbar()
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
79 new
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
80 call SetupWinbar()
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
81 let save_mouse = &mouse
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
82 set mouse=a
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
83 let winid = win_getid()
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
84
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
85 split
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
86 let [row, col] = win_screenpos(winid)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
87
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
88 " Click on Next button in other window
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
89 let g:did_next = 0
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
90 call test_setmouse(row, 5)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
91 call feedkeys("\<LeftMouse>", "xt")
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
92 call assert_equal(11, g:did_next)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
93
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
94 " Click on Cont button in other window from Visual mode
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
95 let g:did_cont = 0
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
96 call setline(1, 'select XYZ here')
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
97 call test_setmouse(row, 12)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
98 call feedkeys("0fXvfZ\<LeftMouse>x", "xt")
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
99 call assert_equal(12, g:did_cont)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
100 call assert_equal('select here', getline(1))
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
101
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
102 " Click on Close button in other window
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
103 let wincount = winnr('$')
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
104 let winid = win_getid()
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
105 call test_setmouse(row, 20)
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
106 call feedkeys("\<LeftMouse>", "xt")
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
107 call assert_equal(wincount - 1, winnr('$'))
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
108 call assert_equal(winid, win_getid())
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
109
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
110 bwipe!
d9f659007109 patch 8.1.1272: click on WinBar of other window not tested
Bram Moolenaar <Bram@vim.org>
parents: 16525
diff changeset
111 endfunc
16910
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
112
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
113 func Test_redraw_after_scroll()
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
114 new
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
115 amenu 1.10 WinBar.Next :let g:did_next = 11<CR>
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
116 redraw
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
117 call assert_equal(" Next", Screenline(1))
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
118 echo "some\nmore"
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
119 redraw
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
120 call assert_equal(" Next", Screenline(1))
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
121 bwipe!
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
122 endfunc
6a99709c6ae3 patch 8.1.1456: WinBar not redrawn after scrolling one line
Bram Moolenaar <Bram@vim.org>
parents: 16537
diff changeset
123
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
124 " vim: shiftwidth=2 sts=2 expandtab