annotate src/testdir/test_gui.vim @ 10972:488cda29455b v8.0.0375

patch 8.0.0375: the "+ register is not tested commit https://github.com/vim/vim/commit/5074a0e0333eaa6a9f697eb765124ca0e244c89b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 26 15:08:21 2017 +0100 patch 8.0.0375: the "+ register is not tested Problem: The "+ register is not tested. Solution: Add a test using another Vim instance to change the "+ register. (Kazuki Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Sun, 26 Feb 2017 15:15:04 +0100
parents 4e2cdce4576c
children b3601a8eb679
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests specifically for the GUI
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 if !has('gui') || ($DISPLAY == "" && !has('gui_running'))
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 finish
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 endif
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
7 source setup_gui.vim
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
8
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
9 func Setup()
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
10 call GUISetUpCommon()
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
11 endfunc
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
12
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
13 func TearDown()
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
14 call GUITearDownCommon()
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 endfunc
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " Test for resetting "secure" flag after GUI has started.
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " Must be run first.
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 func Test_1_set_secure()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 set exrc secure
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 gui -f
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 call assert_equal(1, has('gui_running'))
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 endfunc
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
25 func Test_getfontname_with_arg()
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
26 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
27
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
28 if !g:x11_based_gui
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
29 let skipped = g:not_implemented
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
30 elseif has('gui_athena') || has('gui_motif')
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
31 " Invalid font name. The result should be an empty string.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
32 call assert_equal('', getfontname('notexist'))
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
33
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
34 " Valid font name. This is usually the real name of 7x13 by default.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
35 let fname = '-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
36 call assert_equal(fname, getfontname(fname))
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
37
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
38 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
39 " Invalid font name. The result should be the name plus the default size.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
40 call assert_equal('notexist 10', getfontname('notexist'))
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
41
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
42 " Valid font name. This is usually the real name of Monospace by default.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
43 let fname = 'Bitstream Vera Sans Mono 12'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
44 call assert_equal(fname, getfontname(fname))
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
45 endif
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
46
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
47 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
48 throw skipped
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
49 endif
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
50 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
51
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
52 func Test_getfontname_without_arg()
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
53 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
54
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
55 let fname = getfontname()
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
56
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
57 if !g:x11_based_gui
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
58 let skipped = g:not_implemented
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
59 elseif has('gui_kde')
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
60 " 'expected' is the value specified by SetUp() above.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
61 call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
62 elseif has('gui_athena') || has('gui_motif')
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
63 " 'expected' is DFLT_FONT of gui_x11.c.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
64 call assert_equal('7x13', fname)
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
65 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
66 " 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
67 call assert_equal('Monospace 10', fname)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
68 endif
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
69
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
70 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
71 throw skipped
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
72 endif
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
73 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
74
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
75 func Test_quoteplus()
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
76 let skipped = ''
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
77
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
78 if !g:x11_based_gui
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
79 let skipped = g:not_supported . 'quoteplus'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
80 else
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
81 let quoteplus_saved = @+
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
82
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
83 let test_call = 'Can you hear me?'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
84 let test_response = 'Yes, I can.'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
85 let vim_exe = exepath(v:progpath)
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
86 let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
87 \ . vim_exe . ' -f -g -u NONE -U NONE --noplugin -c ''%s'''
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
88 let cmd = 'call feedkeys("'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
89 \ . '\"+p'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
90 \ . ':s/' . test_call . '/' . test_response . '/\<CR>'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
91 \ . '\"+yis'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
92 \ . ':q!\<CR>", "tx")'
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
93 let run_vimtest = printf(testee, cmd)
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
94
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
95 " Set the quoteplus register to test_call, and another gvim will launched.
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
96 " Then, it first tries to paste the content of its own quotedplus register
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
97 " onto it. Second, it tries to substitute test_responce for the pasted
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
98 " sentence. If the sentence is identical to test_call, the substitution
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
99 " should succeed. Third, it tries to yank the result of the substitution
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
100 " to its own quoteplus register, and last it quits. When system()
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
101 " returns, the content of the quoteplus register should be identical to
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
102 " test_response if those quoteplus registers are synchronized properly
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
103 " with/through the X11 clipboard.
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
104 let @+ = test_call
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
105 call system(run_vimtest)
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
106 call assert_equal(test_response, @+)
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
107
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
108 let @+ = quoteplus_saved
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
109 endif
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
110
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
111 if !empty(skipped)
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
112 throw skipped
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
113 endif
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
114 endfunc
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
115
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
116 func Test_set_guifont()
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
117 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
118
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
119 let guifont_saved = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
120 if has('xfontset')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
121 " Prevent 'guifontset' from canceling 'guifont'.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
122 let guifontset_saved = &guifontset
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
123 set guifontset=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
124 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
125
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
126 if !g:x11_based_gui
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
127 let skipped = g:not_implemented
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
128 elseif has('gui_athena') || has('gui_motif')
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
129 " Non-empty font list with invalid font names.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
130 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
131 " This test is twofold: (1) It checks if the command fails as expected
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
132 " when there are no loadable fonts found in the list. (2) It checks if
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
133 " 'guifont' remains the same after the command loads none of the fonts
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
134 " listed.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
135 let flist = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
136 call assert_fails('set guifont=-notexist1-*,-notexist2-*')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
137 call assert_equal(flist, &guifont)
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
138
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
139 " Non-empty font list with a valid font name. Should pick up the first
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
140 " valid font.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
141 set guifont=-notexist1-*,fixed,-notexist2-*
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
142 call assert_equal('fixed', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
143
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
144 " Empty list. Should fallback to the built-in default.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
145 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
146 call assert_equal('7x13', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
147
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
148 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
149 " For GTK, what we refer to as 'font names' in our manual are actually
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
150 " 'initial font patterns'. A valid font which matches the 'canonical font
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
151 " pattern' constructed from a given 'initial pattern' is to be looked up
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
152 " and loaded. That explains why the GTK GUIs appear to accept 'invalid
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
153 " font names'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
154 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
155 " Non-empty list. Should always pick up the first element, no matter how
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
156 " strange it is, as explained above.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
157 set guifont=(´・ω・`)\ 12,Courier\ 12
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
158 call assert_equal('(´・ω・`) 12', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
159
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
160 " Empty list. Should fallback to the built-in default.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
161 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
162 call assert_equal('Monospace 10', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
163 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
164
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
165 if has('xfontset')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
166 let &guifontset = guifontset_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
167 endif
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
168 let &guifont = guifont_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
169
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
170 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
171 throw skipped
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
172 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
173 endfunc
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
174
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
175 func Test_set_guifontset()
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
176 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
177
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
178 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
179 let skipped = g:not_supported . 'xfontset'
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
180 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
181 let ctype_saved = v:ctype
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
182
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
183 " First, since XCreateFontSet(3) is very sensitive to locale, fonts must
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
184 " be chosen meticulously.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
185 let font_head = '-misc-fixed-medium-r-normal--14'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
186
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
187 let font_aw70 = font_head . '-130-75-75-c-70'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
188 let font_aw140 = font_head . '-130-75-75-c-140'
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
189
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
190 let font_jisx0201 = font_aw70 . '-jisx0201.1976-0'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
191 let font_jisx0208 = font_aw140 . '-jisx0208.1983-0'
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
192
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
193 let full_XLFDs = join([ font_jisx0208, font_jisx0201 ], ',')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
194 let short_XLFDs = join([ font_aw140, font_aw70 ], ',')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
195 let singleton = font_head . '-*'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
196 let aliases = 'k14,r14'
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
197
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
198 " Second, among 'locales', look up such a locale that gets 'set
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
199 " guifontset=' to work successfully with every fontset specified with
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
200 " 'fontsets'.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
201 let locales = [ 'ja_JP.UTF-8', 'ja_JP.eucJP', 'ja_JP.SJIS' ]
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
202 let fontsets = [ full_XLFDs, short_XLFDs, singleton, aliases ]
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
203
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
204 let feasible = 0
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
205 for locale in locales
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
206 try
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
207 exec 'language ctype' locale
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
208 catch /^Vim\%((\a\+)\)\=:E197/
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
209 continue
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
210 endtry
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
211 let done = 0
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
212 for fontset in fontsets
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
213 try
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
214 exec 'set guifontset=' . fontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
215 catch /^Vim\%((\a\+)\)\=:E\%(250\|252\|234\|597\|598\)/
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
216 break
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
217 endtry
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
218 let done += 1
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
219 endfor
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
220 if done == len(fontsets)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
221 let feasible = 1
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
222 break
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
223 endif
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
224 endfor
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
225
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
226 " Third, give a set of tests if it is found feasible.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
227 if !feasible
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
228 let skipped = g:not_hosted
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
229 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
230 " N.B. 'v:ctype' has already been set to an appropriate value in the
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
231 " previous loop.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
232 for fontset in fontsets
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
233 exec 'set guifontset=' . fontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
234 call assert_equal(fontset, &guifontset)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
235 endfor
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
236 endif
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
237
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
238 " Finally, restore ctype.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
239 exec 'language ctype' ctype_saved
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
240 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
241
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
242 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
243 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
244 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
245 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
246
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
247 func Test_set_guifontwide()
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
248 let skipped = ''
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
249
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
250 if !g:x11_based_gui
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
251 let skipped = g:not_implemented
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
252 elseif has('gui_gtk')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
253 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
254 let guifontwide_saved = &guifontwide
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
255
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
256 let fc_match = exepath('fc-match')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
257 if empty(fc_match)
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
258 let skipped = g:not_hosted
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
259 else
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
260 let &guifont = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=en')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
261 let wide = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=ja')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
262 exec 'set guifontwide=' . fnameescape(wide)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
263 call assert_equal(wide, &guifontwide)
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
264 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
265
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
266 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
267 let &guifont = guifont_saved
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
268
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
269 elseif has('gui_athena') || has('gui_motif')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
270 " guifontwide is premised upon the xfontset feature.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
271 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
272 let skipped = g:not_supported . 'xfontset'
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
273 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
274 let encoding_saved = &encoding
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
275 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
276 let guifontset_saved = &guifontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
277 let guifontwide_saved = &guifontwide
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
278
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
279 let nfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
280 let wfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1'
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
281
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
282 set encoding=utf-8
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
283
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
284 " Case 1: guifontset is empty
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
285 set guifontset=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
286
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
287 " Case 1-1: Automatic selection
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
288 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
289 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
290 call assert_equal(wfont, &guifontwide)
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
291
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
292 " Case 1-2: Manual selection
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
293 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
294 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
295 call assert_equal(wfont, &guifontwide)
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
296
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
297 " Case 2: guifontset is invalid
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
298 try
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
299 set guifontset=-*-notexist-*
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
300 call assert_false(1, "'set guifontset=-*-notexist-*' should have failed")
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
301 catch
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
302 call assert_exception('E598')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
303 endtry
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
304 " Set it to an invalid value brutally for preparation.
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
305 let &guifontset = '-*-notexist-*'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
306
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
307 " Case 2-1: Automatic selection
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
308 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
309 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
310 call assert_equal(wfont, &guifontwide)
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
311
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
312 " Case 2-2: Manual selection
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
313 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
314 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
315 call assert_equal(wfont, &guifontwide)
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
316
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
317 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
318 let &guifontset = guifontset_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
319 let &guifont = guifont_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
320 let &encoding = encoding_saved
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
321 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
322 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
323
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
324 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
325 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
326 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
327 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
328
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
329 func Test_set_guiheadroom()
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
330 let skipped = ''
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
331
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
332 if !g:x11_based_gui
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
333 let skipped = g:not_supported . 'guiheadroom'
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
334 else
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
335 " Since this script is to be read together with '-U NONE', the default
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
336 " value must be preserved.
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
337 call assert_equal(50, &guiheadroom)
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
338 endif
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
339
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
340 if !empty(skipped)
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
341 throw skipped
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
342 endif
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
343 endfunc
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
344
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
345 func Test_getwinpos()
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
346 call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
347 call assert_true(getwinposx() >= 0)
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
348 call assert_true(getwinposy() >= 0)
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
349 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
350
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 func Test_shell_command()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352 new
9760
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
353 r !echo hello
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
354 call assert_equal('hello', substitute(getline(2), '\W', '', 'g'))
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355 bwipe!
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
357
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
358 func Test_windowid_variable()
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
359 if g:x11_based_gui || has('win32')
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
360 call assert_true(v:windowid > 0)
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
361 else
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
362 call assert_equal(0, v:windowid)
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
363 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
364 endfunc