Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 1 | " Tests specifically for the GUI features/options that need to be set up at |
| 2 | " startup to take effect at runtime. |
| 3 | |
Bram Moolenaar | 9f0139a | 2017-08-13 20:26:20 +0200 | [diff] [blame] | 4 | source shared.vim |
| 5 | if !CanRunGui() |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 6 | finish |
| 7 | endif |
| 8 | |
| 9 | source setup_gui.vim |
| 10 | |
| 11 | func Setup() |
| 12 | call GUISetUpCommon() |
| 13 | endfunc |
| 14 | |
| 15 | func TearDown() |
| 16 | call GUITearDownCommon() |
| 17 | endfunc |
| 18 | |
Bram Moolenaar | 24d7636 | 2017-03-04 13:32:10 +0100 | [diff] [blame] | 19 | " Ignore the "failed to create input context" error. |
Bram Moolenaar | 5d7ead3 | 2018-02-27 17:17:42 +0100 | [diff] [blame] | 20 | call test_ignore_error('E285:') |
Bram Moolenaar | 24d7636 | 2017-03-04 13:32:10 +0100 | [diff] [blame] | 21 | |
| 22 | " Start the GUI now, in the foreground. |
Bram Moolenaar | 8be2fbb | 2017-02-23 19:32:47 +0100 | [diff] [blame] | 23 | gui -f |
| 24 | |
| 25 | func Test_set_guiheadroom() |
| 26 | let skipped = '' |
| 27 | |
| 28 | if !g:x11_based_gui |
| 29 | let skipped = g:not_supported . 'guiheadroom' |
| 30 | else |
| 31 | " The 'expected' value must be consistent with the value specified with |
| 32 | " gui_init.vim. |
| 33 | call assert_equal(0, &guiheadroom) |
| 34 | endif |
| 35 | |
| 36 | if !empty(skipped) |
| 37 | throw skipped |
| 38 | endif |
| 39 | endfunc |
Bram Moolenaar | 8774845 | 2017-03-12 17:10:33 +0100 | [diff] [blame] | 40 | |
| 41 | func Test_set_guioptions_for_M() |
| 42 | sleep 200ms |
| 43 | " Check if the 'M' option is included. |
| 44 | call assert_match('.*M.*', &guioptions) |
| 45 | endfunc |
| 46 | |
| 47 | func Test_set_guioptions_for_p() |
| 48 | let skipped = '' |
| 49 | |
| 50 | if !g:x11_based_gui |
| 51 | let skipped = g:not_supported . '''p'' of guioptions' |
| 52 | else |
| 53 | sleep 200ms |
| 54 | " Check if the 'p' option is included. |
| 55 | call assert_match('.*p.*', &guioptions) |
| 56 | endif |
| 57 | |
| 58 | if !empty(skipped) |
| 59 | throw skipped |
| 60 | endif |
| 61 | endfunc |