Skip to content

Commit 6f78574

Browse files
committed
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)
1 parent 88989cc commit 6f78574

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

src/testdir/test_gui.vim

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,48 @@ func Test_1_set_secure()
3535
call assert_equal(1, has('gui_running'))
3636
endfunc
3737

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+
3875
func Test_getwinpos()
3976
call assert_match('Window position: X \d\+, Y \d\+', execute('winpos'))
4077
call assert_true(getwinposx() >= 0)
4178
call assert_true(getwinposy() >= 0)
42-
endfunction
79+
endfunc
4380

4481
func Test_shell_command()
4582
new
@@ -54,4 +91,4 @@ func Test_windowid_variable()
5491
else
5592
call assert_equal(0, v:windowid)
5693
endif
57-
endfunction
94+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
313,
767769
/**/
768770
312,
769771
/**/

0 commit comments

Comments
 (0)