[project @ 5638]
[audio-mpd.git] / t / 25-settings.t
blob3e358ad45b4fb84fe263e609abdc7fb530d6952b
1 #!perl
3 # This file is part of Audio::MPD.
4 # Copyright (c) 2007 Jerome Quelin <jquelin@cpan.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or (at
9 # your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 use strict;
23 use warnings;
25 use Audio::MPD;
26 use Test::More;
28 # are we able to test module?
29 eval 'use Audio::MPD::Test';
30 plan skip_all => $@ if $@ =~ s/\n+Compilation failed.*//s;
32 plan tests => 10;
33 my $mpd = Audio::MPD->new;
37 # testing repeat
38 $mpd->repeat(1);
39 is( $mpd->status->repeat, 1, 'enabling repeat mode' );
40 $mpd->repeat(0);
41 is( $mpd->status->repeat, 0, 'disabling repeat mode' );
42 $mpd->repeat;
43 is( $mpd->status->repeat, 1, 'toggling repeat mode to on' );
44 $mpd->repeat;
45 is( $mpd->status->repeat, 0, 'toggling repeat mode to off' );
49 # testing random
50 $mpd->random(1);
51 is( $mpd->status->random, 1, 'enabling random mode' );
52 $mpd->random(0);
53 is( $mpd->status->random, 0, 'disabling random mode' );
54 $mpd->random;
55 is( $mpd->status->random, 1, 'toggling random mode to on' );
56 $mpd->random;
57 is( $mpd->status->random, 0, 'toggling random mode to off' );
61 # testing fade
62 $mpd->fade(15);
63 is( $mpd->status->xfade, 15, 'enabling fading' );
64 $mpd->fade;
65 is( $mpd->status->xfade,  0, 'disabling fading by default' );
68 exit;