Mercurial > vim
annotate src/testdir/test_gui.vim @ 11006:b3601a8eb679 v8.0.0392
patch 8.0.0392: GUI test fails with Athena and Motif
commit https://github.com/vim/vim/commit/e0c31f6a304496b597a51ce98af419ec815bec74
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 1 15:07:05 2017 +0100
patch 8.0.0392: GUI test fails with Athena and Motif
Problem: GUI test fails with Athena and Motif.
Solution: Add test_ignore_error(). Use it to ignore the "failed to create
input context" error.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 01 Mar 2017 15:15:05 +0100 |
parents | 488cda29455b |
children | ae2de10e8398 |
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() |
11006
b3601a8eb679
patch 8.0.0392: GUI test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
10972
diff
changeset
|
20 " Ignore the "failed to create input context" error. |
b3601a8eb679
patch 8.0.0392: GUI test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
10972
diff
changeset
|
21 call test_ignore_error('E285') |
b3601a8eb679
patch 8.0.0392: GUI test fails with Athena and Motif
Christian Brabandt <cb@256bit.org>
parents:
10972
diff
changeset
|
22 |
9756
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 set exrc secure |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 gui -f |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal(1, has('gui_running')) |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 endfunc |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
28 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
|
29 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
30 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
31 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
|
32 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
|
33 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
|
34 " 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
|
35 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
|
36 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
37 " 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
|
38 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
|
39 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
|
40 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
41 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
|
42 " 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
|
43 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
|
44 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
45 " 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
|
46 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
|
47 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
|
48 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
49 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
50 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
51 throw skipped |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
52 endif |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
53 endfunc |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
54 |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
55 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
|
56 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
57 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
58 let fname = getfontname() |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
59 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
60 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
|
61 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
|
62 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
|
63 " '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
|
64 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
|
65 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
|
66 " '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
|
67 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
|
68 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
|
69 " '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
|
70 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
|
71 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
72 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
73 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
74 throw skipped |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
75 endif |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
76 endfunc |
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
77 |
10972
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
78 func Test_quoteplus() |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
79 let skipped = '' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
80 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
81 if !g:x11_based_gui |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
82 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
|
83 else |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
84 let quoteplus_saved = @+ |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
85 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
86 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
|
87 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
|
88 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
|
89 let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
90 \ . vim_exe . ' -f -g -u NONE -U NONE --noplugin -c ''%s''' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
91 let cmd = 'call feedkeys("' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
92 \ . '\"+p' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
93 \ . ':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
|
94 \ . '\"+yis' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
95 \ . ':q!\<CR>", "tx")' |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
96 let run_vimtest = printf(testee, cmd) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
97 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
98 " 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
|
99 " 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
|
100 " 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
|
101 " 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
|
102 " 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
|
103 " 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
|
104 " 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
|
105 " 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
|
106 " with/through the X11 clipboard. |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
107 let @+ = test_call |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
108 call system(run_vimtest) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
109 call assert_equal(test_response, @+) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
110 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
111 let @+ = quoteplus_saved |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
112 endif |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
113 |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
114 if !empty(skipped) |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
115 throw skipped |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
116 endif |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
117 endfunc |
488cda29455b
patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents:
10944
diff
changeset
|
118 |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
119 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
|
120 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
121 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
122 let guifont_saved = &guifont |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
123 if has('xfontset') |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
124 " 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
|
125 let guifontset_saved = &guifontset |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
126 set guifontset= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
127 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
128 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
129 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
|
130 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
|
131 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
|
132 " 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
|
133 " |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
134 " 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
|
135 " 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
|
136 " '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
|
137 " listed. |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
138 let flist = &guifont |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
139 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
|
140 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
|
141 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
142 " 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
|
143 " valid font. |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
144 set guifont=-notexist1-*,fixed,-notexist2-* |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
145 call assert_equal('fixed', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
146 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
147 " 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
|
148 set guifont= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
149 call assert_equal('7x13', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
150 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
151 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
|
152 " 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
|
153 " '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
|
154 " 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
|
155 " 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
|
156 " font names'. |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
157 " |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
158 " 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
|
159 " 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
|
160 set guifont=(´・ω・`)\ 12,Courier\ 12 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
161 call assert_equal('(´・ω・`) 12', getfontname()) |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
162 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
163 " 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
|
164 set guifont= |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
165 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
|
166 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
167 |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
168 if has('xfontset') |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
169 let &guifontset = guifontset_saved |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
170 endif |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
171 let &guifont = guifont_saved |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
172 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
173 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
174 throw skipped |
10855
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
175 endif |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
176 endfunc |
0beffabed338
patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents:
10847
diff
changeset
|
177 |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
178 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
|
179 let skipped = '' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
180 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
181 if !has('xfontset') |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
182 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
|
183 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
184 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
|
185 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
186 " 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
|
187 " be chosen meticulously. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
188 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
|
189 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
190 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
|
191 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
|
192 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
193 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
|
194 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
|
195 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
196 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
|
197 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
|
198 let singleton = font_head . '-*' |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
199 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
|
200 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
201 " 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
|
202 " 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
|
203 " 'fontsets'. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
204 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
|
205 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
|
206 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
207 let feasible = 0 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
208 for locale in locales |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
209 try |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
210 exec 'language ctype' locale |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
211 catch /^Vim\%((\a\+)\)\=:E197/ |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
212 continue |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
213 endtry |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
214 let done = 0 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
215 for fontset in fontsets |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
216 try |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
217 exec 'set guifontset=' . fontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
218 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
|
219 break |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
220 endtry |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
221 let done += 1 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
222 endfor |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
223 if done == len(fontsets) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
224 let feasible = 1 |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
225 break |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
226 endif |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
227 endfor |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
228 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
229 " 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
|
230 if !feasible |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
231 let skipped = g:not_hosted |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
232 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
233 " 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
|
234 " previous loop. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
235 for fontset in fontsets |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
236 exec 'set guifontset=' . fontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
237 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
|
238 endfor |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
239 endif |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
240 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
241 " Finally, restore ctype. |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
242 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
|
243 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
244 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
245 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
246 throw skipped |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
247 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
248 endfunc |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
249 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
250 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
|
251 let skipped = '' |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
252 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
253 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
|
254 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
|
255 elseif has('gui_gtk') |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
256 let guifont_saved = &guifont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
257 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
|
258 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
259 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
|
260 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
|
261 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
|
262 else |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
263 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
|
264 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
|
265 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
|
266 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
|
267 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
268 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
269 let &guifontwide = guifontwide_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
270 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
|
271 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
272 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
|
273 " 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
|
274 if !has('xfontset') |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
275 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
|
276 else |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
277 let encoding_saved = &encoding |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
278 let guifont_saved = &guifont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
279 let guifontset_saved = &guifontset |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
280 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
|
281 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
282 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
|
283 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
|
284 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
285 set encoding=utf-8 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
286 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
287 " Case 1: guifontset is empty |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
288 set guifontset= |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
289 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
290 " 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
|
291 set guifontwide= |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
292 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
293 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
|
294 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
295 " 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
|
296 exec 'set guifontwide=' . wfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
297 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
298 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
|
299 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
300 " 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
|
301 try |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
302 set guifontset=-*-notexist-* |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
303 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
|
304 catch |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
305 call assert_exception('E598') |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
306 endtry |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
307 " 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
|
308 let &guifontset = '-*-notexist-*' |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
309 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
310 " 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
|
311 set guifontwide= |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
312 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
313 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
|
314 |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
315 " 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
|
316 exec 'set guifontwide=' . wfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
317 exec 'set guifont=' . nfont |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
318 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
|
319 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
320 let &guifontwide = guifontwide_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
321 let &guifontset = guifontset_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
322 let &guifont = guifont_saved |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
323 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
|
324 endif |
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 |
10885
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
327 if !empty(skipped) |
310834b0256a
patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents:
10879
diff
changeset
|
328 throw skipped |
10879
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
329 endif |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
330 endfunc |
1fce74a5a628
patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents:
10857
diff
changeset
|
331 |
10944
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
332 func Test_set_guiheadroom() |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
333 let skipped = '' |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
334 |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
335 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
|
336 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
|
337 else |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
338 " 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
|
339 " value must be preserved. |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
340 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
|
341 endif |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
342 |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
343 if !empty(skipped) |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
344 throw skipped |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
345 endif |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
346 endfunc |
4e2cdce4576c
patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents:
10885
diff
changeset
|
347 |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
348 func Test_getwinpos() |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
349 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
|
350 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
|
351 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
|
352 endfunc |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
353 |
9756
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 func Test_shell_command() |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 new |
9760
96667173293d
commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents:
9756
diff
changeset
|
356 r !echo hello |
96667173293d
commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents:
9756
diff
changeset
|
357 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
|
358 bwipe! |
00d753ea19a9
commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 endfunc |
10841
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
360 |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
361 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
|
362 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
|
363 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
|
364 else |
5c0415a8b96e
patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10777
diff
changeset
|
365 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
|
366 endif |
10847
881194ae47a1
patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents:
10841
diff
changeset
|
367 endfunc |