Only refresh project tree values when status labels change

This commit is contained in:
Veronica Berglyd Olsen
2024-07-25 20:39:32 +02:00
parent 3bffaa01dc
commit 06aa2e6c07
6 changed files with 82 additions and 67 deletions
@@ -113,13 +113,13 @@ def testDlgProjSettings_SettingsPage(qtbot, monkeypatch, nwGUI, fncPath, projPat
assert settings.projAuthor.text() == "Jane Smith"
assert settings.projLang.currentData() == "en"
assert settings.spellLang.currentData() == "en"
assert settings.doBackup.isChecked() is False
assert settings.noBackup.isChecked() is False
settings.projName.setText("Project Name")
settings.projAuthor.setText("Jane Doe")
settings.projLang.setCurrentIndex(settings.projLang.findData("de"))
settings.spellLang.setCurrentIndex(settings.spellLang.findData("de"))
settings.doBackup.setChecked(True)
settings.noBackup.setChecked(True)
projSettings._doSave()
assert project.data.name == "Project Name"
@@ -128,7 +128,7 @@ def testDlgProjSettings_SettingsPage(qtbot, monkeypatch, nwGUI, fncPath, projPat
assert project.data.spellLang == "de"
assert project.data.doBackup is False
nwGUI._processProjectSettingsChanges(False)
nwGUI._processProjectSettingsChanges()
assert nwGUI.windowTitle() == "Project Name - novelWriter"
# qtbot.stop()
+1 -1
View File
@@ -221,7 +221,7 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
nwJohn = SHARED.project.tree[hJohn]
assert isinstance(nwJohn, NWItem)
nwJohn.setActive(False)
projTree.setTreeItemValues(hJohn)
projTree.setTreeItemValues(nwJohn)
projTree._alertTreeChange(hJohn, flush=False)
assert charTab.topLevelItemCount() == 1
+4
View File
@@ -186,6 +186,10 @@ def testGuiProjTree_NewItems(qtbot, caplog, monkeypatch, nwGUI, projPath, mockRn
# Adding an invalid item directly to the tree should also fail
assert projTree._addTreeItem(None) is None
# Setting values for a non-existing tree item should be handled
projTree.setTreeItemValues(None)
projTree.setTreeItemValues(C.hInvalid) # The function used to take handles
# Clean up
# qtbot.stop()
nwGUI.closeProject()