diff options
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/terminal/helpers.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/highlight_spec.lua | 13 | ||||
-rw-r--r-- | test/functional/ui/highlight_spec.lua | 26 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 3 |
5 files changed, 42 insertions, 5 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 76bf338d97..5297c6454e 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -25,6 +25,7 @@ describe('API: highlight',function() reverse = true, undercurl = true, underline = true, + strikethrough = true, } before_each(function() @@ -46,7 +47,7 @@ describe('API: highlight',function() eq('Invalid highlight id: 30000', string.match(emsg, 'Invalid.*')) -- Test all highlight properties. - command('hi NewHighlight gui=underline,bold,undercurl,italic,reverse') + command('hi NewHighlight gui=underline,bold,undercurl,italic,reverse,strikethrough') eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true)) -- Test nil argument. diff --git a/test/functional/terminal/helpers.lua b/test/functional/terminal/helpers.lua index 9e450cc264..f6cab6bd1e 100644 --- a/test/functional/terminal/helpers.lua +++ b/test/functional/terminal/helpers.lua @@ -29,6 +29,7 @@ local function set_bg(num) feed_termcode('[48;5;'..num..'m') end local function set_bold() feed_termcode('[1m') end local function set_italic() feed_termcode('[3m') end local function set_underline() feed_termcode('[4m') end +local function set_strikethrough() feed_termcode('[9m') end local function clear_attrs() feed_termcode('[0;10m') end -- mouse local function enable_mouse() feed_termcode('[?1002h') end @@ -113,6 +114,7 @@ return { set_bold = set_bold, set_italic = set_italic, set_underline = set_underline, + set_strikethrough = set_strikethrough, clear_attrs = clear_attrs, enable_mouse = enable_mouse, disable_mouse = disable_mouse, diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 48fedd5927..06a6fd6f2b 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -18,7 +18,7 @@ describe(':terminal highlight', function() [1] = {foreground = 45}, [2] = {background = 46}, [3] = {foreground = 45, background = 46}, - [4] = {bold = true, italic = true, underline = true}, + [4] = {bold = true, italic = true, underline = true, strikethrough = true}, [5] = {bold = true}, [6] = {foreground = 12}, [7] = {bold = true, reverse = true}, @@ -108,10 +108,11 @@ describe(':terminal highlight', function() thelpers.set_fg(45) thelpers.set_bg(46) end) - descr('bold, italics and underline', 4, function() + descr('bold, italics, underline and strikethrough', 4, function() thelpers.set_bold() thelpers.set_italic() thelpers.set_underline() + thelpers.set_strikethrough() end) end) @@ -215,7 +216,7 @@ describe('synIDattr()', function() screen = Screen.new(50, 7) command('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black') -- Salmon #fa8072 Maroon #800000 - command('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon') + command('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon cterm=strikethrough gui=strikethrough') end) it('returns cterm-color if RGB-capable UI is _not_ attached', function() @@ -255,6 +256,12 @@ describe('synIDattr()', function() eq('252', eval('synIDattr(hlID("Normal"), "fg")')) eq('79', eval('synIDattr(hlID("Keyword"), "fg")')) end) + + it('returns "1" if group has "strikethrough" attribute', function() + eq('', eval('synIDattr(hlID("Normal"), "strikethrough")')) + eq('1', eval('synIDattr(hlID("Keyword"), "strikethrough")')) + eq('1', eval('synIDattr(hlID("Keyword"), "strikethrough", "gui")')) + end) end) describe('fg/bg special colors', function() diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 47b2d23c9b..f40f658275 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -412,6 +412,32 @@ describe('highlight', function() ]]) end) + it('strikethrough', function() + screen:detach() + screen = Screen.new(25,6) + screen:attach() + feed_command('syntax on') + feed_command('syn keyword TmpKeyword foo') + feed_command('hi! Awesome cterm=strikethrough gui=strikethrough') + feed_command('hi link TmpKeyword Awesome') + insert([[ + foo + foo bar + foobarfoobar + ]]) + screen:expect([[ + {1:foo} | + {1:foo} bar | + foobarfoobar | + ^ | + {2:~ }| + | + ]],{ + [1] = {strikethrough = true}, + [2] = {bold = true, foreground = Screen.colors.Blue1}, + }) + end) + it('guisp (special/undercurl)', function() feed_command('syntax on') feed_command('syn keyword TmpKeyword neovim') diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 12abfb2ad9..06a2ac3ca2 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -1509,7 +1509,8 @@ function Screen:_equal_attrs(a, b) a.underline == b.underline and a.undercurl == b.undercurl and a.italic == b.italic and a.reverse == b.reverse and a.foreground == b.foreground and a.background == b.background and - a.special == b.special and a.blend == b.blend + a.special == b.special and a.blend == b.blend and + a.strikethrough == b.strikethrough end function Screen:_equal_info(a, b) |