#
# Copyright (C) 2003 Tels
# Copyright (C) 2004 David J. Goehrig
-#
# Copyright (C) 2005 David J. Goehrig <dgoehrig\@cpan.org>
#
# ------------------------------------------------------------------------------
#
# 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' );
}
/);
-if ( SDL::Init(SDL_INIT_AUDIO) < 0) {
- plan( skip_all => "Cannot initialize audio!!" );
- }
-
# 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');