comparison src/testdir/test_popupwin.vim @ 16841:cf630fab9fb6 v8.1.1422

patch 8.1.1422: popup_getoptions() not implemented yet commit https://github.com/vim/vim/commit/8c2a600f72ca930841a5f4f7eac22884238afaf3 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 30 14:29:45 2019 +0200 patch 8.1.1422: popup_getoptions() not implemented yet Problem: Popup_getoptions() not implemented yet. Solution: Implement it. (closes https://github.com/vim/vim/issues/4452)
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 May 2019 14:30:07 +0200
parents 032d5335987e
children 283037126560
comparison
equal deleted inserted replaced
16840:e9db83da71f5 16841:cf630fab9fb6
106 \ 'minwidth': 20, 106 \ 'minwidth': 20,
107 \}) 107 \})
108 redraw 108 redraw
109 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') 109 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
110 call assert_equal('world', line) 110 call assert_equal('world', line)
111 call assert_equal(1, popup_getposition(winid).visible)
111 112
112 call popup_hide(winid) 113 call popup_hide(winid)
113 redraw 114 redraw
114 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') 115 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
115 call assert_equal('hello', line) 116 call assert_equal('hello', line)
117 call assert_equal(0, popup_getposition(winid).visible)
116 118
117 call popup_show(winid) 119 call popup_show(winid)
118 redraw 120 redraw
119 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') 121 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
120 call assert_equal('world', line) 122 call assert_equal('world', line)
123 call assert_equal(1, popup_getposition(winid).visible)
121 124
122 125
123 call popup_close(winid) 126 call popup_close(winid)
124 redraw 127 redraw
125 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '') 128 let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
176 let res = popup_getposition(winid) 179 let res = popup_getposition(winid)
177 call assert_equal(2, res.line) 180 call assert_equal(2, res.line)
178 call assert_equal(3, res.col) 181 call assert_equal(3, res.col)
179 call assert_equal(10, res.width) 182 call assert_equal(10, res.width)
180 call assert_equal(11, res.height) 183 call assert_equal(11, res.height)
184 call assert_equal(1, res.visible)
181 185
182 call popup_close(winid) 186 call popup_close(winid)
183 endfunc 187 endfunc
184 188
185 func Test_popup_width_longest() 189 func Test_popup_width_longest()
213 let position = popup_getposition(winid) 217 let position = popup_getposition(winid)
214 call assert_equal(test[1], position.width) 218 call assert_equal(test[1], position.width)
215 call assert_equal(test[2], position.height) 219 call assert_equal(test[2], position.height)
216 220
217 call popup_close(winid) 221 call popup_close(winid)
222 call assert_equal({}, popup_getposition(winid))
218 endfor 223 endfor
219 endfunc 224 endfunc
225
226 func Test_popup_getoptions()
227 let winid = popup_create('hello', {
228 \ 'line': 2,
229 \ 'col': 3,
230 \ 'minwidth': 10,
231 \ 'minheight': 11,
232 \ 'maxwidth': 20,
233 \ 'maxheight': 21,
234 \ 'zindex': 100,
235 \ 'time': 5000,
236 \})
237 redraw
238 let res = popup_getoptions(winid)
239 call assert_equal(2, res.line)
240 call assert_equal(3, res.col)
241 call assert_equal(10, res.minwidth)
242 call assert_equal(11, res.minheight)
243 call assert_equal(20, res.maxwidth)
244 call assert_equal(21, res.maxheight)
245 call assert_equal(100, res.zindex)
246 if has('timers')
247 call assert_equal(5000, res.time)
248 endif
249 call popup_close(winid)
250
251 let winid = popup_create('hello', {})
252 redraw
253 let res = popup_getoptions(winid)
254 call assert_equal(0, res.line)
255 call assert_equal(0, res.col)
256 call assert_equal(0, res.minwidth)
257 call assert_equal(0, res.minheight)
258 call assert_equal(0, res.maxwidth)
259 call assert_equal(0, res.maxheight)
260 call assert_equal(50, res.zindex)
261 if has('timers')
262 call assert_equal(0, res.time)
263 endif
264 call popup_close(winid)
265 call assert_equal({}, popup_getoptions(winid))
266 endfunc