2 # Copyright (C) 2009 kthakore
4 # Spec tests for SDL::Surface
8 unshift @INC, 'blib/lib', 'blib/arch';
18 use Test::More tests => 9;
21 = SDL::Surface->new( SDL::SDL_ANYFORMAT(), 640, 320, 0, 0, 0, 0, 0 );
22 isa_ok( $surface, 'SDL::Surface' );
23 is( $surface->w, 640, 'surface has width' );
24 is( $surface->h, 320, 'surface has height' );
26 my $image = SDL::Surface->load('test/data/logo.png');
27 is( $image->w, 608, 'image has width' );
28 is( $image->h, 126, 'image has height' );
30 $surface->fill_rect( SDL::Rect->new( 0, 0, 32, 32 ),
31 SDL::Color->new( 200, 200, 200 ) );
32 ok( 1, 'Managed to fill_rect' );
34 my $small_rect = SDL::Rect->new( 0, 0, 64, 64 );
35 $image->blit( $small_rect, $surface, $small_rect );
36 ok( 1, 'Managed to blit' );
38 #my $image_format = $surface->display;
39 #$surface->update_rect( 0, 0, 32, 32 );
40 #ok( 1, 'Managed to update_rect' );
41 #$surface->update_rects( SDL::Rect->new( 0, 0, 32, 32 ) );
42 #ok( 1, 'Managed to update_rects' );
44 my $app = SDL::App->new(
48 -init => SDL_INIT_VIDEO
53 my $rect = SDL::Rect->new( 0, 0, $app->w, $app->h );
55 my $blue = SDL::Color->new( 0x00, 0x00, 0xff, );
57 $app->fill_rect( $rect, $blue );
59 diag( 'This is in surface : ' . SDL::Surface::get_pixels($app) );