diff options
Diffstat (limited to 'test/functional/terminal')
-rw-r--r-- | test/functional/terminal/buffer_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/terminal/mouse_spec.lua | 86 | ||||
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 36 |
3 files changed, 97 insertions, 27 deletions
diff --git a/test/functional/terminal/buffer_spec.lua b/test/functional/terminal/buffer_spec.lua index f25cfa2039..1ff451434d 100644 --- a/test/functional/terminal/buffer_spec.lua +++ b/test/functional/terminal/buffer_spec.lua @@ -350,7 +350,7 @@ describe('on_lines does not emit out-of-bounds line indexes when', function() end) it('creating a terminal buffer #16394', function() - feed_command([[autocmd TermOpen * ++once call v:lua.register_callback(expand("<abuf>"))]]) + feed_command('autocmd TermOpen * ++once call v:lua.register_callback(str2nr(expand("<abuf>")))') feed_command('terminal') sleep(500) eq('', exec_lua([[return _G.cb_error]])) diff --git a/test/functional/terminal/mouse_spec.lua b/test/functional/terminal/mouse_spec.lua index 833ded9479..780a0b9b5a 100644 --- a/test/functional/terminal/mouse_spec.lua +++ b/test/functional/terminal/mouse_spec.lua @@ -66,7 +66,7 @@ describe(':terminal mouse', function() ]]) end) - it('will forward mouse clicks to the program', function() + it('will forward mouse press, drag and release to the program', function() if helpers.pending_win32(pending) then return end feed('<LeftMouse><1,2>') screen:expect([[ @@ -78,6 +78,36 @@ describe(':terminal mouse', function() "#{1: } | {3:-- TERMINAL --} | ]]) + feed('<LeftDrag><2,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + @##{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<LeftDrag><3,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + @$#{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<LeftRelease><3,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + #$#{1: } | + {3:-- TERMINAL --} | + ]]) end) it('will forward mouse scroll to the program', function() @@ -94,6 +124,60 @@ describe(':terminal mouse', function() ]]) end) + it('dragging and scrolling do not interfere with each other', function() + if helpers.pending_win32(pending) then return end + feed('<LeftMouse><1,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + "#{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<ScrollWheelUp><1,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + `"#{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<LeftDrag><2,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + @##{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<ScrollWheelUp><2,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + `##{1: } | + {3:-- TERMINAL --} | + ]]) + feed('<LeftRelease><2,2>') + screen:expect([[ + line27 | + line28 | + line29 | + line30 | + mouse enabled | + ###{1: } | + {3:-- TERMINAL --} | + ]]) + end) + it('will forward mouse clicks to the program with the correct even if set nu', function() if helpers.pending_win32(pending) then return end nvim('command', 'set number') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index bf57b135cb..faf44fa01d 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -20,7 +20,6 @@ local nvim_prog = helpers.nvim_prog local nvim_set = helpers.nvim_set local ok = helpers.ok local read_file = helpers.read_file -local exec_lua = helpers.exec_lua if helpers.pending_win32(pending) then return end @@ -581,34 +580,21 @@ describe('TUI', function() end) it("paste: 'nomodifiable' buffer", function() - local has_luajit = exec_lua('return jit ~= nil') child_session:request('nvim_command', 'set nomodifiable') child_session:request('nvim_exec_lua', [[ - -- Stack traces for this test are non-deterministic, so disable them - _G.debug.traceback = function(msg) return msg end + -- Truncate the error message to hide the line number + _G.debug.traceback = function(msg) return msg:sub(-49) end ]], {}) feed_data('\027[200~fail 1\nfail 2\n\027[201~') - if has_luajit then - screen:expect{grid=[[ - | - {4:~ }| - {5: }| - {8:paste: Error executing lua: vim.lua:0: Vim:E21: Ca}| - {8:nnot make changes, 'modifiable' is off} | - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} - else - screen:expect{grid=[[ - | - {4:~ }| - {5: }| - {8:paste: Error executing lua: Vim:E21: Cannot make c}| - {8:hanges, 'modifiable' is off} | - {10:Press ENTER or type command to continue}{1: } | - {3:-- TERMINAL --} | - ]]} - end + screen:expect{grid=[[ + | + {4:~ }| + {5: }| + {8:paste: Error executing lua: Vim:E21: Cannot make c}| + {8:hanges, 'modifiable' is off} | + {10:Press ENTER or type command to continue}{1: } | + {3:-- TERMINAL --} | + ]]} feed_data('\n') -- <Enter> child_session:request('nvim_command', 'set modifiable') feed_data('\027[200~success 1\nsuccess 2\n\027[201~') |