Skip to content
Browse files

Added file t/core_surface.t

  • Loading branch information...
1 parent 793e880 commit b7ed9095b918fe7014ba59a7b71f3dbf6227ac51 @kthakore kthakore committed Oct 15, 2009
Showing with 43 additions and 1 deletion.
  1. +1 −1 src/Surface.xs
  2. +42 −0 t/core_surface.t
View
2 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
View
42 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';
+

0 comments on commit b7ed909

Please sign in to comment.
Something went wrong with that request. Please try again.