def test_go_to_order(self): self.pl.order = OrderShuffle() for i in range(5): self.pl.go_to(5) self.failUnlessEqual(self.pl.current, 5) self.pl.go_to(1) self.failUnlessEqual(self.pl.current, 1)
def test_previous_shuffle(self): self.pl.set(range(10)) self.pl.order = OrderShuffle() self.mux.go_to(0) self.next() self.previous() self.assertEqual(self.mux.current, 0)
def test_shuffle_repeat(self): self.pl.order = RepeatListForever(OrderShuffle()) numbers = [self.pl.current for _ in range(30) if self.pl.next_ended() or True] allnums = sorted(list(range(10)) * 3) self.assertNotEqual(numbers, allnums) numbers.sort() self.assertEqual(numbers, allnums)
def test_shuffle(self): self.pl.order = OrderShuffle() for i in range(5): history = [self.pl.current for _ in range(10) if self.pl.next() or True] self.assertNotEqual(history, list(range(10))) self.assertEqual(sorted(history), list(range(10))) self.pl.next() self.assertEqual(self.pl.current, None) self.pl.order.reset(self.pl)
def test_random_queue_666(self): for i in range(5): self.mux.go_to(None) self.pl.set([1]) do_events() self.failUnless(self.mux.current is None) self.q.order = OrderShuffle() self.failUnless(self.next() == 1) self.q.set([10, 11]) do_events() value = self.next() self.failUnless( value in [10, 11], "got %r, expected 10 or 11" % value) if value == 10: next = 11 else: next = 10 self.failUnlessEqual(self.next(), next)
def test_next_nosong_536(self): self.pl.go_to(1) self.pl.order = OrderShuffle() self.pl.set([]) Gtk.main_iteration_do(False) self.pl.next()
def test_shuffle_repeat_forever(self): self.pl.order = RepeatSongForever(OrderShuffle()) old = self.pl.current for i in range(5): self.pl.next_ended() self.assertEqual(self.pl.current, old)
def set_shuffled(self, is_shuffled): self.queue.model.order = (OrderShuffle() if is_shuffled else OrderInOrder())
def __queue_shuffle(self, button, model): if not button.get_active(): model.order = OrderInOrder(model) else: model.order = OrderShuffle(model)
def __queue_shuffle(self, button, model): model.order = OrderShuffle() if button.get_active() else OrderInOrder()