Make test pass
[sdlgit/SDL_perl.git] / t / surfacepm.t
1 #!perl
2 use strict;
3 use warnings;
4 use Test::More tests => 11;
5 use_ok('SDL');
6 use_ok('SDL::Color');
7 use_ok('SDL::Rect');
8 use_ok('SDL::Surface');
9
10 my $surface
11     = SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 0, 0, 0, 0, 0 );
12 isa_ok( $surface, 'SDL::Surface' );
13 is( $surface->w, 640, 'surface has width' );
14 is( $surface->h, 320, 'surface has height' );
15
16 my $image = SDL::Surface->load('test/data/logo.png');
17 is( $image->w, 608, 'image has width' );
18 is( $image->h, 126, 'image has height' );
19
20 $surface->fill_rect( SDL::Rect->new( 0, 0, 32, 32 ),
21     SDL::Color->new( 200, 200, 200 ) );
22 ok( 1, 'Managed to fill_rect' );
23
24 my $rect = SDL::Rect->new( 0, 0, 64, 64 );
25 $image->blit( $rect, $surface, $rect );
26 ok( 1, 'Managed to blit' );
27
28 #my $image_format = $surface->display;
29 #$surface->update_rect( 0, 0, 32, 32 );
30 #ok( 1, 'Managed to update_rect' );
31 #$surface->update_rects( SDL::Rect->new( 0, 0, 32, 32 ) );
32 #ok( 1, 'Managed to update_rects' );
33