diff src/testdir/test_popupwin.vim @ 16809:5ff14f96f1c9 v8.1.1406

patch 8.1.1406: popup_hide() and popup_show() not implemented yet commit https://github.com/vim/vim/commit/2cd0dce898995a2b05f7285a70efec3f67f579f5 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 26 22:17:52 2019 +0200 patch 8.1.1406: popup_hide() and popup_show() not implemented yet Problem: popup_hide() and popup_show() not implemented yet. Solution: Implement the functions.
author Bram Moolenaar <Bram@vim.org>
date Sun, 26 May 2019 22:30:05 +0200
parents 306766ed0f70
children 0457d49eb2d9
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -76,3 +76,41 @@ func Test_popup_time()
 
   bwipe!
 endfunc
+
+func Test_popup_hide()
+  topleft vnew
+  call setline(1, 'hello')
+
+  let winid = popup_create('world', {
+	\ 'line': 1,
+	\ 'col': 1,
+	\})
+  redraw
+  let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
+  call assert_equal('world', line)
+
+  call popup_hide(winid)
+  redraw
+  let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
+  call assert_equal('hello', line)
+
+  call popup_show(winid)
+  redraw
+  let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
+  call assert_equal('world', line)
+
+
+  call popup_close(winid)
+  redraw
+  let line = join(map(range(1, 5), 'screenstring(1, v:val)'), '')
+  call assert_equal('hello', line)
+
+  " error is given for existing non-popup window
+  call assert_fails('call popup_hide(win_getid())', 'E993:')
+
+  " no error non-existing window
+  call popup_hide(1234234)
+  call popup_show(41234234)
+
+  bwipe!
+endfunc