From: Kartik Thakore Date: Fri, 16 Oct 2009 00:34:08 +0000 (-0400) Subject: Added file t/core_surface.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b7ed9095b918fe7014ba59a7b71f3dbf6227ac51;p=sdlgit%2FSDL_perl.git Added file t/core_surface.t --- diff --git a/src/Surface.xs b/src/Surface.xs index 29e9427..f3805db 100644 --- a/src/Surface.xs +++ b/src/Surface.xs @@ -144,7 +144,7 @@ IV surface_get_pixels(surface) SDL_Surface *surface CODE: - printf("Incomplete surface"); + if(!surface->pixels) croak("Incomplete surface"); RETVAL = PTR2IV(surface->pixels); OUTPUT: RETVAL diff --git a/t/core_surface.t b/t/core_surface.t new file mode 100644 index 0000000..143a791 --- /dev/null +++ b/t/core_surface.t @@ -0,0 +1,42 @@ +#!perl -w +# Copyright (C) 2009 kthakore +# +# Spec tests for SDL::Surface +# + +BEGIN { + unshift @INC, 'blib/lib','blib/arch'; + } + +use strict; +use SDL; +use SDL::Config; +use SDL::Surface; +use SDL::App; +use SDL::Rect; +use SDL::Color; +use Test::More; + +plan (tests => 2 ); + + +my $app = SDL::App->new(-title => "Test", -width => 640, -height => 480, -init => SDL_INIT_VIDEO); + +pass 'did this pass'; + +my $rect = SDL::Rect->new(0,0, $app->w, $app->h); + + + my $blue = SDL::Color->new( + 0x00, + 0x00, + 0xff, + ); + +$app->fill_rect($rect,$blue); + + +print 'This is in surface : '.SDL::Surface::get_pixels($app); + +pass 'did this pass'; +