From 28ef1d12b012745ba3391f01d537bc6b61d6c969 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Mon, 28 Sep 2020 22:22:29 +0200 Subject: [PATCH] All message box questions are now handled in test suite, so no need to check for showGUI --- nw/gui/docsplit.py | 21 +++++------ nw/gui/projload.py | 18 +++------ nw/gui/projtree.py | 19 +++++----- nw/gui/writingstats.py | 25 ++++++------- nw/guimain.py | 85 ++++++++++++++++++++---------------------- tests/conftest.py | 24 +++++++++++- tests/test_dialogs.py | 63 +++++++++++++++++++++++++------ tests/test_gui.py | 65 ++++++++++++++++++++++++++------ 8 files changed, 207 insertions(+), 113 deletions(-) diff --git a/nw/gui/docsplit.py b/nw/gui/docsplit.py index 786ac8fa..836fd5cb 100644 --- a/nw/gui/docsplit.py +++ b/nw/gui/docsplit.py @@ -163,17 +163,16 @@ class GuiDocSplit(QDialog): ), nwAlert.ERROR) return - if self.mainConf.showGUI: - msgBox = QMessageBox() - msgRes = msgBox.question( - self, "Split Document", ( - "The document will be split into %d file(s) in a new folder. " - "The original document will remain intact.

" - "Continue with the splitting process?" - ) % nFiles - ) - if msgRes != QMessageBox.Yes: - return + msgBox = QMessageBox() + msgRes = msgBox.question( + self, "Split Document", ( + "The document will be split into %d file(s) in a new folder. " + "The original document will remain intact.

" + "Continue with the splitting process?" + ) % nFiles + ) + if msgRes != QMessageBox.Yes: + return # Create the folder fHandle = self.theProject.newFolder( diff --git a/nw/gui/projload.py b/nw/gui/projload.py index 804a4c2e..c19175be 100644 --- a/nw/gui/projload.py +++ b/nw/gui/projload.py @@ -218,18 +218,12 @@ class GuiProjectLoad(QDialog): """ selList = self.listBox.selectedItems() if selList: - doRemove = False - if self.mainConf.showGUI: - msgBox = QMessageBox() - msgRes = msgBox.question( - self, "Remove Entry", - "Remove the selected entry from the recent projects list?" - ) - doRemove = (msgRes == QMessageBox.Yes) - else: - doRemove = True - - if doRemove: + msgBox = QMessageBox() + msgRes = msgBox.question( + self, "Remove Entry", + "Remove the selected entry from the recent projects list?" + ) + if msgRes == QMessageBox.Yes: self.mainConf.removeFromRecentCache( selList[0].data(self.C_NAME, Qt.UserRole) ) diff --git a/nw/gui/projtree.py b/nw/gui/projtree.py index b5f8443b..00b81dac 100644 --- a/nw/gui/projtree.py +++ b/nw/gui/projtree.py @@ -362,15 +362,14 @@ class GuiProjectTree(QTreeWidget): self.makeAlert("The Trash folder is already empty.", nwAlert.INFO) return False - if self.mainConf.showGUI: - msgBox = QMessageBox() - msgRes = msgBox.question( - self, "Empty Trash", "Permanently delete %d file%s from Trash?" % ( - nTrash, "s" if nTrash > 1 else "" - ) + msgBox = QMessageBox() + msgRes = msgBox.question( + self, "Empty Trash", "Permanently delete %d file%s from Trash?" % ( + nTrash, "s" if nTrash > 1 else "" ) - if msgRes != QMessageBox.Yes: - return False + ) + if msgRes != QMessageBox.Yes: + return False logger.verbose("Deleting %d files from Trash" % nTrash) for tHandle in self.getTreeFromHandle(trashHandle): @@ -416,7 +415,7 @@ class GuiProjectTree(QTreeWidget): # If the file is in the trash folder already, as the # user if they want to permanently delete the file. doPermanent = False - if self.mainConf.showGUI and not alreadyAsked: + if not alreadyAsked: msgBox = QMessageBox() msgRes = msgBox.question( self, "Delete File", "Permanently delete file '%s'?" % nwItemS.itemName @@ -445,7 +444,7 @@ class GuiProjectTree(QTreeWidget): # The file is not already in the trash folder, so we # move it there. doTrash = False - if self.mainConf.showGUI and askForTrash: + if askForTrash: msgBox = QMessageBox() msgRes = msgBox.question( self, "Delete File", "Move file '%s' to Trash?" % nwItemS.itemName diff --git a/nw/gui/writingstats.py b/nw/gui/writingstats.py index d4a4e5d6..dd272b8b 100644 --- a/nw/gui/writingstats.py +++ b/nw/gui/writingstats.py @@ -380,19 +380,18 @@ class GuiWritingStats(QDialog): errMsg = str(e) # Report to user - if self.mainConf.showGUI: - if wSuccess: - self.theParent.makeAlert( - "%s file successfully written to:
%s" % ( - textFmt, savePath - ), nwAlert.INFO - ) - else: - self.theParent.makeAlert( - "Failed to write %s file. %s" % ( - textFmt, errMsg - ), nwAlert.ERROR - ) + if wSuccess: + self.theParent.makeAlert( + "%s file successfully written to:
%s" % ( + textFmt, savePath + ), nwAlert.INFO + ) + else: + self.theParent.makeAlert( + "Failed to write %s file. %s" % ( + textFmt, errMsg + ), nwAlert.ERROR + ) return True diff --git a/nw/guimain.py b/nw/guimain.py index bc8d5e88..859145df 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -251,14 +251,13 @@ class GuiMain(QMainWindow): The variable forceNew is used for testing. """ if self.hasProject: - msgBox = QMessageBox() - msgBox.warning( - self, "New Project", - "Please close the current project before making a new one." + self.makeAlert( + "Please close the current project before making a new one.", + nwAlert.ERROR ) return False - if projData is None and self.mainConf.showGUI: + if projData is None: projData = self.showNewProjectDialog() if projData is None: @@ -270,10 +269,9 @@ class GuiMain(QMainWindow): return False if path.isfile(path.join(projPath, self.theProject.projFile)) and not forceNew: - msgBox = QMessageBox() - msgBox.critical( - self, "New Project", - "A project already exists in that location. Please choose another folder." + self.makeAlert( + "A project already exists in that location. Please choose another folder.", + nwAlert.ERROR ) return False @@ -299,7 +297,7 @@ class GuiMain(QMainWindow): # There is no project loaded, everything OK return True - if self.mainConf.showGUI and not isYes: + if not isYes: msgBox = QMessageBox() msgRes = msgBox.question( self, "Close Project", "Save changes and close current project?" @@ -315,7 +313,7 @@ class GuiMain(QMainWindow): doBackup = False if self.theProject.doBackup and self.mainConf.backupOnClose: doBackup = True - if self.mainConf.showGUI and self.mainConf.askBeforeBackup: + if self.mainConf.askBeforeBackup: msgBox = QMessageBox() msgRes = msgBox.question( self, "Backup Project", "Backup current project?" @@ -362,39 +360,38 @@ class GuiMain(QMainWindow): # reason handled by the project class. return False - if self.mainConf.showGUI: - try: - lockDetails = ( - "

The project was locked by the computer " - "'%s' (%s %s), last active on %s" - ) % ( - self.theProject.lockedBy[0], - self.theProject.lockedBy[1], - self.theProject.lockedBy[2], - datetime.fromtimestamp( - int(self.theProject.lockedBy[3]) - ).strftime("%x %X") - ) - except Exception: - lockDetails = "" - - msgBox = QMessageBox() - msgRes = msgBox.warning( - self, "Project Locked", ( - "The project is already open by another instance of novelWriter, and " - "is therefore locked. Override lock and continue anyway?

" - "Note: If the program or the computer previously crashed, the lock " - "can safely be overridden. If, however, another instance of " - "novelWriter has the project open, overriding the lock may corrupt " - "the project, and is not recommended.%s" - ) % lockDetails, - QMessageBox.Yes | QMessageBox.No, QMessageBox.No + try: + lockDetails = ( + "

The project was locked by the computer " + "'%s' (%s %s), last active on %s" + ) % ( + self.theProject.lockedBy[0], + self.theProject.lockedBy[1], + self.theProject.lockedBy[2], + datetime.fromtimestamp( + int(self.theProject.lockedBy[3]) + ).strftime("%x %X") ) - if msgRes == QMessageBox.Yes: - if not self.theProject.openProject(projFile, overrideLock=True): - return False - else: + except Exception: + lockDetails = "" + + msgBox = QMessageBox() + msgRes = msgBox.warning( + self, "Project Locked", ( + "The project is already open by another instance of novelWriter, and " + "is therefore locked. Override lock and continue anyway?

" + "Note: If the program or the computer previously crashed, the lock " + "can safely be overridden. If, however, another instance of " + "novelWriter has the project open, overriding the lock may corrupt " + "the project, and is not recommended.%s" + ) % lockDetails, + QMessageBox.Yes | QMessageBox.No, QMessageBox.No + ) + if msgRes == QMessageBox.Yes: + if not self.theProject.openProject(projFile, overrideLock=True): return False + else: + return False # Project is loaded self.hasProject = True @@ -724,7 +721,7 @@ class GuiMain(QMainWindow): qApp.restoreOverrideCursor() - if self.mainConf.showGUI and not beQuiet: + if not beQuiet: self.makeAlert("The project index has been successfully rebuilt.", nwAlert.INFO) return True @@ -909,7 +906,7 @@ class GuiMain(QMainWindow): def closeMain(self): """Save everything, and close novelWriter. """ - if self.mainConf.showGUI and self.hasProject: + if self.hasProject: msgBox = QMessageBox() msgRes = msgBox.question( self, "Exit", "Do you want to save changes and exit?" diff --git a/tests/conftest.py b/tests/conftest.py index b7ef709e..bafa1fbb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,7 @@ import shutil from os import path, mkdir from nwdummy import DummyMain -from PyQt5.QtWidgets import QFileDialog, QMessageBox +from PyQt5.QtWidgets import QMessageBox sys.path.insert(1, path.abspath(path.join(path.dirname(__file__), path.pardir))) @@ -178,3 +178,25 @@ def nwOldProj(nwTemp): if path.isdir(oldProjDir): shutil.rmtree(oldProjDir) return + +## +# Monkey Patch Dialogs +## + +@pytest.fixture(scope="function") +def yesToAll(monkeypatch): + """Make the message boxes/questions always say yes to the dress! + """ + monkeypatch.setattr( + QMessageBox, "question", lambda *args, **kwargs: QMessageBox.Yes + ) + monkeypatch.setattr( + QMessageBox, "information", lambda *args, **kwargs: QMessageBox.Yes + ) + monkeypatch.setattr( + QMessageBox, "warning", lambda *args, **kwargs: QMessageBox.Yes + ) + monkeypatch.setattr( + QMessageBox, "critical", lambda *args, **kwargs: QMessageBox.Yes + ) + return diff --git a/tests/test_dialogs.py b/tests/test_dialogs.py index 717065e6..464b39bc 100644 --- a/tests/test_dialogs.py +++ b/tests/test_dialogs.py @@ -29,7 +29,7 @@ keyDelay = 2 stepDelay = 20 @pytest.mark.gui -def testProjectSettings(qtbot, monkeypatch, nwFuncTemp, nwTempGUI, nwRef, nwTemp): +def testProjectSettings(qtbot, monkeypatch, yesToAll, nwFuncTemp, nwTempGUI, nwRef, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwFuncTemp, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -139,7 +139,7 @@ def testProjectSettings(qtbot, monkeypatch, nwFuncTemp, nwTempGUI, nwRef, nwTemp nwGUI.closeMain() @pytest.mark.gui -def testItemEditor(qtbot, nwFuncTemp, nwTempGUI, nwRef, nwTemp): +def testItemEditor(qtbot, yesToAll, nwFuncTemp, nwTempGUI, nwRef, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwFuncTemp, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -198,7 +198,7 @@ def testItemEditor(qtbot, nwFuncTemp, nwTempGUI, nwRef, nwTemp): # qtbot.stopForInteraction() @pytest.mark.gui -def testWritingStatsExport(qtbot, nwFuncTemp, nwTemp): +def testWritingStatsExport(qtbot, yesToAll, nwFuncTemp, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwFuncTemp, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -385,7 +385,7 @@ def testAboutBox(qtbot, monkeypatch, nwFuncTemp, nwTemp): nwGUI.closeMain() @pytest.mark.gui -def testBuildTool(qtbot, nwTempBuild, nwLipsum, nwRef, nwTemp): +def testBuildTool(qtbot, yesToAll, nwTempBuild, nwLipsum, nwRef, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -547,7 +547,7 @@ def testBuildTool(qtbot, nwTempBuild, nwLipsum, nwRef, nwTemp): nwGUI.closeMain() @pytest.mark.gui -def testMergeSplitTools(qtbot, monkeypatch, nwTempGUI, nwLipsum, nwRef, nwTemp): +def testMergeSplitTools(qtbot, monkeypatch, yesToAll, nwTempGUI, nwLipsum, nwRef, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -690,7 +690,7 @@ def testMergeSplitTools(qtbot, monkeypatch, nwTempGUI, nwLipsum, nwRef, nwTemp): nwGUI.closeMain() @pytest.mark.gui -def testNewProjectWizard(qtbot, nwLipsum, nwTemp): +def testNewProjectWizard(qtbot, monkeypatch, yesToAll, nwMinimal, nwTemp): from PyQt5.QtWidgets import QWizard from nw.gui.projwizard import ( @@ -698,7 +698,47 @@ def testNewProjectWizard(qtbot, nwLipsum, nwTemp): ProjWizardCustomPage, ProjWizardFinalPage ) - nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) + nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp]) + qtbot.addWidget(nwGUI) + nwGUI.show() + qtbot.waitForWindowShown(nwGUI) + qtbot.wait(stepDelay) + + ## + # Test New Project Function + ## + + # New with a project open should cause an error + assert nwGUI.openProject(nwMinimal) + assert not nwGUI.newProject() + + # Close project, but call with invalid path + assert nwGUI.closeProject() + monkeypatch.setattr(nwGUI, "showNewProjectDialog", lambda *args: None) + assert not nwGUI.newProject() + + # Now, with an empty dictionary + monkeypatch.setattr(nwGUI, "showNewProjectDialog", lambda *args: {}) + assert not nwGUI.newProject() + + # Now, with a non-empty folder + monkeypatch.setattr(nwGUI, "showNewProjectDialog", lambda *args: {"projPath": nwMinimal}) + assert not nwGUI.newProject() + + # Force overwrite + monkeypatch.setattr(nwGUI, "showNewProjectDialog", lambda *args: {"projPath": nwMinimal}) + assert nwGUI.newProject(forceNew=True) + + nwGUI.closeMain() + nwGUI.close() + + # qtbot.stopForInteraction() + + ## + # Test the Wizard + ## + + nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() qtbot.waitForWindowShown(nwGUI) @@ -817,9 +857,10 @@ def testNewProjectWizard(qtbot, nwLipsum, nwTemp): # qtbot.stopForInteraction() nwGUI.closeMain() + nwGUI.close() @pytest.mark.gui -def testLoadProject(qtbot, monkeypatch, nwMinimal, nwTemp): +def testLoadProject(qtbot, monkeypatch, yesToAll, nwMinimal, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -877,7 +918,7 @@ def testLoadProject(qtbot, monkeypatch, nwMinimal, nwTemp): nwGUI.closeMain() @pytest.mark.gui -def testPreferences(qtbot, monkeypatch, nwMinimal, nwTemp, nwRef, tmpConf): +def testPreferences(qtbot, monkeypatch, yesToAll, nwMinimal, nwTemp, nwRef, tmpConf): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -1034,7 +1075,7 @@ def testPreferences(qtbot, monkeypatch, nwMinimal, nwTemp, nwRef, tmpConf): assert cmpFiles(testConf, refConf, ignoreLines) @pytest.mark.gui -def testQuotesDialog(qtbot, nwMinimal, nwTemp): +def testQuotesDialog(qtbot, yesToAll, nwMinimal, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp, nwMinimal]) qtbot.addWidget(nwGUI) nwGUI.show() @@ -1064,7 +1105,7 @@ def testQuotesDialog(qtbot, nwMinimal, nwTemp): nwGUI.close() @pytest.mark.gui -def testDialogsOpenClose(qtbot, monkeypatch, nwMinimal, nwTemp): +def testDialogsOpenClose(qtbot, monkeypatch, yesToAll, nwMinimal, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp, nwMinimal]) qtbot.addWidget(nwGUI) nwGUI.show() diff --git a/tests/test_gui.py b/tests/test_gui.py index 016325b2..5289b187 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -88,7 +88,7 @@ def testLaunch(qtbot, nwFuncTemp, nwTemp): nwGUI.close() @pytest.mark.gui -def testDocEditor(qtbot, nwFuncTemp, nwTempGUI, nwRef, nwTemp): +def testDocEditor(qtbot, yesToAll, nwFuncTemp, nwTempGUI, nwRef, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwFuncTemp, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -392,7 +392,7 @@ def testDocEditor(qtbot, nwFuncTemp, nwTempGUI, nwRef, nwTemp): nwGUI.close() @pytest.mark.gui -def testDocViewer(qtbot, nwLipsum, nwTemp): +def testDocViewer(qtbot, yesToAll, nwLipsum, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -544,7 +544,7 @@ def testDocViewer(qtbot, nwLipsum, nwTemp): nwGUI.close() @pytest.mark.gui -def testProjectTree(qtbot, nwMinimal, nwTemp): +def testProjectTree(qtbot, yesToAll, nwMinimal, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp, nwMinimal]) qtbot.addWidget(nwGUI) @@ -678,7 +678,7 @@ def testProjectTree(qtbot, nwMinimal, nwTemp): nwGUI.close() @pytest.mark.gui -def testEditFormatMenu(qtbot, nwLipsum, nwTemp): +def testEditFormatMenu(qtbot, yesToAll, nwLipsum, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -915,7 +915,7 @@ def testEditFormatMenu(qtbot, nwLipsum, nwTemp): nwGUI.close() @pytest.mark.gui -def testContextMenu(qtbot, nwLipsum, nwTemp): +def testContextMenu(qtbot, yesToAll, nwLipsum, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -1087,7 +1087,9 @@ def testInsertMenu(qtbot, monkeypatch, nwFuncTemp, nwTemp): assert nwGUI.docEditor.getText() == " " nwGUI.docEditor.clear() - # Insert text from file + ## + # Insert text from file + ## nwGUI.closeDocument() # First, with no path @@ -1123,12 +1125,33 @@ def testInsertMenu(qtbot, monkeypatch, nwFuncTemp, nwTemp): nwGUI.mainMenu.aImportFile.activate(QAction.Trigger) assert nwGUI.docEditor.getText() == "Foo" + ## + # Reveal file location + ## + + theMessage = "" + + def recordMsg(*args): + nonlocal theMessage + theMessage = args[3] + return None + + assert not theMessage + monkeypatch.setattr(QMessageBox, "information", recordMsg) + nwGUI.mainMenu.aFileDetails.activate(QAction.Trigger) + + theBits = theMessage.split("
") + assert len(theBits) == 3 + assert theBits[0] == "File details for the currently open file" + assert theBits[1] == "Handle: 0e17daca5f3e1" + assert theBits[2] == "Location: %s" % path.join(nwFuncTemp, "content", "0e17daca5f3e1.nwd") + # qtbot.stopForInteraction() nwGUI.closeMain() nwGUI.close() @pytest.mark.gui -def testTextSearch(qtbot, nwLipsum, nwTemp): +def testTextSearch(qtbot, monkeypatch, yesToAll, nwLipsum, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -1153,8 +1176,9 @@ def testTextSearch(qtbot, nwLipsum, nwTemp): assert nwGUI.docEditor.docSearch.isVisible() assert nwGUI.docEditor.docSearch.getSearchText() == "est" - # Find Next by Menu - nwGUI.mainMenu.aFindNext.activate(QAction.Trigger) + # Find Next by Enter + monkeypatch.setattr(nwGUI.docEditor.docSearch.searchBox, "hasFocus", lambda: True) + qtbot.keyClick(nwGUI.docEditor.docSearch.searchBox, Qt.Key_Return, delay=keyDelay) assert abs(nwGUI.docEditor.getCursorPosition() - 1272) < 3 # Find Next by Button @@ -1283,12 +1307,31 @@ def testTextSearch(qtbot, nwLipsum, nwTemp): nwGUI.mainMenu.aFindNext.activate(QAction.Trigger) assert abs(nwGUI.docEditor.getCursorPosition() - 1127) < 3 + # Toggle Replace + nwGUI.docEditor._beginReplace() + + # MonkeyPatch the focus cycle. We can't really test this very well, other than + # check that the tabs aren't captured when the main editor has focus + monkeypatch.setattr(nwGUI.docEditor, "hasFocus", lambda: True) + monkeypatch.setattr(nwGUI.docEditor.docSearch.searchBox, "hasFocus", lambda: False) + monkeypatch.setattr(nwGUI.docEditor.docSearch.replaceBox, "hasFocus", lambda: False) + assert not nwGUI.docEditor.focusNextPrevChild(True) + + monkeypatch.setattr(nwGUI.docEditor, "hasFocus", lambda: False) + monkeypatch.setattr(nwGUI.docEditor.docSearch.searchBox, "hasFocus", lambda: True) + monkeypatch.setattr(nwGUI.docEditor.docSearch.replaceBox, "hasFocus", lambda: False) + assert nwGUI.docEditor.focusNextPrevChild(True) + + monkeypatch.setattr(nwGUI.docEditor.docSearch.searchBox, "hasFocus", lambda: False) + monkeypatch.setattr(nwGUI.docEditor.docSearch.replaceBox, "hasFocus", lambda: True) + assert nwGUI.docEditor.focusNextPrevChild(True) + # qtbot.stopForInteraction() nwGUI.closeMain() nwGUI.close() @pytest.mark.gui -def testOutline(qtbot, nwLipsum, nwTemp): +def testOutline(qtbot, yesToAll, nwLipsum, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwLipsum, "--data=%s" % nwTemp]) qtbot.addWidget(nwGUI) @@ -1349,7 +1392,7 @@ def testOutline(qtbot, nwLipsum, nwTemp): nwGUI.close() @pytest.mark.gui -def testThemes(qtbot, nwMinimal, nwTemp): +def testThemes(qtbot, yesToAll, nwMinimal, nwTemp): nwGUI = nw.main(["--testmode", "--config=%s" % nwMinimal, "--data=%s" % nwTemp, nwMinimal]) qtbot.addWidget(nwGUI)