mirror of
https://github.com/neovim/neovim.git
synced 2025-12-17 03:45:42 +00:00
test(tui_spec): get &background from child session directly (#27224)
This commit is contained in:
@@ -8,7 +8,6 @@ local helpers = require('test.functional.helpers')(after_each)
|
|||||||
local thelpers = require('test.functional.terminal.helpers')
|
local thelpers = require('test.functional.terminal.helpers')
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
local eq = helpers.eq
|
local eq = helpers.eq
|
||||||
local feed_command = helpers.feed_command
|
|
||||||
local feed_data = thelpers.feed_data
|
local feed_data = thelpers.feed_data
|
||||||
local clear = helpers.clear
|
local clear = helpers.clear
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
@@ -2810,17 +2809,13 @@ end)
|
|||||||
describe('TUI bg color', function()
|
describe('TUI bg color', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
|
|
||||||
local attr_ids = {
|
|
||||||
[1] = { reverse = true },
|
|
||||||
[2] = { bold = true },
|
|
||||||
[3] = { reverse = true, bold = true },
|
|
||||||
[4] = { foreground = tonumber('0x00000a') },
|
|
||||||
}
|
|
||||||
|
|
||||||
it('is properly set in a nested Nvim instance when background=dark', function()
|
it('is properly set in a nested Nvim instance when background=dark', function()
|
||||||
command('highlight clear Normal')
|
command('highlight clear Normal')
|
||||||
command('set background=dark') -- set outer Nvim background
|
command('set background=dark') -- set outer Nvim background
|
||||||
|
local child_server = new_pipename()
|
||||||
local screen = thelpers.setup_child_nvim({
|
local screen = thelpers.setup_child_nvim({
|
||||||
|
'--listen',
|
||||||
|
child_server,
|
||||||
'-u',
|
'-u',
|
||||||
'NONE',
|
'NONE',
|
||||||
'-i',
|
'-i',
|
||||||
@@ -2830,26 +2825,20 @@ describe('TUI bg color', function()
|
|||||||
'--cmd',
|
'--cmd',
|
||||||
'set noswapfile',
|
'set noswapfile',
|
||||||
})
|
})
|
||||||
screen:set_default_attr_ids(attr_ids)
|
screen:expect({ any = '%[No Name%]' })
|
||||||
retry(nil, 30000, function() -- wait for automatic background processing
|
local child_session = helpers.connect(child_server)
|
||||||
screen:sleep(20)
|
retry(nil, nil, function()
|
||||||
feed_command('set background?') -- check nested Nvim background
|
eq({ true, 'dark' }, { child_session:request('nvim_eval', '&background') })
|
||||||
screen:expect([[
|
|
||||||
{1: } |
|
|
||||||
{2:~} |
|
|
||||||
{2:~} |
|
|
||||||
{2:~} |
|
|
||||||
{3:[No Name] 0,0-1 All}|
|
|
||||||
background=dark |
|
|
||||||
{4:-- TERMINAL --} |
|
|
||||||
]])
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('is properly set in a nested Nvim instance when background=light', function()
|
it('is properly set in a nested Nvim instance when background=light', function()
|
||||||
command('highlight clear Normal')
|
command('highlight clear Normal')
|
||||||
command('set background=light') -- set outer Nvim background
|
command('set background=light') -- set outer Nvim background
|
||||||
|
local child_server = new_pipename()
|
||||||
local screen = thelpers.setup_child_nvim({
|
local screen = thelpers.setup_child_nvim({
|
||||||
|
'--listen',
|
||||||
|
child_server,
|
||||||
'-u',
|
'-u',
|
||||||
'NONE',
|
'NONE',
|
||||||
'-i',
|
'-i',
|
||||||
@@ -2859,18 +2848,10 @@ describe('TUI bg color', function()
|
|||||||
'--cmd',
|
'--cmd',
|
||||||
'set noswapfile',
|
'set noswapfile',
|
||||||
})
|
})
|
||||||
retry(nil, 30000, function() -- wait for automatic background processing
|
screen:expect({ any = '%[No Name%]' })
|
||||||
screen:sleep(20)
|
local child_session = helpers.connect(child_server)
|
||||||
feed_command('set background?') -- check nested Nvim background
|
retry(nil, nil, function()
|
||||||
screen:expect([[
|
eq({ true, 'light' }, { child_session:request('nvim_eval', '&background') })
|
||||||
{1: } |
|
|
||||||
{3:~} |
|
|
||||||
{3:~} |
|
|
||||||
{3:~} |
|
|
||||||
{5:[No Name] 0,0-1 All}|
|
|
||||||
background=light |
|
|
||||||
{3:-- TERMINAL --} |
|
|
||||||
]])
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -2914,20 +2895,15 @@ describe('TUI bg color', function()
|
|||||||
'-c',
|
'-c',
|
||||||
'autocmd OptionSet background echo "did OptionSet, yay!"',
|
'autocmd OptionSet background echo "did OptionSet, yay!"',
|
||||||
})
|
})
|
||||||
retry(nil, 30000, function() -- wait for automatic background processing
|
|
||||||
screen:sleep(20)
|
|
||||||
screen:expect([[
|
screen:expect([[
|
||||||
{1: } |
|
{1: } |
|
||||||
{3:~} |
|
{3:~} |*3
|
||||||
{3:~} |
|
|
||||||
{3:~} |
|
|
||||||
{5:[No Name] 0,0-1 All}|
|
{5:[No Name] 0,0-1 All}|
|
||||||
did OptionSet, yay! |
|
did OptionSet, yay! |
|
||||||
{3:-- TERMINAL --} |
|
{3:-- TERMINAL --} |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
|
||||||
|
|
||||||
-- These tests require `thelpers` because --headless/--embed
|
-- These tests require `thelpers` because --headless/--embed
|
||||||
-- does not initialize the TUI.
|
-- does not initialize the TUI.
|
||||||
|
|||||||
Reference in New Issue
Block a user