diff src/testdir/test_terminal.vim @ 13700:b28d679b1843 v8.0.1722

patch 8.0.1722: cannot specify a minimal size for a terminal window commit https://github.com/vim/vim/commit/498c2562e1bcc72492fe8da8a76504f893e9b5fe Author: Bram Moolenaar <Bram@vim.org> Date: Sun Apr 15 23:45:15 2018 +0200 patch 8.0.1722: cannot specify a minimal size for a terminal window Problem: Cannot specify a minimal size for a terminal window. Solution: Support the "rows*cols" format for 'winsize'.
author Christian Brabandt <cb@256bit.org>
date Mon, 16 Apr 2018 00:00:07 +0200
parents 404b89cb1e2a
children 7d2039b2ecc8
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -1357,7 +1357,7 @@ func Test_terminal_ansicolors_func()
   exe buf . 'bwipe'
 endfunc
 
-func Test_terminal_termsize_option()
+func Test_terminal_termsize_option_fixed()
   if !CanRunVimInTerminal()
     return
   endif
@@ -1389,3 +1389,69 @@ func Test_terminal_termsize_option()
 
   set termsize=
 endfunc
+
+func Test_terminal_termsize_option_zero()
+  set termsize=0x0
+  let buf = Run_shell_in_terminal({})
+  let win = bufwinid(buf)
+  call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  exe buf . 'bwipe'
+
+  set termsize=7x0
+  let buf = Run_shell_in_terminal({})
+  let win = bufwinid(buf)
+  call assert_equal([7, winwidth(win)], term_getsize(buf))
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  exe buf . 'bwipe'
+
+  set termsize=0x33
+  let buf = Run_shell_in_terminal({})
+  let win = bufwinid(buf)
+  call assert_equal([winheight(win), 33], term_getsize(buf))
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  exe buf . 'bwipe'
+
+  set termsize=
+endfunc
+
+func Test_terminal_termsize_mininmum()
+  set termsize=10*50
+  vsplit
+  let buf = Run_shell_in_terminal({})
+  let win = bufwinid(buf)
+  call assert_inrange(10, 1000, winheight(win))
+  call assert_inrange(50, 1000, winwidth(win))
+  call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
+
+  resize 15
+  vertical resize 60
+  redraw
+  call assert_equal([15, 60], term_getsize(buf))
+  call assert_equal(15, winheight(win))
+  call assert_equal(60, winwidth(win))
+
+  resize 7
+  vertical resize 30
+  redraw
+  call assert_equal([10, 50], term_getsize(buf))
+  call assert_equal(7, winheight(win))
+  call assert_equal(30, winwidth(win))
+
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  exe buf . 'bwipe'
+
+  set termsize=0*0
+  let buf = Run_shell_in_terminal({})
+  let win = bufwinid(buf)
+  call assert_equal([winheight(win), winwidth(win)], term_getsize(buf))
+  call Stop_shell_in_terminal(buf)
+  call term_wait(buf)
+  exe buf . 'bwipe'
+
+  set termsize=
+endfunc