Tighten up the item class (#937)
* Protect the attributes of the NWItem class * Fix test coverage * Add a type checker function to the tree class
This commit is contained in:
committed by
GitHub
parent
af3d0d2eb0
commit
6ac9e1aec4
@@ -1225,8 +1225,8 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, caplog, nwGUI, nwMinimal, ips
|
||||
|
||||
# Open a document and populate it
|
||||
sHandle = "8c659a11cd429"
|
||||
nwGUI.theProject.projTree[sHandle].initCount = 0 # Clear item's count
|
||||
nwGUI.theProject.projTree[sHandle].wordCount = 0 # Clear item's count
|
||||
nwGUI.theProject.projTree[sHandle]._initCount = 0 # Clear item's count
|
||||
nwGUI.theProject.projTree[sHandle]._wordCount = 0 # Clear item's count
|
||||
assert nwGUI.openDocument(sHandle) is True
|
||||
qtbot.wait(stepDelay)
|
||||
|
||||
@@ -1252,9 +1252,9 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, caplog, nwGUI, nwMinimal, ips
|
||||
nwGUI.docEditor.wCounterDoc.run()
|
||||
# nwGUI.docEditor._updateDocCounts(cC, wC, pC)
|
||||
qtbot.wait(stepDelay)
|
||||
assert nwGUI.theProject.projTree[sHandle].charCount == cC
|
||||
assert nwGUI.theProject.projTree[sHandle].wordCount == wC
|
||||
assert nwGUI.theProject.projTree[sHandle].paraCount == pC
|
||||
assert nwGUI.theProject.projTree[sHandle]._charCount == cC
|
||||
assert nwGUI.theProject.projTree[sHandle]._wordCount == wC
|
||||
assert nwGUI.theProject.projTree[sHandle]._paraCount == pC
|
||||
assert nwGUI.docEditor.docFooter.wordsText.text() == f"Words: {wC} (+{wC})"
|
||||
|
||||
# Select all text
|
||||
|
||||
@@ -223,7 +223,7 @@ def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal):
|
||||
# Add new file after one that has no parent handle
|
||||
chItem = nwTree._getTreeItem("44cb730c42048")
|
||||
nwTree.setCurrentItem(chItem, QItemSelectionModel.Current)
|
||||
nwTree.theProject.projTree["44cb730c42048"].itemParent = None
|
||||
nwTree.theProject.projTree["44cb730c42048"]._parent = None
|
||||
assert not nwTree.newTreeItem(nwItemType.FILE, nwItemClass.NOVEL)
|
||||
nwTree.clearSelection()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user