Skip to content

Commit

Permalink
Fixed tests and error message for Sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Thakore committed Jul 15, 2010
1 parent 5be4261 commit 83d5c81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Expand Up @@ -341,7 +341,7 @@ my %subsystems =
from => 'src/Image.xs',
to => 'lib/SDL/Image.xs',
},
libraries => [qw( SDL SDL_image jpeg png tiff)],
libraries => [qw( SDL SDL_image )],
},
SFont => {
file => {
Expand Down
2 changes: 1 addition & 1 deletion lib/SDLx/Sprite.pm
Expand Up @@ -46,7 +46,7 @@ sub new {
else
{

Carp::croak "Need a surface or an image name";
Carp::croak "Need a surface => SDL::Surface, an image => name, or ( width => ... , height => ...)";
}


Expand Down
13 changes: 6 additions & 7 deletions t/sdlx_sprite.t
Expand Up @@ -36,27 +36,27 @@ elsif( !SDL::Config->has('SDL_image') )

my $disp = SDL::Video::set_video_mode( 300, 300, 32, SDL_ANYFORMAT);

my $sprite = SDLx::Sprite->new;
my $sprite = SDLx::Sprite->new( width => 1, height => 1);

# test initial values
ok($sprite, 'object defined');
#ok($sprite, 'object defined');
isa_ok ( $sprite, 'SDLx::Sprite');

my $rect = $sprite->rect;
ok($rect, 'rect defined upon raw initialization');
isa_ok($rect, 'SDL::Rect', 'spawned rect isa SDL::Rect');
is($rect->x, 0, 'rect->x init');
is($rect->y, 0, 'rect->y init');
is($rect->w, 0, 'rect->w init');
is($rect->h, 0, 'rect->h init');
is($rect->w, 1, 'rect->w init');
is($rect->h, 1, 'rect->h init');

my ($x, $y) = ($sprite->x, $sprite->y);
is($x, 0, 'no x defined upon raw initialization');
is($y, 0, 'no y defined upon raw initialization');

my ($w, $h) = ($sprite->w, $sprite->h);
is($w, 0, 'no w defined upon raw initialization');
is($h, 0, 'no h defined upon raw initialization');
is($w, 1, 'w defined upon raw initialization');
is($h, 1, 'h defined upon raw initialization');


isa_ok ( $sprite->load('test/data/hero.png'), 'SDLx::Sprite', '[load] works');
Expand All @@ -80,4 +80,3 @@ else
{
delete $ENV{SDL_VIDEODRIVER};
}

0 comments on commit 83d5c81

Please sign in to comment.