Clean up a few remnants of old test code

This commit is contained in:
Veronica Berglyd Olsen
2023-06-09 22:06:38 +02:00
parent 112aa8468c
commit 0eb39d2e0a
7 changed files with 14 additions and 40 deletions
+2 -2
View File
@@ -1203,12 +1203,12 @@ def testGuiEditor_WordCounters(qtbot, monkeypatch, nwGUI, projPath, ipsumText, m
@pytest.mark.gui
def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, nwLipsum):
def testGuiEditor_Search(qtbot, monkeypatch, nwGUI, prjLipsum):
"""Test the document editor search functionality.
"""
monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True)
assert nwGUI.openProject(nwLipsum) is True
assert nwGUI.openProject(prjLipsum) is True
assert nwGUI.openDocument("4c4f28287af27") is True
origText = nwGUI.docEditor.getText()
+2 -2
View File
@@ -33,11 +33,11 @@ from novelwriter.core.tohtml import ToHtml
@pytest.mark.gui
def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
"""Test the document viewer.
"""
# Open project
assert nwGUI.openProject(nwLipsum)
assert nwGUI.openProject(prjLipsum)
# Rebuild the index
nwGUI.mainMenu.aRebuildIndex.activate(QAction.Trigger)
+4 -4
View File
@@ -34,7 +34,7 @@ from novelwriter.gui.doceditor import GuiDocEditor
@pytest.mark.gui
def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, prjLipsum):
"""Test the main menu Edit and Format entries.
"""
monkeypatch.setattr(GuiDocEditor, "hasFocus", lambda *a: True)
@@ -42,7 +42,7 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
# Test Document Action with No Project
assert nwGUI.docEditor.docAction(nwDocAction.COPY) is False
assert nwGUI.openProject(nwLipsum) is True
assert nwGUI.openProject(prjLipsum) is True
# Split By Chapter
assert nwGUI.openDocument("4c4f28287af27") is True
@@ -342,10 +342,10 @@ def testGuiMenu_EditFormat(qtbot, monkeypatch, nwGUI, nwLipsum):
@pytest.mark.gui
def testGuiMenu_ContextMenus(qtbot, nwGUI, nwLipsum):
def testGuiMenu_ContextMenus(qtbot, nwGUI, prjLipsum):
"""Test the context menus.
"""
assert nwGUI.openProject(nwLipsum)
assert nwGUI.openProject(prjLipsum)
assert nwGUI.openDocument("4c4f28287af27")
# Editor Context Menu
+3 -4
View File
@@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import os
import time
import pytest
@@ -152,10 +151,10 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, projPath):
@pytest.mark.gui
def testGuiOutline_Content(qtbot, nwGUI, nwLipsum):
def testGuiOutline_Content(qtbot, nwGUI, prjLipsum):
"""Test the outline view.
"""
assert nwGUI.openProject(nwLipsum)
assert nwGUI.openProject(prjLipsum)
nwGUI.rebuildIndex()
nwGUI._changeView(nwView.OUTLINE)
@@ -192,7 +191,7 @@ def testGuiOutline_Content(qtbot, nwGUI, nwLipsum):
for dTitle, hLevel in docList:
aHandle = nwGUI.theProject.newFile(dTitle, newHandle)
hHash = "#"*hLevel
writeFile(os.path.join(nwLipsum, "content", f"{aHandle}.nwd"), f"{hHash} {dTitle}\n\n")
writeFile(prjLipsum / "content" / f"{aHandle}.nwd", f"{hHash} {dTitle}\n\n")
nwGUI.projView.projTree.revealNewTreeItem(aHandle)
nwGUI.rebuildIndex()