267
267
self.filter_model.setFilters(self.filter)
268
self.assertVisiblePaths(self.expected_visible)
268
self.expected_visible.sort()
269
self.assertEqual(self.getVisiblePaths(), self.expected_visible)
270
def assertVisiblePaths(self, paths):
271
def getVisiblePaths(self):
271
272
visible_paths = []
272
273
parent_indexes_to_visit = [QtCore.QModelIndex()]
273
274
while parent_indexes_to_visit:
278
279
str(self.filter_model.data(index, self.model.PATH).toString()))
279
280
if self.filter_model.hasChildren(index):
280
281
parent_indexes_to_visit.append(index)
282
# we do not care for the order in this test.
283
282
visible_paths.sort()
285
self.assertEqual(visible_paths, paths)
285
def test_unversioned_move_conflict(self):
286
"""Test for bug reported as lp:557603 lp:712931 lp:815822 lp:876180"""
287
tree = self.make_branch_and_tree("parent")
288
tree.commit("Base revision")
289
childtree = tree.bzrdir.sprout("child").open_workingtree()
290
self.build_tree(["parent/f", "child/f"])
292
childtree.commit("Adding f")
293
tree.merge_from_branch(childtree.branch)
294
self.assertLength(1, tree.conflicts())
295
self.assertPathExists("parent/f.moved")
296
os.remove("parent/f.moved")
297
# At this point, the tree has a pending merge adding 'f' and a removed
298
# unversioned duplicate 'f.moved', which is enough to trigger the bug.
299
self.model = TreeModel()
300
load_dirs=[PersistantItemReference(None, "parent")]
301
self.model.set_tree(tree, branch=tree.branch, load_dirs=load_dirs)
302
self.filter_model = TreeFilterProxyModel()
303
self.filter_model.setSourceModel(self.model)
304
self.filter_model.setFilters(self.filter)
306
if self.filter[TreeFilterProxyModel.CHANGED]:
307
expected_paths.append("f")
308
# This seems wrong, f.moved is deleted so should never be shown?
309
if self.filter[TreeFilterProxyModel.UNCHANGED]:
310
expected_paths.append("f.moved")
311
self.assertEqual(self.getVisiblePaths(), expected_paths)
287
314
class TestTreeWidgetSelectAll(qtests.QTestCase):