Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16848:fd2ec8f2c70e | 16849:629f3d3b6886 |
---|---|
48 | 48 |
49 " show not fitting line at bottom | 49 " show not fitting line at bottom |
50 call term_sendkeys(buf, ":call setbufline(winbufnr(popupwin), 3, 'this line will not fit here')\<CR>") | 50 call term_sendkeys(buf, ":call setbufline(winbufnr(popupwin), 3, 'this line will not fit here')\<CR>") |
51 call term_sendkeys(buf, ":redraw\<CR>") | 51 call term_sendkeys(buf, ":redraw\<CR>") |
52 call VerifyScreenDump(buf, 'Test_popupwin_06', {}) | 52 call VerifyScreenDump(buf, 'Test_popupwin_06', {}) |
53 | |
54 " clean up | |
55 call StopVimInTerminal(buf) | |
56 call delete('XtestPopup') | |
57 endfunc | |
58 | |
59 func Test_popup_with_syntax_win_execute() | |
60 if !CanRunVimInTerminal() | |
61 return | |
62 endif | |
63 call writefile([ | |
64 \ "call setline(1, range(1, 100))", | |
65 \ "hi PopupColor ctermbg=lightblue", | |
66 \ "let winid = popup_create([", | |
67 \ "\\ '#include <stdio.h>',", | |
68 \ "\\ 'int main(void)',", | |
69 \ "\\ '{',", | |
70 \ "\\ ' printf(123);',", | |
71 \ "\\ '}',", | |
72 \ "\\], {'line': 3, 'col': 25, 'highlight': 'PopupColor'})", | |
73 \ "call win_execute(winid, 'set syntax=cpp')", | |
74 \], 'XtestPopup') | |
75 let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10}) | |
76 call VerifyScreenDump(buf, 'Test_popupwin_10', {}) | |
77 | |
78 " clean up | |
79 call StopVimInTerminal(buf) | |
80 call delete('XtestPopup') | |
81 endfunc | |
82 | |
83 func Test_popup_with_syntax_setbufvar() | |
84 if !CanRunVimInTerminal() | |
85 return | |
86 endif | |
87 call writefile([ | |
88 \ "call setline(1, range(1, 100))", | |
89 \ "hi PopupColor ctermbg=lightgrey", | |
90 \ "let winid = popup_create([", | |
91 \ "\\ '#include <stdio.h>',", | |
92 \ "\\ 'int main(void)',", | |
93 \ "\\ '{',", | |
94 \ "\\ ' printf(567);',", | |
95 \ "\\ '}',", | |
96 \ "\\], {'line': 3, 'col': 21, 'highlight': 'PopupColor'})", | |
97 \ "call setbufvar(winbufnr(winid), '&syntax', 'cpp')", | |
98 \], 'XtestPopup') | |
99 let buf = RunVimInTerminal('-S XtestPopup', {'rows': 10}) | |
100 call VerifyScreenDump(buf, 'Test_popupwin_11', {}) | |
53 | 101 |
54 " clean up | 102 " clean up |
55 call StopVimInTerminal(buf) | 103 call StopVimInTerminal(buf) |
56 call delete('XtestPopup') | 104 call delete('XtestPopup') |
57 endfunc | 105 endfunc |