Fix test coverage

This commit is contained in:
Veronica Berglyd Olsen
2024-05-27 21:45:31 +02:00
parent 6289840a74
commit cf14f84652
2 changed files with 35 additions and 2 deletions
+23 -1
View File
@@ -106,7 +106,7 @@ def testGuiTheme_Main(qtbot, nwGUI, tstPaths):
@pytest.mark.gui
def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI):
def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI, tstPaths):
"""Test the theme part of the class."""
mainTheme = SHARED.theme
@@ -155,6 +155,28 @@ def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI):
wCol = QApplication.style().standardPalette().color(QPalette.ColorRole.Window).getRgb()
assert mainTheme._guiPalette.color(QPalette.ColorRole.Window).getRgb() == wCol
# Mock Dark Theme
# ===============
mockTheme: Path = tstPaths.cnfDir / "themes" / "test.conf"
mockTheme.write_text(
"[Main]\n"
"name = Test\n"
"\n"
"[Palette]\n"
"window = 0, 0, 0\n"
"windowtext = 255, 255, 255\n"
"\n"
"[GUI]\n"
"helptext = 0, 0, 0\n"
)
mainTheme._availThemes["test"] = mockTheme
CONFIG.guiTheme = "test"
assert mainTheme.loadTheme() is True
assert mainTheme.isLightTheme is False
assert mainTheme.helpText.getRgb() == (165, 165, 165, 255)
# Load Default Light Theme
# ========================