Mercurial > vim
diff src/testdir/test_popupwin.vim @ 17253:26e0352613ec v8.1.1626
patch 8.1.1626: no test for closing a popup window with a modified buffer
commit https://github.com/vim/vim/commit/5ca1ac373ae62b37152cb6f85916b402eda520a5
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jul 4 15:39:28 2019 +0200
patch 8.1.1626: no test for closing a popup window with a modified buffer
Problem: No test for closing a popup window with a modified buffer.
Solution: Add a test. Add "popups" to getbufinfo().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 04 Jul 2019 15:45:05 +0200 |
parents | 13a2d3364b3f |
children | 6a7ba68d448e |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -1710,3 +1710,30 @@ func Test_popupwin_width() endfor call popup_clear() endfunc + +func Test_popupwin_buf_close() + let buf = bufadd('Xtestbuf') + call bufload(buf) + call setbufline(buf, 1, ['just', 'some', 'lines']) + let winid = popup_create(buf, {}) + redraw + call assert_equal(3, popup_getpos(winid).height) + let bufinfo = getbufinfo(buf)[0] + call assert_equal(1, bufinfo.changed) + call assert_equal(0, bufinfo.hidden) + call assert_equal(0, bufinfo.listed) + call assert_equal(1, bufinfo.loaded) + call assert_equal([], bufinfo.windows) + call assert_equal([winid], bufinfo.popups) + + call popup_close(winid) + call assert_equal({}, popup_getpos(winid)) + let bufinfo = getbufinfo(buf)[0] + call assert_equal(1, bufinfo.changed) + call assert_equal(1, bufinfo.hidden) + call assert_equal(0, bufinfo.listed) + call assert_equal(1, bufinfo.loaded) + call assert_equal([], bufinfo.windows) + call assert_equal([], bufinfo.popups) + exe 'bwipe! ' .. buf +endfunc