Clean up signals and passing variables
This commit is contained in:
@@ -47,7 +47,7 @@ def testGuiEditor_Init(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
assert nwGUI.openDocument(C.hSceneDoc)
|
||||
|
||||
nwGUI.docEditor.setPlainText("### Lorem Ipsum\n\n%s" % ipsumText[0])
|
||||
assert nwGUI.saveDocument()
|
||||
nwGUI.saveDocument()
|
||||
|
||||
# Check Defaults
|
||||
qDoc = nwGUI.docEditor.document()
|
||||
@@ -122,7 +122,7 @@ def testGuiEditor_LoadText(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
|
||||
longText = "### Lorem Ipsum\n\n%s" % "\n\n".join(ipsumText*20)
|
||||
nwGUI.docEditor.replaceText(longText)
|
||||
assert nwGUI.saveDocument() is True
|
||||
nwGUI.saveDocument()
|
||||
assert nwGUI.closeDocument() is True
|
||||
|
||||
# Invalid handle
|
||||
@@ -138,7 +138,7 @@ def testGuiEditor_LoadText(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
|
||||
# Load empty document
|
||||
nwGUI.docEditor.replaceText("")
|
||||
assert nwGUI.saveDocument() is True
|
||||
nwGUI.saveDocument()
|
||||
assert nwGUI.docEditor.loadText(C.hSceneDoc) is True
|
||||
assert nwGUI.docEditor.toPlainText() == ""
|
||||
|
||||
@@ -1484,7 +1484,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
cHandle = SHARED.project.newFile("Jane Doe", C.hCharRoot)
|
||||
assert nwGUI.openDocument(cHandle) is True
|
||||
nwGUI.docEditor.replaceText(text)
|
||||
assert nwGUI.saveDocument() is True
|
||||
nwGUI.saveDocument()
|
||||
assert nwGUI.projView.projTree.revealNewTreeItem(cHandle)
|
||||
nwGUI.docEditor.updateTagHighLighting()
|
||||
|
||||
@@ -1514,7 +1514,7 @@ def testGuiEditor_Tags(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
||||
assert nwGUI.docViewer._docHandle is None
|
||||
assert nwGUI.docEditor._processTag(follow=True) is nwTrinary.POSITIVE
|
||||
assert nwGUI.docViewer._docHandle == cHandle
|
||||
assert nwGUI.closeDocViewer() is True
|
||||
assert nwGUI.closeViewerPanel() is True
|
||||
assert nwGUI.docViewer._docHandle is None
|
||||
|
||||
# On Unknown Tag, Create It
|
||||
@@ -1553,7 +1553,7 @@ def testGuiEditor_Completer(qtbot, nwGUI, projPath, mockRnd):
|
||||
cHandle = SHARED.project.newFile("People", C.hCharRoot)
|
||||
assert nwGUI.openDocument(cHandle) is True
|
||||
nwGUI.docEditor.replaceText(text)
|
||||
assert nwGUI.saveDocument() is True
|
||||
nwGUI.saveDocument()
|
||||
assert nwGUI.projView.projTree.revealNewTreeItem(cHandle)
|
||||
|
||||
docEditor = nwGUI.docEditor
|
||||
|
||||
@@ -185,12 +185,12 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, prjLipsum):
|
||||
nwItem.setName("Test Title") # type: ignore
|
||||
assert nwItem.itemName == "Test Title" # type: ignore
|
||||
docViewer.updateDocInfo("4c4f28287af27")
|
||||
assert docViewer.docHeader.docTitle.text() == "Characters \u203a Test Title"
|
||||
assert docViewer.docHeader.itemTitle.text() == "Characters \u203a Test Title"
|
||||
|
||||
# Title without full path
|
||||
CONFIG.showFullPath = False
|
||||
docViewer.updateDocInfo("4c4f28287af27")
|
||||
assert docViewer.docHeader.docTitle.text() == "Test Title"
|
||||
assert docViewer.docHeader.itemTitle.text() == "Test Title"
|
||||
CONFIG.showFullPath = True
|
||||
|
||||
# Document footer show/hide synopsis
|
||||
|
||||
@@ -52,10 +52,8 @@ def testGuiMain_ProjectBlocker(nwGUI):
|
||||
assert nwGUI.closeDocument() is False
|
||||
assert nwGUI.openDocument(None) is False
|
||||
assert nwGUI.openNextDocument(None) is False
|
||||
assert nwGUI.saveDocument() is False
|
||||
assert nwGUI.viewDocument(None) is False
|
||||
assert nwGUI.importDocument() is False
|
||||
assert nwGUI.openSelectedItem() is False
|
||||
assert nwGUI.editItemLabel() is False
|
||||
assert nwGUI.rebuildIndex() is False
|
||||
|
||||
@@ -109,7 +107,8 @@ def testGuiMain_ProjectTreeItems(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
|
||||
buildTestProject(nwGUI, projPath)
|
||||
|
||||
sHandle = "000000000000f"
|
||||
assert nwGUI.openSelectedItem() is False
|
||||
nwGUI.openSelectedItem()
|
||||
assert nwGUI.docEditor.docHandle is None
|
||||
|
||||
# Project Tree has focus
|
||||
nwGUI._changeView(nwView.PROJECT)
|
||||
@@ -238,7 +237,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
nwGUI.projView.projTree.clearSelection()
|
||||
nwGUI.projView.projTree._getTreeItem(C.hCharRoot).setSelected(True)
|
||||
nwGUI.projView.projTree.newTreeItem(nwItemType.FILE, None, isNote=True)
|
||||
assert nwGUI.openSelectedItem()
|
||||
nwGUI.openSelectedItem()
|
||||
|
||||
# Text Editor
|
||||
# ===========
|
||||
@@ -265,7 +264,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
nwGUI.projView.projTree.clearSelection()
|
||||
nwGUI.projView.projTree._getTreeItem(C.hPlotRoot).setSelected(True)
|
||||
nwGUI.projView.projTree.newTreeItem(nwItemType.FILE, None, isNote=True)
|
||||
assert nwGUI.openSelectedItem()
|
||||
nwGUI.openSelectedItem()
|
||||
|
||||
# Type something into the document
|
||||
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||
@@ -287,7 +286,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
nwGUI.projView.projTree.clearSelection()
|
||||
nwGUI.projView.projTree._getTreeItem(C.hWorldRoot).setSelected(True)
|
||||
nwGUI.projView.projTree.newTreeItem(nwItemType.FILE, None, isNote=True)
|
||||
assert nwGUI.openSelectedItem()
|
||||
nwGUI.openSelectedItem()
|
||||
|
||||
# Add Some Text
|
||||
docEditor.replaceText("Hello World!")
|
||||
@@ -319,7 +318,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
nwGUI.projView.projTree._getTreeItem(C.hNovelRoot).setExpanded(True)
|
||||
nwGUI.projView.projTree._getTreeItem(C.hChapterDir).setExpanded(True)
|
||||
nwGUI.projView.projTree._getTreeItem(C.hSceneDoc).setSelected(True)
|
||||
assert nwGUI.openSelectedItem()
|
||||
nwGUI.openSelectedItem()
|
||||
|
||||
# Type something into the document
|
||||
nwGUI.switchFocus(nwWidget.EDITOR)
|
||||
@@ -524,8 +523,8 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
|
||||
# Save the document
|
||||
assert docEditor.docChanged
|
||||
assert nwGUI.saveDocument()
|
||||
assert not docEditor.docChanged
|
||||
nwGUI.saveDocument()
|
||||
assert docEditor.docChanged is False
|
||||
nwGUI.rebuildIndex()
|
||||
|
||||
# Open and view the edited document
|
||||
@@ -533,7 +532,7 @@ def testGuiMain_Editing(qtbot, monkeypatch, nwGUI, projPath, tstPaths, mockRnd):
|
||||
assert nwGUI.openDocument(C.hSceneDoc)
|
||||
assert nwGUI.viewDocument(C.hSceneDoc)
|
||||
assert nwGUI.saveProject()
|
||||
assert nwGUI.closeDocViewer()
|
||||
assert nwGUI.closeViewerPanel()
|
||||
|
||||
# Check the files
|
||||
projFile = projPath / "nwProject.nwx"
|
||||
|
||||
Reference in New Issue
Block a user