emmental/playlist/test_playlist.py

41 lines
1.4 KiB
Python

# Copyright 2021 (c) Anna Schumaker.
import db
import playlist
import unittest
from gi.repository import Gtk
class TestPanel(unittest.TestCase):
def test_init(self):
panel = playlist.Panel()
self.assertIsInstance(panel, Gtk.Box)
self.assertIsInstance(panel.header, playlist.header.Header)
self.assertIsInstance(panel.window, playlist.view.PlaylistWindow)
self.assertIsInstance(panel.footer, playlist.footer.Footer)
self.assertEqual(panel.get_orientation(), Gtk.Orientation.VERTICAL)
def test_items(self):
panel = playlist.Panel()
child = panel.get_first_child()
self.assertEqual(child, panel.header)
child = child.get_next_sibling()
self.assertIsInstance(child, Gtk.Separator)
child = child.get_next_sibling()
self.assertEqual(child, panel.window)
child = child.get_next_sibling()
self.assertIsInstance(child, Gtk.Separator)
child = child.get_next_sibling()
self.assertEqual(child, panel.footer)
def test_set_playlist(self):
collection = db.user.Table.find("Collection")
panel = playlist.Panel()
self.assertIsNone(panel.get_playlist())
panel.set_playlist(collection)
self.assertEqual(panel.header.get_last_child().get_first_child().playlist, collection)
self.assertEqual(panel.get_playlist(), collection)