Commit d37680bb authored by Martin Pitt's avatar Martin Pitt
Browse files

Add missing override for TreeModel.iter_previous()

This should behave like the override for TreeModel.iter_next().

https://bugzilla.gnome.org/show_bug.cgi?id=660018
parent e03284f8
......@@ -802,6 +802,12 @@ class TreeModel(Gtk.TreeModel):
if success:
return next_iter
def iter_previous(self, aiter):
prev_iter = aiter.copy()
success = super(TreeModel, self).iter_previous(prev_iter)
if success:
return prev_iter
def iter_children(self, aiter):
success, child_iter = super(TreeModel, self).iter_children(aiter)
if success:
......
......@@ -1352,6 +1352,8 @@ class TestGtk(unittest.TestCase):
self.assertTrue(tree_store)
self.assertEqual(len(tree_store), 100)
self.assertEqual(tree_store.iter_previous(tree_store.get_iter(0)), None)
for i, row in enumerate(tree_store):
self.assertEqual(row.model, tree_store)
self.assertEqual(row.parent, None)
......@@ -1377,6 +1379,8 @@ class TestGtk(unittest.TestCase):
next = tree_store.iter_next(aiter)
if i < len(tree_store) - 1:
self.assertEqual(tree_store.get_path(next), row.next.path)
self.assertEqual(tree_store.get_path(tree_store.iter_previous(next)),
tree_store.get_path(aiter))
else:
self.assertEqual(next, None)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment