playlist: Create a Header box
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
b09baf3d99
commit
44370b265b
|
@ -80,3 +80,13 @@ class ControlBox(Gtk.Box):
|
|||
while child:
|
||||
child.set_playlist(plist)
|
||||
child = child.get_next_sibling()
|
||||
|
||||
|
||||
class Header(Gtk.Box):
|
||||
def __init__(self):
|
||||
Gtk.Box.__init__(self)
|
||||
self.append(FilterEntry())
|
||||
self.append(ControlBox())
|
||||
|
||||
def set_playlist(self, plist):
|
||||
self.get_last_child().set_playlist(plist)
|
||||
|
|
|
@ -139,3 +139,22 @@ class TestControlBox(unittest.TestCase):
|
|||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, header.SortButton)
|
||||
|
||||
|
||||
class TestHeader(unittest.TestCase):
|
||||
def test_init(self):
|
||||
box = header.Header()
|
||||
self.assertIsInstance(box, Gtk.Box)
|
||||
self.assertEqual(box.get_orientation(), Gtk.Orientation.HORIZONTAL)
|
||||
|
||||
def test_children(self):
|
||||
collection = db.user.Table.find("Collection")
|
||||
box = header.Header()
|
||||
box.set_playlist(collection)
|
||||
|
||||
child = box.get_first_child()
|
||||
self.assertIsInstance(child, header.FilterEntry)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, header.ControlBox)
|
||||
self.assertEqual(child.get_first_child().playlist, collection)
|
||||
|
|
Loading…
Reference in New Issue