diff src/testdir/test_popupwin.vim @ 16849:629f3d3b6886 v8.1.1426

patch 8.1.1426: no test for syntax highlight in popup window commit https://github.com/vim/vim/commit/b42301247d85d60b64c2cc23f5cdf30da2342827 Author: Bram Moolenaar <Bram@vim.org> Date: Thu May 30 18:40:53 2019 +0200 patch 8.1.1426: no test for syntax highlight in popup window Problem: No test for syntax highlight in popup window. Solution: Add a screenshot test. Update associated documentation. Avoid 'buftype' being reset by setbufvar().
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 May 2019 18:45:06 +0200
parents 283037126560
children e6bcccccbf7b
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -56,6 +56,54 @@ func Test_simple_popup()
   call delete('XtestPopup')
 endfunc
 
+func Test_popup_with_syntax_win_execute()
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call writefile([
+	\ "call setline(1, range(1, 100))",
+	\ "hi PopupColor ctermbg=lightblue",
+	\ "let winid = popup_create([",
+	\ "\\ '#include <stdio.h>',",
+	\ "\\ 'int main(void)',",
+	\ "\\ '{',",
+	\ "\\ '    printf(123);',",
+	\ "\\ '}',",
+	\ "\\], {'line': 3, 'col': 25, 'highlight': 'PopupColor'})",
+	\ "call win_execute(winid, 'set syntax=cpp')",
+	\], 'XtestPopup')
+  let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10})
+  call VerifyScreenDump(buf, 'Test_popupwin_10', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestPopup')
+endfunc
+
+func Test_popup_with_syntax_setbufvar()
+  if !CanRunVimInTerminal()
+    return
+  endif
+  call writefile([
+	\ "call setline(1, range(1, 100))",
+	\ "hi PopupColor ctermbg=lightgrey",
+	\ "let winid = popup_create([",
+	\ "\\ '#include <stdio.h>',",
+	\ "\\ 'int main(void)',",
+	\ "\\ '{',",
+	\ "\\ '    printf(567);',",
+	\ "\\ '}',",
+	\ "\\], {'line': 3, 'col': 21, 'highlight': 'PopupColor'})",
+	\ "call setbufvar(winbufnr(winid), '&syntax', 'cpp')",
+	\], 'XtestPopup')
+  let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10})
+  call VerifyScreenDump(buf, 'Test_popupwin_11', {})
+
+  " clean up
+  call StopVimInTerminal(buf)
+  call delete('XtestPopup')
+endfunc
+
 func Test_popup_time()
   if !has('timers')
     return