Permalink
Browse files

Using dummy audiodriver for tests so no sound is played [#163]

  • Loading branch information...
1 parent 60123ca commit 4ac4d64da360c2b212eb11efeac35d75af69b14a Tobias Leich committed Jun 27, 2010
Showing with 140 additions and 1 deletion.
  1. +1 −0 CHANGELOG
  2. +13 −0 t/core_audio.t
  3. +13 −0 t/core_audiospec.t
  4. +14 −0 t/mixer.t
  5. +14 −0 t/mixer_channels.t
  6. +14 −0 t/mixer_effects.t
  7. +14 −0 t/mixer_groups.t
  8. +14 −0 t/mixer_mixchunk.t
  9. +14 −0 t/mixer_mixmusic.t
  10. +14 −0 t/mixer_music.t
  11. +15 −1 t/mixer_samples.t
View
@@ -8,6 +8,7 @@ Revision history for Perl extension SDL_perl.
- Added SDLx::Surface and SDLx::Surface::Matrix
- Added ppport.h support for older perls
- MacOSx compile and useage works
+ - Using dummy audiodriver for tests so no sound is played [#163] [FROGGS]
* 2.408 Sun June 13 2010
- Added File::ShareDir as a dep
View
@@ -16,6 +16,9 @@ use Devel::Peek;
use lib 't/lib';
use SDL::TestTool;
+my $audiodriver = $ENV{SDL_AUDIODRIVER};
+$ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
} else {
@@ -127,6 +130,16 @@ TODO:
}
print "$why\n";
+
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
sleep(1);
sub audio_callback
View
@@ -20,6 +20,10 @@ use lib 't/lib';
use SDL::TestTool;
plan( skip_all => "author tests not required for installation" ) unless ( $ENV{AUTOMATED_TESTING} or $ENV{SDL_RELEASE_TESTING} );
+
+my $audiodriver = $ENV{SDL_AUDIODRIVER};
+$ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
plan( skip_all => 'Failed to init sound' ) unless SDL::TestTool->init(SDL_INIT_AUDIO);
my $obtained = SDL::AudioSpec->new;
@@ -54,6 +58,15 @@ die 'AudioMixer, Unable to open audio: '. SDL::get_error() if( SDL::Audio::open(
SDL::Audio::pause(0);
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
sleep(1);
SDL::Audio::close();
View
@@ -3,6 +3,8 @@ use strict;
use SDL;
use SDL::Config;
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -15,6 +17,9 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -85,4 +90,13 @@ SKIP:
SDL::Mixer::quit(); pass '[quit] ran';
}
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();
View
@@ -3,6 +3,8 @@ use strict;
use SDL;
use SDL::Config;
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -15,6 +17,9 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -105,4 +110,13 @@ SDL::Mixer::close_audio(); pass '[close_audio] ran';
is ( $finished > 0, 1, '[callback_finished] called the callback got '. $finished);
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();
View
@@ -1,5 +1,7 @@
#!/usr/bin/perl -w
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -13,6 +15,9 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -165,4 +170,13 @@ SDL::delay($delay);
SDL::Mixer::close_audio(); pass '[close_audio] ran';
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();
View
@@ -3,6 +3,8 @@ use strict;
use SDL;
use SDL::Config;
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -15,6 +17,9 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -82,4 +87,13 @@ is( SDL::Mixer::Groups::halt_group( 1 ), 0, "[h
SDL::Mixer::close_audio(); pass '[close_audio] ran';
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();
View
@@ -8,6 +8,8 @@ use SDL::Mixer::Channels;
use SDL::Mixer::Samples;
use SDL::Mixer::MixChunk;
+my $audiodriver;
+
BEGIN {
use Config;
if (! $Config{'useithreads'}) {
@@ -19,6 +21,9 @@ BEGIN {
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if (! SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -51,4 +56,13 @@ SDL::Mixer::close_audio();
ok( 1, 'Got to the end' );
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
sleep(2);
View
@@ -2,6 +2,8 @@ use strict;
use SDL;
use SDL::Config;
+my $audiodriver;
+
BEGIN {
use Config;
if (! $Config{'useithreads'}) {
@@ -13,6 +15,9 @@ BEGIN {
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -48,4 +53,13 @@ SDL::Mixer::close_audio();
ok( 1, 'Got to the end' );
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
sleep(2);
View
@@ -1,6 +1,8 @@
#!/usr/bin/perl -w
use strict;
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -14,6 +16,9 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
@@ -159,4 +164,13 @@ SDL::delay($delay);
SDL::Mixer::close_audio(); pass '[close_audio] ran';
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();
View
@@ -3,6 +3,8 @@ use strict;
use SDL;
use SDL::Config;
+my $audiodriver;
+
BEGIN
{
use Config;
@@ -15,7 +17,10 @@ BEGIN
use lib 't/lib';
use SDL::TestTool;
- if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
+ $audiodriver = $ENV{SDL_AUDIODRIVER};
+ $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
+
+ if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
plan( skip_all => 'Failed to init sound' );
}
elsif( !SDL::Config->has('SDL_mixer') )
@@ -89,4 +94,13 @@ print "$why\n";
pass 'Checking for segfaults';
+if($audiodriver)
+{
+ $ENV{SDL_AUDIODRIVER} = $audiodriver;
+}
+else
+{
+ delete $ENV{SDL_AUDIODRIVER};
+}
+
done_testing();

0 comments on commit 4ac4d64

Please sign in to comment.