annotate src/testdir/test_gui.vim @ 27400:722db0819111 v8.2.4228

patch 8.2.4228: no tests for clicking in the GUI tabline Commit: https://github.com/vim/vim/commit/b0ad2d92fd19e673ddbbc66742bae3f71778efde Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Thu Jan 27 13:16:59 2022 +0000 patch 8.2.4228: no tests for clicking in the GUI tabline Problem: No tests for clicking in the GUI tabline. Solution: Add test functions to generate the events. Add tests using the functions. (Yegappan Lakshmanan, closes #9638)
author Bram Moolenaar <Bram@vim.org>
date Thu, 27 Jan 2022 14:30:04 +0100
parents c2c40cefc17b
children b43f6c879d52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests specifically for the GUI
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
12106
d2c20ec4b95a patch 8.0.0933: terminal test tries to start GUI when it's not possible
Christian Brabandt <cb@256bit.org>
parents: 11183
diff changeset
3 source shared.vim
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
4 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
5 CheckCanRunGui
9756
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.
13351
33a2277b8d4d patch 8.0.1549: various small problems in test files
Christian Brabandt <cb@256bit.org>
parents: 12106
diff changeset
18 " Must be run first, since it starts the GUI on Unix.
9756
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
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
25 " As for non-GUI, a balloon_show() test was already added with patch 8.0.0401
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
26 func Test_balloon_show()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
27 CheckFeature balloon_eval
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
28 " This won't do anything but must not crash either.
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
29 call balloon_show('hi!')
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
30 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
31
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
32 func Test_colorscheme()
19997
3d1de9093c01 patch 8.2.0554: the GUI doesn't set t_Co
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
33 call assert_equal('16777216', &t_Co)
3d1de9093c01 patch 8.2.0554: the GUI doesn't set t_Co
Bram Moolenaar <Bram@vim.org>
parents: 19932
diff changeset
34
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
35 let colorscheme_saved = exists('g:colors_name') ? g:colors_name : 'default'
13810
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
36 let g:color_count = 0
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
37 augroup TestColors
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
38 au!
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
39 au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
40 au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
41 augroup END
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
42
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
43 colorscheme torte
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
44 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
45 call assert_equal('dark', &background)
13810
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
46 call assert_equal(1, g:before_colors)
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
47 call assert_equal(2, g:after_colors)
15394
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
48 call assert_equal("\ntorte", execute('colorscheme'))
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
49
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
50 let a = substitute(execute('hi Search'), "\n\\s\\+", ' ', 'g')
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
51 call assert_match("\nSearch xxx term=reverse ctermfg=0 ctermbg=12 gui=bold guifg=Black guibg=Red", a)
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
52
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
53 call assert_fails('colorscheme does_not_exist', 'E185:')
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
54
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
55 exec 'colorscheme' colorscheme_saved
13810
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
56 augroup TestColors
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
57 au!
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
58 augroup END
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
59 unlet g:color_count g:after_colors g:before_colors
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
60 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
61 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
62
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
63 func Test_getfontname_with_arg()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
64 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
65
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
66 if 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
67 " 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
68 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
69
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
70 " Valid font name. This is usually the real name of 7x13 by default.
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
71 let fname = '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
72 call assert_match(fname, getfontname(fname))
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
73
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
74 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
75 " 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
76 call assert_equal('notexist 10', getfontname('notexist'))
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
77 call assert_equal('', getfontname('*'))
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
78
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
79 " 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
80 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
81 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
82 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
83 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
84
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
85 func Test_getfontname_without_arg()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
86 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
87
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
88 let fname = getfontname()
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
89
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
90 if has('gui_kde')
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
91 " '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
92 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
93 elseif has('gui_athena') || has('gui_motif')
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
94 " 'expected' is DFLT_FONT of gui_x11.c or its real name.
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
95 let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
96 call assert_match(pat, fname)
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
97 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
98 " '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
99 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
100 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
101 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
102
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
103 func Test_getwinpos()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
104 call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
105 call assert_true(getwinposx() >= 0)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
106 call assert_true(getwinposy() >= 0)
13940
70e36e1ca442 patch 8.0.1840: getwinpos() is not tested
Christian Brabandt <cb@256bit.org>
parents: 13843
diff changeset
107 call assert_equal([getwinposx(), getwinposy()], getwinpos())
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
108 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
109
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
110 func Test_quoteplus()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
111 CheckX11BasedGui
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
112
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
113 let g:test_is_flaky = 1
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
114
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
115 let quoteplus_saved = @+
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
116
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
117 let test_call = 'Can you hear me?'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
118 let test_response = 'Yes, I can.'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
119 let vim_exe = GetVimCommand()
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
120 let testee = 'VIMRUNTIME=' . $VIMRUNTIME . '; export VIMRUNTIME;'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
121 \ . vim_exe . ' --noplugin --not-a-term -c ''%s'''
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
122 " Ignore the "failed to create input context" error.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
123 let cmd = 'call test_ignore_error("E285") | '
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
124 \ . 'gui -f | '
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
125 \ . 'call feedkeys("'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
126 \ . '\"+p'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
127 \ . ':s/' . test_call . '/' . test_response . '/\<CR>'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
128 \ . '\"+yis'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
129 \ . ':q!\<CR>", "tx")'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
130 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
131
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
132 " Set the quoteplus register to test_call, and another gvim will launched.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
133 " Then, it first tries to paste the content of its own quotedplus register
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
134 " onto it. Second, it tries to substitute test_response for the pasted
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
135 " sentence. If the sentence is identical to test_call, the substitution
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
136 " should succeed. Third, it tries to yank the result of the substitution
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
137 " to its own quoteplus register, and last it quits. When system()
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
138 " returns, the content of the quoteplus register should be identical to
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
139 " test_response if those quoteplus registers are synchronized properly
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
140 " with/through the X11 clipboard.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
141 let @+ = test_call
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
142 call system(run_vimtest)
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
143 call assert_equal(test_response, @+)
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
144
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
145 let @+ = quoteplus_saved
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
146 endfunc
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
147
26028
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
148 func Test_gui_read_stdin()
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
149 CheckUnix
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
150
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
151 call writefile(['some', 'lines'], 'Xstdin')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
152 let script =<< trim END
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
153 call writefile(getline(1, '$'), 'XstdinOK')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
154 qa!
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
155 END
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
156 call writefile(script, 'Xscript')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
157
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
158 " Cannot use --not-a-term here, the "reading from stdin" message would not be
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
159 " displayed.
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
160 let vimcmd = substitute(GetVimCommand(), '--not-a-term', '', '')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
161
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
162 call system('cat Xstdin | ' .. vimcmd .. ' -f -g -S Xscript -')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
163 call assert_equal(['some', 'lines'], readfile('XstdinOK'))
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
164
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
165 call delete('Xstdin')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
166 call delete('XstdinOK')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
167 call delete('Xscript')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
168 endfunc
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
169
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
170 func Test_set_background()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
171 let background_saved = &background
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
172
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
173 set background&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
174 call assert_equal('light', &background)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
175
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
176 set background=dark
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
177 call assert_equal('dark', &background)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
178
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
179 let &background = background_saved
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
180 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
181
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
182 func Test_set_balloondelay()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
183 CheckOption balloondelay
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
184
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
185 let balloondelay_saved = &balloondelay
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
186
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
187 " Check if the default value is identical to that described in the manual.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
188 set balloondelay&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
189 call assert_equal(600, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
190
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
191 " Edge cases
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
192
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
193 " XXX This fact should be hidden so that people won't be tempted to write
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
194 " plugin/TimeMachine.vim. TODO Add reasonable range checks to the source
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
195 " code.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
196 set balloondelay=-1
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
197 call assert_equal(-1, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
198
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
199 " Though it's possible to interpret the zero delay to be 'as soon as
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
200 " possible' or even 'indefinite', its actual meaning depends on the GUI
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
201 " toolkit in use after all.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
202 set balloondelay=0
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
203 call assert_equal(0, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
204
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
205 set balloondelay=1
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
206 call assert_equal(1, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
207
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
208 " Since p_bdelay is of type long currently, the upper bound can be
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
209 " impractically huge and machine-dependent. Practically, it's sufficient
11052
975f54a391ec patch 8.0.0415: balloon test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11050
diff changeset
210 " to check if balloondelay works with 0x7fffffff (32 bits) for now.
975f54a391ec patch 8.0.0415: balloon test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11050
diff changeset
211 set balloondelay=2147483647
975f54a391ec patch 8.0.0415: balloon test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11050
diff changeset
212 call assert_equal(2147483647, &balloondelay)
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
213
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
214 let &balloondelay = balloondelay_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
215 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
216
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
217 func Test_set_ballooneval()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
218 CheckOption ballooneval
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
219
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
220 let ballooneval_saved = &ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
221
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
222 set ballooneval&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
223 call assert_equal(0, &ballooneval)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
224
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
225 set ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
226 call assert_notequal(0, &ballooneval)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
227
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
228 set noballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
229 call assert_equal(0, &ballooneval)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
230
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
231 let &ballooneval = ballooneval_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
232 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
233
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
234 func Test_set_balloonexpr()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
235 CheckOption balloonexpr
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
236
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
237 let balloonexpr_saved = &balloonexpr
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
238
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
239 " Default value
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
240 set balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
241 call assert_equal('', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
242
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
243 " User-defined function
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
244 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
245 func MyBalloonExpr()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
246 return 'Cursor is at line ' . v:beval_lnum .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
247 \', column ' . v:beval_col .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
248 \ ' of file ' . bufname(v:beval_bufnr) .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
249 \ ' on word "' . v:beval_text . '"' .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
250 \ ' in window ' . v:beval_winid . ' (#' . v:beval_winnr . ')'
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
251 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
252 setl balloonexpr=MyBalloonExpr()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
253 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
254 call assert_equal('MyBalloonExpr()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
255 " TODO Read non-empty text, place the pointer at a character of a word,
13940
70e36e1ca442 patch 8.0.1840: getwinpos() is not tested
Christian Brabandt <cb@256bit.org>
parents: 13843
diff changeset
256 " and check if the content of the balloon is the same as what is expected.
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
257 " Also, check if textlock works as expected.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
258 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
259 call assert_equal('', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
260 delfunc MyBalloonExpr
26743
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
261
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
262 " Using a script-local function
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
263 func s:NewBalloonExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
264 endfunc
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
265 set balloonexpr=s:NewBalloonExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
266 call assert_equal(expand('<SID>') .. 'NewBalloonExpr()', &balloonexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
267 set balloonexpr=<SID>NewBalloonExpr()
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
268 call assert_equal(expand('<SID>') .. 'NewBalloonExpr()', &balloonexpr)
c2c40cefc17b patch 8.2.3900: it is not easy to use a script-local function for an option
Bram Moolenaar <Bram@vim.org>
parents: 26028
diff changeset
269 delfunc s:NewBalloonExpr
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
270 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
271
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
272 " Multiline support
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
273 if has('balloon_multiline')
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
274 " Multiline balloon using NL
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
275 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
276 func MyBalloonFuncForMultilineUsingNL()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
277 return "Multiline\nSuppported\nBalloon\nusing NL"
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
278 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
279 setl balloonexpr=MyBalloonFuncForMultilineUsingNL()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
280 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
281 call assert_equal('MyBalloonFuncForMultilineUsingNL()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
282 " TODO Read non-empty text, place the pointer at a character of a word,
13940
70e36e1ca442 patch 8.0.1840: getwinpos() is not tested
Christian Brabandt <cb@256bit.org>
parents: 13843
diff changeset
283 " and check if the content of the balloon is the same as what is
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
284 " expected. Also, check if textlock works as expected.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
285 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
286 delfunc MyBalloonFuncForMultilineUsingNL
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
287 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
288
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
289 " Multiline balloon using List
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
290 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
291 func MyBalloonFuncForMultilineUsingList()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
292 return [ 'Multiline', 'Suppported', 'Balloon', 'using List' ]
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
293 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
294 setl balloonexpr=MyBalloonFuncForMultilineUsingList()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
295 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
296 call assert_equal('MyBalloonFuncForMultilineUsingList()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
297 " TODO Read non-empty text, place the pointer at a character of a word,
13940
70e36e1ca442 patch 8.0.1840: getwinpos() is not tested
Christian Brabandt <cb@256bit.org>
parents: 13843
diff changeset
298 " and check if the content of the balloon is the same as what is
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
299 " expected. Also, check if textlock works as expected.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
300 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
301 delfunc MyBalloonFuncForMultilineUsingList
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
302 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
303 endif
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
304
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
305 let &balloonexpr = balloonexpr_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
306 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
307
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
308 " Invalid arguments are tested with test_options in conjunction with segfaults
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
309 " caused by them (Patch 8.0.0357, 24922ec233).
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
310 func Test_set_guicursor()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
311 let guicursor_saved = &guicursor
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
312
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
313 let default = [
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
314 \ "n-v-c:block-Cursor/lCursor",
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
315 \ "ve:ver35-Cursor",
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
316 \ "o:hor50-Cursor",
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
317 \ "i-ci:ver25-Cursor/lCursor",
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
318 \ "r-cr:hor20-Cursor/lCursor",
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
319 \ "sm:block-Cursor-blinkwait175-blinkoff150-blinkon175"
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
320 \ ]
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
321
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
322 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
323 set guicursor&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
324 call assert_equal(join(default, ','), &guicursor)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
325
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
326 " Argument List Example 1
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
327 let opt_list = copy(default)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
328 let opt_list[0] = "n-c-v:block-nCursor"
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
329 exec "set guicursor=" . join(opt_list, ',')
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
330 call assert_equal(join(opt_list, ','), &guicursor)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
331 unlet opt_list
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
332
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
333 " Argument List Example 2
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
334 let opt_list = copy(default)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
335 let opt_list[3] = "i-ci:ver30-iCursor-blinkwait300-blinkon200-blinkoff150"
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
336 exec "set guicursor=" . join(opt_list, ',')
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
337 call assert_equal(join(opt_list, ','), &guicursor)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
338 unlet opt_list
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
339
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
340 " 'a' Mode
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
341 set guicursor&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
342 let &guicursor .= ',a:blinkon0'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
343 call assert_equal(join(default, ',') . ",a:blinkon0", &guicursor)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
344
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
345 let &guicursor = guicursor_saved
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
346 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
347
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
348 func Test_set_guifont_errors()
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
349 if has('win32')
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
350 " Invalid font names are accepted in GTK GUI
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
351 call assert_fails('set guifont=xa1bc23d7f', 'E596:')
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
352 endif
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
353
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
354 " This only works if 'renderoptions' exists and does not work for Windows XP
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
355 " and older.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
356 if exists('+renderoptions') && windowsversion() !~ '^[345]\.'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
357 " doing this four times used to cause a crash
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
358 set renderoptions=type:directx
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
359 for i in range(5)
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
360 set guifont=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
361 endfor
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
362 set renderoptions=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
363 for i in range(5)
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
364 set guifont=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
365 endfor
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
366 endif
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
367 endfunc
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
368
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
369 func Test_set_guifont()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
370 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
371
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
372 let guifont_saved = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
373 if has('xfontset')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
374 " 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
375 let guifontset_saved = &guifontset
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
376 set guifontset=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
377 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
378
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
379 if 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
380 " 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
381 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
382 " 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
383 " 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
384 " '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
385 " listed.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
386 let flist = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
387 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
388 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
389
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
390 " 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
391 " valid font.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
392 set guifont=-notexist1-*,fixed,-notexist2-*
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
393 let pat = '\(fixed\)\|\(\c-Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1\)'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
394 call assert_match(pat, getfontname())
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
395
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
396 " 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
397 set guifont=
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
398 let pat = '\(7x13\)\|\(\c-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO8859-1\)'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
399 call assert_match(pat, getfontname())
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
400
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
401 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
402 " 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
403 " '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
404 " 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
405 " 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
406 " font names'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
407 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
408 " 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
409 " 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
410 set guifont=(´・ω・`)\ 12,Courier\ 12
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
411 call assert_equal('(´・ω・`) 12', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
412
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
413 " 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
414 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
415 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
416 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
417
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
418 if has('xfontset')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
419 let &guifontset = guifontset_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
420 endif
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
421 let &guifont = guifont_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
422 endfunc
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
423
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
424 func Test_set_guifontset()
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
425 CheckFeature xfontset
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
426 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
427
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
428 call assert_fails('set guifontset=*', 'E597:')
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
429
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
430 let ctype_saved = v:ctype
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
431
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
432 " First, since XCreateFontSet(3) is very sensitive to locale, fonts must
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
433 " be chosen meticulously.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
434 let font_head = '-misc-fixed-medium-r-normal--14'
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
435
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
436 let font_aw70 = font_head . '-130-75-75-c-70'
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
437 let font_aw140 = font_head . '-130-75-75-c-140'
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
438
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
439 let font_jisx0201 = font_aw70 . '-jisx0201.1976-0'
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
440 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
441
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
442 let full_XLFDs = join([ font_jisx0208, font_jisx0201 ], ',')
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
443 let short_XLFDs = join([ font_aw140, font_aw70 ], ',')
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
444 let singleton = font_head . '-*'
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
445 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
446
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
447 " Second, among 'locales', look up such a locale that gets 'set
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
448 " guifontset=' to work successfully with every fontset specified with
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
449 " 'fontsets'.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
450 let locales = [ 'ja_JP.UTF-8', 'ja_JP.eucJP', 'ja_JP.SJIS' ]
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
451 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
452
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
453 let feasible = 0
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
454 for locale in locales
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
455 try
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
456 exec 'language ctype' locale
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
457 catch /^Vim\%((\a\+)\)\=:E197/
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
458 continue
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
459 endtry
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
460 let done = 0
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
461 for fontset in fontsets
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
462 try
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
463 exec 'set guifontset=' . fontset
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
464 catch /^Vim\%((\a\+)\)\=:E\%(250\|252\|234\|597\|598\)/
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
465 break
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
466 endtry
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
467 let done += 1
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
468 endfor
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
469 if done == len(fontsets)
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
470 let feasible = 1
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
471 break
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
472 endif
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
473 endfor
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
474
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
475 " Third, give a set of tests if it is found feasible.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
476 if !feasible
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
477 let skipped = g:not_hosted
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
478 else
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
479 " N.B. 'v:ctype' has already been set to an appropriate value in the
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
480 " previous loop.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
481 for fontset in fontsets
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
482 exec 'set guifontset=' . fontset
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
483 call assert_equal(fontset, &guifontset)
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
484 endfor
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
485 endif
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
486
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
487 " Finally, restore ctype.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
488 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
489
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
490 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
491 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
492 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
493 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
494
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
495 func Test_set_guifontwide()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
496 CheckX11BasedGui
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
497
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
498 call assert_fails('set guifontwide=*', 'E533:')
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
499
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
500 if has('gui_gtk')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
501 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
502 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
503
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
504 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
505 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
506 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
507 else
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
508 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
509 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
510 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
511 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
512 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
513
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
514 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
515 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
516
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
517 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
518 " 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
519 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
520 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
521 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
522 let encoding_saved = &encoding
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
523 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
524 let guifontset_saved = &guifontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
525 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
526
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
527 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
528 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
529
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
530 set encoding=utf-8
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
531
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
532 " 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
533 set guifontset=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
534
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
535 " 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
536 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
537 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
538 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
539
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
540 " 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
541 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
542 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
543 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
544
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
545 " 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
546 try
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
547 set guifontset=-*-notexist-*
11183
1c4ebbae41d2 patch 8.0.0478: tests use assert_true(0) and assert_false(1) to report errors
Christian Brabandt <cb@256bit.org>
parents: 11119
diff changeset
548 call assert_report("'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
549 catch
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
550 call assert_exception('E598:')
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
551 endtry
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
552 " 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
553 let &guifontset = '-*-notexist-*'
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
554
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
555 " 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
556 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
557 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
558 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
559
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
560 " 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
561 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
562 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
563 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
564
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
565 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
566 let &guifontset = guifontset_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
567 let &guifont = guifont_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
568 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
569 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
570 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
571 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
572
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
573 func Test_set_guiligatures()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
574 CheckX11BasedGui
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
575
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
576 if has('gui_gtk') || has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3')
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
577 " Try correct value
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
578 set guiligatures=<>=ab
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
579 call assert_equal("<>=ab", &guiligatures)
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
580 " Try to throw error
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
581 try
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
582 set guiligatures=<>=Å¡ab
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
583 call assert_report("'set guiligatures=<>=Å¡ab should have failed")
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
584 catch
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
585 call assert_exception('E1243:')
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
586 endtry
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
587 endif
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
588 endfunc
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
589
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
590 func Test_set_guiheadroom()
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
591 CheckX11BasedGui
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
592
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
593 " Since this script is to be read together with '-U NONE', the default
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
594 " value must be preserved.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
595 call assert_equal(50, &guiheadroom)
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
596 endfunc
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
597
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
598 func Test_set_guioptions()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
599 let guioptions_saved = &guioptions
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
600 let duration = '200m'
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
601
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
602 if has('win32')
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
603 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
604 set guioptions&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
605 call assert_equal('egmrLtT', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
606
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
607 else
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
608 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
609 set guioptions&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
610 call assert_equal('aegimrLtT', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
611
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
612 " To activate scrollbars of type 'L' or 'R'.
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
613 wincmd v
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
614 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
615
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
616 " Remove all default GUI ornaments
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
617 set guioptions-=T
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
618 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
619 call assert_equal('aegimrLt', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
620 set guioptions-=t
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
621 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
622 call assert_equal('aegimrL', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
623 set guioptions-=L
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
624 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
625 call assert_equal('aegimr', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
626 set guioptions-=r
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
627 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
628 call assert_equal('aegim', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
629 set guioptions-=m
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
630 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
631 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
632
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
633 " Try non-default GUI ornaments
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
634 set guioptions+=l
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
635 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
636 call assert_equal('aegil', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
637 set guioptions-=l
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
638 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
639 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
640
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
641 set guioptions+=R
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
642 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
643 call assert_equal('aegiR', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
644 set guioptions-=R
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
645 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
646 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
647
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
648 set guioptions+=b
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
649 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
650 call assert_equal('aegib', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
651 set guioptions+=h
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
652 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
653 call assert_equal('aegibh', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
654 set guioptions-=h
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
655 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
656 call assert_equal('aegib', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
657 set guioptions-=b
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
658 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
659 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
660
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
661 set guioptions+=v
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
662 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
663 call assert_equal('aegiv', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
664 set guioptions-=v
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
665 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
666 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
667
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
668 if has('gui_motif')
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
669 set guioptions+=F
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
670 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
671 call assert_equal('aegiF', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
672 set guioptions-=F
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
673 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
674 call assert_equal('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
675 endif
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
676
18078
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
677 if has('gui_gtk3')
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
678 set guioptions+=d
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
679 exec 'sleep' . duration
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
680 call assert_equal('aegid', &guioptions)
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
681 set guioptions-=d
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
682 exec 'sleep' . duration
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
683 call assert_equal('aegi', &guioptions)
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
684 endif
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
685
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
686 " Restore GUI ornaments to the default state.
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
687 set guioptions+=m
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
688 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
689 call assert_equal('aegim', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
690 set guioptions+=r
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
691 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
692 call assert_equal('aegimr', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
693 set guioptions+=L
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
694 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
695 call assert_equal('aegimrL', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
696 set guioptions+=t
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
697 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
698 call assert_equal('aegimrLt', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
699 set guioptions+=T
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
700 exec 'sleep' . duration
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
701 call assert_equal("aegimrLtT", &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
702
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
703 wincmd o
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
704 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
705 endif
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
706
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
707 let &guioptions = guioptions_saved
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
708 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
709
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
710 func Test_scrollbars()
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
711 new
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
712 " buffer with 200 lines
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
713 call setline(1, repeat(['one', 'two'], 100))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
714 set guioptions+=rlb
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
715
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
716 " scroll to move line 11 at top, moves the cursor there
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
717 eval 10->test_scrollbar('left', 0)
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
718 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
719 call assert_equal(1, winline())
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
720 call assert_equal(11, line('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
721
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
722 " scroll to move line 1 at top, cursor stays in line 11
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
723 call test_scrollbar('right', 0, 0)
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
724 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
725 call assert_equal(11, winline())
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
726 call assert_equal(11, line('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
727
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
728 set nowrap
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
729 call setline(11, repeat('x', 150))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
730 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
731 call assert_equal(1, wincol())
16963
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
732 set number
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
733 redraw
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
734 call assert_equal(5, wincol())
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
735 set nonumber
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
736 redraw
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
737 call assert_equal(1, col('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
738
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
739 " scroll to character 11, cursor is moved
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
740 call test_scrollbar('hor', 10, 0)
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
741 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
742 call assert_equal(1, wincol())
16963
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
743 set number
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
744 redraw
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
745 call assert_equal(5, wincol())
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
746 set nonumber
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
747 redraw
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
748 call assert_equal(11, col('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
749
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
750 set guioptions&
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
751 set wrap&
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
752 bwipe!
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
753 endfunc
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
754
16121
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
755 func Test_menu()
18767
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18078
diff changeset
756 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18078
diff changeset
757
16121
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
758 " Check Help menu exists
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
759 let help_menu = execute('menu Help')
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
760 call assert_match('Overview', help_menu)
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
761
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
762 " Check Help menu works
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
763 emenu Help.Overview
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
764 call assert_equal('help', &buftype)
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
765 close
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
766
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
767 " Check deleting menu doesn't cause trouble.
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
768 aunmenu Help
22439
445799159195 patch 8.2.1768: cannot use the help menu from a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
769 if exists(':tlmenu')
445799159195 patch 8.2.1768: cannot use the help menu from a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
770 tlunmenu Help
445799159195 patch 8.2.1768: cannot use the help menu from a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 22087
diff changeset
771 endif
16121
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
772 call assert_fails('menu Help', 'E329:')
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
773 endfunc
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
774
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
775 func Test_set_guipty()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
776 let guipty_saved = &guipty
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
777
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
778 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
779 set guipty&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
780 call assert_equal(1, &guipty)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
781
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
782 set noguipty
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
783 call assert_equal(0, &guipty)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
784
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
785 let &guipty = guipty_saved
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
786 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
787
16119
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
788 func Test_encoding_conversion()
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
789 " GTK supports conversion between 'encoding' and "utf-8"
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
790 CheckFeature gui_gtk
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
791 let encoding_saved = &encoding
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
792 set encoding=latin1
16119
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
793
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
794 " would be nice if we could take a screenshot
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
795 intro
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
796 " sets the window title
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
797 edit SomeFile
16119
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
798
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
799 let &encoding = encoding_saved
16119
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
800 endfunc
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
801
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
802 func Test_shell_command()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 new
9760
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
804 r !echo hello
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
805 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
806 bwipe!
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
808
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
809 func Test_syntax_colortest()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
810 runtime syntax/colortest.vim
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
811 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
812 sleep 200m
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
813 bwipe!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
814 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
815
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
816 func Test_set_term()
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
817 " It's enough to check the current value since setting 'term' to anything
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
818 " other than builtin_gui makes no sense at all.
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
819 call assert_equal('builtin_gui', &term)
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
820 call assert_fails('set term=xterm', 'E530:')
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
821 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
822
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
823 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
824 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
825 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
826 else
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
827 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
828 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
829 endfunc
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
830
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
831 " Test "vim -g" and also the GUIEnter autocommand.
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
832 func Test_gui_dash_g()
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
833 let cmd = GetVimCommand('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
834 call writefile([""], "Xtestgui")
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
835 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
836 au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
837 au GUIEnter * qall
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
838 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
839 call writefile(lines, 'Xscriptgui')
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
840 call system(cmd . ' -g')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
841 call WaitForAssert({-> assert_equal(['insertmode: 0'], readfile('Xtestgui'))})
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
842
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
843 call delete('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
844 call delete('Xtestgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
845 endfunc
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
846
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
847 " Test "vim -7" and also the GUIEnter autocommand.
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
848 func Test_gui_dash_y()
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
849 let cmd = GetVimCommand('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
850 call writefile([""], "Xtestgui")
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
851 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
852 au GUIEnter * call writefile(["insertmode: " . &insertmode], "Xtestgui")
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
853 au GUIEnter * qall
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
854 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
855 call writefile(lines, 'Xscriptgui')
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
856 call system(cmd . ' -y')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
857 call WaitForAssert({-> assert_equal(['insertmode: 1'], readfile('Xtestgui'))})
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
858
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
859 call delete('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
860 call delete('Xtestgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
861 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
862
20365
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
863 " Test for "!" option in 'guioptions'. Use a terminal for running external
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
864 " commands
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
865 func Test_gui_run_cmd_in_terminal()
20417
86333cdb8cf8 patch 8.2.0763: GUI test fails without the terminal feature
Bram Moolenaar <Bram@vim.org>
parents: 20365
diff changeset
866 CheckFeature terminal
20365
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
867 let save_guioptions = &guioptions
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
868 set guioptions+=!
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
869 if has('win32')
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
870 let cmd = 'type'
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
871 else
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
872 " assume all the other systems have a cat command
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
873 let cmd = 'cat'
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
874 endif
20508
357dea6b9fde patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 20417
diff changeset
875 exe "silent !" . cmd . " test_gui.vim"
20365
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
876 " TODO: how to check that the command ran in a separate terminal?
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
877 " Maybe check for $TERM (dumb vs xterm) in the spawned shell?
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
878 let &guioptions = save_guioptions
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
879 endfunc
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
880
20701
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
881 func Test_gui_recursive_mapping()
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
882 nmap ' <C-W>
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
883 nmap <C-W>a :let didit = 1<CR>
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
884 call feedkeys("'a", 'xt')
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
885 call assert_equal(1, didit)
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
886
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
887 nunmap '
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
888 nunmap <C-W>a
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
889 endfunc
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
890
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
891 " Test GUI mouse events
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
892 func Test_gui_mouse_event()
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
893 set mousemodel=extend
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
894 call test_override('no_query_mouse', 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
895 new
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
896 call setline(1, ['one two three', 'four five six'])
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
897
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
898 " place the cursor using left click in normal mode
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
899 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
900 call test_gui_mouse_event(0, 2, 4, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
901 call test_gui_mouse_event(3, 2, 4, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
902 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
903 call assert_equal([0, 2, 4, 0], getpos('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
904
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
905 " select and yank a word
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
906 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
907 call test_gui_mouse_event(0, 1, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
908 call test_gui_mouse_event(0, 1, 9, 1, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
909 call test_gui_mouse_event(3, 1, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
910 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
911 call assert_equal('three', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
912
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
913 " create visual selection using right click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
914 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
915 call test_gui_mouse_event(0, 2, 6, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
916 call test_gui_mouse_event(3, 2, 6, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
917 call test_gui_mouse_event(2, 2, 13, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
918 call test_gui_mouse_event(3, 2, 13, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
919 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
920 call assert_equal('five six', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
921
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
922 " paste using middle mouse button
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
923 let @* = 'abc '
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
924 call feedkeys('""', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
925 call test_gui_mouse_event(1, 1, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
926 call test_gui_mouse_event(3, 1, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
927 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
928 call assert_equal(['one two abc three', 'four five six'], getline(1, '$'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
929
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
930 " extend visual selection using right click in visual mode
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
931 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
932 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
933 call feedkeys('v', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
934 call test_gui_mouse_event(2, 1, 17, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
935 call test_gui_mouse_event(3, 1, 17, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
936 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
937 call assert_equal('one two abc three', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
938
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
939 " extend visual selection using mouse drag
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
940 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
941 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
942 call test_gui_mouse_event(0, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
943 call test_gui_mouse_event(0x43, 2, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
944 call test_gui_mouse_event(0x3, 2, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
945 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
946 call assert_equal('four five', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
947
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
948 " select text by moving the mouse
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
949 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
950 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
951 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
952 call test_gui_mouse_event(0, 1, 4, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
953 call test_gui_mouse_event(0x700, 1, 9, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
954 call test_gui_mouse_event(0x700, 1, 13, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
955 call test_gui_mouse_event(0x3, 1, 13, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
956 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
957 call assert_equal(' two abc t', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
958
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
959 " Using mouse in insert mode
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
960 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
961 call feedkeys('i', 't')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
962 call test_gui_mouse_event(0, 2, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
963 call test_gui_mouse_event(3, 2, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
964 call feedkeys("po\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
965 call assert_equal(['one two abc three', 'four five posix'], getline(1, '$'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
966
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
967 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
968 call setline(1, range(1, 100))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
969 " scroll up
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
970 call test_gui_mouse_event(0x200, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
971 call test_gui_mouse_event(0x200, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
972 call test_gui_mouse_event(0x200, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
973 call feedkeys("H", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
974 call assert_equal(10, line('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
975
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
976 " scroll down
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
977 call test_gui_mouse_event(0x100, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
978 call test_gui_mouse_event(0x100, 2, 1, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
979 call feedkeys("H", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
980 call assert_equal(4, line('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
981
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
982 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
983 set nowrap
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
984 call setline(1, range(10)->join('')->repeat(10))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
985 " scroll left
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
986 call test_gui_mouse_event(0x500, 1, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
987 call test_gui_mouse_event(0x500, 1, 10, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
988 call test_gui_mouse_event(0x500, 1, 15, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
989 call feedkeys('g0', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
990 call assert_equal(19, col('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
991
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
992 " scroll right
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
993 call test_gui_mouse_event(0x600, 1, 15, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
994 call test_gui_mouse_event(0x600, 1, 10, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
995 call feedkeys('g0', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
996 call assert_equal(7, col('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
997 set wrap&
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
998
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
999 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1000 call setline(1, repeat([repeat('a', 60)], 10))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1001
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1002 " record various mouse events
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1003 let mouseEventNames = [
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1004 \ 'LeftMouse', 'LeftRelease', '2-LeftMouse', '3-LeftMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1005 \ 'S-LeftMouse', 'A-LeftMouse', 'C-LeftMouse', 'MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1006 \ 'MiddleRelease', '2-MiddleMouse', '3-MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1007 \ 'S-MiddleMouse', 'A-MiddleMouse', 'C-MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1008 \ 'RightMouse', 'RightRelease', '2-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1009 \ '3-RightMouse', 'S-RightMouse', 'A-RightMouse', 'C-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1010 \ 'X1Mouse', 'S-X1Mouse', 'A-X1Mouse', 'C-X1Mouse', 'X2Mouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1011 \ 'S-X2Mouse', 'A-X2Mouse', 'C-X2Mouse'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1012 \ ]
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1013 let mouseEventCodes = map(copy(mouseEventNames), "'<' .. v:val .. '>'")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1014 let g:events = []
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1015 for e in mouseEventCodes
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1016 exe 'nnoremap ' .. e .. ' <Cmd>call add(g:events, "' ..
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1017 \ substitute(e, '[<>]', '', 'g') .. '")<CR>'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1018 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1019
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1020 " Test various mouse buttons (0 - Left, 1 - Middle, 2 - Right, 0x300 - X1,
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1021 " 0x300- X2)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1022 for button in [0, 1, 2, 0x300, 0x400]
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1023 " Single click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1024 call test_gui_mouse_event(button, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1025 call test_gui_mouse_event(3, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1026
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1027 " Double/Triple click is supported by only the Left/Middle/Right mouse
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1028 " buttons
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1029 if button <= 2
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1030 " Double Click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1031 call test_gui_mouse_event(button, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1032 call test_gui_mouse_event(button, 2, 5, 1, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1033 call test_gui_mouse_event(3, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1034
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1035 " Triple Click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1036 call test_gui_mouse_event(button, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1037 call test_gui_mouse_event(button, 2, 5, 1, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1038 call test_gui_mouse_event(button, 2, 5, 1, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1039 call test_gui_mouse_event(3, 2, 5, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1040 endif
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1041
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1042 " Shift click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1043 call test_gui_mouse_event(button, 3, 7, 0, 4)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1044 call test_gui_mouse_event(3, 3, 7, 0, 4)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1045
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1046 " Alt click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1047 call test_gui_mouse_event(button, 3, 7, 0, 8)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1048 call test_gui_mouse_event(3, 3, 7, 0, 8)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1049
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1050 " Ctrl click
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1051 call test_gui_mouse_event(button, 3, 7, 0, 16)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1052 call test_gui_mouse_event(3, 3, 7, 0, 16)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1053
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1054 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1055 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1056
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1057 call assert_equal(['LeftMouse', 'LeftRelease', 'LeftMouse', '2-LeftMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1058 \ 'LeftMouse', '2-LeftMouse', '3-LeftMouse', 'S-LeftMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1059 \ 'A-LeftMouse', 'C-LeftMouse', 'MiddleMouse', 'MiddleRelease',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1060 \ 'MiddleMouse', '2-MiddleMouse', 'MiddleMouse', '2-MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1061 \ '3-MiddleMouse', 'S-MiddleMouse', 'A-MiddleMouse', 'C-MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1062 \ 'RightMouse', 'RightRelease', 'RightMouse', '2-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1063 \ 'RightMouse', '2-RightMouse', '3-RightMouse', 'S-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1064 \ 'A-RightMouse', 'C-RightMouse', 'X1Mouse', 'S-X1Mouse', 'A-X1Mouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1065 \ 'C-X1Mouse', 'X2Mouse', 'S-X2Mouse', 'A-X2Mouse', 'C-X2Mouse'],
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1066 \ g:events)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1067
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1068 for e in mouseEventCodes
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1069 exe 'nunmap ' .. e
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1070 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1071
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1072 " modeless selection
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1073 set mouse=
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1074 let save_guioptions = &guioptions
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1075 set guioptions+=A
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1076 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1077 call setline(1, ['one two three', 'four five sixteen'])
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1078 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1079 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1080 " Double click should select the word and copy it to clipboard
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1081 let @* = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1082 call test_gui_mouse_event(0, 2, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1083 call test_gui_mouse_event(0, 2, 11, 1, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1084 call test_gui_mouse_event(3, 2, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1085 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1086 call assert_equal([0, 1, 1, 0], getpos('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1087 call assert_equal('sixteen', @*)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1088 " Right click should extend the selection from cursor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1089 call cursor(1, 6)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1090 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1091 let @* = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1092 call test_gui_mouse_event(2, 1, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1093 call test_gui_mouse_event(3, 1, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1094 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1095 call assert_equal([0, 1, 6, 0], getpos('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1096 call assert_equal('wo thr', @*)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1097 " Middle click should paste the clipboard contents
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1098 call cursor(2, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1099 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1100 call test_gui_mouse_event(1, 1, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1101 call test_gui_mouse_event(3, 1, 11, 0, 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1102 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1103 call assert_equal([0, 2, 7, 0], getpos('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1104 call assert_equal('wo thrfour five sixteen', getline(2))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1105 set mouse&
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1106 let &guioptions = save_guioptions
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1107
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1108 " Test invalid parameters for test_gui_mouse_event()
25302
4d3c68196d05 patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25112
diff changeset
1109 call assert_fails('call test_gui_mouse_event("", 1, 2, 3, 4)', 'E1210:')
4d3c68196d05 patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25112
diff changeset
1110 call assert_fails('call test_gui_mouse_event(0, "", 2, 3, 4)', 'E1210:')
4d3c68196d05 patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25112
diff changeset
1111 call assert_fails('call test_gui_mouse_event(0, 1, "", 3, 4)', 'E1210:')
4d3c68196d05 patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25112
diff changeset
1112 call assert_fails('call test_gui_mouse_event(0, 1, 2, "", 4)', 'E1210:')
4d3c68196d05 patch 8.2.3188: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25112
diff changeset
1113 call assert_fails('call test_gui_mouse_event(0, 1, 2, 3, "")', 'E1210:')
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1114
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1115 bw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1116 call test_override('no_query_mouse', 0)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1117 set mousemodel&
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1118 endfunc
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1119
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1120 " Test for 'guitablabel' and 'guitabtooltip' options
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1121 func TestGuiTabLabel()
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1122 call add(g:TabLabels, v:lnum + 100)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1123 let bufnrlist = tabpagebuflist(v:lnum)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1124 return bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1125 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1126
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1127 func TestGuiTabToolTip()
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1128 call add(g:TabToolTips, v:lnum + 200)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1129 let bufnrlist = tabpagebuflist(v:lnum)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1130 return bufname(bufnrlist[tabpagewinnr(v:lnum) - 1])
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1131 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1132
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1133 func Test_gui_tablabel_tooltip()
25112
c39a64bc5ca2 patch 8.2.3093: tablabel_tooltip test fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25060
diff changeset
1134 CheckNotFeature gui_athena
c39a64bc5ca2 patch 8.2.3093: tablabel_tooltip test fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25060
diff changeset
1135
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1136 %bw!
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1137 " Removing the tabline at the end of this test, reduces the window height by
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1138 " one. Save and restore it after the test.
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1139 let save_lines = &lines
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1140 edit one
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1141 set modified
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1142 tabnew two
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1143 set modified
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1144 tabnew three
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1145 set modified
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1146 let g:TabLabels = []
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1147 set guitablabel=%{TestGuiTabLabel()}
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1148 call test_override('starting', 1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1149 redrawtabline
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1150 call test_override('starting', 0)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1151 call assert_true(index(g:TabLabels, 101) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1152 call assert_true(index(g:TabLabels, 102) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1153 call assert_true(index(g:TabLabels, 103) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1154 set guitablabel&
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1155 unlet g:TabLabels
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1156
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1157 if has('gui_gtk')
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1158 " Only on GTK+, the tooltip function is called even if the mouse is not
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1159 " on the tabline. on Win32 and Motif, the tooltip function is called only
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1160 " when the mouse pointer is over the tabline.
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1161 let g:TabToolTips = []
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1162 set guitabtooltip=%{TestGuiTabToolTip()}
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1163 call test_override('starting', 1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1164 redrawtabline
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1165 call test_override('starting', 0)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1166 call assert_true(index(g:TabToolTips, 201) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1167 call assert_true(index(g:TabToolTips, 202) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1168 call assert_true(index(g:TabToolTips, 203) != -1)
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1169 set guitabtooltip&
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1170 unlet g:TabToolTips
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1171 endif
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1172 %bw!
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1173 let &lines = save_lines
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1174 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1175
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1176 " Test for dropping files into a window in GUI
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1177 func DropFilesInCmdLine()
25060
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1178 CheckFeature drop_file
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1179
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1180 call feedkeys(":\"", 'L')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1181 call test_gui_drop_files(['a.c', 'b.c'], &lines, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1182 call feedkeys("\<CR>", 'L')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1183 endfunc
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1184
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1185 func Test_gui_drop_files()
25060
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1186 CheckFeature drop_file
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1187
25356
1cde96e768e4 patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25302
diff changeset
1188 call assert_fails('call test_gui_drop_files(1, 1, 1, 0)', 'E1211:')
1cde96e768e4 patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25302
diff changeset
1189 call assert_fails('call test_gui_drop_files(["x"], "", 1, 0)', 'E1210:')
1cde96e768e4 patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25302
diff changeset
1190 call assert_fails('call test_gui_drop_files(["x"], 1, "", 0)', 'E1210:')
1cde96e768e4 patch 8.2.3215: Vim9: argument types are not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 25302
diff changeset
1191 call assert_fails('call test_gui_drop_files(["x"], 1, 1, "")', 'E1210:')
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1192
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1193 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1194 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1195 call test_gui_drop_files([], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1196 call assert_equal([], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1197 call test_gui_drop_files([1, 2], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1198 call assert_equal([], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1199
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1200 call test_gui_drop_files(['a.c', 'b.c'], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1201 call assert_equal(['a.c', 'b.c'], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1202 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1203 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1204 call test_gui_drop_files([], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1205 call assert_equal([], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1206 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1207 " if the buffer in the window is modified, then the file should be opened in
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1208 " a new window
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1209 set modified
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1210 call test_gui_drop_files(['x.c', 'y.c'], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1211 call assert_equal(['x.c', 'y.c'], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1212 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1213 call assert_equal('x.c', bufname(winbufnr(1)))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1214 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1215 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1216 " if Ctrl is pressed, then the file should be opened in a new window
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1217 call test_gui_drop_files(['s.py', 't.py'], 1, 1, 0x10)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1218 call assert_equal(['s.py', 't.py'], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1219 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1220 call assert_equal('s.py', bufname(winbufnr(1)))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1221 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1222 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1223 " drop the files in a non-current window
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1224 belowright new
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1225 call test_gui_drop_files(['a.py', 'b.py'], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1226 call assert_equal(['a.py', 'b.py'], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1227 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1228 call assert_equal(1, winnr())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1229 call assert_equal('a.py', bufname(winbufnr(1)))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1230 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1231 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1232 " pressing shift when dropping files should change directory
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1233 let save_cwd = getcwd()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1234 call mkdir('Xdir1')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1235 call writefile([], 'Xdir1/Xfile1')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1236 call writefile([], 'Xdir1/Xfile2')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1237 call test_gui_drop_files(['Xdir1/Xfile1', 'Xdir1/Xfile2'], 1, 1, 0x4)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1238 call assert_equal('Xdir1', fnamemodify(getcwd(), ':t'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1239 call assert_equal('Xfile1', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1240 call chdir(save_cwd)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1241 " pressing shift when dropping directory and files should change directory
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1242 call test_gui_drop_files(['Xdir1', 'Xdir1/Xfile2'], 1, 1, 0x4)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1243 call assert_equal('Xdir1', fnamemodify(getcwd(), ':t'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1244 call assert_equal('Xdir1', fnamemodify(@%, ':t'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1245 call chdir(save_cwd)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1246 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1247 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1248 " dropping a directory should edit it
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1249 call test_gui_drop_files(['Xdir1'], 1, 1, 0)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1250 call assert_equal('Xdir1', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1251 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1252 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1253 " dropping only a directory name with Shift should ignore it
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1254 call test_gui_drop_files(['Xdir1'], 1, 1, 0x4)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1255 call assert_equal('', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1256 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1257 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1258 call delete('Xdir1', 'rf')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1259 " drop files in the command line. The GUI drop files adds the file names to
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1260 " the low level input buffer. So need to use a cmdline map and feedkeys()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1261 " with 'Lx!' to process it in this function itself.
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1262 cnoremap <expr> <buffer> <F4> DropFilesInCmdLine()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1263 call feedkeys(":\"\<F4>\<CR>", 'xt')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1264 call feedkeys('k', 'Lx!')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1265 call assert_equal('"a.c b.c', @:)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1266 cunmap <buffer> <F4>
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1267 endfunc
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1268
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1269 " Test for generating a GUI tabline event to select a tab page
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1270 func Test_gui_tabline_event()
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1271 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1272 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1273 tabedit Xfile2
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1274 tabedit Xfile3
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1275
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1276 tabfirst
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1277 call assert_equal(v:true, test_gui_tabline_event(2))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1278 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1279 call assert_equal(2, tabpagenr())
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1280 call assert_equal(v:true, test_gui_tabline_event(3))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1281 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1282 call assert_equal(3, tabpagenr())
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1283 call assert_equal(v:false, test_gui_tabline_event(3))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1284
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1285 " From the cmdline window, tabline event should not be handled
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1286 call feedkeys("q::let t = test_gui_tabline_event(2)\<CR>:q\<CR>", 'x!')
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1287 call assert_equal(v:false, t)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1288
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1289 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1290 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1291
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1292 " Test for generating a GUI tabline menu event to execute an action
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1293 func Test_gui_tabmenu_event()
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1294 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1295
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1296 " Try to close the last tab page
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1297 call test_gui_tabmenu_event(1, 1)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1298 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1299
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1300 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1301 tabedit Xfile2
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1302 call test_gui_tabmenu_event(1, 1)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1303 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1304 call assert_equal(1, tabpagenr('$'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1305 call assert_equal('Xfile2', bufname())
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1306
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1307 call test_gui_tabmenu_event(1, 2)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1308 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1309 call assert_equal(2, tabpagenr('$'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1310
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1311 " If tabnr is 0, then the current tabpage should be used.
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1312 call test_gui_tabmenu_event(0, 2)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1313 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1314 call assert_equal(3, tabpagenr('$'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1315 call test_gui_tabmenu_event(0, 1)
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1316 call feedkeys("y", "Lx!")
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1317 call assert_equal(2, tabpagenr('$'))
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1318
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1319 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1320 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1321
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
1322 " vim: shiftwidth=2 sts=2 expandtab