forked from macvim-dev/macvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_macvim.vim
More file actions
77 lines (64 loc) · 3.45 KB
/
test_macvim.vim
File metadata and controls
77 lines (64 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
" Test for MacVim behaviors and regressions
CheckFeature gui_macvim
" Tests for basic existence of commands and options to make sure no
" regressions have accidentally removed them
func Test_macvim_options_commands_exist()
" MacVim-specific options
call assert_true(exists('+antialias'), 'Missing option "antialias"')
call assert_true(exists('+blurradius'), 'Missing option "blurradius"')
call assert_true(exists('+fullscreen'), 'Missing option "fullscreen"')
call assert_true(exists('+fuoptions'), 'Missing option "fuoptions"')
call assert_true(exists('+macligatures'), 'Missing option "macligatures"')
call assert_true(exists('+macmeta'), 'Missing option "macmeta"')
call assert_true(exists('+macthinstrokes'), 'Missing option "macthinstrokes"')
call assert_true(exists('+transparency'), 'Missing option "transparency"')
" Other GUI options we care about
call assert_true(exists('+toolbariconsize'), 'Missing option "toolbariconsize"')
call assert_true(exists(':macaction'), 'Missing command "macaction"')
call assert_true(exists(':macmenu'), 'Missing command "macmenu"')
call assert_true(exists('*showdefinition'), 'Missing function "showdefinition"')
call assert_true(exists('##OSAppearanceChanged'), 'Missing autocmd event "OSAppearanceChanged"')
call assert_true(has('fullscreen'), 'Missing feature "fullscreen"')
call assert_true(has('gui_macvim'), 'Missing feature "gui_macvim"')
call assert_true(has('odbeditor'), 'Missing feature "odbeditor"')
call assert_true(has('touchbar'), 'Missing feature "touchbar"')
call assert_true(has('transparency'), 'Missing feature "transparency"')
" Vim system-specific features that we expect to be on in macOS
call assert_true(has('clientserver'), 'Missing feature "clientserver"')
call assert_true(has('clipboard'), 'Missing feature "clipboard"')
call assert_true(has('clipboard_working'), 'Missing feature "clipboard_working"')
call assert_true(has('sound'), 'Missing feature "sound"')
call assert_true(has('terminal'), 'Missing feature "terminal"')
call assert_true(has('xim'), 'Missing feature "xim"')
endfunc
" Test that Cmd-key and touch pad mappings are working (this doesn't actually
" test that the full mapping work properly as it's difficult to inject keys in
" Vimscript)
func Test_macvim_mappings()
let g:marker_value=0
nnoremap <D-1> :let g:marker_value=100<CR>
call feedkeys("\<D-1>", "xt")
call assert_equal(100, g:marker_value)
nnoremap <SwipeLeft> :let g:marker_value=1<CR>
call feedkeys("\<SwipeLeft>", "xt")
call assert_equal(1, g:marker_value)
nnoremap <SwipeRight> :let g:marker_value=2<CR>
call feedkeys("\<SwipeRight>", "xt")
call assert_equal(2, g:marker_value)
nnoremap <SwipeUp> :let g:marker_value=3<CR>
call feedkeys("\<SwipeUp>", "xt")
call assert_equal(3, g:marker_value)
nnoremap <SwipeDown> :let g:marker_value=4<CR>
call feedkeys("\<SwipeDown>", "xt")
call assert_equal(4, g:marker_value)
nnoremap <ForceClick> :let g:marker_value=5<CR>
call feedkeys("\<ForceClick>", "xt")
call assert_equal(5, g:marker_value)
endfunc
" Test that setting invalid values with properly throw invalid argument errors
func Test_macvim_invalid_options()
call assert_fails("let &blur=-1", 'E474:')
call assert_fails("let &transparency=-1", 'E474:')
call assert_fails("let &transparency=101", 'E474:')
call assert_fails("let &fuoptions='abcdef'", 'E474:')
endfunc