sidebar: Load child tagstores during __init__()
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
cf23b4f8e0
commit
f477f8f12a
|
@ -80,6 +80,8 @@ class ParentTagBox(TagBox):
|
|||
self.childstore = childstore
|
||||
self.childicon = childicon
|
||||
|
||||
for child in childstore.tags():
|
||||
self.on_child_tag_added(child)
|
||||
childstore.Added.register(self.child_tag_added)
|
||||
childstore.Removed.register(self.child_tag_removed)
|
||||
|
||||
|
|
|
@ -146,3 +146,18 @@ class TestParentTagBox(unittest.TestCase):
|
|||
store.remove(tag)
|
||||
ptbox.bus.complete()
|
||||
self.assertIsNone(tag.widgets)
|
||||
|
||||
def test_parent_tagbox_load(self):
|
||||
store = lib.tagstore.TagStore()
|
||||
superstore = lib.tagstore.TagSuperStore()
|
||||
|
||||
tag = store.add("Test", fake.Track(1))
|
||||
tag1 = superstore.add(tag, "Tag 1", fake.Track(1))
|
||||
tag2 = superstore.add(tag, "Tag 2", fake.Track(2))
|
||||
|
||||
ptbox = tagbox.ParentTagBox(store, "missing-icon",
|
||||
superstore, "missing-icon")
|
||||
|
||||
self.assertEqual(ptbox[0], tag.widgets)
|
||||
self.assertEqual(ptbox[1], tag1.widgets)
|
||||
self.assertEqual(ptbox[2], tag2.widgets)
|
||||
|
|
Loading…
Reference in New Issue
Block a user