diff src/testdir/test_terminal2.vim @ 22079:ba2c3f38a596 v8.2.1589

patch 8.2.1589: term_start() options for size are overruled by 'termwinsize' Commit: https://github.com/vim/vim/commit/b936b79424d435b83cdebed5507a9d3800e66e6c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 4 18:34:09 2020 +0200 patch 8.2.1589: term_start() options for size are overruled by 'termwinsize' Problem: Term_start() options for size are overruled by 'termwinsize'. (Sergey Vlasov) Solution: Set 'termwinsize' to the specified size.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Sep 2020 18:45:03 +0200
parents 08940efa6b4e
children ff21e2962490
line wrap: on
line diff
--- a/src/testdir/test_terminal2.vim
+++ b/src/testdir/test_terminal2.vim
@@ -109,6 +109,27 @@ func Test_terminal_termwinsize_minimum()
   set termwinsize=
 endfunc
 
+func Test_terminal_termwinsize_overruled()
+  let cmd = GetDummyCmd()
+  set termwinsize=5x43
+  let buf = term_start(cmd, #{term_rows: 7, term_cols: 50})
+  call TermWait(buf)
+  call assert_equal([7, 50], term_getsize(buf))
+  exe "bwipe! " .. buf
+
+  let buf = term_start(cmd, #{term_cols: 50})
+  call TermWait(buf)
+  call assert_equal([5, 50], term_getsize(buf))
+  exe "bwipe! " .. buf
+
+  let buf = term_start(cmd, #{term_rows: 7})
+  call TermWait(buf)
+  call assert_equal([7, 43], term_getsize(buf))
+  exe "bwipe! " .. buf
+
+  set termwinsize=
+endfunc
+
 func Test_terminal_termwinkey()
   " make three tabpages, terminal in the middle
   0tabnew
@@ -397,13 +418,17 @@ func Test_terminal_does_not_truncate_las
   call delete('Xfile')
 endfunc
 
-func Test_terminal_no_job()
+func GetDummyCmd()
   if has('win32')
-    let cmd = 'cmd /c ""'
+    return 'cmd /c ""'
   else
     CheckExecutable false
-    let cmd = 'false'
+    return 'false'
   endif
+endfunc
+
+func Test_terminal_no_job()
+  let cmd = GetDummyCmd()
   let term = term_start(cmd, {'term_finish': 'close'})
   call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) })
 endfunc