Update test coverage
This commit is contained in:
+15
-1
@@ -34,6 +34,8 @@ from PyQt6.QtWidgets import QMessageBox
|
||||
sys.path.insert(1, str(Path(__file__).parent.parent.absolute()))
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.config import DEF_GUI_DARK, DEF_GUI_LIGHT
|
||||
from novelwriter.enum import nwTheme
|
||||
|
||||
from tests.mocked import MockGuiMain
|
||||
from tests.tools import cleanProject
|
||||
@@ -60,6 +62,10 @@ def resetConfigVars():
|
||||
CONFIG._dLocale = QLocale("en_GB")
|
||||
CONFIG._manuals = {"manual": _TMP_ROOT / "manual.pdf"}
|
||||
CONFIG.guiLocale = "en_GB"
|
||||
CONFIG.darkTheme = DEF_GUI_DARK
|
||||
CONFIG.lightTheme = DEF_GUI_LIGHT
|
||||
CONFIG.themeMode = nwTheme.LIGHT
|
||||
CONFIG.emphLabels = True # Ensures better coverage, off by default
|
||||
return
|
||||
|
||||
|
||||
@@ -157,13 +163,21 @@ def mockGUI(qtbot, monkeypatch):
|
||||
monkeypatch.setattr(QMessageBox, "result", lambda *a: QMessageBox.StandardButton.Yes)
|
||||
gui = MockGuiMain()
|
||||
theme = GuiTheme()
|
||||
theme.loadTheme()
|
||||
monkeypatch.setattr(SHARED, "_gui", gui)
|
||||
monkeypatch.setattr(SHARED, "_theme", theme)
|
||||
|
||||
return gui
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def mockGUIwithTheme(mockGUI):
|
||||
"""Create a mock instance of novelWriter's main GUI class with the
|
||||
theme instance initialised.
|
||||
"""
|
||||
SHARED.theme.initThemes()
|
||||
return mockGUI
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def nwGUI(qtbot, monkeypatch, functionFixture):
|
||||
"""Create an instance of the novelWriter GUI."""
|
||||
|
||||
Reference in New Issue
Block a user