Mercurial > vim
comparison src/testdir/test_popupwin.vim @ 20386:3b3589275ab9 v8.2.0748
patch 8.2.0748: cannot get a list of all popups
Commit: https://github.com/vim/vim/commit/ef6b979bfae82f64781d8b0ce0194c57111243d4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 13 16:34:15 2020 +0200
patch 8.2.0748: cannot get a list of all popups
Problem: Cannot get a list of all popups.
Solution: Add popup_list(). Use it in the test runner.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 13 May 2020 16:45:05 +0200 |
parents | b790d00d5ccb |
children | 8216bfb88709 |
comparison
equal
deleted
inserted
replaced
20385:3613c433a314 | 20386:3b3589275ab9 |
---|---|
426 " clean up | 426 " clean up |
427 call StopVimInTerminal(buf) | 427 call StopVimInTerminal(buf) |
428 call delete('XtestPopupNospace') | 428 call delete('XtestPopupNospace') |
429 endfunc | 429 endfunc |
430 | 430 |
431 func Test_popup_firstline() | 431 func Test_popup_firstline_dump() |
432 CheckScreendump | 432 CheckScreendump |
433 | 433 |
434 let lines =<< trim END | 434 let lines =<< trim END |
435 call setline(1, range(1, 20)) | 435 call setline(1, range(1, 20)) |
436 let winid = popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], #{ | 436 let winid = popup_create(['1111', '222222', '33333', '44', '5', '666666', '77777', '888', '9999999999999999'], #{ |
447 call VerifyScreenDump(buf, 'Test_popupwin_firstline_2', {}) | 447 call VerifyScreenDump(buf, 'Test_popupwin_firstline_2', {}) |
448 | 448 |
449 " clean up | 449 " clean up |
450 call StopVimInTerminal(buf) | 450 call StopVimInTerminal(buf) |
451 call delete('XtestPopupFirstline') | 451 call delete('XtestPopupFirstline') |
452 | 452 endfunc |
453 | |
454 func Test_popup_firstline() | |
453 let winid = popup_create(['1111', '222222', '33333', '44444'], #{ | 455 let winid = popup_create(['1111', '222222', '33333', '44444'], #{ |
454 \ maxheight: 2, | 456 \ maxheight: 2, |
455 \ firstline: 3, | 457 \ firstline: 3, |
456 \ }) | 458 \ }) |
457 call assert_equal(3, popup_getoptions(winid).firstline) | 459 call assert_equal(3, popup_getoptions(winid).firstline) |
489 | 491 |
490 " Making some property change has no side effect | 492 " Making some property change has no side effect |
491 call popup_setoptions(winid, #{line: 3}) | 493 call popup_setoptions(winid, #{line: 3}) |
492 call assert_equal(0, popup_getoptions(winid).firstline) | 494 call assert_equal(0, popup_getoptions(winid).firstline) |
493 call assert_equal(10, popup_getpos(winid).firstline) | 495 call assert_equal(10, popup_getpos(winid).firstline) |
496 call popup_close(winid) | |
494 | 497 |
495 " CTRL-D scrolls down half a page | 498 " CTRL-D scrolls down half a page |
496 let winid = popup_create(['xxx']->repeat(50), #{ | 499 let winid = popup_create(['xxx']->repeat(50), #{ |
497 \ maxheight: 8, | 500 \ maxheight: 8, |
498 \ }) | 501 \ }) |
824 call assert_equal(0, popup_getoptions(winid).tabpage) | 827 call assert_equal(0, popup_getoptions(winid).tabpage) |
825 call popup_clear() | 828 call popup_clear() |
826 endfunc | 829 endfunc |
827 | 830 |
828 func Test_popup_valid_arguments() | 831 func Test_popup_valid_arguments() |
832 call assert_equal(0, len(popup_list())) | |
833 | |
829 " Zero value is like the property wasn't there | 834 " Zero value is like the property wasn't there |
830 let winid = popup_create("text", #{col: 0}) | 835 let winid = popup_create("text", #{col: 0}) |
831 let pos = popup_getpos(winid) | 836 let pos = popup_getpos(winid) |
832 call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col) | 837 call assert_inrange(&columns / 2 - 1, &columns / 2 + 1, pos.col) |
838 call assert_equal([winid], popup_list()) | |
833 call popup_clear() | 839 call popup_clear() |
834 | 840 |
835 " using cursor column has minimum value of 1 | 841 " using cursor column has minimum value of 1 |
836 let winid = popup_create("text", #{col: 'cursor-100'}) | 842 let winid = popup_create("text", #{col: 'cursor-100'}) |
837 let pos = popup_getpos(winid) | 843 let pos = popup_getpos(winid) |
1617 let winid = popup_create('', #{padding: [2,2,2,2]}) | 1623 let winid = popup_create('', #{padding: [2,2,2,2]}) |
1618 redraw | 1624 redraw |
1619 let pos = popup_getpos(winid) | 1625 let pos = popup_getpos(winid) |
1620 call assert_equal(5, pos.width) | 1626 call assert_equal(5, pos.width) |
1621 call assert_equal(5, pos.height) | 1627 call assert_equal(5, pos.height) |
1628 call popup_close(winid) | |
1622 | 1629 |
1623 let winid = popup_create([], #{border: []}) | 1630 let winid = popup_create([], #{border: []}) |
1624 redraw | 1631 redraw |
1625 let pos = popup_getpos(winid) | 1632 let pos = popup_getpos(winid) |
1626 call assert_equal(3, pos.width) | 1633 call assert_equal(3, pos.width) |
1627 call assert_equal(3, pos.height) | 1634 call assert_equal(3, pos.height) |
1635 call popup_close(winid) | |
1628 endfunc | 1636 endfunc |
1629 | 1637 |
1630 func Test_popup_never_behind() | 1638 func Test_popup_never_behind() |
1631 CheckScreendump | 1639 CheckScreendump |
1632 | 1640 |
3321 | 3329 |
3322 " this was getting stuck | 3330 " this was getting stuck |
3323 set signcolumn=yes | 3331 set signcolumn=yes |
3324 call setline(1, repeat('=', &columns)) | 3332 call setline(1, repeat('=', &columns)) |
3325 normal! ggg$ | 3333 normal! ggg$ |
3326 call popup_atcursor(repeat('x', 500), #{moved: 'any', border: []}) | 3334 let winid = popup_atcursor(repeat('x', 500), #{moved: 'any', border: []}) |
3327 | 3335 |
3336 call popup_close(winid) | |
3328 bwipe! | 3337 bwipe! |
3329 set signcolumn& | 3338 set signcolumn& |
3330 endfunc | 3339 endfunc |
3331 | 3340 |
3332 func Test_popupwin_splitmove() | 3341 func Test_popupwin_splitmove() |