From 42213ed4295ebbebf7c3222b2b519a4f3a5d7ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Linse?= Date: Tue, 23 May 2017 10:24:57 +0200 Subject: [PATCH] WIP: more tests --- test/functional/ui/highlight_spec.lua | 124 +++++++++++++++++++++----- 1 file changed, 103 insertions(+), 21 deletions(-) diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 4fd00cc3208bc5..ef6f515bb2dec7 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -5,6 +5,7 @@ local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local command = helpers.command local eval, exc_exec = helpers.eval, helpers.exc_exec local feed_command, request, eq = helpers.feed_command, helpers.request, helpers.eq +local curbufmeths = helpers.curbufmeths describe('colorscheme compatibility', function() before_each(function() @@ -670,12 +671,23 @@ describe("'winhighlight' highlight", function() [8] = {background = Screen.colors.DarkMagenta, bold = true, foreground = Screen.colors.Blue1}, [9] = {foreground = Screen.colors.Brown}, [10] = {foreground = Screen.colors.Brown, background = Screen.colors.DarkBlue}, + [11] = {background = Screen.colors.DarkBlue, bold = true, reverse = true}, + [12] = {background = Screen.colors.DarkGreen, reverse = true}, + [13] = {background = Screen.colors.Magenta4, reverse = true}, + [14] = {background = Screen.colors.DarkBlue, reverse = true}, + [15] = {foreground = Screen.colors.Grey100, background = Screen.colors.Red}, + [16] = {foreground = Screen.colors.Blue1}, + [17] = {background = Screen.colors.LightRed}, + [18] = {background = Screen.colors.Gray90}, + [19] = {foreground = Screen.colors.LightGrey, background = Screen.colors.DarkGray}, + [20] = {background = Screen.colors.LightGrey, underline = true}, + [21] = {bold = true}, }) command("hi Background1 guibg=DarkBlue") command("hi Background2 guibg=DarkGreen") end) - it('works', function() + it('works for background color', function() insert("aa") command("split") command("set winhl=Normal:Background1") @@ -683,7 +695,7 @@ describe("'winhighlight' highlight", function() {1:a^a }| {2:~ }| {2:~ }| - {3:[No Name] [+] }| + {11:[No Name] [+] }| aa | {0:~ }| {4:[No Name] [+] }| @@ -695,7 +707,7 @@ describe("'winhighlight' highlight", function() {1:^ }| {2:~ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| aa | {0:~ }| {4:[No Name] [+] }| @@ -740,7 +752,7 @@ describe("'winhighlight' highlight", function() {1:a^a }| {2:~ }| {2:~ }| - {3:[No Name] [+] }| + {11:[No Name] [+] }| aa | {0:~ }| {4:[No Name] [+] }| @@ -764,7 +776,7 @@ describe("'winhighlight' highlight", function() {1:^aa }| {2:~ }| {2:~ }| - {3:[No Name] [+] }| + {11:[No Name] [+] }| aa | {0:~ }| {4:[No Name] [+] }| @@ -773,7 +785,7 @@ describe("'winhighlight' highlight", function() end) - it('for inactive window works', function() + it('for inactive window background works', function() command("set winhl=Normal:Background1,NormalNC:Background2") -- tests global value is copied across split command("split") @@ -781,10 +793,10 @@ describe("'winhighlight' highlight", function() {1:^ }| {2:~ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| {5: }| {6:~ }| - {4:[No Name] }| + {12:[No Name] }| | ]]) @@ -793,10 +805,10 @@ describe("'winhighlight' highlight", function() {5: }| {6:~ }| {6:~ }| - {4:[No Name] }| + {12:[No Name] }| {1:^ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| | ]]) @@ -805,10 +817,10 @@ describe("'winhighlight' highlight", function() {1:^ }| {2:~ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| {5: }| {6:~ }| - {4:[No Name] }| + {12:[No Name] }| | ]]) @@ -825,7 +837,7 @@ describe("'winhighlight' highlight", function() {3:[No Name] }| {7: }| {8:~ }| - {4:[No Name] }| + {13:[No Name] }| | ]]) @@ -834,7 +846,7 @@ describe("'winhighlight' highlight", function() {7: }| {8:~ }| {8:~ }| - {4:[No Name] }| + {13:[No Name] }| ^ | {0:~ }| {3:[No Name] }| @@ -848,10 +860,10 @@ describe("'winhighlight' highlight", function() {7: }| {8:~ }| {8:~ }| - {4:[No Name] }| + {13:[No Name] }| {1:^ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| | ]]) @@ -863,7 +875,7 @@ describe("'winhighlight' highlight", function() {3:[No Name] }| {1: }| {2:~ }| - {4:[No Name] }| + {14:[No Name] }| | ]]) @@ -873,10 +885,10 @@ describe("'winhighlight' highlight", function() {7: }| {8:~ }| {8:~ }| - {4:[No Name] }| + {13:[No Name] }| {1:^ }| {2:~ }| - {3:[No Name] }| + {11:[No Name] }| | ]]) @@ -888,13 +900,13 @@ describe("'winhighlight' highlight", function() {3:[No Name] }| {5: }| {6:~ }| - {4:[No Name] }| + {12:[No Name] }| | ]]) end) - it('applies also to non-text', function() + it('background applies also to non-text', function() insert('Lorem ipsum dolor sit amet ') command('set shiftwidth=2') feed('>>') @@ -940,6 +952,76 @@ describe("'winhighlight' highlight", function() | ]]) end) + + it('can override NonText, Conceal and EndOfBuffer', function() + curbufmeths.set_lines(0,-1,true, {"raa\000"}) + command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})') + command('set cole=2 cocu=nvic') + command('split') + command('call matchaddpos("Conceal", [[1,2]], 0, -1, {"conceal": "#"})') + command('set winhl=SpecialKey:ErrorMsg,EndOfBuffer:Background1,Conceal:Background2') + + screen:expect([[ + ^r{5:#}a{15:^@} | + {1:~ }| + {1:~ }| + {3:[No Name] [+] }| + r{19:#}a{16:^@} | + {0:~ }| + {4:[No Name] [+] }| + | + ]]) + end) + + it('can override LineNr, CursorColumn and ColorColumn', function() + insert('very text\nmore text') + command('set number') + command('set colorcolumn=2') + command('set cursorcolumn') + + command('split') + command('set winhl=LineNr:Background1,CursorColumn:Background2,ColorColumn:ErrorMsg') + screen:expect([[ + {1: 1 }v{15:e}ry tex{5:t} | + {1: 2 }m{15:o}re tex^t | + {0:~ }| + {3:[No Name] [+] }| + {9: 1 }v{17:e}ry tex{18:t} | + {9: 2 }m{17:o}re text | + {4:[No Name] [+] }| + | + ]]) + end) + + it('can override Tabline', function() + command('tabnew') + command('set winhl=TabLine:Background1,TabLineSel:ErrorMsg') + + screen:expect([[ + {20: No Name] }{15: No Name]}{20:X}| + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + command("tabnext") + screen:expect([[ + {21: No Name] }{1: No Name]}{20:X}| + ^ | + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + {0:~ }| + | + ]]) + end) + + --, ModeMsg and PopupMenu + end)