X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fmixerpm.t;h=14a4e4da63fff5d0b44014c2d0878080f3ad3d0a;hb=105dd7ae8057a6e4b9913dbf5e48ac3d61970656;hp=0ad5dbefebde1ac3acd0392a3cfa7a9037e951f8;hpb=7b6a53a1f5064ca5b8ab0243f7bcf6209e6bf5a4;p=sdlgit%2FSDL_perl.git diff --git a/t/mixerpm.t b/t/mixerpm.t index 0ad5dbe..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,19 +30,36 @@ # # 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 => 3 ); -} else { +} +else { plan ( skip_all => 'SDL_mixer support not compiled' ); } @@ -86,8 +102,8 @@ can_ok ('SDL::Mixer', qw/ playing_music /); + # these are exported by default, so main:: should know them: -SDL::Init(SDL_INIT_AUDIO); my $mixer = SDL::Mixer->new(); -isa_ok($mixer, 'SDL::Mixer'); +isa_ok($mixer, 'SDL::Mixer', 'Checking if mixer can be build');