From f6a82c1d4fbda50cc167ac138d0e58e9bdad627e Mon Sep 17 00:00:00 2001 From: AdnoC Date: Sat, 23 Apr 2016 18:01:15 -0400 Subject: test: Fix tests failing --- test/functional/ui/screen.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index a11fab18a2..93f7142dab 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -425,6 +425,10 @@ function Screen:_handle_update_bg(bg) self._bg = bg end +function Screen:_handle_update_sp(sp) + self._sp = sp +end + function Screen:_handle_suspend() self.suspended = true end -- cgit From a5ac389e5c0484824552ffeede64b9e2be75b883 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Sun, 24 Apr 2016 11:46:48 +0200 Subject: test: Add a test for the new guisp highlighting feature. Screen.lua needed a little cosmetical adjustment to print out the color nicely. --- test/functional/ui/highlight_spec.lua | 59 ++++++++++++++++++++++++++++++++++- test/functional/ui/screen.lua | 2 +- 2 files changed, 59 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index 06139277b2..cd3fba2a17 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -1,7 +1,7 @@ local helpers = require('test.functional.helpers') local Screen = require('test.functional.ui.screen') local os = require('os') -local clear, feed = helpers.clear, helpers.feed +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert local execute, request, eq = helpers.execute, helpers.request, helpers.eq @@ -303,3 +303,60 @@ describe('Default highlight groups', function() ]], {[1] = {foreground = Screen.colors.Red, background = Screen.colors.Green}}) end) end) + +describe('New special highlight color attribute', function() + local screen + + before_each(function() + clear() + screen = Screen.new(25,10) + screen:attach() + screen:set_default_attr_ignore({ + [1] = {bold=true}, + [2] = {bold=true, foreground=Screen.colors.Blue} + }) + end) + + it('used for undercurls', function() + execute('syntax on') + execute('syn keyword TmpKeyword neovim') + execute('syn keyword TmpKeyword1 special') + execute('syn keyword TmpKeyword2 specialwithbg') + execute('syn keyword TmpKeyword3 specialwithfg') + execute('hi! Awesome guifg=red guibg=yellow guisp=red') + execute('hi! Awesome1 guisp=red') + execute('hi! Awesome2 guibg=yellow guisp=red') + execute('hi! Awesome3 guifg=red guisp=red') + execute('hi link TmpKeyword Awesome') + execute('hi link TmpKeyword1 Awesome1') + execute('hi link TmpKeyword2 Awesome2') + execute('hi link TmpKeyword3 Awesome3') + insert([[ + neovim + awesome neovim + wordcontainingneovim + special + specialwithbg + specialwithfg + ]]) + feed('Goneovim tabbed') + screen:expect([[ + {1:neovim} | + awesome {1:neovim} | + wordcontainingneovim | + special | + {2:specialwithbg} | + {3:specialwithfg} | + | + {1:neovim} tabbed^ | + ~ | + -- INSERT -- | + ]],{ + [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, + special = Screen.colors.Red}, + [2] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, + [3] = {foreground = Screen.colors.Red, special = Screen.colors.Red} + }) + + end) +end) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 93f7142dab..11fde34ffc 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -577,7 +577,7 @@ function Screen:_pprint_attrs(attrs) local items = {} for f, v in pairs(attrs) do local desc = tostring(v) - if f == "foreground" or f == "background" then + if f == "foreground" or f == "background" or f == "special" then if Screen.colornames[v] ~= nil then desc = "Screen.colors."..Screen.colornames[v] end -- cgit From 724fc8859745370b7ebe971eee79f21dedadcdc2 Mon Sep 17 00:00:00 2001 From: AdnoC Date: Sun, 24 Apr 2016 21:07:05 -0400 Subject: test: Edit the special color test --- test/functional/ui/highlight_spec.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index cd3fba2a17..c46dd59ada 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -312,8 +312,7 @@ describe('New special highlight color attribute', function() screen = Screen.new(25,10) screen:attach() screen:set_default_attr_ignore({ - [1] = {bold=true}, - [2] = {bold=true, foreground=Screen.colors.Blue} + {bold=true, foreground=Screen.colors.Blue} }) end) @@ -350,12 +349,13 @@ describe('New special highlight color attribute', function() | {1:neovim} tabbed^ | ~ | - -- INSERT -- | - ]],{ + {4:-- INSERT --} | + ]],{ [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, special = Screen.colors.Red}, [2] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, - [3] = {foreground = Screen.colors.Red, special = Screen.colors.Red} + [3] = {foreground = Screen.colors.Red, special = Screen.colors.Red}, + [4] = {bold = true} }) end) -- cgit From e5eea7fa06ae7057521755d1f638d34e049bd379 Mon Sep 17 00:00:00 2001 From: AdnoC Date: Tue, 17 May 2016 16:25:11 -0400 Subject: test: Screen also checks 'special' when testing attribute equality --- test/functional/terminal/highlight_spec.lua | 6 +++--- test/functional/ui/highlight_spec.lua | 19 ++++++++++--------- test/functional/ui/screen.lua | 3 ++- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'test') diff --git a/test/functional/terminal/highlight_spec.lua b/test/functional/terminal/highlight_spec.lua index 045f5aa42f..97875c5147 100644 --- a/test/functional/terminal/highlight_spec.lua +++ b/test/functional/terminal/highlight_spec.lua @@ -25,7 +25,7 @@ describe('terminal window highlighting', function() [5] = {background = 11}, [6] = {foreground = 130}, [7] = {reverse = true}, - [8] = {background = 11} + [8] = {background = 11}, }) screen:attach(false) execute('enew | call termopen(["'..nvim_dir..'/tty-test"]) | startinsert') @@ -121,7 +121,7 @@ describe('terminal window highlighting with custom palette', function() clear() screen = Screen.new(50, 7) screen:set_default_attr_ids({ - [1] = {foreground = 1193046} + [1] = {foreground = 1193046, special = Screen.colors.Black} }) screen:set_default_attr_ignore({ [1] = {bold = true}, @@ -130,7 +130,7 @@ describe('terminal window highlighting with custom palette', function() [5] = {background = 11}, [6] = {foreground = 130}, [7] = {reverse = true}, - [8] = {background = 11} + [8] = {background = 11}, }) screen:attach(true) nvim('set_var', 'terminal_color_3', '#123456') diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua index c46dd59ada..c773836c6e 100644 --- a/test/functional/ui/highlight_spec.lua +++ b/test/functional/ui/highlight_spec.lua @@ -312,11 +312,12 @@ describe('New special highlight color attribute', function() screen = Screen.new(25,10) screen:attach() screen:set_default_attr_ignore({ - {bold=true, foreground=Screen.colors.Blue} + [1] = {bold = true, foreground = Screen.colors.Blue}, + [2] = {bold = true} }) end) - it('used for undercurls', function() + it('can be set and is applied like foreground or background', function() execute('syntax on') execute('syn keyword TmpKeyword neovim') execute('syn keyword TmpKeyword1 special') @@ -343,19 +344,19 @@ describe('New special highlight color attribute', function() {1:neovim} | awesome {1:neovim} | wordcontainingneovim | - special | - {2:specialwithbg} | - {3:specialwithfg} | + {2:special} | + {3:specialwithbg} | + {4:specialwithfg} | | {1:neovim} tabbed^ | ~ | - {4:-- INSERT --} | + -- INSERT -- | ]],{ [1] = {background = Screen.colors.Yellow, foreground = Screen.colors.Red, special = Screen.colors.Red}, - [2] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, - [3] = {foreground = Screen.colors.Red, special = Screen.colors.Red}, - [4] = {bold = true} + [2] = {special = Screen.colors.Red}, + [3] = {special = Screen.colors.Red, background = Screen.colors.Yellow}, + [4] = {foreground = Screen.colors.Red, special = Screen.colors.Red}, }) end) diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 11fde34ffc..6372cbe081 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -618,7 +618,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 + a.background == b.background and + a.special == b.special end function Screen:_attr_index(attrs, attr) -- cgit