view src/testdir/test_gui.vim @ 10777:80b286d6d38d v8.0.0278

patch 8.0.0278: GUI test fails on MS-Windows commit https://github.com/vim/vim/commit/f1ab9c137060a4d3aa1e69bcbbed02342cd746a3 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Feb 1 12:32:58 2017 +0100 patch 8.0.0278: GUI test fails on MS-Windows Problem: GUI test fails on MS-Windows. Solution: Check that tester_HOME exists.
author Christian Brabandt <cb@256bit.org>
date Wed, 01 Feb 2017 12:45:03 +0100
parents d08655e2633a
children 5c0415a8b96e
line wrap: on
line source

" Tests specifically for the GUI

if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
  finish
endif

" For KDE set a font, empty 'guifont' may cause a hang.
func SetUp()
  if has("gui_kde")
    set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
  endif

  " Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
  " actual home directory.  But avoid triggering fontconfig by setting the
  " cache directory.  Only needed for Unix.
  if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
    let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
  endif
  call mkdir('Xhome')
  let $HOME = fnamemodify('Xhome', ':p')
endfunc

func TearDown()
  call delete('Xhome', 'rf')
endfunc

" Test for resetting "secure" flag after GUI has started.
" Must be run first.
func Test_1_set_secure()
  set exrc secure
  gui -f
  call assert_equal(1, has('gui_running'))
endfunc

func Test_shell_command()
  new
  r !echo hello
  call assert_equal('hello', substitute(getline(2), '\W', '', 'g'))
  bwipe!
  call assert_true(1, match(execute('winpos'), 'Window position: X \d\+, Y \d\+') >= 0)
endfunc