diff src/testdir/test_gui.vim @ 14756:a179e5cfcab7 v8.1.0390

patch 8.1.0390: scrollbars are not tested commit https://github.com/vim/vim/commit/ab18673731522c18696b9b132d3841646904e1bd Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 14 21:27:06 2018 +0200 patch 8.1.0390: scrollbars are not tested Problem: Scrollbars are not tested. Solution: Add test_scrollbar() and a test.
author Christian Brabandt <cb@256bit.org>
date Fri, 14 Sep 2018 21:30:05 +0200
parents 70e36e1ca442
children f20d90aeecaa
line wrap: on
line diff
--- 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