diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-10-14 14:10:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-14 06:10:14 +0000 |
commit | 1189c5ce599ad7172dfde3eb7c0be9c5f8d742f2 (patch) | |
tree | c6b546dfc6e7e283223fefdd9c61dea89cf69db6 | |
parent | a6d5e6b105a6b4d499e8b288f660afecf62356fd (diff) | |
download | rneovim-1189c5ce599ad7172dfde3eb7c0be9c5f8d742f2.tar.gz rneovim-1189c5ce599ad7172dfde3eb7c0be9c5f8d742f2.tar.bz2 rneovim-1189c5ce599ad7172dfde3eb7c0be9c5f8d742f2.zip |
test(tui_spec): use Unicode in cursor_address test (#30807)
Now that #16425 is fixed, use Unicode again to reduce screen height.
Unfortunately composing chars still can't be used, as it turns out that
composing chars may be missing when sent separately from the base char
at the last char a screen line.
-rw-r--r-- | test/functional/terminal/tui_spec.lua | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 629c0b1054..79a9c8674e 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -13,7 +13,6 @@ local eq = t.eq local feed_data = tt.feed_data local clear = n.clear local command = n.command -local dedent = t.dedent local exec = n.exec local exec_lua = n.exec_lua local testprg = n.testprg @@ -1853,19 +1852,19 @@ describe('TUI', function() end) it('draws correctly when cursor_address overflows #21643', function() - t.skip(is_os('mac'), 'FIXME: crashes/errors on macOS') - screen:try_resize(77, 855) + screen:try_resize(70, 333) retry(nil, nil, function() - eq({ true, 852 }, { child_session:request('nvim_win_get_height', 0) }) + eq({ true, 330 }, { child_session:request('nvim_win_get_height', 0) }) end) -- Use full screen message so that redrawing afterwards is more deterministic. child_session:notify('nvim_command', 'intro') - screen:expect({ any = 'Nvim' }) + screen:expect({ any = 'Nvim is open source and freely distributable' }) -- Going to top-left corner needs 3 bytes. -- Setting underline attribute needs 9 bytes. - -- The whole line needs 3 + 9 + 65513 + 3 = 65528 bytes. + -- A Ꝩ character takes 3 bytes. + -- The whole line needs 3 + 9 + 3 * 21838 + 3 = 65529 bytes. -- The cursor_address that comes after will overflow the 65535-byte buffer. - local line = ('a'):rep(65513) .. '℃' + local line = ('Ꝩ'):rep(21838) .. '℃' child_session:notify( 'nvim_exec_lua', [[ @@ -1876,22 +1875,16 @@ describe('TUI', function() ) -- Close the :intro message and redraw the lines. feed_data('\n') - screen:expect( - '{13:a}{12:' - .. ('a'):rep(76) - .. '}|\n' - .. ('{12:' .. ('a'):rep(77) .. '}|\n'):rep(849) - .. '{12:' - .. ('a'):rep(63) - .. '℃' - .. (' '):rep(13) - .. '}|\n' - .. dedent([[ - b | - {5:[No Name] [+] }| - | - {3:-- TERMINAL --} |]]) - ) + screen:expect([[ + {13:Ꝩ}{12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ}| + {12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ}|*310 + {12:ꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨꝨ℃ }| + b | + {4:~ }|*17 + {5:[No Name] [+] }| + | + {3:-- TERMINAL --} | + ]]) end) it('visual bell (padding) does not crash #21610', function() |