本文整理匯總了Python中quodlibet.player.nullbe.NullPlayer._error方法的典型用法代碼示例。如果您正苦於以下問題:Python NullPlayer._error方法的具體用法?Python NullPlayer._error怎麽用?Python NullPlayer._error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類quodlibet.player.nullbe.NullPlayer
的用法示例。
在下文中一共展示了NullPlayer._error方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TSongTracker
# 需要導入模塊: from quodlibet.player.nullbe import NullPlayer [as 別名]
# 或者: from quodlibet.player.nullbe.NullPlayer import _error [as 別名]
class TSongTracker(TestCase):
def setUp(self):
config.init()
self.p = NullPlayer()
self.w = SongLibrary()
self.s1 = AudioFile(
{"~#playcount": 0, "~#skipcount": 0, "~#lastplayed": 10,
"~filename": "foo", "~#length": 1.5})
self.s2 = AudioFile(
{"~#playcount": 0, "~#skipcount": 0, "~#lastplayed": 10,
"~filename": "foo", "~#length": 1.5})
self.cm = SongTracker(self.w, self.p, self)
self.current = None
def do(self):
while Gtk.events_pending():
Gtk.main_iteration()
def test_destroy(self):
self.cm.destroy()
def test_play(self):
import time
# Allow at least 2 second to elapse to simulate playing
self.p.song = self.s1
self.p.paused = False
time.sleep(2)
self.do()
self.p.emit('song-ended', self.s1, False)
self.do()
t = time.time()
self.assertEquals(self.s1["~#playcount"], 1)
self.assertEquals(self.s1["~#skipcount"], 0)
self.failUnless(t - self.s1["~#lastplayed"] <= 1)
def test_skip(self):
self.p.emit('song-ended', self.s1, True)
self.do()
self.assertEquals(self.s1["~#playcount"], 0)
self.assertEquals(self.s1["~#skipcount"], 1)
self.failUnless(self.s1["~#lastplayed"], 10)
def test_error(self):
self.current = self.p.song = self.s1
self.p._error('Test error')
self.do()
self.assertEquals(self.s1["~#playcount"], 0)
self.assertEquals(self.s1["~#skipcount"], 0)
self.failUnless(self.s1["~#lastplayed"], 10)
def test_restart(self):
self.current = self.s1
self.p.emit('song-ended', self.s1, True)
self.do()
self.assertEquals(self.s1["~#playcount"], 0)
self.assertEquals(self.s1["~#skipcount"], 0)
def tearDown(self):
self.w.destroy()
config.quit()