Let the shared class handle alert dialogs
This commit is contained in:
@@ -27,7 +27,7 @@ from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox
|
||||
|
||||
from tools import C, writeFile, buildTestProject
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.enum import nwDocAction, nwDocInsert
|
||||
from novelwriter.constants import nwKeyWords, nwUnicode
|
||||
from novelwriter.gui.doceditor import GuiDocEditor
|
||||
@@ -653,21 +653,10 @@ def testGuiMenu_Insert(qtbot, monkeypatch, nwGUI, fncPath, projPath, mockRnd):
|
||||
# Reveal File Location
|
||||
# ====================
|
||||
|
||||
theMessage = ""
|
||||
|
||||
def recordMsg(*args, **kwargs):
|
||||
nonlocal theMessage
|
||||
theMessage = "%s|%s" % (args[0], kwargs["info"])
|
||||
return None
|
||||
|
||||
assert not theMessage
|
||||
monkeypatch.setattr(nwGUI, "makeAlert", recordMsg)
|
||||
nwGUI.mainMenu.aFileDetails.activate(QAction.Trigger)
|
||||
|
||||
theBits = theMessage.split("|")
|
||||
assert len(theBits) == 2
|
||||
assert theBits[0] == "The currently open file is saved in:"
|
||||
assert theBits[1] == str(projPath / "content" / "000000000000f.nwd")
|
||||
path = str(projPath / "content" / "000000000000f.nwd")
|
||||
logMsg = SHARED.alert.logMessage if SHARED.alert else ""
|
||||
assert logMsg == f"The currently open file is saved in: {path}"
|
||||
|
||||
# qtbot.stop()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user