Update tests

This commit is contained in:
Veronica Berglyd Olsen
2025-05-18 16:28:27 +02:00
parent 916039b420
commit 28c70dfc2e
2 changed files with 16 additions and 3 deletions
+2 -3
View File
@@ -1957,7 +1957,7 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
assert docEditor.docFooter.wordsText.text() == "Words: 0 (+0)"
# Open a document and populate it
SHARED.project.tree[C.hSceneDoc]._initCount = 0 # type: ignore
SHARED.project.tree[C.hSceneDoc]._wordInit = 0 # type: ignore
SHARED.project.tree[C.hSceneDoc]._wordCount = 0 # type: ignore
assert nwGUI.openDocument(C.hSceneDoc) is True
@@ -1981,7 +1981,6 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
assert threadPool.objectID() == id(docEditor._wCounterDoc)
docEditor._wCounterDoc.run()
# docEditor._updateDocCounts(cC, wC, pC)
assert SHARED.project.tree[C.hSceneDoc]._charCount == cC # type: ignore
assert SHARED.project.tree[C.hSceneDoc]._wordCount == wC # type: ignore
assert SHARED.project.tree[C.hSceneDoc]._paraCount == pC # type: ignore
@@ -1993,7 +1992,7 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
assert threadPool.objectID() == id(docEditor._wCounterSel)
docEditor._wCounterSel.run()
assert docEditor.docFooter.wordsText.text() == f"Words: {wC} selected"
assert docEditor.docFooter.wordsText.text() == f"Selected: {wC}"
# qtbot.stop()
+14
View File
@@ -109,4 +109,18 @@ def testGuiStatusBar_Main(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
nwGUI._timeTick()
assert status.statsText.text() == "Words: 11 (+11)"
# Switch to character count
CONFIG.useCharCount = True
status.initSettings()
with monkeypatch.context() as mp:
mp.setattr("novelwriter.guimain.time", lambda *a: 50.0)
CONFIG.incNotesWCount = True
nwGUI._lastTotalCount = 0
nwGUI._timeTick()
assert status.statsText.text() == "Characters: 46 (+46)"
CONFIG.incNotesWCount = False
nwGUI._lastTotalCount = 0
nwGUI._timeTick()
assert status.statsText.text() == "Characters: 40 (+40)"
# qtbot.stop()