summaryrefslogtreecommitdiffstats
path: root/src/testdir
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_01.dump10
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_02.dump10
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_03.dump10
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_04.dump10
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_05.dump10
-rw-r--r--src/testdir/dumps/Test_popup_setbuf_06.dump10
-rw-r--r--src/testdir/test_popupwin.vim82
-rw-r--r--src/testdir/test_vim9_builtin.vim5
8 files changed, 147 insertions, 0 deletions
diff --git a/src/testdir/dumps/Test_popup_setbuf_01.dump b/src/testdir/dumps/Test_popup_setbuf_01.dump
new file mode 100644
index 0000000000..14359bacfe
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_01.dump
@@ -0,0 +1,10 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @33|t+0#0000001#ffd7ff255|e|s|t| +0#4040ff13#ffffff0@35
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_popup_setbuf_02.dump b/src/testdir/dumps/Test_popup_setbuf_02.dump
new file mode 100644
index 0000000000..5feb98299d
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_02.dump
@@ -0,0 +1,10 @@
+> +0&#ffffff0@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @33|t+0#0000001#ffd7ff255|e|s|t| +0#4040ff13#ffffff0@35
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|:+0#0000000&|c|a|l@1| |p|o|p|u|p|_|s|e|t|b|u|f|(|p|,| |'|f|o@1|b|a|r|.|t|x|t|'|)| @21|0|,|0|-|1| @8|A|l@1|
diff --git a/src/testdir/dumps/Test_popup_setbuf_03.dump b/src/testdir/dumps/Test_popup_setbuf_03.dump
new file mode 100644
index 0000000000..2c49576dce
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_03.dump
@@ -0,0 +1,10 @@
+|~+0#4040ff13#ffffff0| @73
+|~| @73
+|~| @73
+|~| @33|t+0#0000001#ffd7ff255|e|s|t| +0#4040ff13#ffffff0@35
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|E+0#ffffff16#e000002|1|2@1|0|:| |S|t|r|i|n|g| |o|r| |N|u|m|b|e|r| |r|e|q|u|i|r|e|d| |f|o|r| |a|r|g|u|m|e|n|t| |2| +0#0000000#ffffff0@27
+|P+0#00e0003&|r|e|s@1| |E|N|T|E|R| |o|r| |t|y|p|e| |c|o|m@1|a|n|d| |t|o| |c|o|n|t|i|n|u|e> +0#0000000&@35
diff --git a/src/testdir/dumps/Test_popup_setbuf_04.dump b/src/testdir/dumps/Test_popup_setbuf_04.dump
new file mode 100644
index 0000000000..937fa7c3c2
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_04.dump
@@ -0,0 +1,10 @@
+>*+0#ffffff16#ffd7ff255|h+0#e000002&|e|l|p|.|t|x|t|*+0#ffffff16&| +0#0000001&@5|F|o|r| |V+0#00e0e07&|i|m| |v|e|r|s|i|o|n| |9|.|1|.| +0#0000001&@1|L|a|s|t| |c|h|a|n|g|e|:| |2|0|2|4| |M|a|y| |2|7| @11| +0#0000000#0000001
+| +0#0000001#ffd7ff255@73| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@23|V|I|M| |-| |m|a|i|n| |h|e|l|p| |f|i|l|e| @29| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@72|k| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@5|M|o|v|e| |a|r|o|u|n|d|:| @1|U|s|e| |t|h|e| |c|u|r|s|o|r| |k|e|y|s|,| |o|r| |"|h|"| |t|o| |g|o| |l|e|f|t|,| @11|h| @1| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255|l| @71| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@19|"|j|"| |t|o| |g|o| |d|o|w|n|,| |"|k|"| |t|o| |g|o| |u|p|,| |"|l|"| |t|o| |g|o| |r|i|g|h|t|.| @6|j| +0#0000000#a8a8a8255
+|C+0#0000001#ffd7ff255|l|o|s|e| |t|h|i|s| |w|i|n|d|o|w|:| @1|U|s|e| |"|:|q|<+0#e000e06&|E|n|t|e|r|>|"+0#0000001&|.| @37| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@2|G|e|t| |o|u|t| |o|f| |V|i|m|:| @1|U|s|e| |"|:|q|a|!|<+0#e000e06&|E|n|t|e|r|>|"+0#0000001&| |(|c|a|r|e|f|u|l|,| |a|l@1| |c|h|a|n|g|e|s| |a|r|e| |l|o|s|t|!|)|.| @2| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@73| +0#0000000#a8a8a8255
diff --git a/src/testdir/dumps/Test_popup_setbuf_05.dump b/src/testdir/dumps/Test_popup_setbuf_05.dump
new file mode 100644
index 0000000000..a13dfe35ee
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_05.dump
@@ -0,0 +1,10 @@
+>h+0#e000002#ffffff0|e|l|p|.|t|x|t| +0#0000000&@7|F|o|r| |V+0#00e0e07&|i|m| |v|e|r|s|i|o|n| |9|.|1|.| +0#0000000&@1|L|a|s|t| |c|h|a|n|g|e|:| |2|0|2|4| |M|a|y| |2|7| @12
+@75
+@24|V|I|M| |-| |m|a|i|n| |h|e|l|p| |f|i|l|e| @30
+@73|k|
+@6|M|o|v|e| |a|r|o|u|n|d|:| @1|U|s|e| |t|h|e| |c|u|r|s|o|r| |k|e| +0#0000001#ffd7ff255|s+0#0000000#ffffff0|,| |o|r| |"|h|"| |t|o| |g|o| |l|e|f|t|,| @11|h| @2
+|l| @73
+|h+3&&|e|l|p|.|t|x|t| |[|H|e|l|p|]|[|R|O|]| @37|1|,|1| @11|T|o|p
+| +0&&@74
+|[+1&&|N|o| |N|a|m|e|]| @47|0|,|0|-|1| @9|A|l@1
+| +0&&@74
diff --git a/src/testdir/dumps/Test_popup_setbuf_06.dump b/src/testdir/dumps/Test_popup_setbuf_06.dump
new file mode 100644
index 0000000000..937fa7c3c2
--- /dev/null
+++ b/src/testdir/dumps/Test_popup_setbuf_06.dump
@@ -0,0 +1,10 @@
+>*+0#ffffff16#ffd7ff255|h+0#e000002&|e|l|p|.|t|x|t|*+0#ffffff16&| +0#0000001&@5|F|o|r| |V+0#00e0e07&|i|m| |v|e|r|s|i|o|n| |9|.|1|.| +0#0000001&@1|L|a|s|t| |c|h|a|n|g|e|:| |2|0|2|4| |M|a|y| |2|7| @11| +0#0000000#0000001
+| +0#0000001#ffd7ff255@73| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@23|V|I|M| |-| |m|a|i|n| |h|e|l|p| |f|i|l|e| @29| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@72|k| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@5|M|o|v|e| |a|r|o|u|n|d|:| @1|U|s|e| |t|h|e| |c|u|r|s|o|r| |k|e|y|s|,| |o|r| |"|h|"| |t|o| |g|o| |l|e|f|t|,| @11|h| @1| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255|l| @71| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@19|"|j|"| |t|o| |g|o| |d|o|w|n|,| |"|k|"| |t|o| |g|o| |u|p|,| |"|l|"| |t|o| |g|o| |r|i|g|h|t|.| @6|j| +0#0000000#a8a8a8255
+|C+0#0000001#ffd7ff255|l|o|s|e| |t|h|i|s| |w|i|n|d|o|w|:| @1|U|s|e| |"|:|q|<+0#e000e06&|E|n|t|e|r|>|"+0#0000001&|.| @37| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@2|G|e|t| |o|u|t| |o|f| |V|i|m|:| @1|U|s|e| |"|:|q|a|!|<+0#e000e06&|E|n|t|e|r|>|"+0#0000001&| |(|c|a|r|e|f|u|l|,| |a|l@1| |c|h|a|n|g|e|s| |a|r|e| |l|o|s|t|!|)|.| @2| +0#0000000#a8a8a8255
+| +0#0000001#ffd7ff255@73| +0#0000000#a8a8a8255
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index a397f70752..64aa654cf7 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2499,6 +2499,88 @@ func Test_popup_settext_null()
call popup_close(id)
endfunc
+func Test_popup_setbuf()
+ CheckScreendump
+
+ let lines =<< trim END
+ let opts = #{wrap: 0}
+ let p = popup_create('test', opts)
+ let buf = bufnr('%')
+ END
+
+ call writefile(lines, 'XtestPopupSetBuf', 'D')
+ let buf = RunVimInTerminal('-S XtestPopupSetBuf', #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_01', {})
+
+ " Setting to an non-existing buffer doesn't do anything
+ call term_sendkeys(buf, ":call popup_setbuf(p, 'foobar.txt')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_02', {})
+
+ " Error
+ call term_sendkeys(buf, ":call popup_setbuf(p, ['a','b','c'])\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_03', {})
+
+ " Set to help window
+ call term_sendkeys(buf, ":help\<CR>")
+ call term_sendkeys(buf, ":call popup_setbuf(p, 'help.txt')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_04', {})
+
+ " Setting back to original buffer
+ call term_sendkeys(buf, ":call popup_setbuf(p, buf)\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_05', {})
+
+ " use method
+ call term_sendkeys(buf, ":echo p->popup_setbuf('help.txt')\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_06', {})
+
+ call term_sendkeys(buf, ":echo p->popup_setbuf(buf)\<CR>")
+ call VerifyScreenDump(buf, 'Test_popup_setbuf_05', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+endfunc
+
+func Test_popup_setbuf_terminal()
+ CheckFeature terminal
+
+ " Check Terminal Feature
+ let termbuf = term_start(&shell, #{hidden: 1})
+ " Wait for shell to start
+ call WaitForAssert({-> assert_equal("run", job_status(term_getjob(termbuf)))})
+
+ let popup = popup_create('test', {})
+ call assert_true(popup->popup_setbuf(termbuf))
+ call popup_close(popup)
+
+ let popup1 = popup_create(termbuf, #{minwidth: 40, minheight: 10, border: []})
+
+ let popup = popup_create('test', {})
+ try
+ call assert_fails(call popup_setbuf(popup, termbuf))
+ catch
+ endtry
+ call popup_close(popup)
+ call popup_close(popup1)
+ call assert_equal([], popup_list())
+ " Close the terminal
+ call term_sendkeys(termbuf, "exit\<CR>")
+ " Wait for shell to exit
+ call WaitForAssert({-> assert_equal("dead", job_status(term_getjob(termbuf)))})
+endfunc
+
+func Test_popup_setbuf_null()
+ let id = popup_create('', {})
+ call assert_false(popup_setbuf(id, -1))
+ call popup_close(id)
+
+ let id = popup_create('', {})
+ call assert_true(popup_setbuf(id, test_null_string()))
+ call assert_true(popup_setbuf(id, ''))
+ call popup_close(id)
+
+ call assert_false(popup_setbuf(id, 0))
+endfunc
+
func Test_popup_hidden()
new
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 6b1a50d416..9adb7a5857 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -3152,6 +3152,11 @@ def Test_popup_settext()
v9.CheckSourceDefAndScriptFailure(['popup_settext(1, 2)'], ['E1013: Argument 2: type mismatch, expected string but got number', 'E1222: String or List required for argument 2'])
enddef
+def Test_popup_setbuf()
+ v9.CheckSourceDefAndScriptFailure(['popup_setbuf([], "abc")'], ['E1013: Argument 1: type mismatch, expected number but got list<any>', 'E1210: Number required for argument 1'])
+ v9.CheckSourceDefAndScriptFailure(['popup_setbuf(1, [])'], ['E1013: Argument 2: type mismatch, expected string but got list<any>', 'E1220: String or Number required for argument 2'])
+enddef
+
def Test_popup_show()
v9.CheckSourceDefAndScriptFailure(['popup_show("a")'], ['E1013: Argument 1: type mismatch, expected number but got string', 'E1210: Number required for argument 1'])
v9.CheckSourceDefAndScriptFailure(['popup_show(true)'], ['E1013: Argument 1: type mismatch, expected number but got bool', 'E1210: Number required for argument 1'])