diff src/testdir/test_window_cmd.vim @ 12019:7d7835ab8b37 v8.0.0890

patch 8.0.0890: still many old style tests commit https://github.com/vim/vim/commit/75373f38087dd756babdbbf9f14fd4711712c5de Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 7 22:02:30 2017 +0200 patch 8.0.0890: still many old style tests Problem: Still many old style tests. Solution: Convert several tests to new style. (Yegappan Lakshmanan)
author Christian Brabandt <cb@256bit.org>
date Mon, 07 Aug 2017 22:15:03 +0200
parents d06a3db9b651
children 2d817fd289ba
line wrap: on
line diff
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -416,4 +416,42 @@ func Test_next_split_all()
   bwipe!
 endfunc
 
+" Tests for adjusting window and contents
+func GetScreenStr(row)
+   let str = ""
+   for c in range(1,3)
+       let str .= nr2char(screenchar(a:row, c))
+   endfor
+   return str
+endfunc
+
+func Test_window_contents()
+  enew! | only | new
+  call setline(1, range(1,256))
+
+  exe "norm! \<C-W>t\<C-W>=1Gzt\<C-W>w\<C-W>+"
+  redraw
+  let s3=GetScreenStr(1)
+  wincmd p
+  call assert_equal(1, line("w0"))
+  call assert_equal('1  ', s3)
+
+  exe "norm! \<C-W>t\<C-W>=50Gzt\<C-W>w\<C-W>+"
+  redraw
+  let s3=GetScreenStr(1)
+  wincmd p
+  call assert_equal(50, line("w0"))
+  call assert_equal('50 ', s3)
+
+  exe "norm! \<C-W>t\<C-W>=59Gzt\<C-W>w\<C-W>+"
+  redraw
+  let s3=GetScreenStr(1)
+  wincmd p
+  call assert_equal(59, line("w0"))
+  call assert_equal('59 ', s3)
+
+  bwipeout!
+  call test_garbagecollect_now()
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab