Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (46 sloc) 1.332 kb
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
1 use strict;
54b3c65 Constants exported by default now (again)
Tobias Leich authored
2 use SDL;
8a89f42 @kthakore Mixer fix up to check Config before testign or compiling
kthakore authored
3 use SDL::Config;
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
4
4ac4d64 Using dummy audiodriver for tests so no sound is played [#163]
Tobias Leich authored
5 my $audiodriver;
6
eb3a029 proper skip for tests that needs threads
Tobias Leich authored
7 BEGIN {
4979eb1 @jtpalmer perltidy
jtpalmer authored
8 use Config;
9 if ( !$Config{'useithreads'} ) {
10 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
11 exit(0);
12 }
13
14 use Test::More;
15 use lib 't/lib';
16 use SDL::TestTool;
17
18 $audiodriver = $ENV{SDL_AUDIODRIVER};
19 $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
20
21 if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
22 plan( skip_all => 'Failed to init sound' );
23 } elsif ( !SDL::Config->has('SDL_mixer') ) {
24 plan( skip_all => 'SDL_mixer support not compiled' );
25 } else {
26 plan( tests => 6 );
27 }
e49ed6e @kthakore Removed dupe test. Fixed typo
kthakore authored
28 }
29
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
30 use_ok('SDL::Mixer');
31 use_ok('SDL::Mixer::Music');
32 use_ok('SDL::Mixer::MixMusic');
d1c9e67 @kthakore Made tests wrok with no Video
kthakore authored
33
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
34 is( SDL::Mixer::open_audio( 44100, SDL::Audio::AUDIO_S16SYS, 2, 4096 ),
4979eb1 @jtpalmer perltidy
jtpalmer authored
35 0, 'open_audio passed'
36 );
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
37
38 my $mix_music = SDL::Mixer::Music::load_MUS('test/data/tribe_i.wav')
4979eb1 @jtpalmer perltidy
jtpalmer authored
39 ; # from Matthew Newman, http://opengameart.org/content/vocal-grunts-tribeiwav
d1c9e67 @kthakore Made tests wrok with no Video
kthakore authored
40
1ffe45e moved mixer from SDL to SDL::Mixer
Tobias Leich authored
41 #warn 'Error:'. SDL::get_error() if (!$mix_music);
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
42
43 {
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
44
4979eb1 @jtpalmer perltidy
jtpalmer authored
45 # I'm not sure why this fails
46 isa_ok( $mix_music, 'SDL::Mixer::MixMusic' );
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
47 };
48
e6abde1 @kthakore Cleaned up tests
kthakore authored
49 SDL::Mixer::Music::play_music( $mix_music, 0 );
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
50
51 # we close straight away so no audio is actually played
52
1ffe45e moved mixer from SDL to SDL::Mixer
Tobias Leich authored
53 SDL::Mixer::close_audio();
1f745fc @acme Rename, move MixChunk and MixMusic to the right place
acme authored
54
55 ok( 1, 'Got to the end' );
a3c5e84 removed SDL::quit() from the tests, its called by xs on exit
Tobias Leich authored
56
e6e146e @kthakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
57 if ($audiodriver) {
4979eb1 @jtpalmer perltidy
jtpalmer authored
58 $ENV{SDL_AUDIODRIVER} = $audiodriver;
59 } else {
60 delete $ENV{SDL_AUDIODRIVER};
4ac4d64 Using dummy audiodriver for tests so no sound is played [#163]
Tobias Leich authored
61 }
62
fc90dcd @m4gnet time to sleep(2);
m4gnet authored
63 sleep(2);
Something went wrong with that request. Please try again.