PageRenderTime 18ms CodeModel.GetById 7ms app.highlight 8ms RepoModel.GetById 2ms app.codeStats 0ms

/t/ttf_font.t

http://github.com/PerlGameDev/SDL
Perl | 56 lines | 45 code | 10 blank | 1 comment | 1 complexity | 73ad0092af5ab271896af52f4959490c MD5 | raw file
 1#!/usr/bin/perl -w
 2use strict;
 3use warnings;
 4use SDL;
 5use SDL::Config;
 6
 7BEGIN {
 8	use FindBin;
 9	use File::Spec;
10	use Test::More;
11	use lib 't/lib';
12	use SDL::TestTool;
13
14	if ( !SDL::Config->has('SDL_ttf') ) {
15		plan( skip_all => 'SDL_ttf support not compiled' );
16	}
17}
18
19use SDL::TTF;
20use SDL::TTF::Font;
21use SDL::Version;
22my $font_filename = File::Spec->catfile(
23        $FindBin::Bin, '..', 'share', 'GenBasR.ttf'
24);
25
26my $lv = SDL::TTF::linked_version();
27my $cv = SDL::TTF::compile_time_version();
28
29isa_ok( $lv, 'SDL::Version', '[linked_version] returns a SDL::Version object' );
30isa_ok(
31	$cv, 'SDL::Version',
32	'[compile_time_version] returns a SDL::Version object'
33);
34printf(
35	"got version: %d.%d.%d/%d.%d.%d\n",
36	$lv->major, $lv->minor, $lv->patch, $cv->major, $cv->minor, $cv->patch
37);
38
39is( SDL::TTF::init(), 0, "[init] succeeded" );
40
41isa_ok(
42	SDL::TTF::Font->new( $font_filename, 24 ),
43	'SDL::TTF::Font',
44	"[new] with font and size"
45);
46isa_ok(
47	SDL::TTF::Font->new( $font_filename, 24, 0 ),
48	'SDL::TTF::Font',
49	"[new] with font, size and index"
50);
51
52is( SDL::TTF::quit(), undef, "[quit] ran" );
53
54done_testing;
55
56sleep(1);