diff --git a/playlist/header.py b/playlist/header.py index b0cda70..95471d3 100644 --- a/playlist/header.py +++ b/playlist/header.py @@ -85,26 +85,33 @@ class ControlBox(Gtk.Box): child = child.get_next_sibling() -class PlaylistBox(ControlBox): +class TrackBox(ControlBox): def __init__(self): ControlBox.__init__(self) - self.append(RandomToggle()) - self.append(LoopToggle()) - self.append(SortButton()) self.append(JumpButton()) def get_jump_button(self): return self.get_last_child() +class PlaylistBox(ControlBox): + def __init__(self): + ControlBox.__init__(self) + self.append(RandomToggle()) + self.append(LoopToggle()) + self.append(SortButton()) + + class Header(Gtk.Box): def __init__(self): Gtk.Box.__init__(self) + self.append(TrackBox()) self.append(FilterEntry()) self.append(PlaylistBox()) def get_jump_button(self): - return self.get_last_child().get_jump_button() + return self.get_first_child().get_jump_button() def set_playlist(self, plist): + self.get_first_child().set_playlist(plist) self.get_last_child().set_playlist(plist) diff --git a/playlist/test_header.py b/playlist/test_header.py index 53da155..fbf0785 100644 --- a/playlist/test_header.py +++ b/playlist/test_header.py @@ -139,6 +139,19 @@ class TestControlBox(unittest.TestCase): self.assertTrue(box.has_css_class("linked")) +class TestTrackBox(unittest.TestCase): + def test_init(self): + box = header.TrackBox() + self.assertIsInstance(box, header.ControlBox) + + def test_children(self): + box = header.TrackBox() + + child = box.get_first_child() + self.assertIsInstance(child, header.JumpButton) + self.assertEqual(box.get_jump_button(), child) + + class TestPlaylistBox(unittest.TestCase): def test_init(self): box = header.PlaylistBox() @@ -160,10 +173,6 @@ class TestPlaylistBox(unittest.TestCase): child = child.get_next_sibling() self.assertIsInstance(child, header.SortButton) - child = child.get_next_sibling() - self.assertIsInstance(child, header.JumpButton) - self.assertEqual(box.get_jump_button(), child) - class TestHeader(unittest.TestCase): def test_init(self): @@ -178,6 +187,9 @@ class TestHeader(unittest.TestCase): box.set_playlist(collection) child = box.get_first_child() + self.assertIsInstance(child, header.TrackBox) + + child = child.get_next_sibling() self.assertIsInstance(child, header.FilterEntry) child = child.get_next_sibling()