summaryrefslogtreecommitdiff
path: root/src/testdir/test_gui.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-09-14 21:27:06 +0200
committerBram Moolenaar <Bram@vim.org>2018-09-14 21:27:06 +0200
commitab18673731522c18696b9b132d3841646904e1bd (patch)
tree03234ad6705334d62dbd6c32bd0fed716a06f590 /src/testdir/test_gui.vim
parentda1f71d75f0bf5d5ef876a09aa08fb19f6f24b3b (diff)
downloadvim-git-ab18673731522c18696b9b132d3841646904e1bd.tar.gz
patch 8.1.0390: scrollbars are not testedv8.1.0390
Problem: Scrollbars are not tested. Solution: Add test_scrollbar() and a test.
Diffstat (limited to 'src/testdir/test_gui.vim')
-rw-r--r--src/testdir/test_gui.vim35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim
index 9b42134ac..0775b178f 100644
--- a/src/testdir/test_gui.vim
+++ b/src/testdir/test_gui.vim
@@ -667,6 +667,41 @@ func Test_set_guioptions()
let &guioptions = guioptions_saved
endfunc
+func Test_scrollbars()
+ new
+ " buffer with 200 lines
+ call setline(1, repeat(['one', 'two'], 100))
+ set guioptions+=rlb
+
+ " scroll to move line 11 at top, moves the cursor there
+ call test_scrollbar('left', 10, 0)
+ redraw
+ call assert_equal(1, winline())
+ call assert_equal(11, line('.'))
+
+ " scroll to move line 1 at top, cursor stays in line 11
+ call test_scrollbar('right', 0, 0)
+ redraw
+ call assert_equal(11, winline())
+ call assert_equal(11, line('.'))
+
+ set nowrap
+ call setline(11, repeat('x', 150))
+ redraw
+ call assert_equal(1, wincol())
+ call assert_equal(1, col('.'))
+
+ " scroll to character 11, cursor is moved
+ call test_scrollbar('hor', 10, 0)
+ redraw
+ call assert_equal(1, wincol())
+ call assert_equal(11, col('.'))
+
+ set guioptions&
+ set wrap&
+ bwipe!
+endfunc
+
func Test_set_guipty()
let guipty_saved = &guipty