Update manuscript tests
This commit is contained in:
@@ -40,7 +40,7 @@ from tests.tools import buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testManuscriptBuild_Main(
|
||||
def testToolManuscriptBuild_Main(
|
||||
monkeypatch, qtbot: QtBot, nwGUI: GuiMain, fncPath: Path, projPath: Path, mockRnd
|
||||
):
|
||||
"""Test the GuiManuscriptBuild dialog."""
|
||||
|
||||
@@ -40,7 +40,7 @@ from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
def testToolManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
"""Test the init/main functionality of the GuiManuscript dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
@@ -54,38 +54,27 @@ def testManuscript_Init(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
manus.show()
|
||||
assert manus.docPreview.toPlainText().strip() == ""
|
||||
|
||||
# Run the default build
|
||||
# First load should have create a default build
|
||||
assert manus.buildList.count() == 1
|
||||
|
||||
# Loading again should not add a new build
|
||||
manus.loadContent()
|
||||
assert manus.buildList.count() == 1
|
||||
|
||||
# Build a preview
|
||||
manus.buildList.clearSelection()
|
||||
manus.buildList.setCurrentRow(0)
|
||||
with qtbot.waitSignal(manus.docPreview.document().contentsChanged):
|
||||
manus.btnPreview.click()
|
||||
assert manus.docPreview.toPlainText().strip() == allText
|
||||
|
||||
manus.close()
|
||||
|
||||
# # A new dialog should load the old build
|
||||
# manus = GuiManuscript(nwGUI)
|
||||
# manus.show()
|
||||
# manus.loadContent()
|
||||
# assert manus.docPreview.toPlainText().strip() == allText
|
||||
# manus.close()
|
||||
|
||||
# # But blocking the reload should leave it empty
|
||||
# with monkeypatch.context() as mp:
|
||||
# mp.setattr("builtins.open", lambda *a, **k: causeOSError)
|
||||
# manus = GuiManuscript(nwGUI)
|
||||
# manus.show()
|
||||
# manus.loadContent()
|
||||
# assert manus.docPreview.toPlainText().strip() == ""
|
||||
|
||||
# nwGUI.closeProject() # This should auto-close the manuscript tool
|
||||
# assert manus.isHidden()
|
||||
nwGUI.closeProject() # This should auto-close the manuscript tool
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testManuscript_Builds(qtbot, nwGUI, projPath):
|
||||
def testToolManuscript_Builds(qtbot, nwGUI, projPath):
|
||||
"""Test the handling of builds in the GuiManuscript dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
@@ -156,7 +145,7 @@ def testManuscript_Builds(qtbot, nwGUI, projPath):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
def testToolManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
"""Test other features of the GuiManuscript dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
@@ -280,7 +269,7 @@ def testManuscript_Features(monkeypatch, qtbot, nwGUI, projPath, mockRnd):
|
||||
|
||||
@pytest.mark.gui
|
||||
@pytest.mark.skipif(sys.platform.startswith("darwin"), reason="Not running on Darwin")
|
||||
def testManuscript_Print(monkeypatch, qtbot, nwGUI, projPath):
|
||||
def testToolManuscript_Print(monkeypatch, qtbot, nwGUI, projPath):
|
||||
"""Test the print feature of the GuiManuscript dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
|
||||
@@ -40,7 +40,7 @@ from tests.tools import C, buildTestProject
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
||||
def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
||||
"""Test the initialisation of the GuiBuildSettings dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
@@ -110,7 +110,7 @@ def testBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
||||
def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
||||
"""Test the Filter Tab of the GuiBuildSettings dialog."""
|
||||
buildTestProject(nwGUI, projPath)
|
||||
nwGUI.openProject(projPath)
|
||||
@@ -314,7 +314,7 @@ def testBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Headings(qtbot, nwGUI):
|
||||
def testToolBuildSettings_Headings(qtbot, nwGUI):
|
||||
"""Test the Headings Tab of the GuiBuildSettings dialog."""
|
||||
build = BuildSettings()
|
||||
|
||||
@@ -484,7 +484,7 @@ def testBuildSettings_Headings(qtbot, nwGUI):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Content(qtbot, nwGUI):
|
||||
def testToolBuildSettings_Content(qtbot, nwGUI):
|
||||
"""Test the Content Tab of the GuiBuildSettings dialog."""
|
||||
build = BuildSettings()
|
||||
|
||||
@@ -544,7 +544,7 @@ def testBuildSettings_Content(qtbot, nwGUI):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Format(monkeypatch, qtbot, nwGUI):
|
||||
def testToolBuildSettings_Format(monkeypatch, qtbot, nwGUI):
|
||||
"""Test the Format Tab of the GuiBuildSettings dialog."""
|
||||
build = BuildSettings()
|
||||
|
||||
@@ -650,7 +650,7 @@ def testBuildSettings_Format(monkeypatch, qtbot, nwGUI):
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def testBuildSettings_Output(qtbot, nwGUI):
|
||||
def testToolBuildSettings_Output(qtbot, nwGUI):
|
||||
"""Test the Output Tab of the GuiBuildSettings dialog."""
|
||||
build = BuildSettings()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user