Improve how the novel tree is refreshed

This commit is contained in:
Veronica Berglyd Olsen
2022-11-14 18:45:36 +01:00
parent 992ed4f36c
commit ebc6654069
7 changed files with 76 additions and 135 deletions
+3 -13
View File
@@ -580,12 +580,13 @@ def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
assert wC == 12 # Words in text and title only
assert pC == 2 # Paragraphs in text only
# getItemData
# ===========
# getItemData + getHandleHeaderCount
# ==================================
theItem = theIndex.getItemData(nHandle)
assert isinstance(theItem, IndexItem)
assert theItem.headings() == ["T0001"]
assert theIndex.getHandleHeaderCount(nHandle) == 1
# getReferences
# =============
@@ -786,17 +787,6 @@ def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
assert theIndex.saveIndex() is True
assert theProject.saveProject() is True
# Header Record
bHandle = "0000000000000"
assert theIndex.getHandleHeaders(bHandle) == []
assert theIndex.getHandleHeaders(hHandle) == [("T0001", "H2", "Chapter One")]
assert theIndex.getHandleHeaders(sHandle) == [("T0001", "H3", "Scene One")]
assert theIndex.getHandleHeaders(tHandle) == [("T0001", "H3", "Scene Two")]
assert theIndex.getHandleHeaders(nHandle) == [
("T0001", "H1", "Hello World!"), ("T0002", "H1", "Hello World!")
]
assert theProject.closeProject() is True
# END Test testCoreIndex_ExtractData
+2 -2
View File
@@ -118,10 +118,10 @@ def testGuiEditor_LoadText(qtbot, monkeypatch, caplog, nwGUI, projPath, ipsumTex
assert nwGUI.docEditor.loadText(C.hSceneDoc) is True
assert nwGUI.docEditor._bigDoc is True
# Regular open, with line number
# Regular open, with line number (1 indexed)
assert nwGUI.docEditor.loadText(C.hSceneDoc, tLine=4) is True
cursPos = nwGUI.docEditor.getCursorPosition()
assert nwGUI.docEditor.document().findBlock(cursPos).blockNumber() == 4
assert nwGUI.docEditor.document().findBlock(cursPos).blockNumber() == 3
# Load empty document
nwGUI.docEditor.replaceText("")
-1
View File
@@ -57,7 +57,6 @@ def testGuiMain_ProjectBlocker(nwGUI):
assert nwGUI.importDocument() is False
assert nwGUI.openSelectedItem() is False
assert nwGUI.editItemLabel() is False
assert nwGUI.requestNovelTreeRefresh() is False
assert nwGUI.rebuildIndex() is False
assert nwGUI.showProjectSettingsDialog() is False
assert nwGUI.showProjectDetailsDialog() is False