Commit | Line | Data |
b41abbd6 |
1 | #!perl |
2 | use strict; |
3 | use warnings; |
4 | use SDL::Config; |
5 | use Test::More; |
6 | |
7 | if ( SDL::Config->has('SDL_ttf') ) { |
8 | plan( tests => 10 ); |
9 | } else { |
10 | plan( skip_all => 'SDL_ttf support not compiled' ); |
11 | } |
12 | |
13 | use_ok('SDL'); |
14 | use_ok('SDL::Color'); |
15 | use_ok('SDL::Surface'); |
16 | use_ok('SDL::TTF_Font'); |
17 | |
18 | SDL::TTF_Init(); |
19 | |
20 | my $ttf_font = SDL::TTF_OpenFont( 'test/data/aircut3.ttf', 12 ); |
21 | isa_ok( $ttf_font, 'SDL::TTF_Font' ); |
22 | my ( $w, $h ) = @{ SDL::TTF_SizeText( $ttf_font, 'Hello!' ) }; |
23 | is( $w, 27, '"Hello!" has width 27' ); |
24 | is( $h, 14, '"Hello!" has width 14' ); |
25 | |
26 | my $surface = SDL::TTF_RenderText_Blended( $ttf_font, 'Hello!', |
27 | SDL::Color->new( 255, 0, 0 ) ); |
28 | isa_ok( $surface, 'SDL::Surface' ); |
29 | is( $surface->w, 27, 'Surface has width 27' ); |
30 | is( $surface->h, 14, 'Surface has width 14' ); |
31 | |
32 | SDL::TTF_Quit(); |