diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/functional/eval/null_spec.lua | 2 | ||||
| -rw-r--r-- | test/functional/eval/timer_spec.lua | 4 | ||||
| -rw-r--r-- | test/functional/ui/float_spec.lua | 43 | ||||
| -rw-r--r-- | test/functional/ui/mouse_spec.lua | 22 | ||||
| -rw-r--r-- | test/functional/ui/screen.lua | 17 | ||||
| -rw-r--r-- | test/functional/ui/searchhl_spec.lua | 24 |
6 files changed, 49 insertions, 63 deletions
diff --git a/test/functional/eval/null_spec.lua b/test/functional/eval/null_spec.lua index bef41e52d4..fa8f7d873f 100644 --- a/test/functional/eval/null_spec.lua +++ b/test/functional/eval/null_spec.lua @@ -121,7 +121,7 @@ describe('NULL', function() null_test('does not make Neovim crash when v:oldfiles gets assigned to that', ':let v:oldfiles = L|oldfiles', 0) null_expr_test('does not make complete() crash or error out', 'execute(":normal i\\<C-r>=complete(1, L)[-1]\\n")', - 0, '', function() + '', '\n', function() eq({''}, curbufmeths.get_lines(0, -1, false)) end) null_expr_test('is accepted by setmatches()', 'setmatches(L)', 0, 0) diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua index 3f57568b8e..9ee0735e40 100644 --- a/test/functional/eval/timer_spec.lua +++ b/test/functional/eval/timer_spec.lua @@ -130,12 +130,12 @@ describe('timers', function() nvim_async("command", "call timer_start("..load_adjust(100)..", 'AddItem', {'repeat': -1})") screen:expect([[ - ^ITEM 1 | + ITEM 1 | ITEM 2 | {1:~ }| {1:~ }| {1:~ }| - | + ^ | ]]) nvim_async("command", "let g:cont = 1") diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 8d654f6e5b..32f9ae030f 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -5344,45 +5344,6 @@ describe('floatwin', function() -- at least. Also check invisible EndOfBuffer region blends correctly. meths.buf_set_lines(buf, 0, -1, true, {" x x x xx", " x x x x"}) win = meths.open_win(buf, false, {relative='editor', width=12, height=3, row=0, col=11, style='minimal'}) - if multigrid then - screen:expect{grid=[[ - ## grid 1 - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [2:----------------------------------------]| - [3:----------------------------------------]| - ## grid 2 - # TODO: 测试字典信息的准确性 | - # FIXME: 测试字典信息的准确^性 | - {0:~ }| - {0:~ }| - {0:~ }| - {0:~ }| - ## grid 3 - | - ## grid 6 - {1: x x x xx}| - {1: x x x x}| - {1: }| - ]], float_pos={ - [6] = { { - id = 1003 - }, "NW", 1, 0, 11, true } - }} - else - screen:expect{grid=[[ - # TODO: 测 {1: x x x xx} 确性 | - # FIXME: 测{1: x x x x}准确^性 | - {0:~ }{1: }{0: }| - {0:~ }| - {0:~ }| - {0:~ }| - | - ]]} - end meths.win_set_option(win, 'winblend', 30) screen:set_default_attr_ids({ [1] = {foreground = tonumber('0xb282b2'), background = tonumber('0xffcfff')}, @@ -5420,7 +5381,7 @@ describe('floatwin', function() }, "NW", 1, 0, 11, true } }} else - screen:expect{grid=[[ + screen:expect([[ # TODO: 测 {2: x x x}{1:息}{2: xx} 确性 | # FIXME: 测{1:试}{2:x x x}{1:息}{2: x}准确^性 | {3:~ }{4: }{3: }| @@ -5428,7 +5389,7 @@ describe('floatwin', function() {3:~ }| {3:~ }| | - ]]} + ]]) end meths.win_set_config(win, {relative='editor', row=0, col=12}) diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua index a741136111..7bca741ae3 100644 --- a/test/functional/ui/mouse_spec.lua +++ b/test/functional/ui/mouse_spec.lua @@ -45,13 +45,33 @@ describe('ui/mouse/input', function() it('single left click moves cursor', function() feed('<LeftMouse><2,1>') - screen:expect([[ + screen:expect{grid=[[ testing | mo^use | support and selection | {0:~ }| | + ]], mouse_enabled=true} + feed('<LeftMouse><0,0>') + screen:expect([[ + ^testing | + mouse | + support and selection | + {0:~ }| + | ]]) + end) + + it("in external ui works with unset 'mouse'", function() + meths.set_option('mouse', '') + feed('<LeftMouse><2,1>') + screen:expect{grid=[[ + testing | + mo^use | + support and selection | + {0:~ }| + | + ]], mouse_enabled=false} feed('<LeftMouse><0,0>') screen:expect([[ ^testing | diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 5104c58796..fcf6926433 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -170,7 +170,7 @@ function Screen.new(width, height) ruler = {}, hl_groups = {}, _default_attr_ids = nil, - _mouse_enabled = true, + mouse_enabled = true, _attrs = {}, _hl_info = {[0]={}}, _attr_table = {[0]={{},{}}}, @@ -318,7 +318,7 @@ function Screen:expect(expected, attr_ids, ...) assert(next({...}) == nil, "invalid args to expect()") if type(expected) == "table" then assert(not (attr_ids ~= nil)) - local is_key = {grid=true, attr_ids=true, condition=true, + local is_key = {grid=true, attr_ids=true, condition=true, mouse_enabled=true, any=true, mode=true, unchanged=true, intermediate=true, reset=true, timeout=true, request_cb=true, hl_groups=true} for _, v in ipairs(ext_keys) do @@ -422,12 +422,15 @@ screen:redraw_debug() to show all intermediate screen states. ]]) if expected.mode ~= nil then extstate.mode = self.mode end + if expected.mouse_enabled ~= nil then + extstate.mouse_enabled = self.mouse_enabled + end if expected.win_viewport == nil then extstate.win_viewport = nil end -- Convert assertion errors into invalid screen state descriptions. - for _, k in ipairs(concat_tables(ext_keys, {'mode'})) do + for _, k in ipairs(concat_tables(ext_keys, {'mode', 'mouse_enabled'})) do -- Empty states are considered the default and need not be mentioned. if (not (expected[k] == nil and isempty(extstate[k]))) then local status, res = pcall(eq, expected[k], extstate[k], k) @@ -799,17 +802,15 @@ function Screen:_handle_busy_stop() end function Screen:_handle_mouse_on() - self._mouse_enabled = true + self.mouse_enabled = true end function Screen:_handle_mouse_off() - self._mouse_enabled = false + self.mouse_enabled = false end function Screen:_handle_mode_change(mode, idx) - if self._mode_info ~= nil then - assert(mode == self._mode_info[idx+1].name) - end + assert(mode == self._mode_info[idx+1].name) self.mode = mode end diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua index 3bb72303bf..656f613c6a 100644 --- a/test/functional/ui/searchhl_spec.lua +++ b/test/functional/ui/searchhl_spec.lua @@ -20,7 +20,6 @@ describe('search highlighting', function() [2] = {background = colors.Yellow}, -- Search [3] = {reverse = true}, [4] = {foreground = colors.Red}, -- Message - [5] = {bold = true, reverse = true}, [6] = {foreground = Screen.colors.Blue4, background = Screen.colors.LightGrey}, -- Folded }) end) @@ -176,15 +175,7 @@ describe('search highlighting', function() ]]) feed('/foo') helpers.poke_eventloop() - screen:expect{grid=[[ - {3:foo} bar baz {3:│} | - bar baz {2:foo} {3:│} | - bar {2:foo} baz {3:│} | - {3:│} | - {1:~ }{3:│} | - {5:[No Name] [+] }{3:term }| - /foo^ | - ]]} + screen:expect_unchanged() end) it('works with incsearch', function() @@ -480,6 +471,19 @@ describe('search highlighting', function() {4:search hit BOTTOM, continuing at TOP} | ]]) + -- check hilights work also in folds + feed("zf4j") + command("%foldopen") + screen:expect([[ + very {5:spec^ial}{2: te}{6:xt} | + | + {1:~ }| + {1:~ }| + {1:~ }| + {1:~ }| + {4:search hit BOTTOM, continuing at TOP} | + ]]) + feed_command("call clearmatches()") screen:expect([[ very spec{2:^ial te}xt | |