Bram Moolenaar | 877e957 | 2016-08-04 20:05:50 +0200 | [diff] [blame] | 1 | " Tests specifically for the GUI |
| 2 | |
| 3 | if !has('gui') || ($DISPLAY == "" && !has('gui_running')) |
| 4 | finish |
| 5 | endif |
| 6 | |
| 7 | " For KDE set a font, empty 'guifont' may cause a hang. |
| 8 | func SetUp() |
| 9 | if has("gui_kde") |
| 10 | set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0 |
| 11 | endif |
Bram Moolenaar | 50fa8dd | 2016-08-09 22:58:21 +0200 | [diff] [blame] | 12 | |
Bram Moolenaar | f1ab9c1 | 2017-02-01 12:32:58 +0100 | [diff] [blame] | 13 | " 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 Moolenaar | 56e6bd7 | 2017-02-01 12:08:47 +0100 | [diff] [blame] | 17 | let $XDG_CACHE_HOME = g:tester_HOME . '/.cache' |
| 18 | endif |
Bram Moolenaar | 50fa8dd | 2016-08-09 22:58:21 +0200 | [diff] [blame] | 19 | call mkdir('Xhome') |
| 20 | let $HOME = fnamemodify('Xhome', ':p') |
| 21 | endfunc |
| 22 | |
| 23 | func TearDown() |
| 24 | call delete('Xhome', 'rf') |
Bram Moolenaar | 877e957 | 2016-08-04 20:05:50 +0200 | [diff] [blame] | 25 | endfunc |
| 26 | |
| 27 | " Test for resetting "secure" flag after GUI has started. |
| 28 | " Must be run first. |
| 29 | func Test_1_set_secure() |
| 30 | set exrc secure |
| 31 | gui -f |
| 32 | call assert_equal(1, has('gui_running')) |
| 33 | endfunc |
| 34 | |
| 35 | func Test_shell_command() |
| 36 | new |
Bram Moolenaar | 9d5b876 | 2016-08-04 21:21:13 +0200 | [diff] [blame] | 37 | r !echo hello |
| 38 | call assert_equal('hello', substitute(getline(2), '\W', '', 'g')) |
Bram Moolenaar | 877e957 | 2016-08-04 20:05:50 +0200 | [diff] [blame] | 39 | bwipe! |
| 40 | call assert_true(1, match(execute('winpos'), 'Window position: X \d\+, Y \d\+') >= 0) |
| 41 | endfunc |