FreeBSD audio on cpan still fails. So fixed test to catch it better
Kartik Thakore [Mon, 31 Aug 2009 10:19:43 +0000 (06:19 -0400)]
lib/SDL/Surface.pm
src/SDL.xs
t/mixerpm.t
t/surfaceML.t

index 8d09500..d0a53d6 100644 (file)
@@ -163,10 +163,6 @@ sub pixel {
 }
 
 sub fill {
-       croak "SDL::Surface::fill requires a SDL::Rect object"
-               unless !$SDL::DEBUG || $_[1] == 0 || $_[1]->isa('SDL::Rect');
-       croak "SDL::Surface::fill requires a SDL::Color object"
-               unless !$SDL::DEBUG || $_[2]->isa('SDL::Color');
        if ($_[1] == 0 ) {
                SDL::FillRect(${$_[0]},0,${$_[2]});
        } else {
index 806e609..07b3d0b 100644 (file)
@@ -1414,10 +1414,11 @@ void
 UpdateRects ( surface, ... )
        SDL_Surface *surface
        CODE:
-               SDL_Rect *rects, *temp;
+               SDL_Rect *rects, *oldrects, *temp;
                int num_rects,i;
                if ( items < 2 ) return;
-               num_rects = items - 1;  
+               num_rects = items - 1;
+               oldrects = rects;       
                rects = (SDL_Rect *)safemalloc(sizeof(SDL_Rect)*items);
                for(i=0;i<num_rects;i++) {
                        temp = (SDL_Rect *)SvIV(ST(i+1));
@@ -1428,6 +1429,7 @@ UpdateRects ( surface, ... )
                } 
                SDL_UpdateRects(surface,num_rects,rects);
                safefree(rects);
+               safefree(oldrects);
 
 int
 Flip ( surface )
index 359d537..f7e7150 100644 (file)
@@ -43,7 +43,11 @@ use Test::More;
 
 if ( SDL::Config->has('SDL_mixer') ) {
        plan ( tests => 3 );
-} else {
+} 
+elsif ( SDL::Init(SDL_INIT_AUDIO) < 0) {
+                       plan( skip_all => "Cannot initialize audio!!" );
+                               }                       
+else {
        plan ( skip_all => 'SDL_mixer support not compiled' );
 }
 
@@ -87,10 +91,6 @@ can_ok ('SDL::Mixer', qw/
        /);
 
 
-if ( SDL::Init(SDL_INIT_AUDIO) < 0) {
-               plan( skip_all => "Cannot initialize audio!!" );
-       }
-
 # these are exported by default, so main:: should know them:
 my $mixer = SDL::Mixer->new();
 isa_ok($mixer, 'SDL::Mixer', 'Checking if mixer can be build');
index 5b304f1..7ece8a3 100644 (file)
@@ -46,11 +46,11 @@ use Test::More;
 sub surface_leak()
 {
        use SDL;
-       use SDL::Surface;
+       use SDL::App;
        use SDL::Rect;
        use SDL::Color;
 
-       my $window = SDL::Surface->new(
+       my $window = SDL::App->new(
                -width => 640,
                -height => 480,
                -depth => 16,