def setUp(self): config.init() config.set("player", "gst_pipeline", "fakesink") config.set("settings", "xine_driver", "none") module = player.init_backend(self.NAME) lib = library.init() self.player = module.init(lib.librarian) source = PlaylistModel() source.set(FILES) self.events = [] def start_end_handler(player, song, *args): self.events.append((args[-1], song)) self.player.connect("song-started", start_end_handler, "started") self.player.connect("song-ended", start_end_handler, "ended") self.player.setup(source, None, 0) self.signals = [] def handler(type_, *args): self.signals.append(type_) connect_obj(self.player, "unpaused", handler, "unpaused") connect_obj(self.player, "paused", handler, "paused")
def test_stop(self): self.player.next() self.player.seek(10000) self.assertEqual(self.player.get_position(), 10000) self.player.stop() self.assertEqual(self.player.get_position(), 0) def test_can_play_uri_null(self): self.assertTrue(self.player.can_play_uri("")) self.assertTrue(self.player.can_play_uri("file://")) self.assertTrue(self.player.can_play_uri("fake://")) has_xine = True try: player.init_backend("xinebe") except player.PlayerError: has_xine = False @skipUnless(has_xine, "couldn't load/test xinebe") class TXinePlayer(TPlayer, TPlayerMixin): NAME = "xinebe" def test_can_play_uri_xine(self): self.assertFalse(self.player.can_play_uri("")) self.assertTrue(self.player.can_play_uri("file://")) self.assertFalse(self.player.can_play_uri("fake://")) has_gstbe = True