Mercurial > vim
annotate src/testdir/test_gui.vim @ 11028:4df1647531a6 v8.0.0403
patch 8.0.0403: GUI tests may fail
commit https://github.com/vim/vim/commit/24d7636e98b33ec6873c51fc72f6bf4b10188d8b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 4 13:32:10 2017 +0100
patch 8.0.0403: GUI tests may fail
Problem: GUI tests may fail.
Solution: Ignore the E285 error better. (Kazunobu Kuriyama)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 04 Mar 2017 13:45:04 +0100 |
parents | ae2de10e8398 |
children | 622ed5a4925f |
rev | line source |
---|---|
9756
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests specifically for the GUI |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 if !has('gui') || ($DISPLAY == "" && !has('gui_running')) |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 finish |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 endif |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
7 source setup_gui.vim |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
8 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
9 func Setup() |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
10 call GUISetUpCommon() |
9830
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9760
diff
changeset
|
11 endfunc |
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9760
diff
changeset
|
12 |
6049c1f01391
commit https://github.com/vim/vim/commit/50fa8dd00c241fa0786fe92ecc02fee4e5d28e06
Christian Brabandt <cb@256bit.org>
parents:
9760
diff
changeset
|
13 func TearDown() |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
14 call GUITearDownCommon() |
9756
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 endfunc |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 " Test for resetting "secure" flag after GUI has started. |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 " Must be run first. |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 func Test_1_set_secure() |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 set exrc secure |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 gui -f |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal(1, has('gui_running')) |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endfunc |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
25 func Test_getfontname_with_arg() |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
26 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
27 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
28 if !g:x11_based_gui |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
29 let skipped = g:not_implemented |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
30 elseif has('gui_athena') || has('gui_motif') |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
31 " Invalid font name. The result should be an empty string. |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
32 call assert_equal('', getfontname('notexist')) |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
33 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
34 " Valid font name. This is usually the real name of 7x13 by default. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
35 let fname = '-misc-fixed-medium-r-normal--13-120-75-75-c-70-iso8859-1' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
36 call assert_equal(fname, getfontname(fname)) |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
37 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
38 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
39 " Invalid font name. The result should be the name plus the default size. |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
40 call assert_equal('notexist 10', getfontname('notexist')) |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
41 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
42 " Valid font name. This is usually the real name of Monospace by default. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
43 let fname = 'Bitstream Vera Sans Mono 12' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
44 call assert_equal(fname, getfontname(fname)) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
45 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
46 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
47 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
48 throw skipped |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
49 endif |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
50 endfunc |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
51 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
52 func Test_getfontname_without_arg() |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
53 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
54 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
55 let fname = getfontname() |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
56 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
57 if !g:x11_based_gui |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
58 let skipped = g:not_implemented |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
59 elseif has('gui_kde') |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
60 " 'expected' is the value specified by SetUp() above. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
61 call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname) |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
62 elseif has('gui_athena') || has('gui_motif') |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
63 " 'expected' is DFLT_FONT of gui_x11.c. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
64 call assert_equal('7x13', fname) |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
65 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
66 " 'expected' is DEFAULT_FONT of gui_gtk_x11.c. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
67 call assert_equal('Monospace 10', fname) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
68 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
69 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
70 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
71 throw skipped |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
72 endif |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
73 endfunc |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
74 |
10972
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
75 func Test_quoteplus() |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
76 let skipped = '' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
77 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
78 if !g:x11_based_gui |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
79 let skipped = g:not_supported . 'quoteplus' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
80 else |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
81 let quoteplus_saved = @+ |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
82 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
83 let test_call = 'Can you hear me?' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
84 let test_response = 'Yes, I can.' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
85 let vim_exe = exepath(v:progpath) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
86 let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;' |
11012
ae2de10e8398
patch 8.0.0395: testing the + register fails with Motif
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
87 \ . vim_exe |
11028
4df1647531a6
patch 8.0.0403: GUI tests may fail
Christian Brabandt <cb@256bit.org>
parents:
11012
diff
changeset
|
88 \ . ' -u NONE -U NONE --noplugin --not-a-term -c ''%s''' |
11012
ae2de10e8398
patch 8.0.0395: testing the + register fails with Motif
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
89 " Ignore the "failed to create input context" error. |
11028
4df1647531a6
patch 8.0.0403: GUI tests may fail
Christian Brabandt <cb@256bit.org>
parents:
11012
diff
changeset
|
90 let cmd = 'call test_ignore_error("E285") | ' |
4df1647531a6
patch 8.0.0403: GUI tests may fail
Christian Brabandt <cb@256bit.org>
parents:
11012
diff
changeset
|
91 \ . 'gui -f | ' |
4df1647531a6
patch 8.0.0403: GUI tests may fail
Christian Brabandt <cb@256bit.org>
parents:
11012
diff
changeset
|
92 \ . 'call feedkeys("' |
10972
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
93 \ . '\"+p' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
94 \ . ':s/' . test_call . '/' . test_response . '/\<CR>' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
95 \ . '\"+yis' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
96 \ . ':q!\<CR>", "tx")' |
11028
4df1647531a6
patch 8.0.0403: GUI tests may fail
Christian Brabandt <cb@256bit.org>
parents:
11012
diff
changeset
|
97 let run_vimtest = printf(testee, cmd) |
10972
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
98 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
99 " Set the quoteplus register to test_call, and another gvim will launched. |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
100 " Then, it first tries to paste the content of its own quotedplus register |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
101 " onto it. Second, it tries to substitute test_responce for the pasted |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
102 " sentence. If the sentence is identical to test_call, the substitution |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
103 " should succeed. Third, it tries to yank the result of the substitution |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
104 " to its own quoteplus register, and last it quits. When system() |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
105 " returns, the content of the quoteplus register should be identical to |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
106 " test_response if those quoteplus registers are synchronized properly |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
107 " with/through the X11 clipboard. |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
108 let @+ = test_call |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
109 call system(run_vimtest) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
110 call assert_equal(test_response, @+) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
111 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
112 let @+ = quoteplus_saved |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
113 endif |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
114 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
115 if !empty(skipped) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
116 throw skipped |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
117 endif |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
118 endfunc |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
119 |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
120 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
|
121 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
122 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
123 let guifont_saved = &guifont |
10855
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 " 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
|
126 let guifontset_saved = &guifontset |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
127 set guifontset= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
128 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
129 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
130 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
|
131 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
|
132 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
|
133 " 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
|
134 " |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
135 " 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
|
136 " 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
|
137 " '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
|
138 " listed. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
139 let flist = &guifont |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
140 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
|
141 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
|
142 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
143 " 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
|
144 " valid font. |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
145 set guifont=-notexist1-*,fixed,-notexist2-* |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
146 call assert_equal('fixed', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
147 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
148 " 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
|
149 set guifont= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
150 call assert_equal('7x13', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
151 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
152 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
|
153 " 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
|
154 " '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
|
155 " 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
|
156 " 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
|
157 " font names'. |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
158 " |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
159 " 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
|
160 " 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
|
161 set guifont=(´・ω・`)\ 12,Courier\ 12 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
162 call assert_equal('(´・ω・`) 12', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
163 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
164 " 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
|
165 set guifont= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
166 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
|
167 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
168 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
169 if has('xfontset') |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
170 let &guifontset = guifontset_saved |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
171 endif |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
172 let &guifont = guifont_saved |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
173 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
174 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
175 throw skipped |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
176 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
177 endfunc |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
178 |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
179 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
|
180 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
181 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
182 if !has('xfontset') |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
183 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
|
184 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
185 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
|
186 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
187 " 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
|
188 " be chosen meticulously. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
189 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
|
190 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
191 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
|
192 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
|
193 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
194 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
|
195 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
|
196 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
197 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
|
198 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
|
199 let singleton = font_head . '-*' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
200 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
|
201 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
202 " 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
|
203 " 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
|
204 " 'fontsets'. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
205 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
|
206 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
|
207 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
208 let feasible = 0 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
209 for locale in locales |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
210 try |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
211 exec 'language ctype' locale |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
212 catch /^Vim\%((\a\+)\)\=:E197/ |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
213 continue |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
214 endtry |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
215 let done = 0 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
216 for fontset in fontsets |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
217 try |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
218 exec 'set guifontset=' . fontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
219 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
|
220 break |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
221 endtry |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
222 let done += 1 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
223 endfor |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
224 if done == len(fontsets) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
225 let feasible = 1 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
226 break |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
227 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
228 endfor |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
229 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
230 " 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
|
231 if !feasible |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
232 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
|
233 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
234 " 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
|
235 " previous loop. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
236 for fontset in fontsets |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
237 exec 'set guifontset=' . fontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
238 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
|
239 endfor |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
240 endif |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
241 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
242 " Finally, restore ctype. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
243 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
|
244 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
245 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
246 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
247 throw skipped |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
248 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
249 endfunc |
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 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
|
252 let skipped = '' |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
253 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
254 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
|
255 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
|
256 elseif has('gui_gtk') |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
257 let guifont_saved = &guifont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
258 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
|
259 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
260 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
|
261 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
|
262 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
|
263 else |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
264 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
|
265 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
|
266 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
|
267 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
|
268 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
269 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
270 let &guifontwide = guifontwide_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
271 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
|
272 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
273 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
|
274 " 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
|
275 if !has('xfontset') |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
276 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
|
277 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
278 let encoding_saved = &encoding |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
279 let guifont_saved = &guifont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
280 let guifontset_saved = &guifontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
281 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
|
282 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
283 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
|
284 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
|
285 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
286 set encoding=utf-8 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
287 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
288 " 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
|
289 set guifontset= |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
290 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
291 " 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
|
292 set guifontwide= |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
293 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
294 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
|
295 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
296 " 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
|
297 exec 'set guifontwide=' . wfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
298 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
299 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
|
300 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
301 " 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
|
302 try |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
303 set guifontset=-*-notexist-* |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
304 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
|
305 catch |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
306 call assert_exception('E598') |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
307 endtry |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
308 " 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
|
309 let &guifontset = '-*-notexist-*' |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
310 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
311 " 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
|
312 set guifontwide= |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
313 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
314 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
|
315 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
316 " 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
|
317 exec 'set guifontwide=' . wfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
318 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
319 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
|
320 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
321 let &guifontwide = guifontwide_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
322 let &guifontset = guifontset_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
323 let &guifont = guifont_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
324 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
|
325 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
326 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
327 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
328 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
329 throw skipped |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
330 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
331 endfunc |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
332 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
333 func Test_set_guiheadroom() |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
334 let skipped = '' |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
335 |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
336 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
|
337 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
|
338 else |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
339 " 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
|
340 " value must be preserved. |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
341 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
|
342 endif |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
343 |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
344 if !empty(skipped) |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
345 throw skipped |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
346 endif |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
347 endfunc |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
348 |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
349 func Test_getwinpos() |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
350 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
|
351 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
|
352 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
|
353 endfunc |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
354 |
9756
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 func Test_shell_command() |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 new |
9760
96667173293d
commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents:
9756
diff
changeset
|
357 r !echo hello |
96667173293d
commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents:
9756
diff
changeset
|
358 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
|
359 bwipe! |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 endfunc |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
361 |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
362 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
|
363 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
|
364 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
|
365 else |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
366 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
|
367 endif |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
368 endfunc |