comparison src/testdir/test_tabline.vim @ 21004:0650d220f742 v8.2.1053

patch 8.2.1053: insufficient testing for 'statusline' and 'tabline' Commit: https://github.com/vim/vim/commit/832adf9bb8cd39d8e982d8a35ed8a6d39b974494 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 25 19:01:36 2020 +0200 patch 8.2.1053: insufficient testing for 'statusline' and 'tabline' Problem: Insufficient testing for 'statusline' and 'tabline'. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6333)
author Bram Moolenaar <Bram@vim.org>
date Thu, 25 Jun 2020 19:15:25 +0200
parents 325e4a8ba1b6
children 53ff4dfe6e11
comparison
equal deleted inserted replaced
21003:fd0cff8d489b 21004:0650d220f742
68 68
69 set tabline= 69 set tabline=
70 let &showtabline = showtabline_save 70 let &showtabline = showtabline_save
71 au! Bufadd 71 au! Bufadd
72 endfunc 72 endfunc
73
74 " Test for the "%T" and "%X" flags in the 'tabline' option
75 func MyTabLine()
76 let s = ''
77 for i in range(tabpagenr('$'))
78 " set the tab page number (for mouse clicks)
79 let s .= '%' . (i + 1) . 'T'
80
81 " the label is made by MyTabLabel()
82 let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
83 endfor
84
85 " after the last tab fill with TabLineFill and reset tab page nr
86 let s .= '%T'
87
88 " right-align the label to close the current tab page
89 if tabpagenr('$') > 1
90 let s .= '%=%Xclose'
91 endif
92
93 return s
94 endfunc
95
96 func MyTabLabel(n)
97 let buflist = tabpagebuflist(a:n)
98 let winnr = tabpagewinnr(a:n)
99 return bufname(buflist[winnr - 1])
100 endfunc
101
102 func Test_tabline_flags()
103 if has('gui')
104 set guioptions-=e
105 endif
106 set tabline=%!MyTabLine()
107 edit Xtabline1
108 tabnew Xtabline2
109 redrawtabline
110 call assert_match('^ Xtabline1 Xtabline2\s\+close$', Screenline(1))
111 set tabline=
112 %bw!
113 endfunc
114
115 " vim: shiftwidth=2 sts=2 expandtab