3 # This file is part of POE::Component::Client::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.
14 use POE qw[ Component::Client::MPD::Message ];
20 # [ 'event', [ $arg1, $arg2, ... ], $answer_back, \&check_results ]
23 [ 'repeat', [1], $DISCARD, undef ],
24 [ 'status', [], $SEND, \&check_repeat_is_on ],
25 [ 'repeat', [0], $DISCARD, undef ],
26 [ 'status', [], $SEND, \&check_repeat_is_off ],
27 [ 'repeat', [], $SLEEP1, undef ],
28 [ 'status', [], $SEND, \&check_repeat_is_on ],
29 [ 'repeat', [], $SLEEP1, undef ],
30 [ 'status', [], $SEND, \&check_repeat_is_off ],
33 [ 'random', [1], $DISCARD, undef ],
34 [ 'status', [], $SEND, \&check_random_is_on ],
35 [ 'random', [0], $DISCARD, undef ],
36 [ 'status', [], $SEND, \&check_random_is_off ],
37 [ 'random', [], $SLEEP1, undef ],
38 [ 'status', [], $SEND, \&check_random_is_on ],
39 [ 'random', [], $SLEEP1, undef ],
40 [ 'status', [], $SEND, \&check_random_is_off ],
43 [ 'fade', [15], $DISCARD, undef ],
44 [ 'status', [], $SEND, \&check_fade_is_on ],
45 [ 'fade', [], $DISCARD, undef ],
46 [ 'status', [], $SEND, \&check_fade_is_off ],
49 # are we able to test module?
50 eval 'use POE::Component::Client::MPD::Test';
51 plan skip_all => $@ if $@ =~ s/\n+BEGIN failed--compilation aborted.*//s;
54 sub check_repeat_is_on { is( $_[0]->data->repeat, 1, 'repeat is on' ); }
55 sub check_repeat_is_off { is( $_[0]->data->repeat, 0, 'repeat is off' ); }
57 sub check_random_is_on { is( $_[0]->data->random, 1, 'random is on' ); }
58 sub check_random_is_off { is( $_[0]->data->random, 0, 'random is off' ); }
60 sub check_fade_is_on { is( $_[0]->data->xfade, 15, 'enabling fading' ); }
61 sub check_fade_is_off { is( $_[0]->data->xfade, 0, 'disabling fading by default' ); }