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