14a4e4da63fff5d0b44014c2d0878080f3ad3d0a
[sdlgit/SDL_perl.git] / t / mixerpm.t
1 #!/usr/bin/perl -w
2 #
3 # Copyright (C) 2003 Tels
4 # Copyright (C) 2004 David J. Goehrig
5 # Copyright (C) 2005 David J. Goehrig <dgoehrig\@cpan.org>
6 #
7 # ------------------------------------------------------------------------------
8 #
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 # ------------------------------------------------------------------------------
24 #
25 # Please feel free to send questions, suggestions or improvements to:
26 #
27 #       David J. Goehrig
28 #       dgoehrig\@cpan.org
29 #
30 #
31 # basic testing of SDL::Mixer
32
33 use strict;
34 use SDL;
35 use SDL::Config;
36 use Test::More;
37
38 BEGIN {
39         unshift @INC, 'blib/lib','blib/arch';
40 }
41
42 sub check_fail_mixer
43 {       
44         my $ret = 0;
45         eval
46         {
47                 $ret = SDL::Init(SDL_INIT_AUDIO);
48         };
49         return 1 if ($@ or $ret == -1);
50         return 0;
51 }
52
53 if( check_fail_mixer() )
54 {
55          plan( skip_all => "Cannot initialize Audio for Mixer!!" );
56 }
57
58
59 if ( SDL::Config->has('SDL_mixer') ) {
60         plan ( tests => 3 );
61 }                       
62 else {
63         plan ( skip_all => 'SDL_mixer support not compiled' );
64 }
65
66 use_ok( 'SDL::Mixer' ); 
67   
68 can_ok ('SDL::Mixer', qw/
69         new
70         query_spec
71         reserve_channels
72         allocate_channels
73         group_channel
74         group_channels
75         group_available
76         group_count
77         group_oldest
78         group_newer
79         play_channel
80         play_music
81         fade_in_channel
82         fade_in_music
83         channel_volume
84         music_volume
85         halt_channel
86         halt_group
87         halt_music
88         channel_expire
89         fade_out_channel
90         fade_out_group
91         fade_out_music
92         fading_music
93         fading_channel
94         pause
95         resume
96         paused
97         pause_music
98         resume_music
99         rewind_music
100         music_paused
101         playing
102         playing_music
103         /);
104
105
106 # these are exported by default, so main:: should know them:
107 my $mixer = SDL::Mixer->new();
108 isa_ok($mixer, 'SDL::Mixer', 'Checking if mixer can be build');
109