Fix icons not updating on theme switch in viewer panel

This commit is contained in:
Veronica Berglyd Olsen
2023-11-27 16:08:34 +01:00
parent ccc444f355
commit 1f9b6d7624
2 changed files with 49 additions and 4 deletions
+18
View File
@@ -24,6 +24,8 @@ import pytest
from tools import C, buildTestProject
from PyQt5.QtGui import QIcon
from novelwriter import CONFIG, SHARED
from novelwriter.constants import nwLists
from novelwriter.dialogs.editlabel import GuiEditLabel
@@ -91,6 +93,13 @@ def testGuiViewerPanel_BackRefs(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
SHARED.project.index.rebuildIndex()
assert tabBackRefs.topLevelItemCount() == 1
# Test Update Theme
tabBackRefs._editIcon = None
tabBackRefs._viewIcon = None
tabBackRefs.updateTheme()
assert isinstance(tabBackRefs._editIcon, QIcon)
assert isinstance(tabBackRefs._viewIcon, QIcon)
# Click the Edit Button
nwGUI.openDocument(C.hChapterDoc)
assert nwGUI.docEditor.docHandle == C.hChapterDoc
@@ -182,6 +191,15 @@ def testGuiViewerPanel_Tags(qtbot, monkeypatch, caplog, nwGUI, projPath, mockRnd
SHARED.project.index.rebuildIndex()
assert charTab.topLevelItemCount() == 2
# Test Update Theme
charTab._classIcon = None
charTab._editIcon = None
charTab._viewIcon = None
charTab.updateTheme()
assert isinstance(charTab._classIcon, QIcon)
assert isinstance(charTab._editIcon, QIcon)
assert isinstance(charTab._viewIcon, QIcon)
# Remove Non-Existing Tag
caplog.clear()
viewPanel.updateChangedTags(["foo"], ["bar"])