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