comparison src/testdir/test_gui.vim @ 11050:622ed5a4925f v8.0.0414

patch 8.0.0414: balloon eval is not tested commit https://github.com/vim/vim/commit/d5841f28d4b041830af0f3314979f9b9093d1a77 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 5 13:27:25 2017 +0100 patch 8.0.0414: balloon eval is not tested Problem: Balloon eval is not tested. Solution: Add a few balloon tests. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Sun, 05 Mar 2017 13:30:04 +0100
parents 4df1647531a6
children 975f54a391ec
comparison
equal deleted inserted replaced
11049:9ceae23969d4 11050:622ed5a4925f
18 " Must be run first. 18 " Must be run first.
19 func Test_1_set_secure() 19 func Test_1_set_secure()
20 set exrc secure 20 set exrc secure
21 gui -f 21 gui -f
22 call assert_equal(1, has('gui_running')) 22 call assert_equal(1, has('gui_running'))
23 endfunc
24
25 " As for non-GUI, a balloon_show() test was already added with patch 8.0.0401
26 func Test_balloon_show()
27 if has('balloon_eval')
28 " This won't do anything but must not crash either.
29 call balloon_show('hi!')
30 endif
23 endfunc 31 endfunc
24 32
25 func Test_getfontname_with_arg() 33 func Test_getfontname_with_arg()
26 let skipped = '' 34 let skipped = ''
27 35
113 endif 121 endif
114 122
115 if !empty(skipped) 123 if !empty(skipped)
116 throw skipped 124 throw skipped
117 endif 125 endif
126 endfunc
127
128 func Test_set_balloondelay()
129 if !exists('+balloondelay')
130 return
131 endif
132
133 let balloondelay_saved = &balloondelay
134
135 " Check if the default value is identical to that described in the manual.
136 set balloondelay&
137 call assert_equal(600, &balloondelay)
138
139 " Edge cases
140
141 " XXX This fact should be hidden so that people won't be tempted to write
142 " plugin/TimeMachine.vim. TODO Add reasonable range checks to the source
143 " code.
144 set balloondelay=-1
145 call assert_equal(-1, &balloondelay)
146
147 " Though it's possible to interpret the zero delay to be 'as soon as
148 " possible' or even 'indefinite', its actual meaning depends on the GUI
149 " toolkit in use after all.
150 set balloondelay=0
151 call assert_equal(0, &balloondelay)
152
153 set balloondelay=1
154 call assert_equal(1, &balloondelay)
155
156 " Since p_bdelay is of type long currently, the upper bound can be
157 " impractically huge and machine-dependent. Practically, it's sufficient
158 " to check if balloondelay works with 0xffffffff (32 bits) for now.
159 set balloondelay=4294967295
160 call assert_equal(4294967295, &balloondelay)
161
162 let &balloondelay = balloondelay_saved
163 endfunc
164
165 func Test_set_ballooneval()
166 if !exists('+ballooneval')
167 return
168 endif
169
170 let ballooneval_saved = &ballooneval
171
172 set ballooneval&
173 call assert_equal(0, &ballooneval)
174
175 set ballooneval
176 call assert_notequal(0, &ballooneval)
177
178 set noballooneval
179 call assert_equal(0, &ballooneval)
180
181 let &ballooneval = ballooneval_saved
182 endfunc
183
184 func Test_set_balloonexpr()
185 if !exists('+balloonexpr')
186 return
187 endif
188
189 let balloonexpr_saved = &balloonexpr
190
191 " Default value
192 set balloonexpr&
193 call assert_equal('', &balloonexpr)
194
195 " User-defined function
196 new
197 func MyBalloonExpr()
198 return 'Cursor is at line ' . v:beval_lnum .
199 \', column ' . v:beval_col .
200 \ ' of file ' . bufname(v:beval_bufnr) .
201 \ ' on word "' . v:beval_text . '"' .
202 \ ' in window ' . v:beval_winid . ' (#' . v:beval_winnr . ')'
203 endfunc
204 setl balloonexpr=MyBalloonExpr()
205 setl ballooneval
206 call assert_equal('MyBalloonExpr()', &balloonexpr)
207 " TODO Read non-empty text, place the pointer at a character of a word,
208 " and check if the content of the balloon is the smae as what is expected.
209 " Also, check if textlock works as expected.
210 setl balloonexpr&
211 call assert_equal('', &balloonexpr)
212 delfunc MyBalloonExpr
213 bwipe!
214
215 " Multiline support
216 if has('balloon_multiline')
217 " Multiline balloon using NL
218 new
219 func MyBalloonFuncForMultilineUsingNL()
220 return "Multiline\nSuppported\nBalloon\nusing NL"
221 endfunc
222 setl balloonexpr=MyBalloonFuncForMultilineUsingNL()
223 setl ballooneval
224 call assert_equal('MyBalloonFuncForMultilineUsingNL()', &balloonexpr)
225 " TODO Read non-empty text, place the pointer at a character of a word,
226 " and check if the content of the balloon is the smae as what is
227 " expected. Also, check if textlock works as expected.
228 setl balloonexpr&
229 delfunc MyBalloonFuncForMultilineUsingNL
230 bwipe!
231
232 " Multiline balloon using List
233 new
234 func MyBalloonFuncForMultilineUsingList()
235 return [ 'Multiline', 'Suppported', 'Balloon', 'using List' ]
236 endfunc
237 setl balloonexpr=MyBalloonFuncForMultilineUsingList()
238 setl ballooneval
239 call assert_equal('MyBalloonFuncForMultilineUsingList()', &balloonexpr)
240 " TODO Read non-empty text, place the pointer at a character of a word,
241 " and check if the content of the balloon is the smae as what is
242 " expected. Also, check if textlock works as expected.
243 setl balloonexpr&
244 delfunc MyBalloonFuncForMultilineUsingList
245 bwipe!
246 endif
247
248 let &balloonexpr = balloonexpr_saved
118 endfunc 249 endfunc
119 250
120 func Test_set_guifont() 251 func Test_set_guifont()
121 let skipped = '' 252 let skipped = ''
122 253