2013-09-01 21:14:25 +00:00
|
|
|
describe 'themes'
|
|
|
|
after
|
|
|
|
highlight clear Foo
|
|
|
|
highlight clear Normal
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should extract correct colors'
|
2017-08-11 10:05:39 +00:00
|
|
|
call airline#highlighter#reset_hlcache()
|
2013-09-01 21:14:25 +00:00
|
|
|
highlight Foo ctermfg=1 ctermbg=2
|
|
|
|
let colors = airline#themes#get_highlight('Foo')
|
2020-10-26 20:16:31 +00:00
|
|
|
Expect colors[0] == 'NONE'
|
|
|
|
Expect colors[1] == 'NONE'
|
2013-09-01 21:14:25 +00:00
|
|
|
Expect colors[2] == '1'
|
|
|
|
Expect colors[3] == '2'
|
|
|
|
end
|
|
|
|
|
2020-10-26 20:16:31 +00:00
|
|
|
if exists("+termguicolors")
|
|
|
|
it 'should extract correct colors with termguicolors'
|
|
|
|
call airline#highlighter#reset_hlcache()
|
|
|
|
set termguicolors
|
|
|
|
highlight Foo guifg=#cd0000 guibg=#00cd00 ctermfg=1 ctermbg=2
|
|
|
|
let colors = airline#themes#get_highlight('Foo')
|
|
|
|
Expect colors[0] == '#cd0000'
|
|
|
|
Expect colors[1] == '#00cd00'
|
|
|
|
Expect colors[2] == '1'
|
|
|
|
Expect colors[3] == '2'
|
|
|
|
end
|
|
|
|
endif
|
|
|
|
|
2013-09-01 21:14:25 +00:00
|
|
|
it 'should extract from normal if colors unavailable'
|
2017-08-11 10:05:39 +00:00
|
|
|
call airline#highlighter#reset_hlcache()
|
2013-09-01 21:14:25 +00:00
|
|
|
highlight Normal ctermfg=100 ctermbg=200
|
|
|
|
highlight Foo ctermbg=2
|
|
|
|
let colors = airline#themes#get_highlight('Foo')
|
2020-10-26 20:16:31 +00:00
|
|
|
Expect colors[0] == 'NONE'
|
|
|
|
Expect colors[1] == 'NONE'
|
2013-09-01 21:14:25 +00:00
|
|
|
Expect colors[2] == '100'
|
|
|
|
Expect colors[3] == '2'
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should flip target group if it is reversed'
|
2017-08-11 10:05:39 +00:00
|
|
|
call airline#highlighter#reset_hlcache()
|
2020-10-26 20:16:31 +00:00
|
|
|
highlight Foo ctermbg=222 ctermfg=103 cterm=reverse
|
2013-09-01 21:14:25 +00:00
|
|
|
let colors = airline#themes#get_highlight('Foo')
|
2020-10-26 20:16:31 +00:00
|
|
|
Expect colors[0] == 'NONE'
|
|
|
|
Expect colors[1] == 'NONE'
|
2013-09-01 21:14:25 +00:00
|
|
|
Expect colors[2] == '222'
|
|
|
|
Expect colors[3] == '103'
|
|
|
|
end
|
2013-09-02 02:57:32 +00:00
|
|
|
|
|
|
|
it 'should pass args through correctly'
|
2017-08-11 10:05:39 +00:00
|
|
|
call airline#highlighter#reset_hlcache()
|
|
|
|
hi clear Normal
|
2013-09-02 02:57:32 +00:00
|
|
|
let hl = airline#themes#get_highlight('Foo', 'bold', 'italic')
|
2020-10-26 20:16:31 +00:00
|
|
|
Expect hl == ['NONE', 'NONE', 'NONE', 'NONE', 'bold,italic']
|
2013-09-02 02:57:32 +00:00
|
|
|
|
|
|
|
let hl = airline#themes#get_highlight2(['Foo','bg'], ['Foo','fg'], 'italic', 'bold')
|
2020-10-26 20:16:31 +00:00
|
|
|
Expect hl == ['NONE', 'NONE', 'NONE', 'NONE', 'italic,bold']
|
2013-09-02 02:57:32 +00:00
|
|
|
end
|
2013-09-15 12:41:48 +00:00
|
|
|
|
|
|
|
it 'should generate color map with mirroring'
|
|
|
|
let map = airline#themes#generate_color_map(
|
|
|
|
\ [ 1, 1, 1, 1, '1' ],
|
|
|
|
\ [ 2, 2, 2, 2, '2' ],
|
|
|
|
\ [ 3, 3, 3, 3, '3' ],
|
|
|
|
\ )
|
|
|
|
Expect map.airline_a[0] == 1
|
|
|
|
Expect map.airline_b[0] == 2
|
|
|
|
Expect map.airline_c[0] == 3
|
|
|
|
Expect map.airline_x[0] == 3
|
|
|
|
Expect map.airline_y[0] == 2
|
|
|
|
Expect map.airline_z[0] == 1
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should generate color map with full set of colors'
|
|
|
|
let map = airline#themes#generate_color_map(
|
|
|
|
\ [ 1, 1, 1, 1, '1' ],
|
|
|
|
\ [ 2, 2, 2, 2, '2' ],
|
|
|
|
\ [ 3, 3, 3, 3, '3' ],
|
|
|
|
\ [ 4, 4, 4, 4, '4' ],
|
|
|
|
\ [ 5, 5, 5, 5, '5' ],
|
|
|
|
\ [ 6, 6, 6, 6, '6' ],
|
|
|
|
\ )
|
|
|
|
Expect map.airline_a[0] == 1
|
|
|
|
Expect map.airline_b[0] == 2
|
|
|
|
Expect map.airline_c[0] == 3
|
|
|
|
Expect map.airline_x[0] == 4
|
|
|
|
Expect map.airline_y[0] == 5
|
|
|
|
Expect map.airline_z[0] == 6
|
|
|
|
end
|
2013-09-01 21:14:25 +00:00
|
|
|
end
|