def test_model(self):
     model = CollectionTreeStore()
     model.set_albums([("~people", 0)], self.albums)
     self.failUnlessEqual(len(model), 4)
     model.change_albums(self.albums)
     self.failUnlessEqual(len(model), 4)
     model.remove_albums(self.albums)
     self.failUnlessEqual(len(model), 0)
 def test_model(self):
     model = CollectionTreeStore()
     model.set_albums([("~people", 0)], self.albums)
     self.failUnlessEqual(len(model), 4)
     model.change_albums(self.albums)
     self.failUnlessEqual(len(model), 4)
     model.remove_albums(self.albums)
     self.failUnlessEqual(len(model), 0)
    def test_utils(self):
        model = CollectionTreeStore()
        model.set_albums([("~people", 0)], self.albums)
        a = listvalues(self.albums)
        a.sort(key=lambda x: x.key)

        path = model.get_path_for_album(a[0])
        albums = model.get_albums_for_path(path)
        self.failUnless(a[0] in albums)

        albums = model.get_albums_for_iter(model.get_iter(path))
        self.failUnless(a[0] in albums)

        x = model.get_album(model.get_iter_first())
        self.failIf(x)
        x = model.get_album(model.get_iter(path))
        self.failUnlessEqual(x, a[0])

        for r in model:
            self.failUnless(model.get_markup(model.tags, r.iter))

        x = list(model.iter_albums(None))
        self.assertEqual(set(x), set(a))
    def test_utils(self):
        model = CollectionTreeStore()
        model.set_albums([("~people", 0)], self.albums)
        a = self.albums.values()
        a.sort(key=lambda x: x.key)

        path = model.get_path_for_album(a[0])
        albums = model.get_albums_for_path(path)
        self.failUnless(a[0] in albums)

        albums = model.get_albums_for_iter(model.get_iter(path))
        self.failUnless(a[0] in albums)

        x = model.get_album(model.get_iter_first())
        self.failIf(x)
        x = model.get_album(model.get_iter(path))
        self.failUnlessEqual(x, a[0])

        for r in model:
            self.failUnless(model.get_markup(model.tags, r.iter))

        x = list(model.iter_albums(None))
        self.assertEqual(set(x), set(a))