本文整理匯總了Python中quodlibet.player.nullbe.NullPlayer.next方法的典型用法代碼示例。如果您正苦於以下問題:Python NullPlayer.next方法的具體用法?Python NullPlayer.next怎麽用?Python NullPlayer.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.player.nullbe.NullPlayer
的用法示例。
在下文中一共展示了NullPlayer.next方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TPlaylistMux
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import next [as 別名]
class TPlaylistMux(TestCase):
def setUp(self):
self.q = PlaylistModel()
self.pl = PlaylistModel()
self.p = NullPlayer()
self.mux = PlaylistMux(self.p, self.q, self.pl)
self.p.setup(self.mux, None, 0)
self.failUnless(self.pl.current is None)
def test_destroy(self):
self.mux.destroy()
def test_only_pl(self):
self.pl.set(range(10))
do_events()
self.failUnless(self.mux.current is None)
songs = [self.next() for i in range(10)]
self.failUnlessEqual(songs, list(range(10)))
self.next()
self.failUnless(self.mux.current is None)
def test_only_q(self):
self.q.set(range(10))
do_events()
self.failUnless(self.mux.current is None)
songs = [self.next() for i in range(10)]
self.failUnlessEqual(songs, list(range(10)))
self.next()
self.failUnless(self.mux.current is None)
def test_mixed(self):
self.q.set(range(5))
self.pl.set(range(5, 10))
do_events()
self.failUnless(self.mux.current is None)
songs = [self.next() for i in range(10)]
self.failUnlessEqual(songs, list(range(10)))
self.next()
self.failUnless(self.mux.current is None)
def test_newplaylist(self):
self.pl.set(range(5, 10))
do_events()
self.failUnless(self.mux.current is None)
self.mux.go_to(7)
self.failUnlessEqual(self.mux.current, 7)
self.pl.set([3, 5, 12, 11])
do_events()
self.failUnlessEqual(self.mux.current, None)
self.pl.set([19, 8, 12, 3])
do_events()
self.failUnlessEqual(self.mux.current, None)
self.pl.set([3, 7, 9, 11])
do_events()
self.mux.next()
self.failUnlessEqual(self.mux.current, 9)
def test_halfway(self):
self.pl.set(range(10))
do_events()
self.failUnless(self.mux.current is None)
songs = [self.next() for i in range(5)]
self.q.set(range(100, 105))
do_events()
songs.extend([self.next() for i in range(10)])
self.failUnlessEqual(
songs, [0, 1, 2, 3, 4, 100, 101, 102, 103, 104, 5, 6, 7, 8, 9])
self.next()
self.failUnless(self.mux.current is None)
def test_removal(self):
self.pl.set(range(0, 5))
self.q.set(range(10, 15))
do_events()
songs = [self.next() for i in range(3)]
self.q.remove(self.q.find(14))
self.q.remove(self.q.find(13))
songs.extend([self.next() for i in range(5)])
self.failUnlessEqual(songs, [10, 11, 12, 0, 1, 2, 3, 4])
def next(self):
self.mux.next()
song = self.mux.current
self.p.emit('song-started', self.mux.current)
do_events()
return song
def test_goto(self):
self.pl.set(range(10))
self.q.set(range(10, 20))
do_events()
self.failUnless(self.mux.current is None)
self.mux.go_to(5)
self.failUnlessEqual(self.mux.current, 5)
self.mux.go_to(2)
self.failUnlessEqual(self.mux.current, 2)
self.failUnlessEqual(self.next(), 10)
self.mux.go_to(7)
self.failUnlessEqual(self.mux.current, 7)
self.failUnlessEqual(self.next(), 11)
#.........這裏部分代碼省略.........