3 # This file is part of DisOrder.
4 # Copyright (C) 2007, 2008 Richard Kettlewell
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 3 of the License, or
9 # (at 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, see <http://www.gnu.org/licenses/>.
19 import dtest,time,disorder,re
21 class wait_monitor(disorder.monitor):
26 """Check the queue is padded to the (default) configured length"""
30 print " disabling play"
32 print " waiting for queue to be populated..."
35 print " queue at %d tracks" % len(q)
38 print " getting queue via disorder(1)"
39 q = dtest.command(["disorder",
40 "--config", disorder._configfile, "--no-per-user-config",
42 tracks = filter(lambda s: re.match("^track", s), q)
43 assert len(tracks) == 5, "queue is at proper length"
44 print " disabling random play"
46 print " emptying queue"
49 print " checking queue is now empty"
51 assert q == [], "checking queue is empty"
52 print " enabling random play"
54 print " waiting for queue to refill..."
57 print " queue at %d tracks" % len(q)
60 print " disabling all play"
63 print " emptying queue"
66 t1 = "%s/Joe Bloggs/Third Album/01:First_track.ogg" % dtest.tracks
67 t2 = "%s/Joe Bloggs/Third Album/02:Second_track.ogg" % dtest.tracks
68 t3 = "%s/Joe Bloggs/Third Album/02:Second_track.ogg" % dtest.tracks
69 print " adding tracks"
74 assert map(lambda e:e['id'], q) == [i1, i2, i3], "checking queue order(1)"
75 print " moving last track to start"
76 c.moveafter(None, [i3])
78 assert map(lambda e:e['id'], q) == [i3, i1, i2], "checking queue order(2)"
79 print " moving two tracks"
80 c.moveafter(i1, [i2, i3])
82 assert map(lambda e:e['id'], q) == [i1, i2 ,i3], "checking queue order(3)"
83 print " removing a track"
86 assert map(lambda e:e['id'], q) == [i1 ,i3], "checking queue order(4)"
88 if __name__ == '__main__':