33 lines
1010 B
Python
33 lines
1010 B
Python
# Copyright 2021 (c) Anna Schumaker.
|
|
import audio
|
|
import pathlib
|
|
import tagdb
|
|
import unittest
|
|
from gi.repository import Gtk
|
|
|
|
test_album = pathlib.Path("./data/Test Album/")
|
|
|
|
class TestAudio(unittest.TestCase):
|
|
def test_init(self):
|
|
self.assertIsInstance(audio.Player, audio.player.Player)
|
|
|
|
def test_play_track(self):
|
|
lib = tagdb.Library.add(test_album)
|
|
lib.scan().join()
|
|
track = [ t for t in lib.tracks if t.tracknumber == 1 ][0]
|
|
|
|
self.assertTrue(audio.play_track(track))
|
|
self.assertTrue(audio.Player.playing)
|
|
self.assertFalse(audio.play_track(track))
|
|
audio.Player.playing = False
|
|
|
|
def test_header(self):
|
|
header = audio.Header()
|
|
self.assertIsInstance(header, Gtk.HeaderBar)
|
|
self.assertIsInstance(header.get_title_widget(),
|
|
audio.nowplaying.NowPlaying)
|
|
|
|
def test_widgets(self):
|
|
self.assertIsInstance(audio.Artwork(),
|
|
audio.artwork.Artwork)
|