xref: /vim-8.2.3635/src/testdir/test_gui.vim (revision 85eee130)
1" Tests specifically for the GUI
2
3source shared.vim
4if !CanRunGui()
5  finish
6endif
7
8source setup_gui.vim
9
10func Setup()
11  call GUISetUpCommon()
12endfunc
13
14func TearDown()
15  call GUITearDownCommon()
16endfunc
17
18" Test for resetting "secure" flag after GUI has started.
19" Must be run first, since it starts the GUI on Unix.
20func Test_1_set_secure()
21  set exrc secure
22  gui -f
23  call assert_equal(1, has('gui_running'))
24endfunc
25
26" As for non-GUI, a balloon_show() test was already added with patch 8.0.0401
27func Test_balloon_show()
28  if has('balloon_eval')
29    " This won't do anything but must not crash either.
30    call balloon_show('hi!')
31  endif
32endfunc
33
34func Test_colorscheme()
35  let colorscheme_saved = exists('g:colors_name') ? g:colors_name : 'default'
36  let g:color_count = 0
37  augroup TestColors
38    au!
39    au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count
40    au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count
41  augroup END
42
43  colorscheme torte
44  redraw!
45  sleep 200m
46  call assert_equal('dark', &background)
47  call assert_equal(1, g:before_colors)
48  call assert_equal(2, g:after_colors)
49
50  exec 'colorscheme' colorscheme_saved
51  augroup TestColors
52    au!
53  augroup END
54  unlet g:color_count g:after_colors g:before_colors
55  redraw!
56endfunc
57
58func Test_getfontname_with_arg()
59  let skipped = ''
60
61  if !g:x11_based_gui
62    let skipped = g:not_implemented
63  elseif has('gui_athena') || has('gui_motif')
64    " Invalid font name. The result should be an empty string.
65    call assert_equal('', getfontname('notexist'))
66
67    " Valid font name. This is usually the real name of 7x13 by default.
68    let fname = '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1'
69    call assert_match(fname, getfontname(fname))
70
71  elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
72    " Invalid font name. The result should be the name plus the default size.
73    call assert_equal('notexist 10', getfontname('notexist'))
74
75    " Valid font name. This is usually the real name of Monospace by default.
76    let fname = 'Bitstream Vera Sans Mono 12'
77    call assert_equal(fname, getfontname(fname))
78  endif
79
80  if !empty(skipped)
81    throw skipped
82  endif
83endfunc
84
85func Test_getfontname_without_arg()
86  let skipped = ''
87
88  let fname = getfontname()
89
90  if !g:x11_based_gui
91    let skipped = g:not_implemented
92  elseif has('gui_kde')
93    " 'expected' is the value specified by SetUp() above.
94    call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
95  elseif has('gui_athena') || has('gui_motif')
96    " 'expected' is DFLT_FONT of gui_x11.c or its real name.
97    let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)'
98    call assert_match(pat, fname)
99  elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
100    " 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
101    call assert_equal('Monospace 10', fname)
102  endif
103
104  if !empty(skipped)
105    throw skipped
106  endif
107endfunc
108
109func Test_getwinpos()
110  call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
111  call assert_true(getwinposx() >= 0)
112  call assert_true(getwinposy() >= 0)
113endfunc
114
115func Test_quoteplus()
116  let skipped = ''
117
118  if !g:x11_based_gui
119    let skipped = g:not_supported . 'quoteplus'
120  else
121    let quoteplus_saved = @+
122
123    let test_call     = 'Can you hear me?'
124    let test_response = 'Yes, I can.'
125    let vim_exe = exepath(v:progpath)
126    let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
127          \ . vim_exe
128	  \ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s'''
129    " Ignore the "failed to create input context" error.
130    let cmd = 'call test_ignore_error("E285") | '
131	  \ . 'gui -f | '
132	  \ . 'call feedkeys("'
133          \ . '\"+p'
134          \ . ':s/' . test_call . '/' . test_response . '/\<CR>'
135          \ . '\"+yis'
136          \ . ':q!\<CR>", "tx")'
137    let run_vimtest = printf(testee, cmd)
138
139    " Set the quoteplus register to test_call, and another gvim will launched.
140    " Then, it first tries to paste the content of its own quotedplus register
141    " onto it.  Second, it tries to substitute test_responce for the pasted
142    " sentence.  If the sentence is identical to test_call, the substitution
143    " should succeed.  Third, it tries to yank the result of the substitution
144    " to its own quoteplus register, and last it quits.  When system()
145    " returns, the content of the quoteplus register should be identical to
146    " test_response if those quoteplus registers are synchronized properly
147    " with/through the X11 clipboard.
148    let @+ = test_call
149    call system(run_vimtest)
150    call assert_equal(test_response, @+)
151
152    let @+ = quoteplus_saved
153  endif
154
155  if !empty(skipped)
156    throw skipped
157  endif
158endfunc
159
160func Test_set_background()
161  let background_saved = &background
162
163  set background&
164  call assert_equal('light', &background)
165
166  set background=dark
167  call assert_equal('dark', &background)
168
169  let &background = background_saved
170endfunc
171
172func Test_set_balloondelay()
173  if !exists('+balloondelay')
174    return
175  endif
176
177  let balloondelay_saved = &balloondelay
178
179  " Check if the default value is identical to that described in the manual.
180  set balloondelay&
181  call assert_equal(600, &balloondelay)
182
183  " Edge cases
184
185  " XXX This fact should be hidden so that people won't be tempted to write
186  " plugin/TimeMachine.vim.  TODO Add reasonable range checks to the source
187  " code.
188  set balloondelay=-1
189  call assert_equal(-1, &balloondelay)
190
191  " Though it's possible to interpret the zero delay to be 'as soon as
192  " possible' or even 'indefinite', its actual meaning depends on the GUI
193  " toolkit in use after all.
194  set balloondelay=0
195  call assert_equal(0, &balloondelay)
196
197  set balloondelay=1
198  call assert_equal(1, &balloondelay)
199
200  " Since p_bdelay is of type long currently, the upper bound can be
201  " impractically huge and machine-dependent.  Practically, it's sufficient
202  " to check if balloondelay works with 0x7fffffff (32 bits) for now.
203  set balloondelay=2147483647
204  call assert_equal(2147483647, &balloondelay)
205
206  let &balloondelay = balloondelay_saved
207endfunc
208
209func Test_set_ballooneval()
210  if !exists('+ballooneval')
211    return
212  endif
213
214  let ballooneval_saved = &ballooneval
215
216  set ballooneval&
217  call assert_equal(0, &ballooneval)
218
219  set ballooneval
220  call assert_notequal(0, &ballooneval)
221
222  set noballooneval
223  call assert_equal(0, &ballooneval)
224
225  let &ballooneval = ballooneval_saved
226endfunc
227
228func Test_set_balloonexpr()
229  if !exists('+balloonexpr')
230    return
231  endif
232
233  let balloonexpr_saved = &balloonexpr
234
235  " Default value
236  set balloonexpr&
237  call assert_equal('', &balloonexpr)
238
239  " User-defined function
240  new
241  func MyBalloonExpr()
242      return 'Cursor is at line ' . v:beval_lnum .
243	      \', column ' . v:beval_col .
244	      \ ' of file ' .  bufname(v:beval_bufnr) .
245	      \ ' on word "' . v:beval_text . '"' .
246	      \ ' in window ' . v:beval_winid . ' (#' . v:beval_winnr . ')'
247  endfunc
248  setl balloonexpr=MyBalloonExpr()
249  setl ballooneval
250  call assert_equal('MyBalloonExpr()', &balloonexpr)
251  " TODO Read non-empty text, place the pointer at a character of a word,
252  " and check if the content of the balloon is the smae as what is expected.
253  " Also, check if textlock works as expected.
254  setl balloonexpr&
255  call assert_equal('', &balloonexpr)
256  delfunc MyBalloonExpr
257  bwipe!
258
259  " Multiline support
260  if has('balloon_multiline')
261    " Multiline balloon using NL
262    new
263    func MyBalloonFuncForMultilineUsingNL()
264      return "Multiline\nSuppported\nBalloon\nusing NL"
265    endfunc
266    setl balloonexpr=MyBalloonFuncForMultilineUsingNL()
267    setl ballooneval
268    call assert_equal('MyBalloonFuncForMultilineUsingNL()', &balloonexpr)
269    " TODO Read non-empty text, place the pointer at a character of a word,
270    " and check if the content of the balloon is the smae as what is
271    " expected.  Also, check if textlock works as expected.
272    setl balloonexpr&
273    delfunc MyBalloonFuncForMultilineUsingNL
274    bwipe!
275
276    " Multiline balloon using List
277    new
278    func MyBalloonFuncForMultilineUsingList()
279      return [ 'Multiline', 'Suppported', 'Balloon', 'using List' ]
280    endfunc
281    setl balloonexpr=MyBalloonFuncForMultilineUsingList()
282    setl ballooneval
283    call assert_equal('MyBalloonFuncForMultilineUsingList()', &balloonexpr)
284    " TODO Read non-empty text, place the pointer at a character of a word,
285    " and check if the content of the balloon is the smae as what is
286    " expected.  Also, check if textlock works as expected.
287    setl balloonexpr&
288    delfunc MyBalloonFuncForMultilineUsingList
289    bwipe!
290  endif
291
292  let &balloonexpr = balloonexpr_saved
293endfunc
294
295" Invalid arguments are tested with test_options in conjunction with segfaults
296" caused by them (Patch 8.0.0357, 24922ec233).
297func Test_set_guicursor()
298  let guicursor_saved = &guicursor
299
300  let default = [
301        \ "n-v-c:block-Cursor/lCursor",
302        \ "ve:ver35-Cursor",
303        \ "o:hor50-Cursor",
304        \ "i-ci:ver25-Cursor/lCursor",
305        \ "r-cr:hor20-Cursor/lCursor",
306        \ "sm:block-Cursor-blinkwait175-blinkoff150-blinkon175"
307        \ ]
308
309  " Default Value
310  set guicursor&
311  call assert_equal(join(default, ','), &guicursor)
312
313  " Argument List Example 1
314  let opt_list = copy(default)
315  let opt_list[0] = "n-c-v:block-nCursor"
316  exec "set guicursor=" . join(opt_list, ',')
317  call assert_equal(join(opt_list, ','), &guicursor)
318  unlet opt_list
319
320  " Argument List Example 2
321  let opt_list = copy(default)
322  let opt_list[3] = "i-ci:ver30-iCursor-blinkwait300-blinkon200-blinkoff150"
323  exec "set guicursor=" . join(opt_list, ',')
324  call assert_equal(join(opt_list, ','), &guicursor)
325  unlet opt_list
326
327  " 'a' Mode
328  set guicursor&
329  let &guicursor .= ',a:blinkon0'
330  call assert_equal(join(default, ',') . ",a:blinkon0", &guicursor)
331
332  let &guicursor = guicursor_saved
333endfunc
334
335func Test_set_guifont()
336  let skipped = ''
337
338  let guifont_saved = &guifont
339  if has('xfontset')
340    " Prevent 'guifontset' from canceling 'guifont'.
341    let guifontset_saved = &guifontset
342    set guifontset=
343  endif
344
345  if !g:x11_based_gui
346    let skipped = g:not_implemented
347  elseif has('gui_athena') || has('gui_motif')
348    " Non-empty font list with invalid font names.
349    "
350    " This test is twofold: (1) It checks if the command fails as expected
351    " when there are no loadable fonts found in the list. (2) It checks if
352    " 'guifont' remains the same after the command loads none of the fonts
353    " listed.
354    let flist = &guifont
355    call assert_fails('set guifont=-notexist1-*,-notexist2-*')
356    call assert_equal(flist, &guifont)
357
358    " Non-empty font list with a valid font name.  Should pick up the first
359    " valid font.
360    set guifont=-notexist1-*,fixed,-notexist2-*
361    let pat = '\(fixed\)\|\(\c-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1\)'
362    call assert_match(pat, getfontname())
363
364    " Empty list. Should fallback to the built-in default.
365    set guifont=
366    let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)'
367    call assert_match(pat, getfontname())
368
369  elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
370    " For GTK, what we refer to as 'font names' in our manual are actually
371    " 'initial font patterns'.  A valid font which matches the 'canonical font
372    " pattern' constructed from a given 'initial pattern' is to be looked up
373    " and loaded.  That explains why the GTK GUIs appear to accept 'invalid
374    " font names'.
375    "
376    " Non-empty list.  Should always pick up the first element, no matter how
377    " strange it is, as explained above.
378    set guifont=(´・ω・`)\ 12,Courier\ 12
379    call assert_equal('(´・ω・`) 12', getfontname())
380
381    " Empty list. Should fallback to the built-in default.
382    set guifont=
383    call assert_equal('Monospace 10', getfontname())
384  endif
385
386  if has('xfontset')
387    let &guifontset = guifontset_saved
388  endif
389  let &guifont = guifont_saved
390
391  if !empty(skipped)
392    throw skipped
393  endif
394endfunc
395
396func Test_set_guifontset()
397  let skipped = ''
398
399  if !has('xfontset')
400    let skipped = g:not_supported . 'xfontset'
401  else
402    let ctype_saved = v:ctype
403
404    " First, since XCreateFontSet(3) is very sensitive to locale, fonts must
405    " be chosen meticulously.
406    let font_head = '-misc-fixed-medium-r-normal--14'
407
408    let font_aw70 = font_head . '-130-75-75-c-70'
409    let font_aw140 = font_head . '-130-75-75-c-140'
410
411    let font_jisx0201 = font_aw70 . '-jisx0201.1976-0'
412    let font_jisx0208 = font_aw140 . '-jisx0208.1983-0'
413
414    let full_XLFDs = join([ font_jisx0208, font_jisx0201 ], ',')
415    let short_XLFDs = join([ font_aw140, font_aw70 ], ',')
416    let singleton = font_head . '-*'
417    let aliases = 'k14,r14'
418
419    " Second, among 'locales', look up such a locale that gets 'set
420    " guifontset=' to work successfully with every fontset specified with
421    " 'fontsets'.
422    let locales = [ 'ja_JP.UTF-8', 'ja_JP.eucJP', 'ja_JP.SJIS' ]
423    let fontsets = [ full_XLFDs, short_XLFDs, singleton, aliases ]
424
425    let feasible = 0
426    for locale in locales
427      try
428        exec 'language ctype' locale
429      catch /^Vim\%((\a\+)\)\=:E197/
430        continue
431      endtry
432      let done = 0
433      for fontset in fontsets
434        try
435          exec 'set guifontset=' . fontset
436        catch /^Vim\%((\a\+)\)\=:E\%(250\|252\|234\|597\|598\)/
437          break
438        endtry
439        let done += 1
440      endfor
441      if done == len(fontsets)
442        let feasible = 1
443        break
444      endif
445    endfor
446
447    " Third, give a set of tests if it is found feasible.
448    if !feasible
449      let skipped = g:not_hosted
450    else
451      " N.B. 'v:ctype' has already been set to an appropriate value in the
452      " previous loop.
453      for fontset in fontsets
454        exec 'set guifontset=' . fontset
455        call assert_equal(fontset, &guifontset)
456      endfor
457    endif
458
459    " Finally, restore ctype.
460    exec 'language ctype' ctype_saved
461  endif
462
463  if !empty(skipped)
464    throw skipped
465  endif
466endfunc
467
468func Test_set_guifontwide()
469  let skipped = ''
470
471  if !g:x11_based_gui
472    let skipped = g:not_implemented
473  elseif has('gui_gtk')
474    let guifont_saved = &guifont
475    let guifontwide_saved = &guifontwide
476
477    let fc_match = exepath('fc-match')
478    if empty(fc_match)
479      let skipped = g:not_hosted
480    else
481      let &guifont = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=en')
482      let wide = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=ja')
483      exec 'set guifontwide=' . fnameescape(wide)
484      call assert_equal(wide, &guifontwide)
485    endif
486
487    let &guifontwide = guifontwide_saved
488    let &guifont = guifont_saved
489
490  elseif has('gui_athena') || has('gui_motif')
491    " guifontwide is premised upon the xfontset feature.
492    if !has('xfontset')
493      let skipped = g:not_supported . 'xfontset'
494    else
495      let encoding_saved    = &encoding
496      let guifont_saved     = &guifont
497      let guifontset_saved  = &guifontset
498      let guifontwide_saved = &guifontwide
499
500      let nfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1'
501      let wfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1'
502
503      set encoding=utf-8
504
505      " Case 1: guifontset is empty
506      set guifontset=
507
508      " Case 1-1: Automatic selection
509      set guifontwide=
510      exec 'set guifont=' . nfont
511      call assert_equal(wfont, &guifontwide)
512
513      " Case 1-2: Manual selection
514      exec 'set guifontwide=' . wfont
515      exec 'set guifont=' . nfont
516      call assert_equal(wfont, &guifontwide)
517
518      " Case 2: guifontset is invalid
519      try
520        set guifontset=-*-notexist-*
521        call assert_report("'set guifontset=-*-notexist-*' should have failed")
522      catch
523        call assert_exception('E598')
524      endtry
525      " Set it to an invalid value brutally for preparation.
526      let &guifontset = '-*-notexist-*'
527
528      " Case 2-1: Automatic selection
529      set guifontwide=
530      exec 'set guifont=' . nfont
531      call assert_equal(wfont, &guifontwide)
532
533      " Case 2-2: Manual selection
534      exec 'set guifontwide=' . wfont
535      exec 'set guifont=' . nfont
536      call assert_equal(wfont, &guifontwide)
537
538      let &guifontwide = guifontwide_saved
539      let &guifontset  = guifontset_saved
540      let &guifont     = guifont_saved
541      let &encoding    = encoding_saved
542    endif
543  endif
544
545  if !empty(skipped)
546    throw skipped
547  endif
548endfunc
549
550func Test_set_guiheadroom()
551  let skipped = ''
552
553  if !g:x11_based_gui
554    let skipped = g:not_supported . 'guiheadroom'
555  else
556    " Since this script is to be read together with '-U NONE', the default
557    " value must be preserved.
558    call assert_equal(50, &guiheadroom)
559  endif
560
561  if !empty(skipped)
562    throw skipped
563  endif
564endfunc
565
566func Test_set_guioptions()
567  let guioptions_saved = &guioptions
568  let duration = '200m'
569
570  if has('win32')
571    " Default Value
572    set guioptions&
573    call assert_equal('egmrLtT', &guioptions)
574
575  else
576    " Default Value
577    set guioptions&
578    call assert_equal('aegimrLtT', &guioptions)
579
580    " To activate scrollbars of type 'L' or 'R'.
581    wincmd v
582    redraw!
583
584    " Remove all default GUI ornaments
585    set guioptions-=T
586    exec 'sleep' . duration
587    call assert_equal('aegimrLt', &guioptions)
588    set guioptions-=t
589    exec 'sleep' . duration
590    call assert_equal('aegimrL', &guioptions)
591    set guioptions-=L
592    exec 'sleep' . duration
593    call assert_equal('aegimr', &guioptions)
594    set guioptions-=r
595    exec 'sleep' . duration
596    call assert_equal('aegim', &guioptions)
597    set guioptions-=m
598    exec 'sleep' . duration
599    call assert_equal('aegi', &guioptions)
600
601    " Try non-default GUI ornaments
602    set guioptions+=l
603    exec 'sleep' . duration
604    call assert_equal('aegil', &guioptions)
605    set guioptions-=l
606    exec 'sleep' . duration
607    call assert_equal('aegi', &guioptions)
608
609    set guioptions+=R
610    exec 'sleep' . duration
611    call assert_equal('aegiR', &guioptions)
612    set guioptions-=R
613    exec 'sleep' . duration
614    call assert_equal('aegi', &guioptions)
615
616    set guioptions+=b
617    exec 'sleep' . duration
618    call assert_equal('aegib', &guioptions)
619    set guioptions+=h
620    exec 'sleep' . duration
621    call assert_equal('aegibh', &guioptions)
622    set guioptions-=h
623    exec 'sleep' . duration
624    call assert_equal('aegib', &guioptions)
625    set guioptions-=b
626    exec 'sleep' . duration
627    call assert_equal('aegi', &guioptions)
628
629    set guioptions+=v
630    exec 'sleep' . duration
631    call assert_equal('aegiv', &guioptions)
632    set guioptions-=v
633    exec 'sleep' . duration
634    call assert_equal('aegi', &guioptions)
635
636    if has('gui_motif')
637      set guioptions+=F
638      exec 'sleep' . duration
639      call assert_equal('aegiF', &guioptions)
640      set guioptions-=F
641      exec 'sleep' . duration
642      call assert_equal('aegi', &guioptions)
643    endif
644
645    " Restore GUI ornaments to the default state.
646    set guioptions+=m
647    exec 'sleep' . duration
648    call assert_equal('aegim', &guioptions)
649    set guioptions+=r
650    exec 'sleep' . duration
651    call assert_equal('aegimr', &guioptions)
652    set guioptions+=L
653    exec 'sleep' . duration
654    call assert_equal('aegimrL', &guioptions)
655    set guioptions+=t
656    exec 'sleep' . duration
657    call assert_equal('aegimrLt', &guioptions)
658    set guioptions+=T
659    exec 'sleep' . duration
660    call assert_equal("aegimrLtT", &guioptions)
661
662    wincmd o
663    redraw!
664  endif
665
666  let &guioptions = guioptions_saved
667endfunc
668
669func Test_set_guipty()
670  let guipty_saved = &guipty
671
672  " Default Value
673  set guipty&
674  call assert_equal(1, &guipty)
675
676  set noguipty
677  call assert_equal(0, &guipty)
678
679  let &guipty = guipty_saved
680endfunc
681
682func Test_shell_command()
683  new
684  r !echo hello
685  call assert_equal('hello', substitute(getline(2), '\W', '', 'g'))
686  bwipe!
687endfunc
688
689func Test_syntax_colortest()
690  runtime syntax/colortest.vim
691  redraw!
692  sleep 200m
693  bwipe!
694endfunc
695
696func Test_set_term()
697  " It's enough to check the current value since setting 'term' to anything
698  " other than builtin_gui makes no sense at all.
699  call assert_equal('builtin_gui', &term)
700endfunc
701
702func Test_windowid_variable()
703  if g:x11_based_gui || has('win32')
704    call assert_true(v:windowid > 0)
705  else
706    call assert_equal(0, v:windowid)
707  endif
708endfunc
709
710" Test "vim -g" and also the GUIEnter autocommand.
711func Test_gui_dash_g()
712  let cmd = GetVimCommand('Xscriptgui')
713  call writefile([""], "Xtestgui")
714  call writefile([
715	\ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")',
716	\ 'au GUIEnter * qall',
717	\ ], 'Xscriptgui')
718  call system(cmd . ' -g')
719  call WaitForAssert({-> assert_equal(['insertmode: 0'], readfile('Xtestgui'))})
720
721  call delete('Xscriptgui')
722  call delete('Xtestgui')
723endfunc
724
725" Test "vim -7" and also the GUIEnter autocommand.
726func Test_gui_dash_y()
727  let cmd = GetVimCommand('Xscriptgui')
728  call writefile([""], "Xtestgui")
729  call writefile([
730	\ 'au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")',
731	\ 'au GUIEnter * qall',
732	\ ], 'Xscriptgui')
733  call system(cmd . ' -y')
734  call WaitForAssert({-> assert_equal(['insertmode: 1'], readfile('Xtestgui'))})
735
736  call delete('Xscriptgui')
737  call delete('Xtestgui')
738endfunc
739