Fix broken tests
This commit is contained in:
@@ -32,7 +32,7 @@ from novelwriter.constants import nwUnicode
|
|||||||
from novelwriter.dialogs.preferences import GuiPreferences
|
from novelwriter.dialogs.preferences import GuiPreferences
|
||||||
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
||||||
from novelwriter.gui.theme import ThemeEntry
|
from novelwriter.gui.theme import ThemeEntry
|
||||||
from novelwriter.types import QtDialogCancel, QtDialogSave, QtModNone
|
from novelwriter.types import QtModNone
|
||||||
|
|
||||||
KEY_DELAY = 1
|
KEY_DELAY = 1
|
||||||
|
|
||||||
@@ -118,16 +118,12 @@ def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
|
|||||||
# Check Save Button
|
# Check Save Button
|
||||||
prefs.show()
|
prefs.show()
|
||||||
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
||||||
button = prefs.buttonBox.button(QtDialogSave)
|
prefs.btnSave.click()
|
||||||
assert button is not None
|
|
||||||
button.click()
|
|
||||||
assert len(signal.args) == 4
|
assert len(signal.args) == 4
|
||||||
|
|
||||||
# Check Close Button
|
# Check Close Button
|
||||||
prefs.show()
|
prefs.show()
|
||||||
button = prefs.buttonBox.button(QtDialogCancel)
|
prefs.btnCancel.click()
|
||||||
assert button is not None
|
|
||||||
button.click()
|
|
||||||
assert prefs.isHidden() is True
|
assert prefs.isHidden() is True
|
||||||
|
|
||||||
# Close Using Escape Key
|
# Close Using Escape Key
|
||||||
@@ -342,9 +338,7 @@ def testDlgPreferences_Settings(qtbot, monkeypatch, nwGUI, fncPath, tstPaths):
|
|||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
mp.setattr(QFontDatabase, "families", lambda *a: ["TestFont"])
|
mp.setattr(QFontDatabase, "families", lambda *a: ["TestFont"])
|
||||||
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
|
||||||
button = prefs.buttonBox.button(QtDialogSave)
|
prefs.btnSave.click()
|
||||||
assert button is not None
|
|
||||||
button.click()
|
|
||||||
assert signal.args == [True, True, True, True]
|
assert signal.args == [True, True, True, True]
|
||||||
|
|
||||||
# Check Settings
|
# Check Settings
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ from novelwriter.enum import nwBuildFmt
|
|||||||
from novelwriter.guimain import GuiMain
|
from novelwriter.guimain import GuiMain
|
||||||
from novelwriter.shared import _GuiAlert
|
from novelwriter.shared import _GuiAlert
|
||||||
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
||||||
from novelwriter.types import QtDialogClose
|
|
||||||
|
|
||||||
from tests.tools import buildTestProject
|
from tests.tools import buildTestProject
|
||||||
|
|
||||||
@@ -95,9 +94,7 @@ def testToolManuscriptBuild_Main(
|
|||||||
assert (fncPath / "TestBuild").with_suffix(nwLabels.BUILD_EXT[fmt]).exists()
|
assert (fncPath / "TestBuild").with_suffix(nwLabels.BUILD_EXT[fmt]).exists()
|
||||||
lastFmt = fmt
|
lastFmt = fmt
|
||||||
|
|
||||||
button = manus.buttonBox.button(QtDialogClose)
|
manus._dialogButtonClicked(manus.btnClose)
|
||||||
assert button is not None
|
|
||||||
manus._dialogButtonClicked(button)
|
|
||||||
manus.deleteLater()
|
manus.deleteLater()
|
||||||
|
|
||||||
assert build.lastBuildName == "TestBuild"
|
assert build.lastBuildName == "TestBuild"
|
||||||
@@ -151,7 +148,5 @@ def testToolManuscriptBuild_Main(
|
|||||||
assert lastUrl.startswith("file://")
|
assert lastUrl.startswith("file://")
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = manus.buttonBox.button(QtDialogClose)
|
manus._dialogButtonClicked(manus.btnClose)
|
||||||
assert button is not None
|
|
||||||
manus._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ from novelwriter.core.buildsettings import BuildSettings
|
|||||||
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
from novelwriter.tools.manusbuild import GuiManuscriptBuild
|
||||||
from novelwriter.tools.manuscript import GuiManuscript
|
from novelwriter.tools.manuscript import GuiManuscript
|
||||||
from novelwriter.tools.manussettings import GuiBuildSettings
|
from novelwriter.tools.manussettings import GuiBuildSettings
|
||||||
from novelwriter.types import QtDialogApply, QtDialogSave
|
|
||||||
|
|
||||||
from tests.tools import C, buildTestProject
|
from tests.tools import C, buildTestProject
|
||||||
|
|
||||||
@@ -115,9 +114,7 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
button = bSettings.buttonBox.button(QtDialogSave)
|
bSettings.btnSave.click()
|
||||||
assert button is not None
|
|
||||||
button.click()
|
|
||||||
|
|
||||||
assert isinstance(build, BuildSettings)
|
assert isinstance(build, BuildSettings)
|
||||||
assert build.name == "Test Build"
|
assert build.name == "Test Build"
|
||||||
@@ -136,9 +133,7 @@ def testToolManuscript_Builds(qtbot, nwGUI, projPath):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
button = bSettings.buttonBox.button(QtDialogApply)
|
bSettings.btnApply.click() # Should leave the dialog open
|
||||||
assert button is not None
|
|
||||||
button.click() # Should leave the dialog open
|
|
||||||
|
|
||||||
assert isinstance(build, BuildSettings)
|
assert isinstance(build, BuildSettings)
|
||||||
assert build.name == "Test Build"
|
assert build.name == "Test Build"
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ from novelwriter.core.buildsettings import BuildSettings, FilterMode
|
|||||||
from novelwriter.tools.manussettings import (
|
from novelwriter.tools.manussettings import (
|
||||||
GuiBuildSettings, _FilterTab, _FormattingTab, _HeadingsTab
|
GuiBuildSettings, _FilterTab, _FormattingTab, _HeadingsTab
|
||||||
)
|
)
|
||||||
from novelwriter.types import QtDialogApply, QtDialogClose, QtDialogSave
|
|
||||||
|
|
||||||
from tests.tools import C, buildTestProject
|
from tests.tools import C, buildTestProject
|
||||||
|
|
||||||
@@ -78,9 +77,7 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
# Capture Apply button
|
# Capture Apply button
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
button = bSettings.buttonBox.button(QtDialogApply)
|
bSettings._dialogButtonClicked(bSettings.btnApply)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
|
|
||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
@@ -89,9 +86,7 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
|
|
||||||
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
with qtbot.waitSignal(bSettings.newSettingsReady, timeout=5000):
|
||||||
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
bSettings.newSettingsReady.connect(_testNewSettingsReady)
|
||||||
button = bSettings.buttonBox.button(QtDialogSave)
|
bSettings._dialogButtonClicked(bSettings.btnSave)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
|
|
||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
@@ -109,9 +104,7 @@ def testToolBuildSettings_Init(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
assert triggered
|
assert triggered
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -326,9 +319,7 @@ def testToolBuildSettings_Filter(qtbot, nwGUI, projPath, mockRnd):
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -505,9 +496,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
|
|||||||
assert sBuild.getBool("headings.hideSection") is True
|
assert sBuild.getBool("headings.hideSection") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -579,9 +568,7 @@ def testToolBuildSettings_FormatTextContent(qtbot, nwGUI):
|
|||||||
assert sBuild.getBool("text.addNoteHeadings") is True
|
assert sBuild.getBool("text.addNoteHeadings") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -657,9 +644,7 @@ def testToolBuildSettings_FormatTextFormat(monkeypatch, qtbot, nwGUI):
|
|||||||
assert fmtTab._textFont == font
|
assert fmtTab._textFont == font
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -703,9 +688,7 @@ def testToolBuildSettings_FormatFirstLineIndent(monkeypatch, qtbot, nwGUI):
|
|||||||
assert sBuild.getBool("format.indentFirstPar") is True
|
assert sBuild.getBool("format.indentFirstPar") is True
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -761,9 +744,7 @@ def testToolBuildSettings_FormatPageLayout(monkeypatch, qtbot, nwGUI):
|
|||||||
assert fmtTab.rightMargin.value() == 1.5
|
assert fmtTab.rightMargin.value() == 1.5
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|
||||||
|
|
||||||
@@ -832,7 +813,5 @@ def testToolBuildSettings_FormatOutput(qtbot, nwGUI):
|
|||||||
assert fmtTab.odtPageHeader.text() == nwHeadFmt.DOC_AUTO
|
assert fmtTab.odtPageHeader.text() == nwHeadFmt.DOC_AUTO
|
||||||
|
|
||||||
# Finish
|
# Finish
|
||||||
button = bSettings.buttonBox.button(QtDialogClose)
|
bSettings._dialogButtonClicked(bSettings.btnClose)
|
||||||
assert button is not None
|
|
||||||
bSettings._dialogButtonClicked(button)
|
|
||||||
# qtbot.stop()
|
# qtbot.stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user