Update tests other than tree-related

This commit is contained in:
Veronica Berglyd Olsen
2024-11-23 19:30:29 +01:00
parent ca8bd8d271
commit 1bf42ceb55
29 changed files with 229 additions and 205 deletions
+5 -8
View File
@@ -38,8 +38,7 @@ def testGuiViewerPanel_BackRefs(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
monkeypatch.setattr(GuiEditLabel, "getLabel", lambda *a, text: (text, True))
buildTestProject(nwGUI, projPath)
projTree = nwGUI.projView.projTree
projTree.expandAll()
nwGUI.projView.projTree.expandAll()
viewPanel = nwGUI.docViewerPanel
tabBackRefs = viewPanel.tabBackRefs
@@ -81,7 +80,7 @@ def testGuiViewerPanel_BackRefs(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
# Update Label
SHARED.project.tree[C.hSceneDoc].setName("First Scene") # type: ignore
projTree.renameTreeItem(C.hSceneDoc)
nwGUI.projView.renameTreeItem(C.hSceneDoc)
item = tabBackRefs.topLevelItem(0)
assert item.text(tabBackRefs.C_DOC) == "First Scene"
assert item.text(tabBackRefs.C_TITLE) == "Scene One"
@@ -127,8 +126,7 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
monkeypatch.setattr(GuiEditLabel, "getLabel", lambda *a, text: (text, True))
buildTestProject(nwGUI, projPath)
projTree = nwGUI.projView.projTree
projTree.expandAll()
nwGUI.projView.projTree.expandAll()
viewPanel = nwGUI.docViewerPanel
nwGUI.openDocument(C.hSceneDoc)
@@ -175,7 +173,7 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
nwGUI.docEditor.setPlainText("# Jane Smith\n\n@tag: Janey\n\n")
nwGUI.saveDocument()
SHARED.project.tree[hJane].setName("Awesome Jane") # type: ignore
projTree.renameTreeItem(hJane)
nwGUI.projView.renameTreeItem(hJane)
item = charTab.topLevelItem(0)
assert item.text(charTab.C_NAME) == "Janey"
assert item.text(charTab.C_DOC) == "Awesome Jane"
@@ -221,8 +219,7 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
nwJohn = SHARED.project.tree[hJohn]
assert isinstance(nwJohn, NWItem)
nwJohn.setActive(False)
projTree.setTreeItemValues(nwJohn)
projTree._alertTreeChange(hJohn, flush=False)
nwJohn.notifyToRefresh()
assert charTab.topLevelItemCount() == 1
# Update Labels