Make some GuiDocViewer variables private

This commit is contained in:
Veronica K. B. Olsen
2021-05-17 16:57:49 +02:00
parent 45b9215c87
commit c6120fcf7c
6 changed files with 56 additions and 39 deletions
+5 -5
View File
@@ -58,7 +58,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
theItem = nwGUI.treeView._getTreeItem("88243afbe5ed8")
theRect = nwGUI.treeView.visualItemRect(theItem)
qtbot.mouseClick(nwGUI.treeView.viewport(), Qt.MidButton, pos=theRect.center())
assert nwGUI.docViewer.theHandle == "88243afbe5ed8"
assert nwGUI.docViewer.docHandle() == "88243afbe5ed8"
# Reload the text
origText = nwGUI.docViewer.toPlainText()
@@ -112,7 +112,7 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
# Close document
nwGUI.docViewer.docHeader._closeDocument()
assert nwGUI.docViewer.theHandle is None
assert nwGUI.docViewer.docHandle() is None
# Action on no document
assert not nwGUI.docViewer.docAction(nwDocAction.COPY)
@@ -127,13 +127,13 @@ def testGuiViewer_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
theRect = nwGUI.docViewer.cursorRect()
# qtbot.mouseClick(nwGUI.docViewer.viewport(), Qt.LeftButton, pos=theRect.center(), delay=100)
nwGUI.docViewer._linkClicked(QUrl("#char=Bod"))
assert nwGUI.docViewer.theHandle == "4c4f28287af27"
assert nwGUI.docViewer.docHandle() == "4c4f28287af27"
# Click mouse nav buttons
qtbot.mouseClick(nwGUI.docViewer.viewport(), Qt.BackButton, pos=theRect.center(), delay=100)
assert nwGUI.docViewer.theHandle == "88243afbe5ed8"
assert nwGUI.docViewer.docHandle() == "88243afbe5ed8"
qtbot.mouseClick(nwGUI.docViewer.viewport(), Qt.ForwardButton, pos=theRect.center(), delay=100)
assert nwGUI.docViewer.theHandle == "4c4f28287af27"
assert nwGUI.docViewer.docHandle() == "4c4f28287af27"
# Scroll bar default on empty document
nwGUI.docViewer.clear()
+3 -3
View File
@@ -337,17 +337,17 @@ def testGuiMenu_ContextMenus(qtbot, monkeypatch, nwGUI, nwLipsum):
# Navigation History
assert nwGUI.viewDocument("04468803b92e1")
assert nwGUI.docViewer.theHandle == "04468803b92e1"
assert nwGUI.docViewer.docHandle() == "04468803b92e1"
assert nwGUI.docViewer.docHeader.backButton.isEnabled()
assert not nwGUI.docViewer.docHeader.forwardButton.isEnabled()
qtbot.mouseClick(nwGUI.docViewer.docHeader.backButton, Qt.LeftButton)
assert nwGUI.docViewer.theHandle == "4c4f28287af27"
assert nwGUI.docViewer.docHandle() == "4c4f28287af27"
assert not nwGUI.docViewer.docHeader.backButton.isEnabled()
assert nwGUI.docViewer.docHeader.forwardButton.isEnabled()
qtbot.mouseClick(nwGUI.docViewer.docHeader.forwardButton, Qt.LeftButton)
assert nwGUI.docViewer.theHandle == "04468803b92e1"
assert nwGUI.docViewer.docHandle() == "04468803b92e1"
assert nwGUI.docViewer.docHeader.backButton.isEnabled()
assert not nwGUI.docViewer.docHeader.forwardButton.isEnabled()
+4 -4
View File
@@ -104,19 +104,19 @@ def testGuiNovelTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal):
# Open item with middle mouse button
scItem.setSelected(True)
assert scItem.isSelected()
assert nwGUI.docViewer.theHandle is None
assert nwGUI.docViewer.docHandle() is None
qtbot.mouseClick(vPort, Qt.MiddleButton, pos=vPort.rect().center(), delay=10)
assert nwGUI.docViewer.theHandle is None
assert nwGUI.docViewer.docHandle() is None
scRect = nwTree.visualItemRect(scItem)
oldData = scItem.data(nwTree.C_TITLE, Qt.UserRole)
scItem.setData(nwTree.C_TITLE, Qt.UserRole, (None, "", ""))
qtbot.mouseClick(vPort, Qt.MiddleButton, pos=scRect.center(), delay=10)
assert nwGUI.docViewer.theHandle is None
assert nwGUI.docViewer.docHandle() is None
scItem.setData(nwTree.C_TITLE, Qt.UserRole, oldData)
qtbot.mouseClick(vPort, Qt.MiddleButton, pos=scRect.center(), delay=10)
assert nwGUI.docViewer.theHandle == "8c659a11cd429"
assert nwGUI.docViewer.docHandle() == "8c659a11cd429"
##
# Populate Tree
+1 -1
View File
@@ -85,7 +85,7 @@ def testGuiOutline_Main(qtbot, monkeypatch, nwGUI, nwLipsum):
# Click POV Link
assert nwGUI.projMeta.povKeyValue.text() == "<a href='#pov=Bod'>Bod</a>"
nwGUI.projMeta._tagClicked("#pov=Bod")
assert nwGUI.docViewer.theHandle == "4c4f28287af27"
assert nwGUI.docViewer.docHandle() == "4c4f28287af27"
# qtbot.stopForInteraction()