Add automatic index rebuild (#975)
* Rebuild the index automatically if not all files are in the index on open * Update tests
This commit is contained in:
committed by
GitHub
parent
1a9efa4e1e
commit
85ea9f5b19
@@ -108,7 +108,7 @@ def testCoreIndex_LoadSave(monkeypatch, nwLipsum, mockGUI, outDir, refDir):
|
||||
# Break the index and check that we notice
|
||||
assert theIndex.indexBroken is False
|
||||
theIndex._tagIndex["Bod"].append("Stuff")
|
||||
theIndex.checkIndex()
|
||||
theIndex._checkIndex()
|
||||
assert theIndex.indexBroken is True
|
||||
|
||||
# Finalise
|
||||
|
||||
@@ -46,9 +46,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
|
||||
nwGUI.theProject.projTree.setSeed(42)
|
||||
assert nwGUI.openProject(nwLipsum)
|
||||
|
||||
# Rebuild the index as it isn't automatically copied
|
||||
assert nwGUI.theIndex._tagIndex == {}
|
||||
assert nwGUI.theIndex._refIndex == {}
|
||||
# Rebuild the index
|
||||
nwGUI.mainMenu.aRebuildIndex.activate(QAction.Trigger)
|
||||
assert nwGUI.theIndex._tagIndex != {}
|
||||
assert nwGUI.theIndex._refIndex != {}
|
||||
|
||||
@@ -61,10 +61,6 @@ def testGuiNovelTree_TreeItems(qtbot, monkeypatch, nwGUI, nwMinimal):
|
||||
##
|
||||
|
||||
nwGUI.projTabs.setCurrentIndex(nwGUI.idxNovelView)
|
||||
|
||||
# The tree should be empty as there is no index
|
||||
assert nwTree.topLevelItemCount() == 0
|
||||
|
||||
nwGUI.rebuildIndex()
|
||||
nwTree._populateTree()
|
||||
assert nwTree.topLevelItemCount() == 1
|
||||
|
||||
Reference in New Issue
Block a user