[project @ 6363]
[audio-mpd.git] / t / 23-output.t
bloba7932b17081f9101289a78104b9174e4262cac16
1 #!perl
3 # This file is part of Audio::MPD
4 # Copyright (c) 2007 Jerome Quelin, all rights reserved.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the same terms as Perl itself.
11 use strict;
12 use warnings;
14 use Audio::MPD;
15 use Test::More;
17 # are we able to test module?
18 eval 'use Audio::MPD::Test';
19 plan skip_all => $@ if $@ =~ s/\n+Compilation failed.*//s;
21 plan tests => 5;
22 my $mpd = Audio::MPD->new;
26 # testing absolute volume.
27 $mpd->volume(10); # init to sthg that we know
28 $mpd->volume(42);
29 is( $mpd->status->volume, 42, 'setting volume' );
32 # testing positive relative volume.
33 $mpd->volume('+9');
34 is( $mpd->status->volume, 51, 'increasing volume' );
37 # testing negative relative volume.
38 $mpd->volume('-4');
39 is( $mpd->status->volume, 47, 'decreasing volume' );
43 # testing disable_output.
44 $mpd->playlist->add( 'title.ogg' );
45 $mpd->playlist->add( 'dir1/title-artist-album.ogg' );
46 $mpd->playlist->add( 'dir1/title-artist.ogg' );
47 $mpd->play;
48 $mpd->output_disable(0);
49 sleep(1);
50 like( $mpd->status->error, qr/^problems/, 'disabling output' );
53 # testing enable_output.
54 $mpd->output_enable(0);
55 sleep(1);
56 $mpd->play; $mpd->pause;
57 is( $mpd->status->error, undef, 'enabling output' );
60 exit;