diff options
Diffstat (limited to 'test/functional/ui')
-rw-r--r-- | test/functional/ui/float_spec.lua | 91 | ||||
-rw-r--r-- | test/functional/ui/inccommand_spec.lua | 16 | ||||
-rw-r--r-- | test/functional/ui/input_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/ui/messages_spec.lua | 50 | ||||
-rw-r--r-- | test/functional/ui/mode_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/ui/multigrid_spec.lua | 50 | ||||
-rw-r--r-- | test/functional/ui/output_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/ui/popupmenu_spec.lua | 3 | ||||
-rw-r--r-- | test/functional/ui/screen.lua | 14 |
9 files changed, 158 insertions, 80 deletions
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua index 8a1758c4a0..8dfe36c799 100644 --- a/test/functional/ui/float_spec.lua +++ b/test/functional/ui/float_spec.lua @@ -383,6 +383,7 @@ describe('floating windows', function() command('set number') command('set signcolumn=yes') command('set cursorline') + command('set foldcolumn=1') command('hi NormalFloat guibg=#333333') feed('ix<cr>y<cr><esc>gg') local win = meths.open_win(0, false, {relative='editor', width=20, height=4, row=4, col=10, style='minimal'}) @@ -397,9 +398,9 @@ describe('floating windows', function() [2:----------------------------------------]| | ## grid 2 - {19: }{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } | + {19: }{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } | {0:~ }| {0:~ }| {0:~ }| @@ -410,15 +411,15 @@ describe('floating windows', function() {15: }| ]], float_pos={[3] = {{id = 1001}, "NW", 1, 4, 10, true}}} else - screen:expect([[ - {19: }{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } {15:x } | + screen:expect{grid=[[ + {19: }{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } {15:x } | {0:~ }{15:y }{0: }| {0:~ }{15: }{0: }| {0:~ }{15: }{0: }| | - ]]) + ]]} end -- signcolumn=yes still works if there actually are signs @@ -435,9 +436,9 @@ describe('floating windows', function() [2:----------------------------------------]| | ## grid 2 - {17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } | + {19: }{17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } | {0:~ }| {0:~ }| {0:~ }| @@ -450,9 +451,9 @@ describe('floating windows', function() else screen:expect([[ - {17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } {17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{15:x } | + {19: }{17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } {17:π’ΜΜΜΜΜ
Μπ’ΜΜΜΜΜ
Μ}{15:x } | {0:~ }{19: }{15:y }{0: }| {0:~ }{19: }{15: }{0: }| {0:~ }{15: }{0: }| @@ -474,9 +475,9 @@ describe('floating windows', function() [2:----------------------------------------]| | ## grid 2 - {19: }{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } | + {19: }{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } | {0:~ }| {0:~ }| {0:~ }| @@ -488,9 +489,9 @@ describe('floating windows', function() ]], float_pos={[3] = {{id = 1001}, "NW", 1, 4, 10, true}}} else screen:expect([[ - {19: }{20: 1 }{21:^x }| - {19: }{14: 2 }y | - {19: }{14: 3 } {15: } | + {19: }{20: 1 }{21:^x }| + {19: }{14: 2 }y | + {19: }{14: 3 } {15: } | {0:~ }{15: }{0: }| {0:~ }{15: }{0: }| {0:~ }{15: }{0: }| @@ -4143,14 +4144,14 @@ describe('floating windows', function() [4:----------------------------------------]| [4:----------------------------------------]| :tabnew | - ## grid 2 + ## grid 2 (hidden) x | {0:~ }| {0:~ }| {0:~ }| {0:~ }| {0:~ }| - ## grid 3 + ## grid 3 (hidden) {1:y }| {2:~ }| ## grid 4 @@ -4192,7 +4193,7 @@ describe('floating windows', function() ## grid 3 {1:y }| {2:~ }| - ## grid 4 + ## grid 4 (hidden) | {0:~ }| {0:~ }| @@ -4222,13 +4223,13 @@ describe('floating windows', function() [4:----------------------------------------]| [4:----------------------------------------]| :tabnext | - ## grid 2 + ## grid 2 (hidden) x | {0:~ }| {0:~ }| {0:~ }| {0:~ }| - ## grid 3 + ## grid 3 (hidden) {1:y }| {2:~ }| ## grid 4 @@ -4266,7 +4267,7 @@ describe('floating windows', function() [4:----------------------------------------]| [4:----------------------------------------]| :tabnew | - ## grid 2 + ## grid 2 (hidden) x | {0:~ }| {0:~ }| @@ -4312,7 +4313,7 @@ describe('floating windows', function() {0:~ }| {0:~ }| {0:~ }| - ## grid 4 + ## grid 4 (hidden) | {0:~ }| {0:~ }| @@ -4332,7 +4333,7 @@ describe('floating windows', function() [4:----------------------------------------]| [4:----------------------------------------]| :tabnext | - ## grid 2 + ## grid 2 (hidden) x | {0:~ }| {0:~ }| @@ -4364,7 +4365,11 @@ describe('floating windows', function() [5] = {foreground = tonumber('0x990000'), background = tonumber('0xfff1ff')}, [6] = {foreground = tonumber('0x332533'), background = tonumber('0xfff1ff')}, [7] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0x0000d8')}, - [8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1} + [8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1}, + [9] = {background = Screen.colors.LightMagenta, blend=30}, + [10] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=0}, + [11] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta, blend=80}, + [12] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1, blend=30}, }) insert([[ Lorem ipsum dolor sit amet, consectetur @@ -4444,9 +4449,9 @@ describe('floating windows', function() qui officia deserunt mollit anim id est | laborum^. | ## grid 4 - {1:test }| - {1: }| - {1:popup text }| + {9:test }| + {9: }| + {9:popup text }| ]], float_pos={[4] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true} else screen:expect([[ @@ -4486,9 +4491,9 @@ describe('floating windows', function() qui officia deserunt mollit anim id est | laborum^. | ## grid 4 - {1:test }| - {1: }| - {4:popup text}{1: }| + {9:test }| + {9: }| + {10:popup text}{9: }| ]], float_pos={[4] = {{id = 1002}, "NW", 1, 2, 5, true}}} else screen:expect([[ @@ -4496,7 +4501,7 @@ describe('floating windows', function() exercitation ullamco laboris nisi ut aliquip ex | ea co{2:test}{3:o consequat}. Duis aute irure dolor in | repre{3:henderit in vol}uptate velit esse cillum | - dolor{4:popup text}{3:ul}la pariatur. Excepteur sint | + dolor{10:popup text}{3:ul}la pariatur. Excepteur sint | occaecat cupidatat non proident, sunt in culpa | qui officia deserunt mollit anim id est | laborum^. | @@ -4527,9 +4532,9 @@ describe('floating windows', function() qui officia deserunt mollit anim id est | laborum^. | ## grid 4 - {1:test }| - {1: }| - {4:popup text}{1: }| + {9:test }| + {9: }| + {11:popup text}{9: }| ]], float_pos={[4] = {{id = 1002}, "NW", 1, 2, 5, true}}, unchanged=true} else screen:expect([[ @@ -4569,9 +4574,9 @@ describe('floating windows', function() qui officia deserunt mollit anim id est | laborum^. | ## grid 4 - {4:popup text}{1: }| - {8:~ }| - {8:~ }| + {11:popup text}{9: }| + {12:~ }| + {12:~ }| ]], float_pos={[4] = {{id = 1002}, "NW", 1, 2, 5, true}}} else meths.input_mouse('wheel', 'down', '', 0, 4, 7) @@ -4671,7 +4676,7 @@ describe('floating windows', function() [2] = {foreground = Screen.colors.Grey0, background = tonumber('0xffcfff')}, [3] = {bold = true, foreground = Screen.colors.Blue1}, [4] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0xb282ff')}, - [5] = {background = Screen.colors.LightMagenta}, + [5] = {background = Screen.colors.LightMagenta, blend=30}, }) if multigrid then screen:expect{grid=[[ diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua index 4f243e6413..238cc368da 100644 --- a/test/functional/ui/inccommand_spec.lua +++ b/test/functional/ui/inccommand_spec.lua @@ -2634,3 +2634,19 @@ it(':substitute with inccommand, timer-induced :redraw #9777', function() :%s/foo/ZZZ^ | ]]) end) + +it('long :%s/ with inccommand does not collapse cmdline', function() + local screen = Screen.new(10,5) + clear() + common_setup(screen) + command('set inccommand=nosplit') + feed(':%s/AAAAAAA', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', + 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A') + screen:expect([[ + {15:~ }| + {15:~ }| + :%s/AAAAAAAA| + AAAAAAAAAAAA| + AAAAAAA^ | + ]]) +end) diff --git a/test/functional/ui/input_spec.lua b/test/functional/ui/input_spec.lua index 121cbe47d6..0009f2c31b 100644 --- a/test/functional/ui/input_spec.lua +++ b/test/functional/ui/input_spec.lua @@ -103,6 +103,11 @@ describe('mappings', function() check_mapping('<kequal>','<kequal>') check_mapping('<KPEquals>','<kequal>') end) + + it('support meta + multibyte char mapping', function() + add_mapping('<m-Γ€>', '<m-Γ€>') + check_mapping('<m-Γ€>', '<m-Γ€>') + end) end) describe('feeding large chunks of input with <Paste>', function() diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 9a1a0f66a2..ed65c4526f 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -6,7 +6,10 @@ local eq = helpers.eq local command = helpers.command local set_method_error = helpers.set_method_error local meths = helpers.meths - +local test_build_dir = helpers.test_build_dir +local nvim_prog = helpers.nvim_prog +local iswin = helpers.iswin +local exc_exec = helpers.exc_exec describe('ui/ext_messages', function() local screen @@ -1004,3 +1007,48 @@ describe('ui/ext_messages', function() }} end) end) + +describe('ui/msg_puts_printf', function() + it('output multibyte characters correctly', function() + local screen + local cmd = '' + local locale_dir = test_build_dir..'/share/locale/ja/LC_MESSAGES' + + clear({env={LANG='ja_JP.UTF-8'}}) + screen = Screen.new(25, 5) + screen:attach() + + if iswin() then + if os.execute('chcp 932 > NUL 2>&1') ~= 0 then + pending('missing japanese language features', function() end) + return + else + cmd = 'chcp 932 > NULL & ' + end + else + if (exc_exec('lang ja_JP.UTF-8') ~= 0) then + pending('Locale ja_JP.UTF-8 not supported', function() end) + return + elseif helpers.isCI() then + -- Fails non--Windows CI. Message catalog direcotry issue? + pending('fails on unix CI', function() end) + return + end + end + + os.execute('cmake -E make_directory '..locale_dir) + os.execute('cmake -E copy '..test_build_dir..'/src/nvim/po/ja.mo '..locale_dir..'/nvim.mo') + + cmd = cmd..'"'..nvim_prog..'" -u NONE -i NONE -Es -V1' + command([[call termopen(']]..cmd..[[')]]) + screen:expect([[ + ^Exγ’γΌγγ«ε
₯γγΎγ. γγΌ | + γγ«γ’γΌγγ«ζ»γγ«γ―"visu| + al"γ¨ε
₯εγγ¦γγ γγ. | + : | + | + ]]) + + os.execute('cmake -E remove_directory '..test_build_dir..'/share') + end) +end) diff --git a/test/functional/ui/mode_spec.lua b/test/functional/ui/mode_spec.lua index f6b3c1c3c9..a09df075aa 100644 --- a/test/functional/ui/mode_spec.lua +++ b/test/functional/ui/mode_spec.lua @@ -2,8 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert -local command, eval = helpers.command, helpers.eval -local eq = helpers.eq +local command = helpers.command describe('ui mode_change event', function() local screen @@ -63,7 +62,7 @@ describe('ui mode_change event', function() ]], mode="normal"} command("set showmatch") - eq(eval('&matchtime'), 5) -- tenths of seconds + command("set matchtime=1") -- tenths of seconds feed('a(stuff') screen:expect{grid=[[ word(stuff^ | @@ -80,7 +79,6 @@ describe('ui mode_change event', function() {2:-- INSERT --} | ]], mode="showmatch"} - screen:sleep(400) screen:expect{grid=[[ word(stuff)^ | {0:~ }| diff --git a/test/functional/ui/multigrid_spec.lua b/test/functional/ui/multigrid_spec.lua index c5a23e4661..a910f5e2ea 100644 --- a/test/functional/ui/multigrid_spec.lua +++ b/test/functional/ui/multigrid_spec.lua @@ -76,7 +76,7 @@ describe('ext_multigrid', function() it('positions windows correctly', function() command('vsplit') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [3:--------------------------]{12:β}[2:--------------------------]| [3:--------------------------]{12:β}[2:--------------------------]| @@ -118,15 +118,15 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 0, startcol = 27, width = 26, height = 12 }, - [3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 } + [2] = { win = {id=1000}, startrow = 0, startcol = 27, width = 26, height = 12 }, + [3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 } }, screen.win_position) - end) + end} command('wincmd l') command('split') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [3:--------------------------]{12:β}[4:--------------------------]| [3:--------------------------]{12:β}[4:--------------------------]| @@ -168,16 +168,16 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 7, startcol = 27, width = 26, height = 5 }, - [3] = { win = 1001, startrow = 0, startcol = 0, width = 26, height = 12 }, - [4] = { win = 1002, startrow = 0, startcol = 27, width = 26, height = 6 } + [2] = { win = {id=1000}, startrow = 7, startcol = 27, width = 26, height = 5 }, + [3] = { win = {id=1001}, startrow = 0, startcol = 0, width = 26, height = 12 }, + [4] = { win = {id=1002}, startrow = 0, startcol = 27, width = 26, height = 6 } }, screen.win_position) - end) + end} command('wincmd h') command('q') - screen:expect([[ + screen:expect{grid=[[ ## grid 1 [4:-----------------------------------------------------]| [4:-----------------------------------------------------]| @@ -206,12 +206,12 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ]], nil, nil, function() + ]], condition=function() eq({ - [2] = { win = 1000, startrow = 7, startcol = 0, width = 53, height = 5 }, - [4] = { win = 1002, startrow = 0, startcol = 0, width = 53, height = 6 } + [2] = { win = {id=1000}, startrow = 7, startcol = 0, width = 53, height = 5 }, + [4] = { win = {id=1002}, startrow = 0, startcol = 0, width = 53, height = 6 } }, screen.win_position) - end) + end} end) describe('split', function () @@ -1206,7 +1206,7 @@ describe('ext_multigrid', function() ]]) end) - it('handles switich tabs', function() + it('handles switch tabs', function() command('vsp') screen:expect([[ ## grid 1 @@ -1271,7 +1271,7 @@ describe('ext_multigrid', function() [4:-----------------------------------------------------]| {11:[No Name] }| | - ## grid 2 + ## grid 2 (hidden) | {1:~ }| {1:~ }| @@ -1284,7 +1284,7 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ## grid 3 + ## grid 3 (hidden) | {1:~ }| {1:~ }| @@ -1328,7 +1328,7 @@ describe('ext_multigrid', function() [4:-----------------------------------------------------]| {12:[No Name] }| | - ## grid 2 + ## grid 2 (hidden) | {1:~ }| {1:~ }| @@ -1341,7 +1341,7 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ## grid 3 + ## grid 3 (hidden) | {1:~ }| {1:~ }| @@ -1409,13 +1409,13 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ## grid 4 + ## grid 4 (hidden) | {1:~ }| {1:~ }| {1:~ }| {1:~ }| - ## grid 5 + ## grid 5 (hidden) | {1:~ }| {1:~ }| @@ -1440,7 +1440,7 @@ describe('ext_multigrid', function() [4:-----------------------------------------------------]| {12:[No Name] }| | - ## grid 2 + ## grid 2 (hidden) | {1:~ }| {1:~ }| @@ -1452,7 +1452,7 @@ describe('ext_multigrid', function() {1:~ }| {1:~ }| {1:~ }| - ## grid 3 + ## grid 3 (hidden) | {1:~ }| {1:~ }| diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua index 24bf66e2d8..4a0e7ccad0 100644 --- a/test/functional/ui/output_spec.lua +++ b/test/functional/ui/output_spec.lua @@ -12,8 +12,6 @@ local command = helpers.command local nvim_dir = helpers.nvim_dir describe("shell command :!", function() - if helpers.pending_win32(pending) then return end - local screen before_each(function() clear() @@ -36,6 +34,7 @@ describe("shell command :!", function() end) it("displays output without LF/EOF. #4646 #4569 #3772", function() + if helpers.pending_win32(pending) then return end -- NOTE: We use a child nvim (within a :term buffer) -- to avoid triggering a UI flush. child_session.feed_data(":!printf foo; sleep 200\n") diff --git a/test/functional/ui/popupmenu_spec.lua b/test/functional/ui/popupmenu_spec.lua index 9bfea28ed7..c4cfc9d8d3 100644 --- a/test/functional/ui/popupmenu_spec.lua +++ b/test/functional/ui/popupmenu_spec.lua @@ -1644,6 +1644,7 @@ describe('builtin popupmenu', function() [42] = {foreground = tonumber('0x0c0c0c'), background = tonumber('0xe5a8e5')}, [43] = {background = tonumber('0x7f5d7f'), bold = true, foreground = tonumber('0x3f3f3f')}, [44] = {foreground = tonumber('0x3f3f3f'), background = tonumber('0x7f5d7f')}, + [45] = {background = Screen.colors.WebGray, blend=0}, }) command('syntax on') command('set mouse=a') @@ -1761,7 +1762,7 @@ describe('builtin popupmenu', function() Lorem ipsum d{1:ol}or sit amet, consectetur | adipisicing elit, sed do eiusmod tempor | bla bla incididunt^ | - incidid{22: incididunt }{27: }d{1:ol}ore magna aliqua. | + incidid{45: incididunt }{27: }d{1:ol}ore magna aliqua. | Ut enim{28: }{29:ut}{28: minim veniam}{25:,} quis nostrud | exercit{28:a}{29:labore}{28:llamco la}{25:b}oris nisi ut aliquip ex | {2:[No Nam}{30:e}{43:et}{30:[+] }{32: }{2: }| diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index 81a15cada2..3b39794465 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -316,9 +316,10 @@ local ext_keys = { -- cmdline_block: Expected ext_cmdline block (for function definitions) -- wildmenu_items: Expected items for ext_wildmenu -- wildmenu_pos: Expected position for ext_wildmenu -function Screen:expect(expected, attr_ids, attr_ignore) +function Screen:expect(expected, attr_ids, attr_ignore, ...) local grid, condition = nil, nil local expected_rows = {} + assert(next({...}) == nil, "invalid args to expect()") if type(expected) == "table" then assert(not (attr_ids ~= nil or attr_ignore ~= nil)) local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true, @@ -499,7 +500,8 @@ function Screen:_wait(check, flags) local did_miminal_timeout = false local function notification_cb(method, args) - assert(method == 'redraw') + assert(method == 'redraw', string.format( + 'notification_cb: unexpected method (%s, args=%s)', method, inspect(args))) did_flush = self:_redraw(args) if not did_flush then return @@ -1211,7 +1213,11 @@ function Screen:render(headers, attr_state, preview) local rv = {} for igrid,grid in pairs(self._grids) do if headers then - table.insert(rv, "## grid "..igrid) + local suffix = "" + if igrid > 1 and self.win_position[igrid] == nil and self.float_pos[igrid] == nil then + suffix = " (hidden)" + end + table.insert(rv, "## grid "..igrid..suffix) end for i = 1, grid.height do local cursor = self._cursor.grid == igrid and self._cursor.row == i @@ -1491,7 +1497,7 @@ function Screen:_equal_attrs(a, b) a.underline == b.underline and a.undercurl == b.undercurl and a.italic == b.italic and a.reverse == b.reverse and a.foreground == b.foreground and a.background == b.background and - a.special == b.special + a.special == b.special and a.blend == b.blend end function Screen:_equal_info(a, b) |