annotate src/testdir/test_gui.vim @ 10944:4e2cdce4576c v8.0.0361

patch 8.0.0361: GUI initialisation is not sufficiently tested commit https://github.com/vim/vim/commit/8be2fbb6705dfb41d06d688701803d206c968404 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Feb 23 19:32:47 2017 +0100 patch 8.0.0361: GUI initialisation is not sufficiently tested Problem: GUI initialisation is not sufficiently tested. Solution: Add the gui_init test. (Kazuki Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Thu, 23 Feb 2017 19:45:04 +0100
parents 310834b0256a
children 488cda29455b
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
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
75 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
76 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
77
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
78 let guifont_saved = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
79 if has('xfontset')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
80 " 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
81 let guifontset_saved = &guifontset
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
82 set guifontset=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
83 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
84
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
85 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
86 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
87 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
88 " 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
89 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
90 " 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
91 " 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
92 " '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
93 " listed.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
94 let flist = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
95 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
96 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
97
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
98 " 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
99 " valid font.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
100 set guifont=-notexist1-*,fixed,-notexist2-*
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
101 call assert_equal('fixed', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
102
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
103 " 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
104 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
105 call assert_equal('7x13', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
106
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
107 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
108 " 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
109 " '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
110 " 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
111 " 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
112 " font names'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
113 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
114 " 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
115 " 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
116 set guifont=(´・ω・`)\ 12,Courier\ 12
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
117 call assert_equal('(´・ω・`) 12', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
118
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
119 " 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
120 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
121 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
122 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
123
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
124 if has('xfontset')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
125 let &guifontset = guifontset_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
126 endif
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
127 let &guifont = guifont_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
128
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
129 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
130 throw skipped
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
131 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
132 endfunc
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
133
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
134 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
135 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
136
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
137 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
138 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
139 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
140 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
141
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
142 " 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
143 " be chosen meticulously.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
144 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
145
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
146 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
147 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
148
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
149 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
150 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
151
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
152 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
153 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
154 let singleton = font_head . '-*'
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
155 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
156
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
157 " 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
158 " 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
159 " 'fontsets'.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
160 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
161 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
162
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
163 let feasible = 0
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
164 for locale in locales
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
165 try
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
166 exec 'language ctype' locale
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
167 catch /^Vim\%((\a\+)\)\=:E197/
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
168 continue
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
169 endtry
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
170 let done = 0
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
171 for fontset in fontsets
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
172 try
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
173 exec 'set guifontset=' . fontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
174 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
175 break
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
176 endtry
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
177 let done += 1
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
178 endfor
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
179 if done == len(fontsets)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
180 let feasible = 1
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
181 break
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
182 endif
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
183 endfor
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
184
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
185 " 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
186 if !feasible
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
187 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
188 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
189 " 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
190 " previous loop.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
191 for fontset in fontsets
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
192 exec 'set guifontset=' . fontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
193 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
194 endfor
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
195 endif
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
196
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
197 " Finally, restore ctype.
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
198 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
199 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
200
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
201 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
202 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
203 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
204 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
205
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
206 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
207 let skipped = ''
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
208
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
209 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
210 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
211 elseif has('gui_gtk')
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
212 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
213 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
214
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
215 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
216 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
217 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
218 else
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
219 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
220 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
221 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
222 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
223 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
224
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
225 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
226 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
227
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
228 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
229 " 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
230 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
231 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
232 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
233 let encoding_saved = &encoding
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
234 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
235 let guifontset_saved = &guifontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
236 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
237
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
238 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
239 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
240
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
241 set encoding=utf-8
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
242
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
243 " 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
244 set guifontset=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
245
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
246 " 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
247 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
248 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
249 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
250
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
251 " 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
252 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
253 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
254 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
255
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
256 " 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
257 try
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
258 set guifontset=-*-notexist-*
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
259 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
260 catch
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
261 call assert_exception('E598')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
262 endtry
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
263 " 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
264 let &guifontset = '-*-notexist-*'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
265
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
266 " 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
267 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
268 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
269 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
270
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
271 " 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
272 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
273 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
274 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
275
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
276 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
277 let &guifontset = guifontset_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
278 let &guifont = guifont_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
279 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
280 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
281 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
282
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
283 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
284 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
285 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
286 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
287
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
288 func Test_set_guiheadroom()
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
289 let skipped = ''
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
290
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
291 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
292 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
293 else
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
294 " 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
295 " value must be preserved.
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
296 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
297 endif
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
298
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
299 if !empty(skipped)
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
300 throw skipped
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
301 endif
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
302 endfunc
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
303
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
304 func Test_getwinpos()
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
305 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
306 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
307 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
308 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
309
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 func Test_shell_command()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 new
9760
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
312 r !echo hello
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
313 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
314 bwipe!
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
316
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
317 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
318 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
319 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
320 else
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
321 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
322 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
323 endfunc