From: Kartik Thakore Date: Sat, 24 Oct 2009 21:19:50 +0000 (-0400) Subject: Added video_mode_ok() and its test. Fixed test list_modes better X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=218b54717ada03b6fee9b1ef7e441795aa20331f;p=sdlgit%2FSDL_perl.git Added video_mode_ok() and its test. Fixed test list_modes better --- diff --git a/src/Core/Video.xs b/src/Core/Video.xs index caf83fc..0a4569d 100644 --- a/src/Core/Video.xs +++ b/src/Core/Video.xs @@ -76,5 +76,15 @@ list_modes ( format, flags ) RETVAL +int +video_video_mode_ok ( width, height, bpp, flags ) + int width + int height + int bpp + Uint32 flags + CODE: + RETVAL = SDL_VideoModeOK(width,height,bpp,flags); + OUTPUT: + RETVAL diff --git a/t/core_video.t b/t/core_video.t index 5ae1ee4..24db4de 100644 --- a/t/core_video.t +++ b/t/core_video.t @@ -7,7 +7,7 @@ use Devel::Peek; use Data::Dumper; use Test::More; -plan ( tests => 6 ); +plan ( tests => 7 ); use_ok( 'SDL::Video' ); @@ -16,6 +16,7 @@ can_ok ('SDL::Video', qw/ get_video_info video_driver_name list_modes + video_mode_ok /); #testing get_video_surface @@ -23,7 +24,7 @@ SDL::Init(SDL_INIT_VIDEO); my $display = SDL::SetVideoMode(640,480,32, SDL_SWSURFACE ); -diag('Testing SDL::Video'); +#diag('Testing SDL::Video'); isa_ok(SDL::Video::get_video_surface(), 'SDL::Surface', '[get_video_surface] Checking if we get a surface ref back'); @@ -33,7 +34,11 @@ my $driver_name = SDL::Video::video_driver_name(); pass '[video_driver_name] This is your driver name: '.$driver_name; -Dump SDL::Video::list_modes( $display->format , SDL_HWSURFACE ); + + +is( ref( SDL::Video::list_modes( $display->format , SDL_SWSURFACE )), 'ARRAY', '[list_modes] Returned an ARRAY! '); + +cmp_ok(SDL::Video::video_mode_ok( 100, 100, 16, SDL_SWSURFACE), '>=', 0, "[video_mode_ok] Checking if an integer was return"); pass "Are we still alive?";