aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/terminal/buffer_spec.lua12
-rw-r--r--test/functional/terminal/tui_spec.lua55
2 files changed, 67 insertions, 0 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua
index 480ca96289..d0462b5619 100644
--- a/test/functional/terminal/buffer_spec.lua
+++ b/test/functional/terminal/buffer_spec.lua
@@ -317,6 +317,18 @@ describe(':terminal buffer', function()
pcall_err(command, 'write test/functional/fixtures/tty-test.c')
)
end)
+
+ it('emits TermRequest events', function()
+ command('split')
+ command('enew')
+ local term = meths.open_term(0, {})
+ -- cwd will be inserted in a file URI, which cannot contain backs
+ local cwd = funcs.getcwd():gsub('\\', '/')
+ local parent = cwd:match('^(.+/)')
+ local expected = '\027]7;file://host' .. parent
+ meths.chan_send(term, string.format('%s\027\\', expected))
+ eq(expected, eval('v:termrequest'))
+ end)
end)
describe('No heap-buffer-overflow when using', function()
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index f6ee0f9c77..e65e57bc7f 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -28,6 +28,7 @@ local new_pipename = helpers.new_pipename
local spawn_argv = helpers.spawn_argv
local set_session = helpers.set_session
local write_file = helpers.write_file
+local eval = helpers.eval
if helpers.skip(is_os('win')) then
return
@@ -2736,6 +2737,42 @@ describe('TUI', function()
unchanged = true,
}
end)
+
+ it('queries the terminal for truecolor support', function()
+ clear()
+ exec_lua([[
+ vim.api.nvim_create_autocmd('TermRequest', {
+ callback = function(args)
+ local req = args.data
+ local payload = req:match('^\027P%+q([%x;]+)$')
+ if payload then
+ vim.g.xtgettcap = true
+ return true
+ end
+ end,
+ })
+ ]])
+ screen = thelpers.setup_child_nvim({
+ '-u',
+ 'NONE',
+ '-i',
+ 'NONE',
+ }, {
+ env = {
+ VIMRUNTIME = os.getenv('VIMRUNTIME'),
+
+ -- Force COLORTERM to be unset and use a TERM that does not contain Tc or RGB in terminfo.
+ -- This will force the nested nvim instance to query with XTGETTCAP
+ COLORTERM = '',
+ TERM = 'xterm-256colors',
+ },
+ })
+
+ retry(nil, 1000, function()
+ eq(true, eval("get(g:, 'xtgettcap', v:false)"))
+ eq(1, eval('&termguicolors'))
+ end)
+ end)
end)
describe('TUI bg color', function()
@@ -2743,6 +2780,18 @@ describe('TUI bg color', function()
local function setup_bg_test()
clear()
+ exec_lua([[
+ vim.api.nvim_create_autocmd('TermRequest', {
+ callback = function(args)
+ local req = args.data
+ if req == '\027]11;?' then
+ vim.g.oscrequest = true
+ return true
+ end
+ end,
+ })
+ ]])
+
screen = thelpers.setup_child_nvim({
'-u',
'NONE',
@@ -2759,6 +2808,12 @@ describe('TUI bg color', function()
before_each(setup_bg_test)
+ it('queries the terminal for background color', function()
+ retry(nil, 1000, function()
+ eq(true, eval("get(g:, 'oscrequest', v:false)"))
+ end)
+ end)
+
it('triggers OptionSet event on unsplit terminal-response', function()
screen:expect([[
{1: } |