Change assetPath to a Path object

This commit is contained in:
Veronica Berglyd Olsen
2022-11-09 17:44:20 +01:00
parent 6792c11a71
commit 9d3291aba6
13 changed files with 142 additions and 151 deletions
+9 -8
View File
@@ -21,6 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
import pytest
from pathlib import Path
from tools import getGuiItem
from PyQt5.QtWidgets import QAction, QMessageBox
@@ -29,7 +31,7 @@ from novelwriter.dialogs.about import GuiAbout
@pytest.mark.gui
def testDlgAbout_NWDialog(qtbot, nwGUI):
def testDlgAbout_NWDialog(qtbot, monkeypatch, nwGUI):
"""Test the novelWriter about dialogs.
"""
# NW About
@@ -45,13 +47,12 @@ def testDlgAbout_NWDialog(qtbot, nwGUI):
assert msgAbout.pageNotes.document().characterCount() > 100
assert msgAbout.pageLicense.document().characterCount() > 100
msgAbout.mainConf.assetPath = "whatever"
msgAbout._fillNotesPage()
assert msgAbout.pageNotes.toPlainText() == "Error loading release notes text ..."
msgAbout._fillLicensePage()
assert msgAbout.pageLicense.toPlainText() == "Error loading licence text ..."
with monkeypatch.context() as mp:
mp.setattr("novelwriter.config.Config.getAssetPath", lambda *a: Path("whatever"))
msgAbout._fillNotesPage()
assert msgAbout.pageNotes.toPlainText() == "Error loading release notes text ..."
msgAbout._fillLicensePage()
assert msgAbout.pageLicense.toPlainText() == "Error loading licence text ..."
msgAbout.showReleaseNotes()
assert msgAbout.tabBox.currentWidget() == msgAbout.pageNotes