diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-06-21 13:23:45 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-06-21 13:23:45 +0200 |
commit | 8c524f76ebd43f006e765534765b595de7095f12 (patch) | |
tree | eefc09d8b7f869a81d560704abb2128e16b6ec2b | |
parent | 6797966dfc0219313886be55767e53d5a388b5c5 (diff) | |
download | vim-git-8c524f76ebd43f006e765534765b595de7095f12.tar.gz |
patch 8.2.1025: tabpage menu and tabline not sufficiently testedv8.2.1025
Problem: Tabpage menu and tabline not sufficiently tested.
Solution: Add tests. (Yegappan Lakshmanan, closes #6307)
-rw-r--r-- | src/testdir/test_digraph.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_tabpage.vim | 78 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 81 insertions, 1 deletions
diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim index f73ed7cb0..12162b471 100644 --- a/src/testdir/test_digraph.vim +++ b/src/testdir/test_digraph.vim @@ -503,7 +503,7 @@ func Test_loadkeymap_error() call delete('Xkeymap') endfunc -" Test for the characters displayed one the screen when entering a digraph +" Test for the characters displayed on the screen when entering a digraph func Test_entering_digraph() CheckRunVimInTerminal let buf = RunVimInTerminal('', {'rows': 6}) diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim index 44772fdaa..d1bea2f3c 100644 --- a/src/testdir/test_tabpage.vim +++ b/src/testdir/test_tabpage.vim @@ -634,4 +634,82 @@ func Test_tabpage_Ctrl_Pageup() %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 diff --git a/src/version.c b/src/version.c index 47bf03e3b..1a936ec9c 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1025, +/**/ 1024, /**/ 1023, |