blob: 14c0ca1f42726f897e657f1c4a5386ed173f8bd4 [file] [log] [blame]
Bram Moolenaar877e9572016-08-04 20:05:50 +02001" Tests specifically for the GUI
2
3if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
4 finish
5endif
6
7" For KDE set a font, empty 'guifont' may cause a hang.
8func SetUp()
9 if has("gui_kde")
10 set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
11 endif
Bram Moolenaar50fa8dd2016-08-09 22:58:21 +020012
Bram Moolenaarf1ab9c12017-02-01 12:32:58 +010013 " Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
14 " actual home directory. But avoid triggering fontconfig by setting the
15 " cache directory. Only needed for Unix.
16 if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
Bram Moolenaar56e6bd72017-02-01 12:08:47 +010017 let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
18 endif
Bram Moolenaar50fa8dd2016-08-09 22:58:21 +020019 call mkdir('Xhome')
20 let $HOME = fnamemodify('Xhome', ':p')
21endfunc
22
23func TearDown()
24 call delete('Xhome', 'rf')
Bram Moolenaar877e9572016-08-04 20:05:50 +020025endfunc
26
27" Test for resetting "secure" flag after GUI has started.
28" Must be run first.
29func Test_1_set_secure()
30 set exrc secure
31 gui -f
32 call assert_equal(1, has('gui_running'))
33endfunc
34
35func Test_shell_command()
36 new
Bram Moolenaar9d5b8762016-08-04 21:21:13 +020037 r !echo hello
38 call assert_equal('hello', substitute(getline(2), '\W', '', 'g'))
Bram Moolenaar877e9572016-08-04 20:05:50 +020039 bwipe!
40 call assert_true(1, match(execute('winpos'), 'Window position: X \d\+, Y \d\+') >= 0)
41endfunc