From: Kartik Thakore Date: Tue, 10 Nov 2009 12:40:25 +0000 (-0500) Subject: Removed dupe test. Fixed typo X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e49ed6e19999a4711ac11a6b15a1362762948a5b;p=sdlgit%2FSDL_perl.git Removed dupe test. Fixed typo --- diff --git a/t/core_mixchunk.t b/t/core_mixchunk.t deleted file mode 100644 index ef73a3e..0000000 --- a/t/core_mixchunk.t +++ /dev/null @@ -1,51 +0,0 @@ -#!perl -use strict; -use warnings; -use SDL; -use SDL::Mixer::MixChunk; -use Test::More; -use File::Spec; -use IO::CaptureOutput qw(capture); - -sub test_audio -{ - my $stdout = 0 ; - my $stderr = 0 ; - capture { SDL::init(SDL_INIT_AUDIO) } \$stdout, \$stderr; - SDL::quit(); - return ($stderr == 0 ); -} - - -if ( test_audio ) -{ - plan ( skip_all => 'Failed to init sound' ); -} -elsif(SDL::init(SDL_INIT_AUDIO) >= 0) - { plan( tests => 3 ) } -else - { - plan ( skip_all => 'Failed to init sound' ); - } - - - -is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ), - 0, 'MixOpenAudio passed' ); - -my $mix_chunk = SDL::MixLoadWAV('test/data/sample.wav'); -isa_ok( $mix_chunk, 'SDL::Mixer::MixChunk' ); - -is( $mix_chunk->volume, 128, 'Default volume is 128' ); -$mix_chunk->volume(100); -is( $mix_chunk->volume, 100, 'Can change volume to 100' ); - -is( $mix_chunk->alen, 1926848, 'Alen is 1926848' ); - -SDL::MixPlayChannel( -1, $mix_chunk, 0 ); - -# we close straight away so no audio is actually played - -SDL::MixCloseAudio; - -ok( 1, 'Got to the end' ); diff --git a/t/core_mixmusic.t b/t/core_mixmusic.t deleted file mode 100644 index 36846c2..0000000 --- a/t/core_mixmusic.t +++ /dev/null @@ -1,47 +0,0 @@ -#!perl -use strict; -use warnings; -use SDL; -use SDL::Mixer::MixMusic; -use Test::More; -use IO::CaptureOutput qw(capture); - -sub test_audio -{ - my $stdout = 0 ; - my $stderr = 0 ; - capture { SDL::init(SDL_INIT_AUDIO) } \$stdout, \$stderr; - SDL::quit(); - return ($stderr == 0 ); -} - -if ( test_audio ) -{ - plan ( skip_all => 'Failed to init sound' ); -} -elsif(SDL::init(SDL_INIT_AUDIO) >= 0) - { plan( tests => 3 ) } -else - { - plan ( skip_all => 'Failed to init sound' ); - } - -is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ), - 0, 'MixOpenAudio passed' ); - -my $mix_music = SDL::MixLoadMUS('test/data/sample.wav'); - -{ - local $TODO = 1; - - # I'm not sure why this fails - isa_ok( $mix_music, 'SDL::Mixer::MixMusic' ); -}; - -SDL::MixPlayMusic( $mix_music, 0 ); - -# we close straight away so no audio is actually played - -SDL::MixCloseAudio; - -ok( 1, 'Got to the end' ); diff --git a/t/mixer_mixchunk.t b/t/mixer_mixchunk.t index 1f32c70..73e94a8 100644 --- a/t/mixer_mixchunk.t +++ b/t/mixer_mixchunk.t @@ -3,10 +3,28 @@ use strict; use warnings; use SDL; use SDL::Mixer::MixChunk; -use Test::More tests => 7; - -is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' ); - +use Test::More; +use IO::CaptureOutput qw(capture); + +sub test_audio +{ + my $stdout = '' ; + my $stderr = '' ; + capture { SDL::init(SDL_INIT_AUDIO) } \$stdout, \$stderr; + SDL::quit(); + return ($stderr ne '' ); +} + +if ( test_audio ) +{ + plan ( skip_all => 'Failed to init sound' ); +} +elsif(SDL::init(SDL_INIT_AUDIO) >= 0) + { plan( tests => 6 ) } +else + { + plan ( skip_all => 'Failed to init sound' ); + } is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ), 0, 'MixOpenAudio passed' ); diff --git a/t/mixer_mixmusic.t b/t/mixer_mixmusic.t index c741a61..3dba3fe 100644 --- a/t/mixer_mixmusic.t +++ b/t/mixer_mixmusic.t @@ -3,11 +3,30 @@ use strict; use warnings; use SDL; use SDL::Mixer::MixMusic; -use Test::More tests => 4; +use Test::More; +use IO::CaptureOutput qw(capture); -is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' ); - -is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ), +sub test_audio +{ + my $stdout = '' ; + my $stderr = '' ; + capture { SDL::init(SDL_INIT_AUDIO) } \$stdout, \$stderr; + SDL::quit(); + return ($stderr ne '' ); +} + +if ( test_audio ) +{ + plan ( skip_all => 'Failed to init sound' ); +} +elsif(SDL::init(SDL_INIT_AUDIO) >= 0) + { plan( tests => 3 ) } +else + { + plan ( skip_all => 'Failed to init sound' ); + } + + is( SDL::MixOpenAudio( 44100, SDL::Constants::AUDIO_S16, 2, 4096 ), 0, 'MixOpenAudio passed' ); my $mix_music = SDL::MixLoadMUS('test/data/sample.wav');