annotate src/testdir/test_gui.vim @ 29572:fdfb36298114 v9.0.0127

patch 9.0.0127: unused variable Commit: https://github.com/vim/vim/commit/e95f22f63a1871b91e5508088e5ae4905ce28cd7 Author: zeertzjq <zeertzjq@outlook.com> Date: Mon Aug 1 11:49:45 2022 +0100 patch 9.0.0127: unused variable Problem: Unused variable. Solution: Remove the variable. (closes https://github.com/vim/vim/issues/10829)
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Aug 2022 13:00:04 +0200
parents 339fe2968690
children 6d44e5e9e0ce
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')
28858
7f1a48f095be patch 8.2.4952: GUI test will fail if color scheme changes
Bram Moolenaar <Bram@vim.org>
parents: 28755
diff changeset
51 " FIXME: temporarily check less while the colorscheme changes
7f1a48f095be patch 8.2.4952: GUI test will fail if color scheme changes
Bram Moolenaar <Bram@vim.org>
parents: 28755
diff changeset
52 " call assert_match("\nSearch xxx term=reverse cterm=reverse ctermfg=196 ctermbg=16 gui=reverse guifg=#ff0000 guibg=#000000", a)
7f1a48f095be patch 8.2.4952: GUI test will fail if color scheme changes
Bram Moolenaar <Bram@vim.org>
parents: 28755
diff changeset
53 call assert_match("\nSearch xxx term=reverse ", a)
15394
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
54
f20d90aeecaa patch 8.1.0705: :colorscheme isn't tested enough
Bram Moolenaar <Bram@vim.org>
parents: 14756
diff changeset
55 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
56
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
57 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
58 augroup TestColors
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
59 au!
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
60 augroup END
cad480bac9e1 patch 8.0.1777: cannot cleanup before loading another colorscheme
Christian Brabandt <cb@256bit.org>
parents: 13351
diff changeset
61 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
62 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
63 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
64
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
65 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
66 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
67
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28297
diff changeset
68 if has('gui_motif')
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
69 " 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
70 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
71
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
72 " 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
73 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
74 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
75
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
76 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
77 " 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
78 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
79 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
80
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
81 " 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
82 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
83 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
84 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
85 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
86
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
87 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
88 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
89
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
90 let fname = getfontname()
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
91
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
92 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
93 " '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
94 call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', fname)
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28297
diff changeset
95 elseif 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
96 " '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
97 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
98 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
99 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
100 " '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
101 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
102 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
103 endfunc
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
104
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
105 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
106 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
107 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
108 call assert_true(getwinposy() >= 0)
13940
70e36e1ca442 patch 8.0.1840: getwinpos() is not tested
Christian Brabandt <cb@256bit.org>
parents: 13843
diff changeset
109 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
110 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
111
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
112 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
113 CheckX11BasedGui
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
114
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
115 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
116
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
117 let quoteplus_saved = @+
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
118
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
119 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
120 let test_response = 'Yes, I can.'
29183
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
121 let testee = 'VIMRUNTIME=' .. $VIMRUNTIME .. '; export VIMRUNTIME;'
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
122 \ .. GetVimCommand() .. ' --noplugin --not-a-term -c ''%s'''
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
123 " 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
124 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
125 \ . 'gui -f | '
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
126 \ . 'call feedkeys("'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
127 \ . '\"+p'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
128 \ . ':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
129 \ . '\"+yis'
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
130 \ . ':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
131 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
132
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
133 " 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
134 " 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
135 " 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
136 " 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
137 " 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
138 " 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
139 " 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
140 " 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
141 " 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
142 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
143 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
144 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
145
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
146 let @+ = quoteplus_saved
10972
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
147 endfunc
488cda29455b patch 8.0.0375: the "+ register is not tested
Christian Brabandt <cb@256bit.org>
parents: 10944
diff changeset
148
26028
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
149 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
150 CheckUnix
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
151
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
152 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
153 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
154 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
155 qa!
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
156 END
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
157 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
158
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
159 " 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
160 " displayed.
29052
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
161 " However, when using XIM we might get E285, do use it then.
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
162 if has('xim')
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
163 let vimcmd = GetVimCommand()
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
164 else
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
165 let vimcmd = substitute(GetVimCommand(), '--not-a-term', '', '')
e91e749ac101 patch 8.2.5048: when using XIM the gui test may fail
Bram Moolenaar <Bram@vim.org>
parents: 28889
diff changeset
166 endif
26028
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
167
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
168 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
169 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
170
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
171 call delete('Xstdin')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
172 call delete('XstdinOK')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
173 call delete('Xscript')
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
174 endfunc
be2d004247e1 patch 8.2.3548: GTK GUI crashen when reading from stdin
Bram Moolenaar <Bram@vim.org>
parents: 25986
diff changeset
175
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
176 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
177 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
178
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
179 set background&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
180 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
181
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
182 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
183 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
184
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
185 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
186 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
187
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
188 func Test_set_balloondelay()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
189 CheckOption balloondelay
11050
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 let balloondelay_saved = &balloondelay
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 " 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
194 set balloondelay&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
195 call assert_equal(600, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
196
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
197 " Edge cases
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 " 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
200 " 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
201 " code.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
202 set balloondelay=-1
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
203 call assert_equal(-1, &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 " 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
206 " 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
207 " toolkit in use after all.
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
208 set balloondelay=0
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
209 call assert_equal(0, &balloondelay)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
210
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
211 set balloondelay=1
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
212 call assert_equal(1, &balloondelay)
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 " 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
215 " 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
216 " 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
217 set balloondelay=2147483647
975f54a391ec patch 8.0.0415: balloon test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 11050
diff changeset
218 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
219
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
220 let &balloondelay = balloondelay_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
221 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
222
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
223 func Test_set_ballooneval()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
224 CheckOption ballooneval
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
225
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
226 let ballooneval_saved = &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 ballooneval&
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 set ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
232 call assert_notequal(0, &ballooneval)
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 set noballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
235 call assert_equal(0, &ballooneval)
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 &ballooneval = ballooneval_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
238 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
239
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
240 func Test_set_balloonexpr()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
241 CheckOption balloonexpr
11050
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 let balloonexpr_saved = &balloonexpr
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
244
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
245 " Default value
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
246 set balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
247 call assert_equal('', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
248
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
249 " User-defined function
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
250 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
251 func MyBalloonExpr()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
252 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
253 \', column ' . v:beval_col .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
254 \ ' 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
255 \ ' on word "' . v:beval_text . '"' .
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
256 \ ' 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
257 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
258 setl balloonexpr=MyBalloonExpr()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
259 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
260 call assert_equal('MyBalloonExpr()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
261 " 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
262 " 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
263 " 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
264 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
265 call assert_equal('', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
266 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
267
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 " 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
269 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
270 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
271 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
272 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
273 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
274 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
275 delfunc s:NewBalloonExpr
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
276 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
277
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
278 " Multiline support
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
279 if has('balloon_multiline')
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
280 " Multiline balloon using NL
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
281 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
282 func MyBalloonFuncForMultilineUsingNL()
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
283 return "Multiline\nSupported\nBalloon\nusing NL"
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
284 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
285 setl balloonexpr=MyBalloonFuncForMultilineUsingNL()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
286 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
287 call assert_equal('MyBalloonFuncForMultilineUsingNL()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
288 " 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
289 " 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
290 " 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
291 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
292 delfunc MyBalloonFuncForMultilineUsingNL
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
293 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
294
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
295 " Multiline balloon using List
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
296 new
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
297 func MyBalloonFuncForMultilineUsingList()
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
298 return [ 'Multiline', 'Supported', 'Balloon', 'using List' ]
11050
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
299 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
300 setl balloonexpr=MyBalloonFuncForMultilineUsingList()
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
301 setl ballooneval
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
302 call assert_equal('MyBalloonFuncForMultilineUsingList()', &balloonexpr)
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
303 " 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
304 " 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
305 " 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
306 setl balloonexpr&
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
307 delfunc MyBalloonFuncForMultilineUsingList
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
308 bwipe!
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
309 endif
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
310
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
311 let &balloonexpr = balloonexpr_saved
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
312 endfunc
622ed5a4925f patch 8.0.0414: balloon eval is not tested
Christian Brabandt <cb@256bit.org>
parents: 11028
diff changeset
313
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
314 " 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
315 " 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
316 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
317 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
318
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
319 let default = [
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
320 \ "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
321 \ "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
322 \ "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
323 \ "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
324 \ "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
325 \ "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
326 \ ]
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
327
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
328 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
329 set guicursor&
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(default, ','), &guicursor)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
331
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
332 " 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
333 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
334 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
335 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
336 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
337 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
338
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
339 " 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
340 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
341 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
342 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
343 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
344 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
345
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
346 " 'a' Mode
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
347 set guicursor&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
348 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
349 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
350
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
351 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
352 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
353
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
354 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
355 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
356 " 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
357 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
358 endif
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
359
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
360 " 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
361 " and older.
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
362 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
363 " 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
364 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
365 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
366 set guifont=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
367 endfor
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
368 set renderoptions=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
369 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
370 set guifont=
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
371 endfor
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
372 endif
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
373 endfunc
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
374
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
375 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
376 CheckX11BasedGui
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
377
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
378 let guifont_saved = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
379 if has('xfontset')
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
380 " 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
381 let guifontset_saved = &guifontset
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
382 set guifontset=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
383 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
384
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28297
diff changeset
385 if has('gui_motif')
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
386 " 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
387 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
388 " 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
389 " 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
390 " '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
391 " listed.
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
392 let flist = &guifont
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
393 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
394 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
395
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
396 " 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
397 " valid font.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
398 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
399 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
400 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
401
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
402 " 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
403 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
404 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
405 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
406
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
407 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
408 " 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
409 " '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
410 " 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
411 " 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
412 " font names'.
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
413 "
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
414 " 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
415 " 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
416 set guifont=(´・ω・`)\ 12,Courier\ 12
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
417 call assert_equal('(´・ω・`) 12', getfontname())
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
418
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
419 " 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
420 set guifont=
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
421 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
422 endif
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
423
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
424 if has('xfontset')
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
425 let &guifontset = guifontset_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
426 endif
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
427 let &guifont = guifont_saved
10855
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
428 endfunc
0beffabed338 patch 8.0.0317: no test for setting 'guifont'
Christian Brabandt <cb@256bit.org>
parents: 10847
diff changeset
429
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
430 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
431 CheckFeature xfontset
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
432 let skipped = ''
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
433
19932
2c4d9ca33769 patch 8.2.0522: several errors are not tested for
Bram Moolenaar <Bram@vim.org>
parents: 19783
diff changeset
434 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
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 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
437
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
438 " 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
439 " be chosen meticulously.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
440 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
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 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
443 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
444
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
445 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
446 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
447
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
448 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
449 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
450 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
451 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
452
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
453 " 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
454 " 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
455 " 'fontsets'.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
456 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
457 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
458
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
459 let feasible = 0
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
460 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
461 try
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
462 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
463 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
464 continue
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
465 endtry
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
466 let done = 0
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
467 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
468 try
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
469 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
470 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
471 break
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
472 endtry
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
473 let done += 1
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
474 endfor
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
475 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
476 let feasible = 1
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
477 break
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
478 endif
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
479 endfor
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
480
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
481 " 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
482 if !feasible
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
483 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
484 else
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
485 " 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
486 " previous loop.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
487 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
488 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
489 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
490 endfor
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
491 endif
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
492
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
493 " Finally, restore ctype.
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
494 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
495
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
496 if !empty(skipped)
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
497 throw skipped
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
498 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
499 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
500
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
501 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
502 CheckX11BasedGui
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
503
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
504 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
505
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
506 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
507 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
508 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
509
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
510 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
511 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
512 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
513 else
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
514 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
515 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
516 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
517 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
518 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
519
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
520 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
521 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
522
28303
9849df834f1d patch 8.2.4677: the Athena GUI support is outdated
Bram Moolenaar <Bram@vim.org>
parents: 28297
diff changeset
523 elseif has('gui_motif')
10879
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
524 " 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
525 if !has('xfontset')
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
526 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
527 else
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
528 let encoding_saved = &encoding
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
529 let guifont_saved = &guifont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
530 let guifontset_saved = &guifontset
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
531 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
532
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
533 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
534 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
535
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
536 set encoding=utf-8
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
537
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
538 " 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
539 set guifontset=
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
540
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
541 " 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
542 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
543 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
544 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
545
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
546 " 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
547 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
548 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
549 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
550
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
551 " 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
552 try
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
553 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
554 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
555 catch
22087
ff21e2962490 patch 8.2.1593: tests do not check the error number properly
Bram Moolenaar <Bram@vim.org>
parents: 21765
diff changeset
556 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
557 endtry
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
558
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
559 " 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
560 set guifontwide=
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
561 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
562 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
563
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
564 " 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
565 exec 'set guifontwide=' . wfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
566 exec 'set guifont=' . nfont
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
567 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
568
10885
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
569 let &guifontwide = guifontwide_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
570 let &guifontset = guifontset_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
571 let &guifont = guifont_saved
310834b0256a patch 8.0.0332: GUI test fails on some systems
Christian Brabandt <cb@256bit.org>
parents: 10879
diff changeset
572 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
573 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
574 endif
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
575 endfunc
1fce74a5a628 patch 8.0.0329: xfontset and guifontwide are not tested
Christian Brabandt <cb@256bit.org>
parents: 10857
diff changeset
576
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
577 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
578 CheckX11BasedGui
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
579
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
580 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
581 " 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
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_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
584 " 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
585 try
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
586 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
587 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
588 catch
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
589 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
590 endtry
25982
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
591 endif
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
592 endfunc
aade8ef975d5 patch 8.2.3524: GUI: ligatures are not used
Bram Moolenaar <Bram@vim.org>
parents: 25969
diff changeset
593
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
594 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
595 CheckX11BasedGui
10944
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
596
25986
34b75c77a7bd patch 8.2.3526: tests have clumsy check for X11 based GUI
Bram Moolenaar <Bram@vim.org>
parents: 25982
diff changeset
597 " 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
598 " 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
599 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
600 endfunc
4e2cdce4576c patch 8.0.0361: GUI initialisation is not sufficiently tested
Christian Brabandt <cb@256bit.org>
parents: 10885
diff changeset
601
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
602 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
603 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
604 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
605
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
606 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
607 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
608 set guioptions&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
609 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
610
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
611 else
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
612 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
613 set guioptions&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
614 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
615
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
616 " 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
617 wincmd v
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
618 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
619
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
620 " 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
621 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
622 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
623 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
624 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
625 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
626 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
627 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
628 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
629 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
630 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
631 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
632 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
633 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
634 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
635 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
636
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
637 " 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
638 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
639 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
640 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
641 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
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('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
644
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
645 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
646 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
647 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
648 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
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('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
651
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
652 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
653 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
654 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
655 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
656 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
657 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
658 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
659 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
660 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
661 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
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('aegi', &guioptions)
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
664
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
665 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
666 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
667 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
668 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
669 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
670 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
671
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
672 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
673 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
674 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
675 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
676 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
677 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
678 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
679 endif
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
680
18078
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
681 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
682 set guioptions+=d
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
683 exec 'sleep' . duration
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
684 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
685 set guioptions-=d
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
686 exec 'sleep' . duration
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
687 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
688 endif
5ae41d0ea397 patch 8.1.2034: dark them of GTK 3 not supported
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
689
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
690 " 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
691 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
692 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
693 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
694 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
695 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
696 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
697 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
698 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
699 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
700 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
701 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
702 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
703 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
704 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
705 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
706
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
707 wincmd o
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
708 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
709 endif
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
710
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
711 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
712 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
713
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
714 func Test_scrollbars()
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
715 new
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
716 " buffer with 200 lines
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
717 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
718 set guioptions+=rlb
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
719
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
720 " scroll to move line 11 at top, moves the cursor there
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
721 let args = #{which: 'left', value: 10, dragging: 0}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
722 call test_gui_event('scrollbar', args)
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
723 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
724 call assert_equal(1, winline())
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
725 call assert_equal(11, line('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
726
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
727 " scroll to move line 1 at top, cursor stays in line 11
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
728 let args = #{which: 'right', value: 0, dragging: 0}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
729 call test_gui_event('scrollbar', args)
14756
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(11, winline())
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
732 call assert_equal(11, line('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
733
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
734 set nowrap
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
735 call setline(11, repeat('x', 150))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
736 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
737 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
738 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
739 redraw
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
740 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
741 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
742 redraw
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
743 call assert_equal(1, col('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
744
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
745 " scroll to character 11, cursor is moved
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
746 let args = #{which: 'hor', value: 10, dragging: 0}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
747 call test_gui_event('scrollbar', args)
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
748 redraw
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
749 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
750 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
751 redraw
1fbb0a33b074 patch 8.1.1482: no test for wincol() depending on the 'number' option
Bram Moolenaar <Bram@vim.org>
parents: 16121
diff changeset
752 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
753 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
754 redraw
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
755 call assert_equal(11, col('.'))
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
756
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
757 " Invalid arguments
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
758 call assert_false(test_gui_event('scrollbar', {}))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
759 call assert_false(test_gui_event('scrollbar', #{value: 10, dragging: 0}))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
760 call assert_false(test_gui_event('scrollbar', #{which: 'hor', dragging: 0}))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
761 call assert_false(test_gui_event('scrollbar', #{which: 'hor', value: 1}))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
762 call assert_fails("call test_gui_event('scrollbar', #{which: 'a', value: 1, dragging: 0})", 'E475:')
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
763
14756
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
764 set guioptions&
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
765 set wrap&
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
766 bwipe!
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
767 endfunc
a179e5cfcab7 patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents: 13940
diff changeset
768
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
769 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
770 CheckFeature quickfix
068337e86133 patch 8.1.2373: cannot build with +popupwin but without +quickfix
Bram Moolenaar <Bram@vim.org>
parents: 18078
diff changeset
771
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 " 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
773 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
774 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
775
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
776 " 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
777 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
778 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
779 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
780
060b58b492a5 patch 8.1.1065: no test for using and deleting menu in the GUI
Bram Moolenaar <Bram@vim.org>
parents: 16119
diff changeset
781 " 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
782 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
783 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
784 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
785 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
786 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
787 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
788
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
789 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
790 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
791
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
792 " Default Value
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
793 set guipty&
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
794 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
795
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
796 set noguipty
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
797 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
798
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
799 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
800 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
801
16119
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
802 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
803 " 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
804 CheckFeature gui_gtk
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
805 let encoding_saved = &encoding
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
806 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
807
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
808 " 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
809 intro
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
810 " sets the window title
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
811 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
812
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 20701
diff changeset
813 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
814 endfunc
4fac64b51d74 patch 8.1.1064: no test for output conversion in the GTK GUI
Bram Moolenaar <Bram@vim.org>
parents: 15394
diff changeset
815
9756
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816 func Test_shell_command()
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
817 new
9760
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
818 r !echo hello
96667173293d commit https://github.com/vim/vim/commit/9d5b876d458e242b8b5e44da10c5cdc6bbb7f57c
Christian Brabandt <cb@256bit.org>
parents: 9756
diff changeset
819 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
820 bwipe!
00d753ea19a9 commit https://github.com/vim/vim/commit/877e95779869c5426102aa491f67d99904c8534c
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 endfunc
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
822
11119
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
823 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
824 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
825 redraw!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
826 sleep 200m
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
827 bwipe!
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
828 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
829
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
830 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
831 " 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
832 " 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
833 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
834 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
835 endfunc
d8a550329a97 patch 8.0.0447: getting font name does not work on X11
Christian Brabandt <cb@256bit.org>
parents: 11052
diff changeset
836
10841
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
837 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
838 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
839 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
840 else
5c0415a8b96e patch 8.0.0310: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10777
diff changeset
841 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
842 endif
10847
881194ae47a1 patch 8.0.0313: not enough testing for GUI functionality
Christian Brabandt <cb@256bit.org>
parents: 10841
diff changeset
843 endfunc
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
844
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
845 " 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
846 func Test_gui_dash_g()
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
847 let cmd = GetVimCommand('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
848 call writefile([""], "Xtestgui")
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
849 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
850 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
851 au GUIEnter * qall
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
852 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
853 call writefile(lines, 'Xscriptgui')
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
854 call system(cmd . ' -g')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
855 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
856
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
857 call delete('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
858 call delete('Xtestgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
859 endfunc
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
860
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
861 " 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
862 func Test_gui_dash_y()
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
863 let cmd = GetVimCommand('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
864 call writefile([""], "Xtestgui")
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
865 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
866 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
867 au GUIEnter * qall
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
868 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
869 call writefile(lines, 'Xscriptgui')
13843
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
870 call system(cmd . ' -y')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
871 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
872
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
873 call delete('Xscriptgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
874 call delete('Xtestgui')
619730d0d864 patch 8.0.1793: no test for "vim -g"
Christian Brabandt <cb@256bit.org>
parents: 13810
diff changeset
875 endfunc
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
876
20365
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
877 " 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
878 " commands
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
879 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
880 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
881 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
882 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
883 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
884 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
885 else
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
886 " 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
887 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
888 endif
20508
357dea6b9fde patch 8.2.0808: not enough testing for the terminal window
Bram Moolenaar <Bram@vim.org>
parents: 20417
diff changeset
889 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
890 " 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
891 " 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
892 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
893 endfunc
6bcd12791bf1 patch 8.2.0738: mouse handling in a terminal window not well tested
Bram Moolenaar <Bram@vim.org>
parents: 19997
diff changeset
894
20701
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
895 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
896 nmap ' <C-W>
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
897 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
898 call feedkeys("'a", 'xt')
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
899 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
900
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
901 nunmap '
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
902 nunmap <C-W>a
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
903 endfunc
fbee68c6aab1 patch 8.2.0904: assuming modifyOtherKeys for rhs of mapping
Bram Moolenaar <Bram@vim.org>
parents: 20508
diff changeset
904
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
905 " Test GUI mouse events
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
906 func Test_gui_mouse_event()
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
907 set mousemodel=extend
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
908 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
909 new
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
910 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
911
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
912 " 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
913 call cursor(1, 1)
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
914 let args = #{button: 0, row: 2, col: 4, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
915 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
916 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
917 eval 'mouse'->test_gui_event(args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
918 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
919 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
920
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
921 " select and yank a word
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
922 let @" = ''
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
923 let args = #{button: 0, row: 1, col: 9, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
924 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
925 let args.multiclick = 1
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
926 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
927 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
928 let args.multiclick = 0
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
929 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
930 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
931 call assert_equal('three', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
932
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
933 " 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
934 let @" = ''
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
935 let args = #{button: 0, row: 2, col: 6, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
936 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
937 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
938 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
939 let args = #{button: 2, row: 2, col: 13, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
940 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
941 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
942 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
943 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
944 call assert_equal('five six', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
945
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
946 " paste using middle mouse button
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
947 let @* = 'abc '
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
948 call feedkeys('""', 'Lx!')
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
949 let args = #{button: 1, row: 1, col: 9, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
950 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
951 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
952 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
953 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
954 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
955
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
956 " 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
957 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
958 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
959 call feedkeys('v', 'Lx!')
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
960 let args = #{button: 2, row: 1, col: 17, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
961 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
962 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
963 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
964 call feedkeys("y", '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', @")
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 " 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
968 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
969 call cursor(1, 1)
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
970 let args = #{button: 0, row: 2, col: 1, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
971 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
972 let args = #{button: 0x43, row: 2, col: 9, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
973 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
974 let args.button = 0x3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
975 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
976 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
977 call assert_equal('four five', @")
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
978
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
979 " 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
980 let @" = ''
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
981 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
982 redraw!
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
983 let args = #{button: 0, row: 1, col: 4, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
984 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
985 let args.button = 0x700
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
986 let args.col = 9
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
987 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
988 let args.col = 13
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
989 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
990 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
991 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
992 call feedkeys("y", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
993 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
994
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
995 " Using mouse in insert mode
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
996 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
997 call feedkeys('i', 't')
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
998 let args = #{button: 0, row: 2, col: 11, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
999 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1000 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1001 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1002 call feedkeys("po\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1003 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
1004
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1005 %d _
28755
26a2836923d6 patch 8.2.4902: mouse wheel scrolling is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 28644
diff changeset
1006 set scrolloff=0
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1007 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
1008 " scroll up
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1009 let args = #{button: 0x200, row: 2, col: 1, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1010 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1011 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1012 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1013 call feedkeys("H", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1014 call assert_equal(10, line('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1015
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1016 " scroll down
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1017 let args = #{button: 0x100, row: 2, col: 1, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1018 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1019 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1020 call feedkeys("H", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1021 call assert_equal(4, line('.'))
28755
26a2836923d6 patch 8.2.4902: mouse wheel scrolling is inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 28644
diff changeset
1022 set scrolloff&
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1023
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1024 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1025 set nowrap
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1026 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
1027 " scroll left
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1028 let args = #{button: 0x500, row: 1, col: 5, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1029 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1030 let args.col = 10
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1031 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1032 let args.col = 15
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1033 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1034 call feedkeys('g0', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1035 call assert_equal(19, col('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1036
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1037 " scroll right
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1038 let args = #{button: 0x600, row: 1, col: 15, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1039 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1040 let args.col = 10
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1041 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1042 call feedkeys('g0', 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1043 call assert_equal(7, col('.'))
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1044 set wrap&
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 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1047 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
1048
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1049 " record various mouse events
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1050 let mouseEventNames = [
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1051 \ '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
1052 \ '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
1053 \ 'MiddleRelease', '2-MiddleMouse', '3-MiddleMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1054 \ '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
1055 \ 'RightMouse', 'RightRelease', '2-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1056 \ '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
1057 \ '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
1058 \ '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
1059 \ ]
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1060 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
1061 let g:events = []
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1062 for e in mouseEventCodes
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1063 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
1064 \ substitute(e, '[<>]', '', 'g') .. '")<CR>'
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1065 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1066
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1067 " 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
1068 " 0x300- X2)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1069 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
1070 " Single click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1071 let args = #{button: button, row: 2, col: 5, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1072 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1073 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1074 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1075
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1076 " 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
1077 " buttons
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1078 if button <= 2
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1079 " Double Click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1080 let args.button = button
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1081 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1082 let args.multiclick = 1
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1083 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1084 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1085 let args.multiclick = 0
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1086 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1087
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1088 " Triple Click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1089 let args.button = button
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1090 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1091 let args.multiclick = 1
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1092 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1093 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1094 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1095 let args.multiclick = 0
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1096 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1097 endif
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1098
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1099 " Shift click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1100 let args = #{button: button, row: 3, col: 7, multiclick: 0, modifiers: 4}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1101 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1102 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1103 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1104
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1105 " Alt click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1106 let args.button = button
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1107 let args.modifiers = 8
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1108 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1109 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1110 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1111
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1112 " Ctrl click
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1113 let args.button = button
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1114 let args.modifiers = 16
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1115 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1116 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1117 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1118
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1119 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1120 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1121
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1122 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
1123 \ '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
1124 \ '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
1125 \ '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
1126 \ '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
1127 \ 'RightMouse', 'RightRelease', 'RightMouse', '2-RightMouse',
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1128 \ '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
1129 \ '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
1130 \ '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
1131 \ g:events)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1132
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1133 for e in mouseEventCodes
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1134 exe 'nunmap ' .. e
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1135 endfor
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1136
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1137 " modeless selection
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1138 set mouse=
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1139 let save_guioptions = &guioptions
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1140 set guioptions+=A
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1141 %d _
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1142 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
1143 call cursor(1, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1144 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1145 " 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
1146 let @* = ''
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1147 let args = #{button: 0, row: 2, col: 11, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1148 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1149 let args.multiclick = 1
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1150 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1151 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1152 let args.multiclick = 0
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1153 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1154 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1155 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
1156 call assert_equal('sixteen', @*)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1157 " 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
1158 call cursor(1, 6)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1159 redraw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1160 let @* = ''
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1161 let args = #{button: 2, row: 1, col: 11, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1162 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1163 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1164 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1165 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1166 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
1167 call assert_equal('wo thr', @*)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1168 " 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
1169 call cursor(2, 1)
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1170 redraw!
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1171 let args = #{button: 1, row: 1, col: 11, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1172 call test_gui_event('mouse', args)
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1173 let args.button = 3
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1174 call test_gui_event('mouse', args)
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1175 call feedkeys("\<Esc>", 'Lx!')
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1176 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
1177 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
1178 set mouse&
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1179 let &guioptions = save_guioptions
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1180
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1181 " Test invalid parameters for test_gui_event()
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1182 let args = #{row: 2, col: 4, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1183 call assert_false(test_gui_event('mouse', args))
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1184 let args = #{button: 0, col: 4, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1185 call assert_false(test_gui_event('mouse', args))
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1186 let args = #{button: 0, row: 2, multiclick: 0, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1187 call assert_false(test_gui_event('mouse', args))
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1188 let args = #{button: 0, row: 2, col: 4, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1189 call assert_false(test_gui_event('mouse', args))
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1190 let args = #{button: 0, row: 2, col: 4, multiclick: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1191 call assert_false(test_gui_event('mouse', args))
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1192
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1193 " Error cases for test_gui_event()
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1194 call assert_fails("call test_gui_event('a1b2c3', args)", 'E475:')
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1195 call assert_fails("call test_gui_event([], args)", 'E1174:')
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1196 call assert_fails("call test_gui_event('abc', [])", 'E1206:')
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1197 call assert_fails("call test_gui_event(test_null_string(), {})", 'E475:')
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1198 call assert_false(test_gui_event('mouse', test_null_dict()))
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1199
24982
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1200 bw!
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1201 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
1202 set mousemodel&
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1203 endfunc
4cb423b9250d patch 8.2.3028: GUI mouse events not tested
Bram Moolenaar <Bram@vim.org>
parents: 24035
diff changeset
1204
28883
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1205 " Move the mouse to the top-left in preparation for mouse events
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1206 func PrepareForMouseEvent(args)
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1207 call extend(a:args, #{row: 1, col:1})
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1208 call test_gui_event('mouse', a:args)
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1209 call feedkeys('', 'Lx!')
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1210 " on MS-Windows the event may have a slight delay
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1211 if has('win32')
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1212 sleep 20m
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1213 endif
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1214 endfunc
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1215
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1216 func MouseWasMoved()
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1217 let pos = getmousepos()
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1218 call add(g:eventlist, #{row: pos.screenrow, col: pos.screencol})
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1219 endfunc
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1220
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1221 func Test_gui_mouse_move_event()
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1222 let args = #{move: 1, button: 0, multiclick: 0, modifiers: 0}
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1223
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1224 " by default, does not generate mouse move events
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1225 set mousemev&
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1226 call assert_false(&mousemev)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1227
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1228 let g:eventlist = []
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1229 nnoremap <special> <silent> <MouseMove> :call MouseWasMoved()<CR>
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1230
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1231 " start at mouse pos (1,1), clear counter
28883
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1232 call PrepareForMouseEvent(args)
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1233 let g:eventlist = []
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1234
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1235 call extend(args, #{row: 3, col: 30, cell: v:true})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1236 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1237 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1238
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1239 call extend(args, #{row: 10, col: 30, cell: v:true})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1240 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1241 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1242
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1243 " no events since mousemev off
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1244 call assert_equal([], g:eventlist)
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1245
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1246 " turn on mouse events and try the same thing
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1247 set mousemev
28883
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1248 call PrepareForMouseEvent(args)
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1249 let g:eventlist = []
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1250
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1251 call extend(args, #{row: 3, col: 30, cell: v:true})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1252 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1253 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1254
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1255 call extend(args, #{row: 10, col: 30, cell: v:true})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1256 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1257 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1258
28889
d401ff43cd5f patch 8.2.4967: MS-Windows GUI: mouse event test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 28887
diff changeset
1259 " FIXME: on MS-Windows we get a stray event first
d401ff43cd5f patch 8.2.4967: MS-Windows GUI: mouse event test sometimes fails
Bram Moolenaar <Bram@vim.org>
parents: 28887
diff changeset
1260 if has('win32') && len(g:eventlist) == 3
28887
0e207ddd939d patch 8.2.4966: MS-Windows GUI: mouse event test gets extra event
Bram Moolenaar <Bram@vim.org>
parents: 28885
diff changeset
1261 let g:eventlist = g:eventlist[1 : ]
0e207ddd939d patch 8.2.4966: MS-Windows GUI: mouse event test gets extra event
Bram Moolenaar <Bram@vim.org>
parents: 28885
diff changeset
1262 endif
0e207ddd939d patch 8.2.4966: MS-Windows GUI: mouse event test gets extra event
Bram Moolenaar <Bram@vim.org>
parents: 28885
diff changeset
1263
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1264 call assert_equal([#{row: 4, col: 31}, #{row: 11, col: 31}], g:eventlist)
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1265
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1266 " wiggle the mouse around within a screen cell, shouldn't trigger events
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1267 call extend(args, #{cell: v:false})
28883
d5436dbdd082 patch 8.2.4964: MS-Windows GUI: mouse event test is flaky
Bram Moolenaar <Bram@vim.org>
parents: 28858
diff changeset
1268 call PrepareForMouseEvent(args)
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1269 let g:eventlist = []
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1270
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1271 call extend(args, #{row: 1, col: 2, cell: v:false})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1272 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1273 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1274
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1275 call extend(args, #{row: 2, col: 2, cell: v:false})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1276 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1277 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1278
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1279 call extend(args, #{row: 2, col: 1, cell: v:false})
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1280 call test_gui_event('mouse', args)
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1281 call feedkeys('', 'Lx!')
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1282
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1283 call assert_equal([], g:eventlist)
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1284
28885
947b7d061b07 patch 8.2.4965: GUI: testing mouse move event depends on screen cell size
Bram Moolenaar <Bram@vim.org>
parents: 28883
diff changeset
1285 unlet g:eventlist
28297
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1286 unmap <MouseMove>
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1287 set mousemev&
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1288 endfunc
4190b932e6ca patch 8.2.4674: cannot force getting MouseMove events
Bram Moolenaar <Bram@vim.org>
parents: 28171
diff changeset
1289
24998
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1290 " 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
1291 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
1292 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
1293 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
1294 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
1295 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1296
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1297 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
1298 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
1299 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
1300 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
1301 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1302
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1303 func Test_gui_tablabel_tooltip()
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1304 %bw!
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1305 " 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
1306 " 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
1307 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
1308 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
1309 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
1310 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
1311 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
1312 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
1313 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
1314 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
1315 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
1316 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
1317 redrawtabline
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1318 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
1319 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
1320 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
1321 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
1322 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
1323 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
1324
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1325 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
1326 " 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
1327 " 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
1328 " 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
1329 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
1330 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
1331 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
1332 redrawtabline
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1333 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
1334 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
1335 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
1336 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
1337 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
1338 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
1339 endif
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1340 %bw!
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1341 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
1342 endfunc
3b1770226f85 patch 8.2.3036: Vim9: builtin function arguments not checked at compile time
Bram Moolenaar <Bram@vim.org>
parents: 24982
diff changeset
1343
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1344 " 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
1345 func DropFilesInCmdLine()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1346 call feedkeys(":\"", 'L')
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1347 let d = #{files: ['a.c', 'b.c'], row: &lines, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1348 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1349 call feedkeys("\<CR>", 'L')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1350 endfunc
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1351
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1352 func Test_gui_drop_files()
25060
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1353 CheckFeature drop_file
54c0cb81e6a7 patch 8.2.3067: building fails with Athena
Bram Moolenaar <Bram@vim.org>
parents: 25006
diff changeset
1354
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1355 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1356 %argdelete
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1357 let d = #{files: [], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1358 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1359 call assert_equal([], argv())
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1360 let d = #{files: [1, 2], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1361 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1362 call assert_equal([], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1363
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1364 let d = #{files: ['a.c', 'b.c'], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1365 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1366 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
1367 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1368 %argdelete
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1369 let d = #{files: [], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1370 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1371 call assert_equal([], argv())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1372 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1373 " 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
1374 " a new window
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1375 set modified
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1376 let d = #{files: ['x.c', 'y.c'], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1377 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1378 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
1379 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1380 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
1381 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1382 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1383 " if Ctrl is pressed, then the file should be opened in a new window
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1384 let d = #{files: ['s.py', 't.py'], row: 1, col: 1, modifiers: 0x10}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1385 eval 'dropfiles'->test_gui_event(d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1386 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
1387 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1388 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
1389 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1390 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1391 " 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
1392 belowright new
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1393 let d = #{files: ['a.py', 'b.py'], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1394 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1395 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
1396 call assert_equal(2, winnr('$'))
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1397 call assert_equal(1, winnr())
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1398 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
1399 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1400 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1401 " 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
1402 let save_cwd = getcwd()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1403 call mkdir('Xdir1')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1404 call writefile([], 'Xdir1/Xfile1')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1405 call writefile([], 'Xdir1/Xfile2')
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1406 let d = #{files: ['Xdir1/Xfile1', 'Xdir1/Xfile2'], row: 1, col: 1,
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1407 \ modifiers: 0x4}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1408 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1409 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
1410 call assert_equal('Xfile1', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1411 call chdir(save_cwd)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1412 " pressing shift when dropping directory and files should change directory
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1413 let d = #{files: ['Xdir1', 'Xdir1/Xfile2'], row: 1, col: 1, modifiers: 0x4}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1414 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1415 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
1416 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
1417 call chdir(save_cwd)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1418 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1419 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1420 " dropping a directory should edit it
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1421 let d = #{files: ['Xdir1'], row: 1, col: 1, modifiers: 0}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1422 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1423 call assert_equal('Xdir1', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1424 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1425 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1426 " dropping only a directory name with Shift should ignore it
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1427 let d = #{files: ['Xdir1'], row: 1, col: 1, modifiers: 0x4}
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1428 call test_gui_event('dropfiles', d)
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1429 call assert_equal('', @%)
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1430 %bw!
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1431 %argdelete
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1432 call delete('Xdir1', 'rf')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1433 " 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
1434 " 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
1435 " 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
1436 cnoremap <expr> <buffer> <F4> DropFilesInCmdLine()
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1437 call feedkeys(":\"\<F4>\<CR>", 'xt')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1438 call feedkeys('k', 'Lx!')
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1439 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
1440 cunmap <buffer> <F4>
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1441
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1442 " Invalid arguments
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1443 call assert_false(test_gui_event("dropfiles", {}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1444 let d = #{row: 1, col: 1, modifiers: 0}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1445 call assert_false(test_gui_event("dropfiles", d))
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1446 let d = #{files: 1, row: 1, col: 1, modifiers: 0}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1447 call assert_false(test_gui_event("dropfiles", d))
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1448 let d = #{files: test_null_list(), row: 1, col: 1, modifiers: 0}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1449 call assert_false(test_gui_event("dropfiles", d))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1450 let d = #{files: [test_null_string()], row: 1, col: 1, modifiers: 0}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1451 call assert_true(test_gui_event("dropfiles", d))
25006
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1452 endfunc
496221916885 patch 8.2.3040: GUI: dropping files not tested
Bram Moolenaar <Bram@vim.org>
parents: 24998
diff changeset
1453
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1454 " 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
1455 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
1456 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1457 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1458 tabedit Xfile2
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1459 tabedit Xfile3
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1460
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1461 tabfirst
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1462 call assert_equal(v:true, test_gui_event('tabline', #{tabnr: 2}))
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1463 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
1464 call assert_equal(2, tabpagenr())
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1465 call assert_equal(v:true, test_gui_event('tabline', #{tabnr: 3}))
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1466 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
1467 call assert_equal(3, tabpagenr())
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1468 call assert_equal(v:false, 'tabline'->test_gui_event(#{tabnr: 3}))
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1469
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1470 " From the cmdline window, tabline event should not be handled
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1471 call feedkeys("q::let t = test_gui_event('tabline', #{tabnr: 2})\<CR>:q\<CR>", 'x!')
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1472 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
1473
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1474 " Invalid arguments
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1475 call assert_false(test_gui_event('tabline', {}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1476 call assert_false(test_gui_event('tabline', #{abc: 1}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1477
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1478 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1479 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1480
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1481 " 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
1482 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
1483 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1484
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1485 " Try to close the last tab page
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1486 call test_gui_event('tabmenu', #{tabnr: 1, item: 1})
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1487 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
1488
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1489 edit Xfile1
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1490 tabedit Xfile2
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1491 call test_gui_event('tabmenu', #{tabnr: 1, item: 1})
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1492 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
1493 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
1494 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
1495
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1496 eval 'tabmenu'->test_gui_event(#{tabnr: 1, item: 2})
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1497 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
1498 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
1499
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1500 " If tabnr is 0, then the current tabpage should be used.
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1501 call test_gui_event('tabmenu', #{tabnr: 0, item: 2})
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1502 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
1503 call assert_equal(3, tabpagenr('$'))
27462
b43f6c879d52 patch 8.2.4259: number of test functions for GUI events is growing
Bram Moolenaar <Bram@vim.org>
parents: 27400
diff changeset
1504 call test_gui_event('tabmenu', #{tabnr: 0, item: 1})
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1505 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
1506 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
1507
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1508 " Invalid arguments
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1509 call assert_false(test_gui_event('tabmenu', {}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1510 call assert_false(test_gui_event('tabmenu', #{tabnr: 1}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1511 call assert_false(test_gui_event('tabmenu', #{item: 1}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1512 call assert_false(test_gui_event('tabmenu', #{abc: 1}))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1513
27400
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1514 %bw!
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1515 endfunc
722db0819111 patch 8.2.4228: no tests for clicking in the GUI tabline
Bram Moolenaar <Bram@vim.org>
parents: 26743
diff changeset
1516
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1517 " Test for find/replace text dialog event
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1518 func Test_gui_findrepl()
28000
fc34d6c4a42c patch 8.2.4525: some GUI tests don't work on Athena
Bram Moolenaar <Bram@vim.org>
parents: 27994
diff changeset
1519 " Find/Replace dialog is supported only on GTK, Motif and MS-Windows.
fc34d6c4a42c patch 8.2.4525: some GUI tests don't work on Athena
Bram Moolenaar <Bram@vim.org>
parents: 27994
diff changeset
1520 if !has('gui_gtk') && !has('gui_motif') && !has('gui_win32')
fc34d6c4a42c patch 8.2.4525: some GUI tests don't work on Athena
Bram Moolenaar <Bram@vim.org>
parents: 27994
diff changeset
1521 return
fc34d6c4a42c patch 8.2.4525: some GUI tests don't work on Athena
Bram Moolenaar <Bram@vim.org>
parents: 27994
diff changeset
1522 endif
fc34d6c4a42c patch 8.2.4525: some GUI tests don't work on Athena
Bram Moolenaar <Bram@vim.org>
parents: 27994
diff changeset
1523
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1524 new
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1525 call setline(1, ['one two one', 'Twoo One two oneo'])
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1526
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1527 " Replace all instances of a string with another
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1528 let args = #{find_text: 'one', repl_text: 'ONE', flags: 0x4, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1529 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1530 call assert_equal(['ONE two ONE', 'Twoo ONE two ONEo'], getline(1, '$'))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1531
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1532 " Replace all instances of a whole string with another
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1533 call cursor(1, 1)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1534 let args = #{find_text: 'two', repl_text: 'TWO', flags: 0xC, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1535 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1536 call assert_equal(['ONE TWO ONE', 'Twoo ONE TWO ONEo'], getline(1, '$'))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1537
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
1538 " Find next occurrence of a string (in a find dialog)
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1539 call cursor(1, 11)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1540 let args = #{find_text: 'TWO', repl_text: '', flags: 0x11, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1541 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1542 call assert_equal([2, 10], [line('.'), col('.')])
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1543
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
1544 " Find previous occurrences of a string (in a find dialog)
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1545 call cursor(1, 11)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1546 let args = #{find_text: 'TWO', repl_text: '', flags: 0x11, forward: 0}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1547 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1548 call assert_equal([1, 5], [line('.'), col('.')])
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1549
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
1550 " Find next occurrence of a string (in a replace dialog)
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1551 call cursor(1, 1)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1552 let args = #{find_text: 'Twoo', repl_text: '', flags: 0x2, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1553 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1554 call assert_equal([2, 1], [line('.'), col('.')])
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1555
28171
b4c111ea83b1 patch 8.2.4611: typos in tests; one lua line not covered by test
Bram Moolenaar <Bram@vim.org>
parents: 28000
diff changeset
1556 " Replace only the next occurrence of a string (once)
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1557 call cursor(1, 5)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1558 let args = #{find_text: 'TWO', repl_text: 'two', flags: 0x3, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1559 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1560 call assert_equal(['ONE two ONE', 'Twoo ONE TWO ONEo'], getline(1, '$'))
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1561
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1562 " Replace all instances of a whole string with another matching case
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1563 call cursor(1, 1)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1564 let args = #{find_text: 'TWO', repl_text: 'two', flags: 0x1C, forward: 1}
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1565 call test_gui_event('findrepl', args)
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1566 call assert_equal(['ONE two ONE', 'Twoo ONE two ONEo'], getline(1, '$'))
27497
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1567
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1568 " Invalid arguments
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1569 call assert_false(test_gui_event('findrepl', {}))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1570 let args = #{repl_text: 'a', flags: 1, forward: 1}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1571 call assert_false(test_gui_event('findrepl', args))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1572 let args = #{find_text: 'a', flags: 1, forward: 1}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1573 call assert_false(test_gui_event('findrepl', args))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1574 let args = #{find_text: 'a', repl_text: 'b', forward: 1}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1575 call assert_false(test_gui_event('findrepl', args))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1576 let args = #{find_text: 'a', repl_text: 'b', flags: 1}
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1577 call assert_false(test_gui_event('findrepl', args))
7480a2e2ca0f patch 8.2.4276: separate test function for the GUI scrollbar
Bram Moolenaar <Bram@vim.org>
parents: 27470
diff changeset
1578
27470
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1579 bw!
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1580 endfunc
f0096e5b3df9 patch 8.2.4263: no test for the GUI find/replace dialog
Bram Moolenaar <Bram@vim.org>
parents: 27462
diff changeset
1581
28644
0c63014c2513 patch 8.2.4846: termcodes test fails
Bram Moolenaar <Bram@vim.org>
parents: 28641
diff changeset
1582 func Test_gui_CTRL_SHIFT_V()
0c63014c2513 patch 8.2.4846: termcodes test fails
Bram Moolenaar <Bram@vim.org>
parents: 28641
diff changeset
1583 call feedkeys(":let g:str = '\<*C-S-V>\<*C-S-I>\<*C-S-V>\<*C-S-@>'\<CR>", 'tx')
28641
fdb18b1122f7 patch 8.2.4844: <C-S-I> is simplified to <S-Tab>
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1584 call assert_equal('<C-S-I><C-S-@>', g:str)
fdb18b1122f7 patch 8.2.4844: <C-S-I> is simplified to <S-Tab>
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1585 unlet g:str
fdb18b1122f7 patch 8.2.4844: <C-S-I> is simplified to <S-Tab>
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1586 endfunc
fdb18b1122f7 patch 8.2.4844: <C-S-I> is simplified to <S-Tab>
Bram Moolenaar <Bram@vim.org>
parents: 28303
diff changeset
1587
29183
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1588 func Test_gui_dialog_file()
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1589 let lines =<< trim END
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1590 file Xfile
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1591 normal axxx
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1592 confirm qa
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1593 END
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1594 call writefile(lines, 'Xlines')
29185
523a97eab139 patch 8.2.5112: gui test hangs on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29183
diff changeset
1595 let prefix = '!'
523a97eab139 patch 8.2.5112: gui test hangs on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29183
diff changeset
1596 if has('win32')
523a97eab139 patch 8.2.5112: gui test hangs on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29183
diff changeset
1597 let prefix = '!start '
523a97eab139 patch 8.2.5112: gui test hangs on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29183
diff changeset
1598 endif
523a97eab139 patch 8.2.5112: gui test hangs on MS-Windows
Bram Moolenaar <Bram@vim.org>
parents: 29183
diff changeset
1599 execute prefix .. GetVimCommand() .. ' -g -f --clean --gui-dialog-file Xdialog -S Xlines'
29183
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1600
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1601 call WaitForAssert({-> assert_true(filereadable('Xdialog'))})
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1602 call assert_match('Question: Save changes to "Xfile"?', readfile('Xdialog')->join('<NL>'))
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1603
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1604 call delete('Xdialog')
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1605 call delete('Xfile')
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1606 call delete('Xlines')
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1607 endfunc
8f6b850bb8c3 patch 8.2.5111: no test for --gui-dialog-file
Bram Moolenaar <Bram@vim.org>
parents: 29052
diff changeset
1608
29432
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1609 " Test for sending low level key presses
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1610 func SendKeys(keylist)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1611 for k in a:keylist
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1612 call test_gui_event("sendevent", #{event: "keydown", keycode: k})
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1613 endfor
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1614 for k in reverse(a:keylist)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1615 call test_gui_event("sendevent", #{event: "keyup", keycode: k})
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1616 endfor
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1617 endfunc
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1618
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1619 func Test_gui_lowlevel_keyevent()
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1620 CheckMSWindows
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1621 new
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1622
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1623 " Test for <Ctrl-A> to <Ctrl-Z> keys
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1624 for kc in range(65, 90)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1625 call SendKeys([0x11, kc])
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1626 let ch = getcharstr()
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1627 call assert_equal(nr2char(kc - 64), ch)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1628 endfor
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1629
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1630 " Test for the various Ctrl and Shift key combinations.
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1631 let keytests = [
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1632 \ [[0x10, 0x21], "\<S-Pageup>", 2],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1633 \ [[0x11, 0x21], "\<C-Pageup>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1634 \ [[0x10, 0x22], "\<S-PageDown>", 2],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1635 \ [[0x11, 0x22], "\<C-PageDown>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1636 \ [[0x10, 0x23], "\<S-End>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1637 \ [[0x11, 0x23], "\<C-End>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1638 \ [[0x10, 0x24], "\<S-Home>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1639 \ [[0x11, 0x24], "\<C-Home>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1640 \ [[0x10, 0x25], "\<S-Left>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1641 \ [[0x11, 0x25], "\<C-Left>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1642 \ [[0x10, 0x26], "\<S-Up>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1643 \ [[0x11, 0x26], "\<C-Up>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1644 \ [[0x10, 0x27], "\<S-Right>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1645 \ [[0x11, 0x27], "\<C-Right>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1646 \ [[0x10, 0x28], "\<S-Down>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1647 \ [[0x11, 0x28], "\<C-Down>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1648 \ [[0x11, 0x30], "\<C-0>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1649 \ [[0x11, 0x31], "\<C-1>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1650 \ [[0x11, 0x32], "\<C-2>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1651 \ [[0x11, 0x33], "\<C-3>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1652 \ [[0x11, 0x34], "\<C-4>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1653 \ [[0x11, 0x35], "\<C-5>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1654 \ [[0x11, 0x36], "\<C-^>", 0],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1655 \ [[0x11, 0x37], "\<C-7>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1656 \ [[0x11, 0x38], "\<C-8>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1657 \ [[0x11, 0x39], "\<C-9>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1658 \ [[0x11, 0x60], "\<C-0>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1659 \ [[0x11, 0x61], "\<C-1>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1660 \ [[0x11, 0x62], "\<C-2>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1661 \ [[0x11, 0x63], "\<C-3>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1662 \ [[0x11, 0x64], "\<C-4>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1663 \ [[0x11, 0x65], "\<C-5>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1664 \ [[0x11, 0x66], "\<C-6>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1665 \ [[0x11, 0x67], "\<C-7>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1666 \ [[0x11, 0x68], "\<C-8>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1667 \ [[0x11, 0x69], "\<C-9>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1668 \ [[0x11, 0x6A], "\<C-*>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1669 \ [[0x11, 0x6B], "\<C-+>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1670 \ [[0x11, 0x6D], "\<C-->", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1671 \ [[0x11, 0x70], "\<C-F1>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1672 \ [[0x11, 0x71], "\<C-F2>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1673 \ [[0x11, 0x72], "\<C-F3>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1674 \ [[0x11, 0x73], "\<C-F4>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1675 \ [[0x11, 0x74], "\<C-F5>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1676 \ [[0x11, 0x75], "\<C-F6>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1677 \ [[0x11, 0x76], "\<C-F7>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1678 \ [[0x11, 0x77], "\<C-F8>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1679 \ [[0x11, 0x78], "\<C-F9>", 4],
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1680 \ ]
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1681
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1682 for [kcodes, kstr, kmod] in keytests
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1683 call SendKeys(kcodes)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1684 let ch = getcharstr()
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1685 let mod = getcharmod()
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1686 call assert_equal(kstr, ch, $"key = {kstr}")
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1687 call assert_equal(kmod, mod)
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1688 endfor
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1689
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1690 bw!
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1691 endfunc
339fe2968690 patch 9.0.0058: Win32: cannot test low level events
Bram Moolenaar <Bram@vim.org>
parents: 29272
diff changeset
1692
19783
546bdeef35f1 patch 8.2.0448: various functions not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18767
diff changeset
1693 " vim: shiftwidth=2 sts=2 expandtab