Fix warnings in tests

This commit is contained in:
Veronica Berglyd Olsen
2025-01-13 19:43:04 +01:00
parent 72ed5d84f6
commit 0b7c31b6a9
11 changed files with 336 additions and 102 deletions
+3 -1
View File
@@ -41,7 +41,9 @@ def testDlgAbout_NWDialog(qtbot, monkeypatch, nwGUI):
msgAbout = SHARED.findTopLevelWidget(GuiAbout)
assert isinstance(msgAbout, GuiAbout)
assert msgAbout.txtCredits.document().characterCount() > 100
document = msgAbout.txtCredits.document()
assert document is not None
assert document.characterCount() > 100
with monkeypatch.context() as mp:
mp.setattr("novelwriter.config.Config.assetPath", lambda *a: Path("whatever"))
+10 -3
View File
@@ -96,6 +96,7 @@ def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
# Check Navigation
vBar = prefs.mainForm.verticalScrollBar()
assert vBar is not None
old = -1
with qtbot.waitSignal(vBar.valueChanged) as value:
prefs.sidebar.button(1).click()
@@ -119,12 +120,16 @@ def testDlgPreferences_Actions(qtbot, monkeypatch, nwGUI):
# Check Save Button
prefs.show()
with qtbot.waitSignal(prefs.newPreferencesReady) as signal:
prefs.buttonBox.button(QtDialogSave).click()
button = prefs.buttonBox.button(QtDialogSave)
assert button is not None
button.click()
assert signal.args == [False, False, False, False]
# Check Close Button
prefs.show()
prefs.buttonBox.button(QtDialogCancel).click()
button = prefs.buttonBox.button(QtDialogCancel)
assert button is not None
button.click()
assert prefs.isHidden() is True
# Close Using Escape Key
@@ -313,7 +318,9 @@ 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:
prefs.buttonBox.button(QtDialogSave).click()
button = prefs.buttonBox.button(QtDialogSave)
assert button is not None
button.click()
assert signal.args == [True, True, True, True]
# Check Settings