本文整理匯總了Python中quodlibet.player.nullbe.NullPlayer.destroy方法的典型用法代碼示例。如果您正苦於以下問題:Python NullPlayer.destroy方法的具體用法?Python NullPlayer.destroy怎麽用?Python NullPlayer.destroy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.player.nullbe.NullPlayer
的用法示例。
在下文中一共展示了NullPlayer.destroy方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TVolume
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import destroy [as 別名]
class TVolume(TestCase):
def setUp(self):
self.p = NullPlayer()
self.v = Volume(self.p)
def test_setget(self):
for i in [0.0, 1.2, 0.24, 1.0, 0.9]:
self.v.set_value(i)
self.failUnlessAlmostEqual(self.p.volume, self.v.get_value() ** 3)
def test_add(self):
self.v.set_value(0.5)
self.v += 0.1
self.failUnlessAlmostEqual(self.p.volume, 0.6 ** 3)
def test_sub(self):
self.v.set_value(0.5)
self.v -= 0.1
self.failUnlessAlmostEqual(self.p.volume, 0.4 ** 3)
def test_add_boundry(self):
self.v.set_value(0.95)
self.v += 0.1
self.failUnlessAlmostEqual(self.p.volume, 1.0)
def test_sub_boundry(self):
self.v.set_value(0.05)
self.v -= 0.1
self.failUnlessAlmostEqual(self.p.volume, 0.0)
def tearDown(self):
self.p.destroy()
self.v.destroy()
示例2: TFSInterface
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import destroy [as 別名]
class TFSInterface(TestCase):
def setUp(self):
self.p = NullPlayer()
self.dir = mkdtemp()
self.filename = os.path.join(self.dir, "foo")
self.fs = FSInterface(self.filename, self.p)
def tearDown(self):
self.p.destroy()
shutil.rmtree(self.dir)
def do(self):
while Gtk.events_pending():
Gtk.main_iteration()
def test_init(self):
self.do()
self.failIf(os.path.exists(self.filename))
def test_start(self):
self.p.emit('song_started', AudioFile({"woo": "bar", "~#length": 10}))
self.do()
self.failUnless("woo=bar\n" in file(self.filename).read())
def test_song_ended(self):
self.p.emit('song-started', AudioFile({"woo": "bar", "~#length": 10}))
self.do()
self.p.emit('song-ended', {}, False)
self.do()
self.failIf(os.path.exists(self.filename))
示例3: TFSInterface
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import destroy [as 別名]
class TFSInterface(TestCase):
def setUp(self):
self.p = NullPlayer()
self.fs = FSInterface(self.p)
def do(self):
while gtk.events_pending(): gtk.main_iteration()
def test_init(self):
self.do()
self.failIf(os.path.exists(const.CURRENT))
def test_start(self):
self.p.emit('song_started', AudioFile({"woo": "bar", "~#length": 10}))
self.do()
self.failUnless("woo=bar\n" in file(const.CURRENT).read())
def test_song_ended(self):
self.p.emit('song-started', AudioFile({"woo": "bar", "~#length": 10}))
self.do()
self.p.emit('song-ended', {}, False)
self.do()
self.failIf(os.path.exists(const.CURRENT))
def tearDown(self):
self.p.destroy()
try: os.unlink(const.CURRENT)
except EnvironmentError: pass
示例4: TFIFOControl
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import destroy [as 別名]
class TFIFOControl(TestCase):
def setUp(self):
config.init()
self.p = NullPlayer()
self.l = SongFileLibrary()
self.w = gtk.Window()
self.fifo = FIFOControl(self.l, self.w, self.p)
def tearDown(self):
self.p.destroy()
self.l.destroy()
self.w.destroy()
config.quit()
def __send(self, command):
f = open(const.CONTROL, "wb")
f.write(command)
f.close()
while gtk.events_pending():
gtk.main_iteration()
def test_player(self):
self.__send("previous")
self.__send("force_previous")
self.__send("next")
self.__send("pause")
self.__send("play-pause")
self.__send("stop")
self.__send("volume +1000")
self.__send("volume 40")
self.__send("volume -10")
#self.__send("seek -10")
#self.__send("seek +10")
#self.__send("seek 0")
def test_misc(self):
#self.__send("add-directory /dev/null")
self.__send("add-file /dev/null")
#self.__send("dump-playlist /dev/null")
#self.__send("dump_queue /dev/null")
#self.__send("enqueue /dev/null")
self.__send("enqueue-files /dev/null")
#self.__send("filter album=test")
#self.__send("focus")
#self.__send("hide-window")
#self.__send("open-browser 1")
#self.__send("order shuffle")
self.__send("properties")
#self.__send("queue 1")
self.__send("quit")
#self.__send("random album")
#self.__send("refresh")
#self.__send("repeat 0")
#self.__send("set-browser 1")
self.__send("set-rating 0.5")
示例5: TPlaylistMux
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import destroy [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)
#.........這裏部分代碼省略.........