From: Leon Brocard Date: Fri, 6 Nov 2009 13:34:02 +0000 (+0000) Subject: Better defaults, test playing a sound X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bfededfadcdf2ed69f83d835681903af996b2d71;p=sdlgit%2FSDL_perl.git Better defaults, test playing a sound --- diff --git a/t/core_mixchunk.t b/t/core_mixchunk.t index acdad88..773d7c4 100644 --- a/t/core_mixchunk.t +++ b/t/core_mixchunk.t @@ -3,17 +3,12 @@ use strict; use warnings; use SDL; use SDL::MixChunk; -use Test::More tests => 6; +use Test::More tests => 7; is( SDL::init(SDL_INIT_AUDIO), 0, '[init] returns 0 on success' ); -is( SDL::MixOpenAudio( - SDL::MIX_DEFAULT_FREQUENCY(), SDL::MIX_DEFAULT_FORMAT(), - SDL::MIX_DEFAULT_CHANNELS(), 4096 - ), - 0, - 'MixOpenAudio passed' -); +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::MixChunk' ); @@ -22,4 +17,12 @@ 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, 963424, 'Alen is 963424' ); +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' );