annotate src/testdir/test_gui.vim @ 10879:1fce74a5a628 v8.0.0329

patch 8.0.0329: xfontset and guifontwide are not tested commit https://github.com/vim/vim/commit/10434674821939222bf552d15d93e0132d13badc Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 12 19:59:08 2017 +0100 patch 8.0.0329: xfontset and guifontwide are not tested Problem: Xfontset and guifontwide are not tested. Solution: Add tests. (Kazunobu Kuriyama)
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Feb 2017 20:00:04 +0100
parents 20d71d305d1c
children 310834b0256a
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
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
7 let s:x11_based_gui = has('gui_athena') || has('gui_motif')
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
8 \ || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
9
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " For KDE set a font, empty 'guifont' may cause a hang.
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 func SetUp()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if has("gui_kde")
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 endif
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
15
10777
80b286d6d38d patch 8.0.0278: GUI test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10775
diff changeset
16 " Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
80b286d6d38d patch 8.0.0278: GUI test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10775
diff changeset
17 " actual home directory. But avoid triggering fontconfig by setting the
80b286d6d38d patch 8.0.0278: GUI test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10775
diff changeset
18 " cache directory. Only needed for Unix.
80b286d6d38d patch 8.0.0278: GUI test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 10775
diff changeset
19 if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
10775
d08655e2633a patch 8.0.0277: the GUI test may trigger fontconfig and take a long time
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
20 let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
d08655e2633a patch 8.0.0277: the GUI test may trigger fontconfig and take a long time
Christian Brabandt <cb@256bit.org>
parents: 9830
diff changeset
21 endif
9830
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
22 call mkdir('Xhome')
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
23 let $HOME = fnamemodify('Xhome', ':p')
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
24 endfunc
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
25
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
26 func TearDown()
6049c1f01391 commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents: 9760
diff changeset
27 call delete('Xhome', 'rf')
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 endfunc
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " 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
31 " Must be run first.
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 func Test_1_set_secure()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 set exrc secure
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 gui -f
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call assert_equal(1, has('gui_running'))
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 endfunc
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
38 func Test_getfontname_with_arg()
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
39 if 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
40 " 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
41 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
42
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
43 " Valid font name. This is usually the real name of 7x13 by default.
10857
20d71d305d1c patch 8.0.0318: small mistake in 7x13 font name
Christian Brabandt <cb@256bit.org>
parents: 10855
diff changeset
44 let l:fname = '-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1'
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
45 call assert_equal(l:fname, getfontname(l:fname))
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
46
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
47 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
48 " 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
49 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
50
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
51 " Valid font name. This is usually the real name of Monospace by default.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
52 let l:fname = 'Bitstream Vera Sans Mono 12'
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
53 call assert_equal(l:fname, getfontname(l:fname))
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
54 else
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
55 throw "Skipped: Matched font name unpredictable to test on this GUI"
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
56 endif
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
57 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
58
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
59 func Test_getfontname_without_arg()
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
60 let l:fname = getfontname()
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
61 if has('gui_kde')
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
62 " 'expected' is the value specified by SetUp() above.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
63 call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', l:fname)
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
64 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
65 " 'expected' is DFLT_FONT of gui_x11.c.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
66 call assert_equal('7x13', l:fname)
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
67 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
68 " 'expected' is DEFAULT_FONT of gui_gtk_x11.c.
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
69 call assert_equal('Monospace 10', l:fname)
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
70 else
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
71 throw "Skipped: Default font name unpredictable to test on this GUI"
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()
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
76 let l:guifont_saved = &guifont
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
77 if has('xfontset')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
78 " Prevent 'guifontset' from canceling 'guifont'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
79 let l:guifontset_saved = &guifontset
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
80 set guifontset=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
81 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
82
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
83 let skipped = 0
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
84 if has('gui_athena') || has('gui_motif')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
85 " 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
86 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
87 " 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
88 " 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
89 " '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
90 " listed.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
91 let l:flist = &guifont
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
92 call assert_fails('set guifont=-notexist1-*,-notexist2-*')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
93 call assert_equal(l:flist, &guifont)
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
94
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
95 " 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
96 " valid font.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
97 set guifont=-notexist1-*,fixed,-notexist2-*
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
98 call assert_equal('fixed', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
99
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
100 " 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
101 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
102 call assert_equal('7x13', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
103
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
104 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
105 " 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
106 " '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
107 " 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
108 " 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
109 " font names'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
110 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
111 " 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
112 " 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
113 set guifont=(´・ω・`)\ 12,Courier\ 12
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
114 call assert_equal('(´・ω・`) 12', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
115
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
116 " 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
117 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
118 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
119
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
120 else
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
121 let skipped = 1
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')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
125 let &guifontset = l:guifontset_saved
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
126 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
127 let &guifont = l:guifont_saved
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
128
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
129 if skipped
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
130 throw "Skipped: Test not implemented yet for this GUI"
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()
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
135 let skipped = 0
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
136
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
137 if has('xfontset')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
138 let l:ctype_saved = v:ctype
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
139
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
140 " For UTF-8 locales, XCreateFontSet(3) is likely to fail in constructing a
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
141 " fontset automatically from one or two simple XLFDs because it requires
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
142 " the host system to have a fairly comprehensive collection of fixed-width
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
143 " fonts with various sizes and registries/encodings in order to get the
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
144 " job done. To make the test meaningful for a wide variety of hosts, we
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
145 " confine ourselves to the following locale for which X11 historically has
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
146 " the fonts to use with.
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
147 language ctype ja_JP.eucJP
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
148
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
149 " Since XCreateFontSet(3) is very sensitive to locale, fonts must be
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
150 " chosen meticulously.
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
151 let l:font_head = '-misc-fixed-medium-r-normal--14'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
152
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
153 let l:font_aw70 = l:font_head . '-130-75-75-c-70'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
154 let l:font_aw140 = l:font_head . '-130-75-75-c-140'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
155
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
156 let l:font_jisx0201 = l:font_aw70 . '-jisx0201.1976-0'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
157 let l:font_jisx0208 = l:font_aw140 . '-jisx0208.1983-0'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
158
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
159 " Full XLFDs
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
160 let l:fontset_name = join([ l:font_jisx0208, l:font_jisx0201 ], ',')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
161 exec 'set guifontset=' . l:fontset_name
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
162 call assert_equal(l:fontset_name, &guifontset)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
163
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
164 " XLFDs w/o CharSetRegistry and CharSetEncoding
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
165 let l:fontset_name = join([ l:font_aw140, l:font_aw70 ], ',')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
166 exec 'set guifontset=' . l:fontset_name
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
167 call assert_equal(l:fontset_name, &guifontset)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
168
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
169 " Singleton
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
170 let l:fontset_name = l:font_head . '-*'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
171 exec 'set guifontset=' . l:fontset_name
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
172 call assert_equal(l:fontset_name, &guifontset)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
173
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
174 " Aliases
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
175 let l:fontset_name = 'k14,r14'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
176 exec 'set guifontset=' . l:fontset_name
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
177 call assert_equal(l:fontset_name, &guifontset)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
178
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
179 exec 'language ctype' l:ctype_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
180
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
181 else
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
182 let skipped = 1
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
183 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
184
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
185 if skipped
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
186 throw "Skipped: Not supported by this GUI"
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
187 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
188 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
189
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
190 func Test_set_guifontwide()
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
191 let skipped = 0
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
192
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
193 if has('gui_gtk')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
194 let l:guifont_saved = &guifont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
195 let l:guifontwide_saved = &guifontwide
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
196
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
197 let l:fc_match = exepath('fc-match')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
198 if l:fc_match != ''
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
199 let &guifont = system('fc-match -f "%{family[0]} %{size}" monospace:size=10')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
200 let l:wide = system('fc-match -f "%{family[0]} %{size}" monospace:size=10:lang=ja')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
201 exec 'set guifontwide=' . fnameescape(l:wide)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
202 call assert_equal(l:wide, &guifontwide)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
203 else
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
204 let skipped = 3
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
205 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
206
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
207 let &guifontwide = l:guifontwide_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
208 let &guifont = l:guifont_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
209
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
210 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
211 " guifontwide is premised upon the xfontset feature.
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
212 if has('xfontset')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
213 let l:encoding_saved = &encoding
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
214 let l:guifont_saved = &guifont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
215 let l:guifontset_saved = &guifontset
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
216 let l:guifontwide_saved = &guifontwide
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
217
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
218 let l:nfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-90-iso10646-1'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
219 let l:wfont = '-misc-fixed-medium-r-normal-*-18-120-100-100-c-180-iso10646-1'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
220
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
221 set encoding=utf-8
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
222
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
223 " 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
224 set guifontset=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
225
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
226 " 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
227 set guifontwide=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
228 exec 'set guifont=' . l:nfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
229 call assert_equal(l:wfont, &guifontwide)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
230
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
231 " Case 1-2: Manual selection
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
232 exec 'set guifontwide=' . l:wfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
233 exec 'set guifont=' . l:nfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
234 call assert_equal(l:wfont, &guifontwide)
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
235
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
236 " 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
237 try
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
238 set guifontset=-*-notexist-*
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
239 call assert_false(1, "'set guifontset=notexist' should have failed")
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
240 catch
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
241 call assert_exception('E598')
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
242 endtry
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
243 " 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
244 let &guifontset = '-*-notexist-*'
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 2-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=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
248 exec 'set guifont=' . l:nfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
249 call assert_equal(l:wfont, &guifontwide)
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 2-2: Manual selection
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
252 exec 'set guifontwide=' . l:wfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
253 exec 'set guifont=' . l:nfont
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
254 call assert_equal(l:wfont, &guifontwide)
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 let &guifontwide = l:guifontwide_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
257 let &guifontset = l:guifontset_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
258 let &guifont = l:guifont_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
259 let &encoding = l:encoding_saved
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
260 else
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
261 let skipped = 2
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
262 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
263 else
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
264 let skipped = 1
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
265 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
266
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
267 if skipped == 1
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
268 throw "Skipped: Test not implemented yet for this GUI"
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
269 elseif skipped == 2
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
270 throw "Skipped: Not supported by this GUI"
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
271 elseif skipped == 3
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
272 throw "Skipped: Test not supported by the environment"
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
273 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
274 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
275
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
276 func Test_getwinpos()
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
277 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
278 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
279 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
280 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
281
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 func Test_shell_command()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 new
9760
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
284 r !echo hello
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
285 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
286 bwipe!
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
288
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
289 func Test_windowid_variable()
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
290 if s:x11_based_gui || has('win32')
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
291 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
292 else
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
293 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
294 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
295 endfunc