From: Kartik Thakore Date: Sun, 20 Sep 2009 19:02:19 +0000 (-0400) Subject: Fixed tests for timer and mixer X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3493aca9efd7d25d8406cb9245b105a0b740f147;p=sdlgit%2FSDL_perl.git Fixed tests for timer and mixer --- diff --git a/t/mixerpm.t b/t/mixerpm.t index fba9a73..14a4e4d 100644 --- a/t/mixerpm.t +++ b/t/mixerpm.t @@ -2,7 +2,6 @@ # # Copyright (C) 2003 Tels # Copyright (C) 2004 David J. Goehrig -# # Copyright (C) 2005 David J. Goehrig # # ------------------------------------------------------------------------------ @@ -31,18 +30,34 @@ # # basic testing of SDL::Mixer +use strict; +use SDL; +use SDL::Config; +use Test::More; + BEGIN { unshift @INC, 'blib/lib','blib/arch'; } -use strict; -use SDL; -use SDL::Config; +sub check_fail_mixer +{ + my $ret = 0; + eval + { + $ret = SDL::Init(SDL_INIT_AUDIO); + }; + return 1 if ($@ or $ret == -1); + return 0; +} + +if( check_fail_mixer() ) +{ + plan( skip_all => "Cannot initialize Audio for Mixer!!" ); +} -use Test::More; if ( SDL::Config->has('SDL_mixer') ) { - plan ( tests => 2 ); + plan ( tests => 3 ); } else { plan ( skip_all => 'SDL_mixer support not compiled' ); @@ -89,6 +104,6 @@ can_ok ('SDL::Mixer', qw/ # 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'); +my $mixer = SDL::Mixer->new(); +isa_ok($mixer, 'SDL::Mixer', 'Checking if mixer can be build'); diff --git a/t/timerpm.t b/t/timerpm.t index f7fb87c..51d81d5 100644 --- a/t/timerpm.t +++ b/t/timerpm.t @@ -46,9 +46,8 @@ sub check_fail_timer eval { $ret = SDL::Init(SDL_INIT_TIMER); - die "as"; }; - return 1 if (@_ or $ret == -1); + return 1 if ($@ or $ret == -1); return 0; }