diff src/testdir/test_terminal.vim @ 13698:404b89cb1e2a v8.0.1721

patch 8.0.1721: no test for using the 'termsize' option commit https://github.com/vim/vim/commit/a7eef3d87fa36d527d1cfc749b400df1e69dcb3d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 15 22:25:54 2018 +0200 patch 8.0.1721: no test for using the 'termsize' option Problem: No test for using the 'termsize' option. Solution: Add a test.
author Christian Brabandt <cb@256bit.org>
date Sun, 15 Apr 2018 22:30:08 +0200
parents 2dd14253ad12
children b28d679b1843
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1356,3 +1356,36 @@ func Test_terminal_ansicolors_func()
   call term_wait(buf)
   exe buf . 'bwipe'
 endfunc
+
+func Test_terminal_termsize_option()
+  if !CanRunVimInTerminal()
+    return
+  endif
+  set termsize=6x40
+  let text = []
+  for n in range(10)
+    call add(text, repeat(n, 50))
+  endfor
+  call writefile(text, 'Xwinsize')
+  let buf = RunVimInTerminal('Xwinsize', {})
+  let win = bufwinid(buf)
+  call assert_equal([6, 40], term_getsize(buf))
+  call assert_equal(6, winheight(win))
+  call assert_equal(40, winwidth(win))
+
+  " resizing the window doesn't resize the terminal.
+  resize 10
+  vertical resize 60
+  call assert_equal([6, 40], term_getsize(buf))
+  call assert_equal(10, winheight(win))
+  call assert_equal(60, winwidth(win))
+
+  call StopVimInTerminal(buf)
+  call delete('Xwinsize')
+
+  call assert_fails('set termsize=40', 'E474')
+  call assert_fails('set termsize=10+40', 'E474')
+  call assert_fails('set termsize=abc', 'E474')
+
+  set termsize=
+endfunc