comparison src/testdir/test_gui.vim @ 27400:722db0819111 v8.2.4228

patch 8.2.4228: no tests for clicking in the GUI tabline Commit: https://github.com/vim/vim/commit/b0ad2d92fd19e673ddbbc66742bae3f71778efde Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Jan 27 13:16:59 2022 +0000 patch 8.2.4228: no tests for clicking in the GUI tabline Problem: No tests for clicking in the GUI tabline. Solution: Add test functions to generate the events. Add tests using the functions. (Yegappan Lakshmanan, closes #9638)
author Bram Moolenaar <Bram@vim.org>
date Thu, 27 Jan 2022 14:30:04 +0100
parents c2c40cefc17b
children b43f6c879d52
comparison
equal deleted inserted replaced
27399:53c64ca1c4f3 27400:722db0819111
1264 call feedkeys('k', 'Lx!') 1264 call feedkeys('k', 'Lx!')
1265 call assert_equal('"a.c b.c', @:) 1265 call assert_equal('"a.c b.c', @:)
1266 cunmap <buffer> <F4> 1266 cunmap <buffer> <F4>
1267 endfunc 1267 endfunc
1268 1268
1269 " Test for generating a GUI tabline event to select a tab page
1270 func Test_gui_tabline_event()
1271 %bw!
1272 edit Xfile1
1273 tabedit Xfile2
1274 tabedit Xfile3
1275
1276 tabfirst
1277 call assert_equal(v:true, test_gui_tabline_event(2))
1278 call feedkeys("y", "Lx!")
1279 call assert_equal(2, tabpagenr())
1280 call assert_equal(v:true, test_gui_tabline_event(3))
1281 call feedkeys("y", "Lx!")
1282 call assert_equal(3, tabpagenr())
1283 call assert_equal(v:false, test_gui_tabline_event(3))
1284
1285 " From the cmdline window, tabline event should not be handled
1286 call feedkeys("q::let t = test_gui_tabline_event(2)\<CR>:q\<CR>", 'x!')
1287 call assert_equal(v:false, t)
1288
1289 %bw!
1290 endfunc
1291
1292 " Test for generating a GUI tabline menu event to execute an action
1293 func Test_gui_tabmenu_event()
1294 %bw!
1295
1296 " Try to close the last tab page
1297 call test_gui_tabmenu_event(1, 1)
1298 call feedkeys("y", "Lx!")
1299
1300 edit Xfile1
1301 tabedit Xfile2
1302 call test_gui_tabmenu_event(1, 1)
1303 call feedkeys("y", "Lx!")
1304 call assert_equal(1, tabpagenr('$'))
1305 call assert_equal('Xfile2', bufname())
1306
1307 call test_gui_tabmenu_event(1, 2)
1308 call feedkeys("y", "Lx!")
1309 call assert_equal(2, tabpagenr('$'))
1310
1311 " If tabnr is 0, then the current tabpage should be used.
1312 call test_gui_tabmenu_event(0, 2)
1313 call feedkeys("y", "Lx!")
1314 call assert_equal(3, tabpagenr('$'))
1315 call test_gui_tabmenu_event(0, 1)
1316 call feedkeys("y", "Lx!")
1317 call assert_equal(2, tabpagenr('$'))
1318
1319 %bw!
1320 endfunc
1321
1269 " vim: shiftwidth=2 sts=2 expandtab 1322 " vim: shiftwidth=2 sts=2 expandtab