curds: Remove playlist.show() function
Let's just set the visible state directly. Additionally, I add a test for setting visibility back to false when showing a different playlist Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
ce269d496d
commit
213854f3fa
|
@ -135,9 +135,6 @@ class Playlist(node.PlaylistNode):
|
|||
self.random = random
|
||||
return self.random
|
||||
|
||||
def show(self):
|
||||
self.visible = True
|
||||
|
||||
def sort(self, field):
|
||||
if field in self.sort_order:
|
||||
self.sort_order.remove(field)
|
||||
|
|
|
@ -87,7 +87,7 @@ class TestPlaylist(unittest.TestCase):
|
|||
for i, track in enumerate(tracks):
|
||||
self.assertEqual(self.plist[i], track)
|
||||
|
||||
self.plist.show()
|
||||
self.plist.visible = True
|
||||
self.add_tracks([6])
|
||||
self.assertEqual(len(self.plist), 6)
|
||||
self.assertEqual(self.cb_plist, self.plist)
|
||||
|
|
|
@ -24,7 +24,7 @@ class TestPreviousPlaylist(unittest.TestCase):
|
|||
|
||||
def test_previous_playlist(self):
|
||||
plist = previous.PreviousPlaylist()
|
||||
plist.show()
|
||||
plist.visible = True
|
||||
|
||||
self.assertIsInstance(plist, previous.PreviousPlaylist)
|
||||
self.assertIsInstance(plist, playlist.Playlist)
|
||||
|
|
|
@ -9,7 +9,10 @@ class PlaylistModel(GObject.GObject, Gtk.TreeModel):
|
|||
def __init__(self, playlist):
|
||||
GObject.GObject.__init__(self)
|
||||
self.playlist = playlist
|
||||
self.playlist.show()
|
||||
self.playlist.visible = True
|
||||
|
||||
def __del__(self):
|
||||
self.playlist.visible = False
|
||||
|
||||
def do_get_column_type(self, col):
|
||||
return str
|
||||
|
|
|
@ -28,6 +28,13 @@ class TestPlaylistModel(unittest.TestCase):
|
|||
for col in range(self.model.get_n_columns()):
|
||||
self.assertEqual(self.model.get_column_type(col), GObject.GType(str))
|
||||
|
||||
def test_model_del(self):
|
||||
plist = curds.Playlist("Test Playlist Two")
|
||||
self.assertTrue( self.playlist.visible)
|
||||
self.model = model.PlaylistModel(plist)
|
||||
self.assertTrue(plist.visible)
|
||||
self.assertFalse(self.playlist.visible)
|
||||
|
||||
def test_model_get_iter(self):
|
||||
iter = self.model.get_iter(Gtk.TreePath(0))
|
||||
self.assertEqual(iter.user_data, 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user