Separated out about test and updated it

This commit is contained in:
Veronica K. B. Olsen
2020-12-12 15:59:35 +01:00
parent e258ff60d0
commit 9eb8158c36
3 changed files with 75 additions and 61 deletions
+3 -43
View File
@@ -13,12 +13,12 @@ from tools import cmpFiles, getGuiItem
from PyQt5.QtCore import Qt, QItemSelectionModel
from PyQt5.QtWidgets import (
QDialogButtonBox, QTreeWidgetItem, QListWidgetItem, QDialog, QAction,
QMessageBox, QFileDialog, QFontDialog
QFileDialog, QFontDialog
)
from nw.gui import (
GuiItemEditor, GuiAbout, GuiBuildNovel, GuiDocMerge, GuiDocSplit,
GuiProjectWizard, GuiProjectLoad, GuiPreferences
GuiItemEditor, GuiBuildNovel, GuiDocMerge, GuiDocSplit, GuiProjectWizard,
GuiProjectLoad, GuiPreferences
)
from nw.gui.custom import QuotesDialog
from nw.constants import nwItemLayout, nwItemClass
@@ -100,46 +100,6 @@ def testItemEditor(qtbot, yesToAll, monkeypatch, fncDir, nwTempGUI, refDir, tmpD
# qtbot.stopForInteraction()
nwGUI.closeMain()
@pytest.mark.gui
def testAboutBox(qtbot, monkeypatch, fncDir, tmpDir):
nwGUI = nw.main(["--testmode", "--config=%s" % fncDir, "--data=%s" % tmpDir])
qtbot.addWidget(nwGUI)
nwGUI.show()
qtbot.waitForWindowShown(nwGUI)
qtbot.wait(stepDelay)
# NW About
monkeypatch.setattr(GuiAbout, "exec_", lambda *args: None)
nwGUI.mainMenu.aAboutNW.activate(QAction.Trigger)
qtbot.waitUntil(lambda: getGuiItem("GuiAbout") is not None, timeout=1000)
msgAbout = getGuiItem("GuiAbout")
assert isinstance(msgAbout, GuiAbout)
msgAbout.show()
assert msgAbout.pageAbout.document().characterCount() > 100
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 license text ..."
msgAbout.showReleaseNotes()
assert msgAbout.tabBox.currentWidget() == msgAbout.pageNotes
# Qt About
monkeypatch.setattr(QMessageBox, "aboutQt", lambda *args, **kwargs: None)
nwGUI.mainMenu.aAboutQt.activate(QAction.Trigger)
# qtbot.stopForInteraction()
msgAbout._doClose()
nwGUI.closeMain()
@pytest.mark.gui
def testBuildTool(qtbot, yesToAll, nwTempBuild, nwLipsum, refDir, tmpDir):