File: ttf_font.t

package info (click to toggle)
libsdl-perl 2.548-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,972 kB
  • sloc: perl: 13,985; ansic: 583; makefile: 35
file content (56 lines) | stat: -rw-r--r-- 1,121 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/perl -w
use strict;
use warnings;
use SDL;
use SDL::Config;

BEGIN {
	use FindBin;
	use File::Spec;
	use Test::More;
	use lib 't/lib';
	use SDL::TestTool;

	if ( !SDL::Config->has('SDL_ttf') ) {
		plan( skip_all => 'SDL_ttf support not compiled' );
	}
}

use SDL::TTF;
use SDL::TTF::Font;
use SDL::Version;
my $font_filename = File::Spec->catfile(
        $FindBin::Bin, '..', 'share', 'GenBasR.ttf'
);

my $lv = SDL::TTF::linked_version();
my $cv = SDL::TTF::compile_time_version();

isa_ok( $lv, 'SDL::Version', '[linked_version] returns a SDL::Version object' );
isa_ok(
	$cv, 'SDL::Version',
	'[compile_time_version] returns a SDL::Version object'
);
printf(
	"got version: %d.%d.%d/%d.%d.%d\n",
	$lv->major, $lv->minor, $lv->patch, $cv->major, $cv->minor, $cv->patch
);

is( SDL::TTF::init(), 0, "[init] succeeded" );

isa_ok(
	SDL::TTF::Font->new( $font_filename, 24 ),
	'SDL::TTF::Font',
	"[new] with font and size"
);
isa_ok(
	SDL::TTF::Font->new( $font_filename, 24, 0 ),
	'SDL::TTF::Font',
	"[new] with font, size and index"
);

is( SDL::TTF::quit(), undef, "[quit] ran" );

done_testing;

sleep(1);