1
0
forked from aniani/vim

patch 9.1.0863: getcellpixels() can be further improved

Problem:  getcellpixels() can be further improved
Solution: improve it further, add more tests
          (mikoto2000)

closes: #16047

Signed-off-by: mikoto2000 <mikoto2000@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
mikoto2000
2024-11-14 22:13:48 +01:00
committed by Christian Brabandt
parent 0acd3abfad
commit de094dcd6f
6 changed files with 87 additions and 50 deletions

View File

@@ -4159,4 +4159,35 @@ func Test_slice()
call assert_equal(0, slice(v:true, 1))
endfunc
" Test for getcellpixels()
" Pixel size of a cell is terminal-dependent, so in the test, only the list and size 2 are checked.
func Test_getcellpixels()
" Not yet Windows-compatible
CheckNotMSWindows
CheckRunVimInTerminal
let buf = RunVimInTerminal('', #{rows: 6})
" write getcellpixels() result to current buffer.
call term_sendkeys(buf, ":redi @\"\<CR>")
call term_sendkeys(buf, ":echo getcellpixels()\<CR>")
call term_sendkeys(buf, ":redi END\<CR>")
call term_sendkeys(buf, "P")
call WaitForAssert({-> assert_match("\[\d+, \d+\]", term_getline(buf, 3))}, 1000)
call StopVimInTerminal(buf)
endfunc
" Test for getcellpixels() on gVim
func Test_getcellpixels_gui()
" Not yet Windows-compatible
CheckNotMSWindows
if has("gui_running")
let cellpixels = getcellpixels()
call assert_equal(0, len(cellpixels))
endif
endfunc
" vim: shiftwidth=2 sts=2 expandtab