From 28c70dfc2ed868f0d8a460aadabc60893a774feb Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Sun, 18 May 2025 16:28:27 +0200 Subject: [PATCH] Update tests --- tests/test_gui/test_gui_doceditor.py | 5 ++--- tests/test_gui/test_gui_statusbar.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index 312c88bb..b198a71a 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -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() diff --git a/tests/test_gui/test_gui_statusbar.py b/tests/test_gui/test_gui_statusbar.py index 7090f6f7..a4d5d91f 100644 --- a/tests/test_gui/test_gui_statusbar.py +++ b/tests/test_gui/test_gui_statusbar.py @@ -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()