mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 17:21:49 +00:00
test/highlight_spec: Test "gui" arg of synIDattr().
Also use less "regular" values for cterm colors.
This commit is contained in:
@@ -168,46 +168,46 @@ describe('synIDattr()', function()
|
|||||||
before_each(function()
|
before_each(function()
|
||||||
clear()
|
clear()
|
||||||
screen = Screen.new(50, 7)
|
screen = Screen.new(50, 7)
|
||||||
execute('highlight Normal ctermfg=1 guifg=#ff0000 guibg=Black')
|
execute('highlight Normal ctermfg=252 guifg=#ff0000 guibg=Black')
|
||||||
-- Salmon #fa8072 Maroon #800000
|
-- Salmon #fa8072 Maroon #800000
|
||||||
execute('highlight Keyword ctermfg=2 guifg=Salmon guisp=Maroon')
|
execute('highlight Keyword ctermfg=79 guifg=Salmon guisp=Maroon')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
after_each(function()
|
it('returns cterm-color if RGB-capable UI is _not_ attached', function()
|
||||||
screen:detach()
|
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
|
||||||
end)
|
eq('252', eval('synIDattr(hlID("Normal"), "fg#")'))
|
||||||
|
|
||||||
it('returns gui-color if GUI', function()
|
|
||||||
eq('1', eval('synIDattr(hlID("Normal"), "fg")'))
|
|
||||||
eq('-1', eval('synIDattr(hlID("Normal"), "bg")'))
|
eq('-1', eval('synIDattr(hlID("Normal"), "bg")'))
|
||||||
|
eq('-1', eval('synIDattr(hlID("Normal"), "bg#")'))
|
||||||
eq('2', eval('synIDattr(hlID("Keyword"), "fg")'))
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
|
||||||
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
||||||
eq('', eval('synIDattr(hlID("Keyword"), "sp")'))
|
eq('', eval('synIDattr(hlID("Keyword"), "sp")'))
|
||||||
|
eq('', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('returns gui-color if "gui" arg is passed', function()
|
||||||
|
eq('Black', eval('synIDattr(hlID("Normal"), "bg", "gui")'))
|
||||||
|
eq('Maroon', eval('synIDattr(hlID("Keyword"), "sp", "gui")'))
|
||||||
|
end)
|
||||||
|
|
||||||
|
it('returns gui-color if RGB-capable UI is attached', function()
|
||||||
screen:attach(true)
|
screen:attach(true)
|
||||||
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg")'))
|
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg")'))
|
||||||
eq('Black', eval('synIDattr(hlID("Normal"), "bg")'))
|
eq('Black', eval('synIDattr(hlID("Normal"), "bg")'))
|
||||||
|
|
||||||
eq('Salmon', eval('synIDattr(hlID("Keyword"), "fg")'))
|
eq('Salmon', eval('synIDattr(hlID("Keyword"), "fg")'))
|
||||||
eq('Maroon', eval('synIDattr(hlID("Keyword"), "sp")'))
|
eq('Maroon', eval('synIDattr(hlID("Keyword"), "sp")'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('returns #RRGGBB value for [fg|bg|sp]#', function()
|
it('returns #RRGGBB value for fg#/bg#/sp#', function()
|
||||||
eq('1', eval('synIDattr(hlID("Normal"), "fg#")'))
|
|
||||||
eq('-1', eval('synIDattr(hlID("Normal"), "bg#")'))
|
|
||||||
|
|
||||||
eq('2', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
|
||||||
eq('', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
|
||||||
screen:attach(true)
|
screen:attach(true)
|
||||||
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg#")'))
|
eq('#ff0000', eval('synIDattr(hlID("Normal"), "fg#")'))
|
||||||
eq('#000000', eval('synIDattr(hlID("Normal"), "bg#")'))
|
eq('#000000', eval('synIDattr(hlID("Normal"), "bg#")'))
|
||||||
|
|
||||||
eq('#fa8072', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
eq('#fa8072', eval('synIDattr(hlID("Keyword"), "fg#")'))
|
||||||
eq('#800000', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
eq('#800000', eval('synIDattr(hlID("Keyword"), "sp#")'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('returns color number if non-GUI', function()
|
it('returns color number if non-GUI', function()
|
||||||
screen:attach(false)
|
screen:attach(false)
|
||||||
eq('1', eval('synIDattr(hlID("Normal"), "fg")'))
|
eq('252', eval('synIDattr(hlID("Normal"), "fg")'))
|
||||||
eq('2', eval('synIDattr(hlID("Keyword"), "fg")'))
|
eq('79', eval('synIDattr(hlID("Keyword"), "fg")'))
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -38,7 +38,6 @@ describe('manual syntax highlight', function()
|
|||||||
os.remove('Xtest-functional-ui-highlight.tmp.vim')
|
os.remove('Xtest-functional-ui-highlight.tmp.vim')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- test with "set hidden" even if the bug did not occur this way
|
|
||||||
it("works with buffer switch and 'hidden'", function()
|
it("works with buffer switch and 'hidden'", function()
|
||||||
execute('e tmp1.vim')
|
execute('e tmp1.vim')
|
||||||
execute('e Xtest-functional-ui-highlight.tmp.vim')
|
execute('e Xtest-functional-ui-highlight.tmp.vim')
|
||||||
|
Reference in New Issue
Block a user