1" Tests for ":highlight" and highlighting.
2
3source view_util.vim
4source screendump.vim
5source check.vim
6
7func Test_highlight()
8  " basic test if ":highlight" doesn't crash
9  highlight
10  hi Search
11
12  " test setting colors.
13  " test clearing one color and all doesn't generate error or warning
14  silent! hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan
15  silent! hi Group2 term= cterm=
16  hi Group3 term=underline cterm=bold
17
18  let res = split(execute("hi NewGroup"), "\n")[0]
19  " filter ctermfg and ctermbg, the numbers depend on the terminal
20  let res = substitute(res, 'ctermfg=\d*', 'ctermfg=2', '')
21  let res = substitute(res, 'ctermbg=\d*', 'ctermbg=3', '')
22  call assert_equal("NewGroup       xxx term=bold cterm=italic ctermfg=2 ctermbg=3",
23				\ res)
24  call assert_equal("Group2         xxx cleared",
25				\ split(execute("hi Group2"), "\n")[0])
26  call assert_equal("Group3         xxx term=underline cterm=bold",
27				\ split(execute("hi Group3"), "\n")[0])
28
29  hi clear NewGroup
30  call assert_equal("NewGroup       xxx cleared",
31				\ split(execute("hi NewGroup"), "\n")[0])
32  call assert_equal("Group2         xxx cleared",
33				\ split(execute("hi Group2"), "\n")[0])
34  hi Group2 NONE
35  call assert_equal("Group2         xxx cleared",
36				\ split(execute("hi Group2"), "\n")[0])
37  hi clear
38  call assert_equal("Group3         xxx cleared",
39				\ split(execute("hi Group3"), "\n")[0])
40  call assert_fails("hi Crash term='asdf", "E475:")
41endfunc
42
43func HighlightArgs(name)
44  return 'hi ' . substitute(split(execute('hi ' . a:name), '\n')[0], '\<xxx\>', '', '')
45endfunc
46
47func IsColorable()
48  return has('gui_running') || str2nr(&t_Co) >= 8
49endfunc
50
51func HiCursorLine()
52  let hiCursorLine = HighlightArgs('CursorLine')
53  if has('gui_running')
54    let guibg = matchstr(hiCursorLine, 'guibg=\w\+')
55    let hi_ul = 'hi CursorLine gui=underline guibg=NONE'
56    let hi_bg = 'hi CursorLine gui=NONE ' . guibg
57  else
58    let hi_ul = 'hi CursorLine cterm=underline ctermbg=NONE'
59    let hi_bg = 'hi CursorLine cterm=NONE ctermbg=Gray'
60  endif
61  return [hiCursorLine, hi_ul, hi_bg]
62endfunc
63
64func Check_lcs_eol_attrs(attrs, row, col)
65  let save_lcs = &lcs
66  set list
67
68  call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0])
69
70  set nolist
71  let &lcs = save_lcs
72endfunc
73
74func Test_highlight_eol_with_cursorline()
75  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
76
77  call NewWindow('topleft 5', 20)
78  call setline(1, 'abcd')
79  call matchadd('Search', '\n')
80
81  " expected:
82  " 'abcd      '
83  "  ^^^^ ^^^^^   no highlight
84  "      ^        'Search' highlight
85  let attrs0 = ScreenAttrs(1, 10)[0]
86  call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
87  call assert_equal(repeat([attrs0[0]], 5), attrs0[5:9])
88  call assert_notequal(attrs0[0], attrs0[4])
89
90  setlocal cursorline
91
92  " underline
93  exe hi_ul
94
95  " expected:
96  " 'abcd      '
97  "  ^^^^         underline
98  "      ^        'Search' highlight with underline
99  "       ^^^^^   underline
100  let attrs = ScreenAttrs(1, 10)[0]
101  call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
102  call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
103  call assert_notequal(attrs[0], attrs[4])
104  call assert_notequal(attrs[4], attrs[5])
105  call assert_notequal(attrs0[0], attrs[0])
106  call assert_notequal(attrs0[4], attrs[4])
107  call Check_lcs_eol_attrs(attrs, 1, 10)
108
109  if IsColorable()
110    " bg-color
111    exe hi_bg
112
113    " expected:
114    " 'abcd      '
115    "  ^^^^         bg-color of 'CursorLine'
116    "      ^        'Search' highlight
117    "       ^^^^^   bg-color of 'CursorLine'
118    let attrs = ScreenAttrs(1, 10)[0]
119    call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
120    call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
121    call assert_equal(attrs0[4], attrs[4])
122    call assert_notequal(attrs[0], attrs[4])
123    call assert_notequal(attrs[4], attrs[5])
124    call assert_notequal(attrs0[0], attrs[0])
125    call assert_notequal(attrs0[5], attrs[5])
126    call Check_lcs_eol_attrs(attrs, 1, 10)
127  endif
128
129  call CloseWindow()
130  exe hiCursorLine
131endfunc
132
133func Test_highlight_eol_with_cursorline_vertsplit()
134  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
135
136  call NewWindow('topleft 5', 5)
137  call setline(1, 'abcd')
138  call matchadd('Search', '\n')
139
140  let expected = "abcd |abcd     "
141  let actual = ScreenLines(1, 15)[0]
142  call assert_equal(expected, actual)
143
144  " expected:
145  " 'abcd |abcd     '
146  "  ^^^^  ^^^^^^^^^   no highlight
147  "      ^             'Search' highlight
148  "       ^            'VertSplit' highlight
149  let attrs0 = ScreenAttrs(1, 15)[0]
150  call assert_equal(repeat([attrs0[0]], 4), attrs0[0:3])
151  call assert_equal(repeat([attrs0[0]], 9), attrs0[6:14])
152  call assert_notequal(attrs0[0], attrs0[4])
153  call assert_notequal(attrs0[0], attrs0[5])
154  call assert_notequal(attrs0[4], attrs0[5])
155
156  setlocal cursorline
157
158  " expected:
159  " 'abcd |abcd     '
160  "  ^^^^              underline
161  "      ^             'Search' highlight with underline
162  "       ^            'VertSplit' highlight
163  "        ^^^^^^^^^   no highlight
164
165  " underline
166  exe hi_ul
167
168  let actual = ScreenLines(1, 15)[0]
169  call assert_equal(expected, actual)
170
171  let attrs = ScreenAttrs(1, 15)[0]
172  call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
173  call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
174  call assert_equal(attrs0[5:14], attrs[5:14])
175  call assert_notequal(attrs[0], attrs[4])
176  call assert_notequal(attrs[0], attrs[5])
177  call assert_notequal(attrs[0], attrs[6])
178  call assert_notequal(attrs[4], attrs[5])
179  call assert_notequal(attrs[5], attrs[6])
180  call assert_notequal(attrs0[0], attrs[0])
181  call assert_notequal(attrs0[4], attrs[4])
182  call Check_lcs_eol_attrs(attrs, 1, 15)
183
184  if IsColorable()
185    " bg-color
186    exe hi_bg
187
188    let actual = ScreenLines(1, 15)[0]
189    call assert_equal(expected, actual)
190
191    let attrs = ScreenAttrs(1, 15)[0]
192    call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
193    call assert_equal(repeat([attrs[6]], 9), attrs[6:14])
194    call assert_equal(attrs0[5:14], attrs[5:14])
195    call assert_notequal(attrs[0], attrs[4])
196    call assert_notequal(attrs[0], attrs[5])
197    call assert_notequal(attrs[0], attrs[6])
198    call assert_notequal(attrs[4], attrs[5])
199    call assert_notequal(attrs[5], attrs[6])
200    call assert_notequal(attrs0[0], attrs[0])
201    call assert_equal(attrs0[4], attrs[4])
202    call Check_lcs_eol_attrs(attrs, 1, 15)
203  endif
204
205  call CloseWindow()
206  exe hiCursorLine
207endfunc
208
209func Test_highlight_eol_with_cursorline_rightleft()
210  if !has('rightleft')
211    return
212  endif
213
214  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
215
216  call NewWindow('topleft 5', 10)
217  setlocal rightleft
218  call setline(1, 'abcd')
219  call matchadd('Search', '\n')
220  let attrs0 = ScreenAttrs(1, 10)[0]
221
222  setlocal cursorline
223
224  " underline
225  exe hi_ul
226
227  " expected:
228  " '      dcba'
229  "        ^^^^   underline
230  "       ^       'Search' highlight with underline
231  "  ^^^^^        underline
232  let attrs = ScreenAttrs(1, 10)[0]
233  call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
234  call assert_equal(repeat([attrs[4]], 5) + [attrs[5]], attrs[0:5])
235  call assert_notequal(attrs[9], attrs[5])
236  call assert_notequal(attrs[4], attrs[5])
237  call assert_notequal(attrs0[9], attrs[9])
238  call assert_notequal(attrs0[5], attrs[5])
239  call Check_lcs_eol_attrs(attrs, 1, 10)
240
241  if IsColorable()
242    " bg-color
243    exe hi_bg
244
245    " expected:
246    " '      dcba'
247    "        ^^^^   bg-color of 'CursorLine'
248    "       ^       'Search' highlight
249    "  ^^^^^        bg-color of 'CursorLine'
250    let attrs = ScreenAttrs(1, 10)[0]
251    call assert_equal(repeat([attrs[9]], 4), attrs[6:9])
252    call assert_equal(repeat([attrs[4]], 5), attrs[0:4])
253    call assert_equal(attrs0[5], attrs[5])
254    call assert_notequal(attrs[9], attrs[5])
255    call assert_notequal(attrs[5], attrs[4])
256    call assert_notequal(attrs0[9], attrs[9])
257    call assert_notequal(attrs0[4], attrs[4])
258    call Check_lcs_eol_attrs(attrs, 1, 10)
259  endif
260
261  call CloseWindow()
262  exe hiCursorLine
263endfunc
264
265func Test_highlight_eol_with_cursorline_linewrap()
266  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
267
268  call NewWindow('topleft 5', 10)
269  call setline(1, [repeat('a', 51) . 'bcd', ''])
270  call matchadd('Search', '\n')
271
272  setlocal wrap
273  normal! gg$
274  let attrs0 = ScreenAttrs(5, 10)[0]
275  setlocal cursorline
276
277  " underline
278  exe hi_ul
279
280  " expected:
281  " 'abcd      '
282  "  ^^^^         underline
283  "      ^        'Search' highlight with underline
284  "       ^^^^^   underline
285  let attrs = ScreenAttrs(5, 10)[0]
286  call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
287  call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
288  call assert_notequal(attrs[0], attrs[4])
289  call assert_notequal(attrs[4], attrs[5])
290  call assert_notequal(attrs0[0], attrs[0])
291  call assert_notequal(attrs0[4], attrs[4])
292  call Check_lcs_eol_attrs(attrs, 5, 10)
293
294  if IsColorable()
295    " bg-color
296    exe hi_bg
297
298    " expected:
299    " 'abcd      '
300    "  ^^^^         bg-color of 'CursorLine'
301    "      ^        'Search' highlight
302    "       ^^^^^   bg-color of 'CursorLine'
303    let attrs = ScreenAttrs(5, 10)[0]
304    call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
305    call assert_equal(repeat([attrs[5]], 5), attrs[5:9])
306    call assert_equal(attrs0[4], attrs[4])
307    call assert_notequal(attrs[0], attrs[4])
308    call assert_notequal(attrs[4], attrs[5])
309    call assert_notequal(attrs0[0], attrs[0])
310    call assert_notequal(attrs0[5], attrs[5])
311    call Check_lcs_eol_attrs(attrs, 5, 10)
312  endif
313
314  setlocal nocursorline nowrap
315  normal! gg$
316  let attrs0 = ScreenAttrs(1, 10)[0]
317  setlocal cursorline
318
319  " underline
320  exe hi_ul
321
322  " expected:
323  " 'aaabcd    '
324  "  ^^^^^^       underline
325  "        ^      'Search' highlight with underline
326  "         ^^^   underline
327  let attrs = ScreenAttrs(1, 10)[0]
328  call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
329  call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
330  call assert_notequal(attrs[0], attrs[6])
331  call assert_notequal(attrs[6], attrs[7])
332  call assert_notequal(attrs0[0], attrs[0])
333  call assert_notequal(attrs0[6], attrs[6])
334  call Check_lcs_eol_attrs(attrs, 1, 10)
335
336  if IsColorable()
337    " bg-color
338    exe hi_bg
339
340    " expected:
341    " 'aaabcd    '
342    "  ^^^^^^       bg-color of 'CursorLine'
343    "        ^      'Search' highlight
344    "         ^^^   bg-color of 'CursorLine'
345    let attrs = ScreenAttrs(1, 10)[0]
346    call assert_equal(repeat([attrs[0]], 6), attrs[0:5])
347    call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
348    call assert_equal(attrs0[6], attrs[6])
349    call assert_notequal(attrs[0], attrs[6])
350    call assert_notequal(attrs[6], attrs[7])
351    call assert_notequal(attrs0[0], attrs[0])
352    call assert_notequal(attrs0[7], attrs[7])
353    call Check_lcs_eol_attrs(attrs, 1, 10)
354  endif
355
356  call CloseWindow()
357  exe hiCursorLine
358endfunc
359
360func Test_highlight_eol_with_cursorline_sign()
361  if !has('signs')
362    return
363  endif
364
365  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
366
367  call NewWindow('topleft 5', 10)
368  call setline(1, 'abcd')
369  call matchadd('Search', '\n')
370
371  sign define Sign text=>>
372  exe 'sign place 1 line=1 name=Sign buffer=' . bufnr('')
373  let attrs0 = ScreenAttrs(1, 10)[0]
374  setlocal cursorline
375
376  " underline
377  exe hi_ul
378
379  " expected:
380  " '>>abcd    '
381  "  ^^           sign
382  "    ^^^^       underline
383  "        ^      'Search' highlight with underline
384  "         ^^^   underline
385  let attrs = ScreenAttrs(1, 10)[0]
386  call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
387  call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
388  call assert_notequal(attrs[2], attrs[6])
389  call assert_notequal(attrs[6], attrs[7])
390  call assert_notequal(attrs0[2], attrs[2])
391  call assert_notequal(attrs0[6], attrs[6])
392  call Check_lcs_eol_attrs(attrs, 1, 10)
393
394  if IsColorable()
395    " bg-color
396    exe hi_bg
397
398    " expected:
399    " '>>abcd    '
400    "  ^^           sign
401    "    ^^^^       bg-color of 'CursorLine'
402    "        ^      'Search' highlight
403    "         ^^^   bg-color of 'CursorLine'
404    let attrs = ScreenAttrs(1, 10)[0]
405    call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
406    call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
407    call assert_equal(attrs0[6], attrs[6])
408    call assert_notequal(attrs[2], attrs[6])
409    call assert_notequal(attrs[6], attrs[7])
410    call assert_notequal(attrs0[2], attrs[2])
411    call assert_notequal(attrs0[7], attrs[7])
412    call Check_lcs_eol_attrs(attrs, 1, 10)
413  endif
414
415  sign unplace 1
416  call CloseWindow()
417  exe hiCursorLine
418endfunc
419
420func Test_highlight_eol_with_cursorline_breakindent()
421  if !has('linebreak')
422    return
423  endif
424
425  let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
426
427  call NewWindow('topleft 5', 10)
428  setlocal breakindent breakindentopt=min:0,shift:1 showbreak=>
429  call setline(1, ' ' . repeat('a', 9) . 'bcd')
430  call matchadd('Search', '\n')
431  let attrs0 = ScreenAttrs(2, 10)[0]
432  setlocal cursorline
433
434  " underline
435  exe hi_ul
436
437  " expected:
438  " '  >bcd    '
439  "  ^^^          breakindent and showbreak
440  "     ^^^       underline
441  "        ^      'Search' highlight with underline
442  "         ^^^   underline
443  let attrs = ScreenAttrs(2, 10)[0]
444  call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
445  call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
446  call assert_equal([attrs[6]] + repeat([attrs[7]], 3), attrs[6:9])
447  call assert_equal(attrs0[0], attrs[0])
448  call assert_notequal(attrs[0], attrs[2])
449  call assert_notequal(attrs[2], attrs[3])
450  call assert_notequal(attrs[3], attrs[6])
451  call assert_notequal(attrs[6], attrs[7])
452  call assert_notequal(attrs0[2], attrs[2])
453  call assert_notequal(attrs0[3], attrs[3])
454  call assert_notequal(attrs0[6], attrs[6])
455  call Check_lcs_eol_attrs(attrs, 2, 10)
456
457  if IsColorable()
458    " bg-color
459    exe hi_bg
460
461    " expected:
462    " '  >bcd    '
463    "  ^^^          breakindent and showbreak
464    "     ^^^       bg-color of 'CursorLine'
465    "        ^      'Search' highlight
466    "         ^^^   bg-color of 'CursorLine'
467    let attrs = ScreenAttrs(2, 10)[0]
468    call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
469    call assert_equal(repeat([attrs[3]], 3), attrs[3:5])
470    call assert_equal(repeat([attrs[7]], 3), attrs[7:9])
471    call assert_equal(attrs0[0], attrs[0])
472    call assert_equal(attrs0[6], attrs[6])
473    call assert_notequal(attrs[0], attrs[2])
474    call assert_notequal(attrs[2], attrs[3])
475    call assert_notequal(attrs[3], attrs[6])
476    call assert_notequal(attrs[6], attrs[7])
477    call assert_notequal(attrs0[2], attrs[2])
478    call assert_notequal(attrs0[3], attrs[3])
479    call assert_notequal(attrs0[7], attrs[7])
480    call Check_lcs_eol_attrs(attrs, 2, 10)
481  endif
482
483  call CloseWindow()
484  set showbreak=
485  exe hiCursorLine
486endfunc
487
488func Test_highlight_eol_on_diff()
489  call setline(1, ['abcd', ''])
490  call matchadd('Search', '\n')
491  let attrs0 = ScreenAttrs(1, 10)[0]
492
493  diffthis
494  botright new
495  diffthis
496
497  " expected:
498  " '  abcd    '
499  "  ^^           sign
500  "    ^^^^ ^^^   'DiffAdd' highlight
501  "        ^      'Search' highlight
502  let attrs = ScreenAttrs(1, 10)[0]
503  call assert_equal(repeat([attrs[0]], 2), attrs[0:1])
504  call assert_equal(repeat([attrs[2]], 4), attrs[2:5])
505  call assert_equal(repeat([attrs[2]], 3), attrs[7:9])
506  call assert_equal(attrs0[4], attrs[6])
507  call assert_notequal(attrs[0], attrs[2])
508  call assert_notequal(attrs[0], attrs[6])
509  call assert_notequal(attrs[2], attrs[6])
510  call Check_lcs_eol_attrs(attrs, 1, 10)
511
512  bwipe!
513  diffoff
514endfunc
515
516func Test_termguicolors()
517  if !exists('+termguicolors')
518    return
519  endif
520  if has('vtp') && !has('vcon')
521    " Win32: 'guicolors' doesn't work without virtual console.
522    call assert_fails('set termguicolors', 'E954:')
523    return
524  endif
525
526  " Basic test that setting 'termguicolors' works with one color.
527  set termguicolors
528  redraw
529  set t_Co=1
530  redraw
531  set t_Co=0
532  redraw
533endfunc
534
535func Test_cursorline_after_yank()
536  CheckScreendump
537
538  call writefile([
539	\ 'set cul rnu',
540	\ 'call setline(1, ["","1","2","3",""])',
541	\ ], 'Xtest_cursorline_yank')
542  let buf = RunVimInTerminal('-S Xtest_cursorline_yank', {'rows': 8})
543  call term_wait(buf)
544  call term_sendkeys(buf, "Gy3k")
545  call term_wait(buf)
546  call term_sendkeys(buf, "jj")
547
548  call VerifyScreenDump(buf, 'Test_cursorline_yank_01', {})
549
550  " clean up
551  call StopVimInTerminal(buf)
552  call delete('Xtest_cursorline_yank')
553endfunc
554
555" test for issue #4862
556func Test_put_before_cursorline()
557  new
558  only!
559  call setline(1, 'A')
560  redraw
561  let std_attr = screenattr(1, 1)
562  set cursorline
563  redraw
564  let cul_attr = screenattr(1, 1)
565  normal yyP
566  redraw
567  " Line 1 has cursor so it should be highlighted with CursorLine.
568  call assert_equal(cul_attr, screenattr(1, 1))
569  " And CursorLine highlighting from the second line should be gone.
570  call assert_equal(std_attr, screenattr(2, 1))
571  set nocursorline
572  bwipe!
573endfunc
574
575func Test_cursorline_with_visualmode()
576  CheckScreendump
577
578  call writefile([
579	\ 'set cul',
580	\ 'call setline(1, repeat(["abc"], 50))',
581	\ ], 'Xtest_cursorline_with_visualmode')
582  let buf = RunVimInTerminal('-S Xtest_cursorline_with_visualmode', {'rows': 12})
583  call term_wait(buf)
584  call term_sendkeys(buf, "V\<C-f>kkkjk")
585
586  call VerifyScreenDump(buf, 'Test_cursorline_with_visualmode_01', {})
587
588  " clean up
589  call StopVimInTerminal(buf)
590  call delete('Xtest_cursorline_with_visualmode')
591endfunc
592
593func Test_wincolor()
594  CheckScreendump
595
596  let lines =<< trim END
597	set cursorline cursorcolumn rnu
598	call setline(1, ["","1111111111","22222222222","3 here 3","","the cat is out of the bag"])
599	set wincolor=Pmenu
600	hi CatLine guifg=green ctermfg=green
601	hi Reverse gui=reverse cterm=reverse
602	syn match CatLine /^the.*/
603	call prop_type_add("foo", {"highlight": "Reverse", "combine": 1})
604	call prop_add(6, 12, {"type": "foo", "end_col": 15})
605	/here
606  END
607  call writefile(lines, 'Xtest_wincolor')
608  let buf = RunVimInTerminal('-S Xtest_wincolor', {'rows': 8})
609  call term_wait(buf)
610  call term_sendkeys(buf, "2G5lvj")
611  call term_wait(buf)
612
613  call VerifyScreenDump(buf, 'Test_wincolor_01', {})
614
615  " clean up
616  call term_sendkeys(buf, "\<Esc>")
617  call StopVimInTerminal(buf)
618  call delete('Xtest_wincolor')
619endfunc
620
621func Test_colorcolumn()
622  CheckScreendump
623
624  " check that setting 'colorcolumn' when entering a buffer works
625  let lines =<< trim END
626	split
627	edit X
628	call setline(1, ["1111111111","22222222222","3333333333"])
629	set nomodified
630	set colorcolumn=3,9
631	set number cursorline cursorlineopt=number
632	wincmd w
633	buf X
634  END
635  call writefile(lines, 'Xtest_colorcolumn')
636  let buf = RunVimInTerminal('-S Xtest_colorcolumn', {'rows': 10})
637  call term_sendkeys(buf, ":\<CR>")
638  call term_wait(buf)
639  call VerifyScreenDump(buf, 'Test_colorcolumn_1', {})
640
641  " clean up
642  call StopVimInTerminal(buf)
643  call delete('Xtest_colorcolumn')
644endfunc
645
646" This test must come before the Test_cursorline test, as it appears this
647" defines the Normal highlighting group anyway.
648func Test_1_highlight_Normalgroup_exists()
649  let hlNormal = HighlightArgs('Normal')
650  if !has('gui_running')
651    call assert_match('hi Normal\s*clear', hlNormal)
652  elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
653    " expect is DEFAULT_FONT of gui_gtk_x11.c
654    call assert_match('hi Normal\s*font=Monospace 10', hlNormal)
655  elseif has('gui_motif') || has('gui_athena')
656    " expect is DEFAULT_FONT of gui_x11.c
657    call assert_match('hi Normal\s*font=7x13', hlNormal)
658  elseif has('win32')
659    " expect any font
660    call assert_match('hi Normal\s*font=.*', hlNormal)
661  endif
662endfunc
663
664function Test_no_space_before_xxx()
665  let l:org_columns = &columns
666  set columns=17
667  let l:hi_StatusLineTermNC = join(split(execute('hi StatusLineTermNC')))
668  call assert_match('StatusLineTermNC xxx', l:hi_StatusLineTermNC)
669  let &columns = l:org_columns
670endfunction
671