diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/api/highlight_spec.lua | 11 | ||||
-rw-r--r-- | test/functional/legacy/syn_attr_spec.lua | 60 | ||||
-rw-r--r-- | test/functional/ui/cmdline_spec.lua | 2 |
3 files changed, 68 insertions, 5 deletions
diff --git a/test/functional/api/highlight_spec.lua b/test/functional/api/highlight_spec.lua index 933103046c..c4197f0b3e 100644 --- a/test/functional/api/highlight_spec.lua +++ b/test/functional/api/highlight_spec.lua @@ -34,6 +34,7 @@ describe('API: highlight',function() underdotted = true, underdashed = true, strikethrough = true, + nocombine = true, } before_each(function() @@ -55,7 +56,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,underdouble,underdotted,underdashed,italic,reverse,strikethrough') + command('hi NewHighlight gui=underline,bold,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough,nocombine') eq(expected_rgb2, nvim("get_hl_by_id", hl_id, true)) -- Test nil argument. @@ -136,10 +137,10 @@ describe('API: highlight',function() -- Test cterm & Normal values. #18024 (tail) & #18980 -- Ensure Normal, and groups that match Normal return their fg & bg cterm values meths.set_hl(0, 'Normal', {ctermfg = 17, ctermbg = 213}) - meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213}) + meths.set_hl(0, 'NotNormal', {ctermfg = 17, ctermbg = 213, nocombine = true}) -- Note colors are "cterm" values, not rgb-as-ints eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'Normal', false)) - eq({foreground = 17, background = 213}, nvim("get_hl_by_name", 'NotNormal', false)) + eq({foreground = 17, background = 213, nocombine = true}, nvim("get_hl_by_name", 'NotNormal', false)) end) it('nvim_get_hl_id_by_name', function() @@ -214,6 +215,7 @@ describe("API: set highlight", function() reverse = true, undercurl = true, strikethrough = true, + nocombine = true, } } local highlight3_result_gui = { @@ -236,6 +238,7 @@ describe("API: set highlight", function() reverse = true, undercurl = true, strikethrough = true, + nocombine = true, } local function get_ns() @@ -290,7 +293,7 @@ describe("API: set highlight", function() exec_capture('highlight Test_hl')) meths.set_hl(0, 'Test_hl2', highlight3_config) - eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa', + eq('Test_hl2 xxx cterm=undercurl,italic,reverse,strikethrough,nocombine ctermfg=8 ctermbg=15 gui=bold,underline,undercurl,underdouble,underdotted,underdashed,italic,reverse,strikethrough guifg=#ff0000 guibg=#0032aa', exec_capture('highlight Test_hl2')) -- Colors are stored with the name they are defined, but diff --git a/test/functional/legacy/syn_attr_spec.lua b/test/functional/legacy/syn_attr_spec.lua new file mode 100644 index 0000000000..06e8427e27 --- /dev/null +++ b/test/functional/legacy/syn_attr_spec.lua @@ -0,0 +1,60 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear = helpers.clear +local command = helpers.command +local eq = helpers.eq +local eval = helpers.eval + +before_each(clear) + +-- oldtest: Test_missing_attr() +it('synIDattr() works', function() + local bool_attrs = { + 'bold', + 'italic', + 'reverse', + 'standout', + 'underline', + 'undercurl', + 'underdouble', + 'underdotted', + 'underdashed', + 'strikethrough', + 'nocombine', + } + + command('hi Mine cterm=NONE gui=NONE') + eq('Mine', eval([[synIDattr(hlID("Mine"), "name")]])) + for _, mode in ipairs({'cterm', 'gui'}) do + eq('', eval(([[synIDattr("Mine"->hlID(), "bg", '%s')]]):format(mode))) + eq('', eval(([[synIDattr("Mine"->hlID(), "fg", '%s')]]):format(mode))) + eq('', eval(([[synIDattr("Mine"->hlID(), "sp", '%s')]]):format(mode))) + for _, attr in ipairs(bool_attrs) do + eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode))) + eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode))) + eq('', eval(([[synIDattr(hlID("Mine"), "%s", '%s')]]):format(attr, mode))) + end + eq('', eval(([[synIDattr(hlID("Mine"), "inverse", '%s')]]):format(mode))) + end + + for i, attr1 in ipairs(bool_attrs) do + local attr2 = bool_attrs[i - 1] or bool_attrs[#bool_attrs] + + command(('hi Mine cterm=%s gui=%s'):format(attr1, attr2)) + eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr1))) + eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'cterm')]]):format(attr2))) + eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr1))) + eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'gui')]]):format(attr2))) + + command(('hi Mine cterm=%s gui=%s'):format(attr2, attr1)) + eq('', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr1))) + eq('1', eval(([[synIDattr("Mine"->hlID(), "%s", 'cterm')]]):format(attr2))) + eq('1', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr1))) + eq('', eval(([[synIDattr(hlID("Mine"), "%s", 'gui')]]):format(attr2))) + end + + command('hi Mine cterm=reverse gui=inverse') + eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'cterm')]])) + eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'cterm')]])) + eq('1', eval([[synIDattr(hlID("Mine"), "reverse", 'gui')]])) + eq('1', eval([[synIDattr(hlID("Mine"), "inverse", 'gui')]])) +end) diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua index f2b9173be1..db13647cc6 100644 --- a/test/functional/ui/cmdline_spec.lua +++ b/test/functional/ui/cmdline_spec.lua @@ -1103,7 +1103,7 @@ describe('cmdheight=0', function() ~ | ~ | ~ | - ~ | + recording @q | ]], showmode={}} feed('q') screen:expect{grid=[[ |