Mercurial > vim
comparison src/testdir/test_gui.vim @ 10847:881194ae47a1 v8.0.0313
patch 8.0.0313: not enough testing for GUI functionality
commit https://github.com/vim/vim/commit/6f785749db766205616fcf8438f43d1859d8f5e4
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 6 22:11:55 2017 +0100
patch 8.0.0313: not enough testing for GUI functionality
Problem: Not enough testing for GUI functionality.
Solution: Add tests for the GUI font. (Kazunobu Kuriyama)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 06 Feb 2017 22:15:03 +0100 |
parents | 5c0415a8b96e |
children | 0beffabed338 |
comparison
equal
deleted
inserted
replaced
10846:877c60bf316e | 10847:881194ae47a1 |
---|---|
33 set exrc secure | 33 set exrc secure |
34 gui -f | 34 gui -f |
35 call assert_equal(1, has('gui_running')) | 35 call assert_equal(1, has('gui_running')) |
36 endfunc | 36 endfunc |
37 | 37 |
38 func Test_getfontname_with_arg() | |
39 if has('gui_athena') || has('gui_motif') | |
40 " Invalid font name. The result should be an empty string. | |
41 call assert_equal('', getfontname('notexist')) | |
42 | |
43 " Valid font name. This is usually the real name of 7x13 by default. | |
44 let l:fname = '-Misc-Fixed-Medium-R-Normal--13-120-75-75-C-70-ISO10646-1' | |
45 call assert_equal(l:fname, getfontname(l:fname)) | |
46 | |
47 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') | |
48 " Invalid font name. The result should be the name plus the default size. | |
49 call assert_equal('notexist 10', getfontname('notexist')) | |
50 | |
51 " Valid font name. This is usually the real name of Monospace by default. | |
52 let l:fname = 'Bitstream Vera Sans Mono 12' | |
53 call assert_equal(l:fname, getfontname(l:fname)) | |
54 else | |
55 throw "Skipped: Matched font name unpredictable to test on this GUI" | |
56 endif | |
57 endfunc | |
58 | |
59 func Test_getfontname_without_arg() | |
60 let l:fname = getfontname() | |
61 if has('gui_kde') | |
62 " 'expected' is the value specified by SetUp() above. | |
63 call assert_equal('Courier 10 Pitch/8/-1/5/50/0/0/0/0/0', l:fname) | |
64 elseif has('gui_athena') || has('gui_motif') | |
65 " 'expected' is DFLT_FONT of gui_x11.c. | |
66 call assert_equal('7x13', l:fname) | |
67 elseif has('gui_gtk2') || has('gui_gnome') || has('gui_gtk3') | |
68 " 'expected' is DEFAULT_FONT of gui_gtk_x11.c. | |
69 call assert_equal('Monospace 10', l:fname) | |
70 else | |
71 throw "Skipped: Default font name unpredictable to test on this GUI" | |
72 endif | |
73 endfunc | |
74 | |
38 func Test_getwinpos() | 75 func Test_getwinpos() |
39 call assert_match('Window position: X \d\+, Y \d\+', execute('winpos')) | 76 call assert_match('Window position: X \d\+, Y \d\+', execute('winpos')) |
40 call assert_true(getwinposx() >= 0) | 77 call assert_true(getwinposx() >= 0) |
41 call assert_true(getwinposy() >= 0) | 78 call assert_true(getwinposy() >= 0) |
42 endfunction | 79 endfunc |
43 | 80 |
44 func Test_shell_command() | 81 func Test_shell_command() |
45 new | 82 new |
46 r !echo hello | 83 r !echo hello |
47 call assert_equal('hello', substitute(getline(2), '\W', '', 'g')) | 84 call assert_equal('hello', substitute(getline(2), '\W', '', 'g')) |
52 if s:x11_based_gui || has('win32') | 89 if s:x11_based_gui || has('win32') |
53 call assert_true(v:windowid > 0) | 90 call assert_true(v:windowid > 0) |
54 else | 91 else |
55 call assert_equal(0, v:windowid) | 92 call assert_equal(0, v:windowid) |
56 endif | 93 endif |
57 endfunction | 94 endfunc |