audio: Create a custom AudioControls widget
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
ca47bd052f
commit
ef1d3f0985
|
@ -122,6 +122,16 @@ class MenuButton(Gtk.ToggleButton):
|
|||
self.set_active(False)
|
||||
|
||||
|
||||
class AudioControls(Gtk.Box):
|
||||
def __init__(self, player, apscale):
|
||||
Gtk.Box.__init__(self)
|
||||
self.add_css_class("linked")
|
||||
self.append(PreviousButton(player))
|
||||
self.append(PlayPauseButton(player))
|
||||
self.append(NextButton(player))
|
||||
self.append(MenuButton(player, apscale))
|
||||
|
||||
|
||||
class Controls(Gtk.Box):
|
||||
def __init__(self):
|
||||
Gtk.Box.__init__(self)
|
||||
|
|
|
@ -168,6 +168,26 @@ class TestControlsMenuButton(unittest.TestCase):
|
|||
self.assertEqual(menu.popover.get_parent(), menu)
|
||||
|
||||
|
||||
class TestAudioControls(unittest.TestCase):
|
||||
def test_audio_controls(self):
|
||||
fake = FakePlayer()
|
||||
apscale = scale.AutoPauseScale()
|
||||
ctrl = controls.AudioControls(fake, apscale)
|
||||
|
||||
self.assertIsInstance(ctrl, Gtk.Box)
|
||||
self.assertEqual(ctrl.get_orientation(), Gtk.Orientation.HORIZONTAL)
|
||||
self.assertTrue(ctrl.has_css_class("linked"))
|
||||
|
||||
child = ctrl.get_first_child()
|
||||
self.assertIsInstance(child, controls.PreviousButton)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, controls.PlayPauseButton)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, controls.NextButton)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, controls.MenuButton)
|
||||
|
||||
|
||||
class TestControls(unittest.TestCase):
|
||||
def test_controls_init(self):
|
||||
ctrl = controls.Controls()
|
||||
|
|
Loading…
Reference in New Issue