@@ -35,11 +35,48 @@ func Test_1_set_secure()
3535 call assert_equal (1 , has (' gui_running' ))
3636endfunc
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+
3875func 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
4481func 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
0 commit comments