emmental/audio/test_bass.py
Anna Schumaker c2c6ac7890 audio: Give the BassPlayer a uri property
With both setter and getter to change the playbin uri

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
2021-09-06 10:48:03 -04:00

37 lines
1.3 KiB
Python

# Copyright 2021 (c) Anna Schumaker.
import pathlib
import unittest
from gi.repository import GObject
from gi.repository import Gst
from . import bass
test_album = pathlib.Path("./data/Test Album/")
test_track = test_album / "01 - Test Track.ogg"
test_uri = test_track.absolute().as_uri()
class TestBassPlayer(unittest.TestCase):
def test_bass_player_init(self):
base = bass.BassPlayer()
self.assertIsInstance(base, GObject.GObject)
self.assertIsInstance(base.video, Gst.Element)
self.assertIsInstance(base.playbin, Gst.Element)
self.assertEqual(base.playbin.get_property("video-sink"), base.video)
self.assertEqual(base.playbin.get_state(Gst.CLOCK_TIME_NONE)[1],
Gst.State.READY)
def test_bass_player_bus(self):
base = bass.BassPlayer()
self.assertIsInstance(base.bus, Gst.Bus)
def test_bass_player_uri(self):
base = bass.BassPlayer()
self.assertIsNone(base.get_property("uri"))
base.set_property("uri", test_uri)
self.assertEqual(base.get_property("uri"), test_uri)
base.playbin.set_state(Gst.State.PAUSED)
base.set_property("uri", None)
self.assertEqual(base.playbin.get_state(Gst.CLOCK_TIME_NONE)[1],
Gst.State.READY)