Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 64 lines (48 sloc) 1.396 kb
1f745fc Léon Brocard Rename, move MixChunk and MixMusic to the right place
acme authored
1 #!perl
2 use strict;
3 use warnings;
eb3a029 proper skip for tests that needs threads
Tobias Leich authored
4 use SDL;
8a89f42 Kartik Thakore Mixer fix up to check Config before testign or compiling
kthakore authored
5 use SDL::Config;
1ffe45e moved mixer from SDL to SDL::Mixer
Tobias Leich authored
6 use SDL::Mixer;
c982e3d Kartik Thakore Fixed regression in play_channel usage
kthakore authored
7 use SDL::Mixer::Channels;
fb2ed5d Kartik Thakore Fixed regression in SDL::Mixer
kthakore authored
8 use SDL::Mixer::Samples;
1f745fc Léon Brocard Rename, move MixChunk and MixMusic to the right place
acme authored
9 use SDL::Mixer::MixChunk;
e49ed6e Kartik Thakore Removed dupe test. Fixed typo
kthakore authored
10
4ac4d64 Using dummy audiodriver for tests so no sound is played [#163]
Tobias Leich authored
11 my $audiodriver;
12
eb3a029 proper skip for tests that needs threads
Tobias Leich authored
13 BEGIN {
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
14 use Config;
15 if ( !$Config{'useithreads'} ) {
16 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
17 exit(0);
18 }
19
20 use Test::More;
21 use lib 't/lib';
22 use SDL::TestTool;
23
24 $audiodriver = $ENV{SDL_AUDIODRIVER};
25 $ENV{SDL_AUDIODRIVER} = 'dummy' unless $ENV{SDL_RELEASE_TESTING};
26
27 if ( !SDL::TestTool->init(SDL_INIT_AUDIO) ) {
28 plan( skip_all => 'Failed to init sound' );
29 } elsif ( !SDL::Config->has('SDL_mixer') ) {
30 plan( skip_all => 'SDL_mixer support not compiled' );
31 } else {
32 plan( tests => 6 );
33 }
8a89f42 Kartik Thakore Mixer fix up to check Config before testign or compiling
kthakore authored
34 }
35
e6e146e Kartik Thakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
36 is( SDL::Mixer::open_audio( 44100, SDL::Audio::AUDIO_S16SYS, 2, 4096 ),
4979eb1 Jeffrey T. Palmer perltidy
jtpalmer authored
37 0, 'open_audio passed'
38 );
1f745fc Léon Brocard Rename, move MixChunk and MixMusic to the right place
acme authored
39
fb2ed5d Kartik Thakore Fixed regression in SDL::Mixer
kthakore authored
40 my $mix_chunk = SDL::Mixer::Samples::load_WAV('test/data/sample.wav');
1f745fc Léon Brocard Rename, move MixChunk and MixMusic to the right place
acme authored
41 isa_ok( $mix_chunk, 'SDL::Mixer::MixChunk' );
42
43 is( $mix_chunk->volume, 128, 'Default volume is 128' );
44 $mix_chunk->volume(100);
45 is( $mix_chunk->volume, 100, 'Can change volume to 100' );
46
47 is( $mix_chunk->alen, 1926848, 'Alen is 1926848' );
48
c982e3d Kartik Thakore Fixed regression in play_channel usage
kthakore authored
49 SDL::Mixer::Channels::play_channel( -1, $mix_chunk, 0 );
1f745fc Léon Brocard 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 Léon Brocard 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 Kartik Thakore Did perl tidy. Stole rc from padre. bricas++
kthakore authored
57 if ($audiodriver) {
4979eb1 Jeffrey T. Palmer 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.