Patch 8.2.1025
Problem: Tabpage menu and tabline not sufficiently tested.
Solution: Add tests. (Yegappan Lakshmanan, closes #6307)
Files: src/testdir/test_digraph.vim, src/testdir/test_tabpage.vim
*** ../vim-8.2.1024/src/testdir/test_digraph.vim 2020-06-20
16:05:29.012185251 +0200
--- src/testdir/test_digraph.vim 2020-06-21 13:20:42.363841616 +0200
***************
*** 503,509 ****
call delete('Xkeymap')
endfunc
! " Test for the characters displayed one the screen when entering a digraph
func Test_entering_digraph()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
--- 503,509 ----
call delete('Xkeymap')
endfunc
! " Test for the characters displayed on the screen when entering a digraph
func Test_entering_digraph()
CheckRunVimInTerminal
let buf = RunVimInTerminal('', {'rows': 6})
*** ../vim-8.2.1024/src/testdir/test_tabpage.vim 2020-06-20
16:05:29.016185239 +0200
--- src/testdir/test_tabpage.vim 2020-06-21 13:20:42.363841616 +0200
***************
*** 634,637 ****
--- 634,715 ----
%bw!
endfunc
+ " Return the terminal key code for selecting a tab page from the tabline. This
+ " sequence contains the following codes: a CSI (0x9b), KS_TABLINE (0xf0),
+ " KS_FILLER (0x58) and then the tab page number.
+ func TabLineSelectPageCode(tabnr)
+ return "\x9b\xf0\x58" .. nr2char(a:tabnr)
+ endfunc
+
+ " Return the terminal key code for opening a new tabpage from the tabpage
+ " menu. This sequence consists of the following codes: a CSI (0x9b),
+ " KS_TABMENU (0xef), KS_FILLER (0x58), the tab page number and
+ " TABLINE_MENU_NEW (2).
+ func TabMenuNewItemCode(tabnr)
+ return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(2)
+ endfunc
+
+ " Return the terminal key code for closing a tabpage from the tabpage menu.
+ " This sequence consists of the following codes: a CSI (0x9b), KS_TABMENU
+ " (0xef), KS_FILLER (0x58), the tab page number and TABLINE_MENU_CLOSE (1).
+ func TabMenuCloseItemCode(tabnr)
+ return "\x9b\xef\x58" .. nr2char(a:tabnr) .. nr2char(1)
+ endfunc
+
+ " Test for using the tabpage menu from the insert and normal modes
+ func Test_tabline_tabmenu()
+ " only works in GUI
+ CheckGui
+
+ %bw!
+ tabnew
+ tabnew
+ call assert_equal(3, tabpagenr())
+
+ " go to tab page 2 in normal mode
+ call feedkeys(TabLineSelectPageCode(2), "Lx!")
+ call assert_equal(2, tabpagenr())
+
+ " close tab page 3 in normal mode
+ call feedkeys(TabMenuCloseItemCode(3), "Lx!")
+ call assert_equal(2, tabpagenr('$'))
+ call assert_equal(2, tabpagenr())
+
+ " open new tab page before tab page 1 in normal mode
+ call feedkeys(TabMenuNewItemCode(1), "Lx!")
+ call assert_equal(1, tabpagenr())
+ call assert_equal(3, tabpagenr('$'))
+
+ " go to tab page 2 in operator-pending mode (should beep)
+ call assert_beeps('call feedkeys("f" .. TabLineSelectPageCode(2), "Lx!")')
+
+ " open new tab page before tab page 1 in operator-pending mode (should beep)
+ call assert_beeps('call feedkeys("f" .. TabMenuNewItemCode(1), "Lx!")')
+
+ " open new tab page after tab page 3 in normal mode
+ call feedkeys(TabMenuNewItemCode(4), "Lx!")
+ call assert_equal(4, tabpagenr())
+ call assert_equal(4, tabpagenr('$'))
+
+ " go to tab page 2 in insert mode
+ call feedkeys("i" .. TabLineSelectPageCode(2) .. "\<C-C>", "Lx!")
+ call assert_equal(2, tabpagenr())
+
+ " close tab page 2 in insert mode
+ call feedkeys("i" .. TabMenuCloseItemCode(2) .. "\<C-C>", "Lx!")
+ call assert_equal(3, tabpagenr('$'))
+
+ " open new tab page before tab page 3 in insert mode
+ call feedkeys("i" .. TabMenuNewItemCode(3) .. "\<C-C>", "Lx!")
+ call assert_equal(3, tabpagenr())
+ call assert_equal(4, tabpagenr('$'))
+
+ " open new tab page after tab page 4 in insert mode
+ call feedkeys("i" .. TabMenuNewItemCode(5) .. "\<C-C>", "Lx!")
+ call assert_equal(5, tabpagenr())
+ call assert_equal(5, tabpagenr('$'))
+
+ %bw!
+ endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.1024/src/version.c 2020-06-20 22:50:44.175608236 +0200
--- src/version.c 2020-06-20 23:03:07.945393385 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1025,
/**/
--
Lose weight, NEVER Diet again with
The "Invisible Weight Loss Patch"
(spam e-mail)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202006211124.05LBOYmK1126901%40masaka.moolenaar.net.