vim-patch:8.1.1179: no test for mouse clicks in the fold column

Problem:    No test for mouse clicks in the fold column.
Solution:   Add a test. (Dominique Pelle, closes vim/vim#4261)

696d637728

Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
zeertzjq 2023-04-28 14:19:45 +08:00
parent 355ccaeb04
commit 2be868ab5e

View File

@ -369,6 +369,58 @@ func Test_xterm_mouse_double_click_to_create_tab()
set mousetime&
endfunc
func Test_xterm_mouse_click_in_fold_columns()
new
let save_mouse = &mouse
let save_term = &term
" let save_ttymouse = &ttymouse
let save_foldcolumn = &foldcolumn
" set mouse=a term=xterm foldcolumn=3
set mouse=a foldcolumn=3
" Create 2 nested folds.
call setline(1, range(1, 7))
2,6fold
norm! zR
4,5fold
call assert_equal([-1, -1, -1, 4, 4, -1, -1],
\ map(range(1, 7), 'foldclosed(v:val)'))
" Click in "+" of inner fold in foldcolumn should open it.
redraw
let row = 4
let col = 2
call MouseLeftClick(row, col)
call MouseLeftRelease(row, col)
call assert_equal([-1, -1, -1, -1, -1, -1, -1],
\ map(range(1, 7), 'foldclosed(v:val)'))
" Click in "-" of outer fold in foldcolumn should close it.
redraw
let row = 2
let col = 1
call MouseLeftClick(row, col)
call MouseLeftRelease(row, col)
call assert_equal([-1, 2, 2, 2, 2, 2, -1],
\ map(range(1, 7), 'foldclosed(v:val)'))
norm! zR
" Click in "|" of inner fold in foldcolumn should close it.
redraw
let row = 5
let col = 2
call MouseLeftClick(row, col)
call MouseLeftRelease(row, col)
call assert_equal([-1, -1, -1, 4, 4, -1, -1],
\ map(range(1, 7), 'foldclosed(v:val)'))
let &foldcolumn = save_foldcolumn
" let &ttymouse = save_ttymouse
" let &term = save_term
let &mouse = save_mouse
bwipe!
endfunc
" Test for translation of special key codes (<xF1>, <xF2>, etc.)
func Test_Keycode_Translation()
let keycodes = [