Restructure the record of root items in the tree class

This commit is contained in:
Veronica Berglyd Olsen
2022-04-02 19:13:54 +02:00
parent 8ddda4783d
commit f9ddcd2f8a
7 changed files with 66 additions and 33 deletions
+1
View File
@@ -284,6 +284,7 @@ def testCoreIndex_ScanText(nwMinimal, mockGUI):
aHandle = theProject.newRoot("Archive", nwItemClass.ARCHIVE)
assert theProject.projTree[aHandle] is not None
xItem.setParent(aHandle)
xItem.setRoot(aHandle)
assert theIndex.scanText(xHandle, "Hello World!") is False
# Make some usable items
-7
View File
@@ -224,17 +224,10 @@ def testCoreTree_Methods(mockGUI, mockItems):
assert theTree.checkType("c000000000001", nwItemType.FILE) is True
# Root item lookup
theTree._treeRoots.append("stuff")
assert theTree.findRoot(nwItemClass.WORLD) is None
assert theTree.findRoot(nwItemClass.NOVEL) == "a000000000001"
assert theTree.findRoot(nwItemClass.CHARACTER) == "a000000000004"
# Find root item of child item
assert theTree.getRootItem("b000000000001").itemHandle == "a000000000001"
assert theTree.getRootItem("c000000000001").itemHandle == "a000000000001"
assert theTree.getRootItem("c000000000002").itemHandle == "a000000000001"
assert theTree.getRootItem("stuff") is None
# Get item path
assert theTree.getItemPath("stuff") == []
assert theTree.getItemPath("c000000000001") == [