Fix test coverage
This commit is contained in:
@@ -334,6 +334,7 @@ def testCoreToQTextDocument_TextBlockFormats(mockGUI):
|
|||||||
"""Test text block formats in the ToQTextDocument class."""
|
"""Test text block formats in the ToQTextDocument class."""
|
||||||
project = NWProject()
|
project = NWProject()
|
||||||
qdoc = ToQTextDocument(project)
|
qdoc = ToQTextDocument(project)
|
||||||
|
qdoc.setFirstLineIndent(True, 2.0, False)
|
||||||
qdoc.initDocument(CONFIG.textFont, THEME)
|
qdoc.initDocument(CONFIG.textFont, THEME)
|
||||||
|
|
||||||
qdoc._isNovel = True
|
qdoc._isNovel = True
|
||||||
@@ -351,10 +352,11 @@ def testCoreToQTextDocument_TextBlockFormats(mockGUI):
|
|||||||
"> Left Indent\n\n"
|
"> Left Indent\n\n"
|
||||||
"Right Indent <\n\n"
|
"Right Indent <\n\n"
|
||||||
"> Double Indent <\n\n"
|
"> Double Indent <\n\n"
|
||||||
|
"Text Indent\n\n"
|
||||||
)
|
)
|
||||||
qdoc.tokenizeText()
|
qdoc.tokenizeText()
|
||||||
qdoc.doConvert()
|
qdoc.doConvert()
|
||||||
assert qdoc.document.blockCount() == 7
|
assert qdoc.document.blockCount() == 8
|
||||||
|
|
||||||
# 0: Scene
|
# 0: Scene
|
||||||
block = qdoc.document.findBlockByNumber(0)
|
block = qdoc.document.findBlockByNumber(0)
|
||||||
@@ -402,6 +404,15 @@ def testCoreToQTextDocument_TextBlockFormats(mockGUI):
|
|||||||
assert bFmt.leftMargin() == qdoc._mIndent
|
assert bFmt.leftMargin() == qdoc._mIndent
|
||||||
assert bFmt.rightMargin() == qdoc._mIndent
|
assert bFmt.rightMargin() == qdoc._mIndent
|
||||||
|
|
||||||
|
# 7: Text Indent
|
||||||
|
block = qdoc.document.findBlockByNumber(7)
|
||||||
|
assert block.text() == "Text Indent"
|
||||||
|
bFmt = block.blockFormat()
|
||||||
|
assert bFmt.alignment() == QtAlignAbsolute
|
||||||
|
assert bFmt.textIndent() == qdoc._tIndent
|
||||||
|
assert bFmt.leftMargin() == 0.0
|
||||||
|
assert bFmt.rightMargin() == 0.0
|
||||||
|
|
||||||
# Unreachable
|
# Unreachable
|
||||||
# ===========
|
# ===========
|
||||||
# Some formatting markers are currently not reachable
|
# Some formatting markers are currently not reachable
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ def testGuiTheme_Main(qtbot, nwGUI, tstPaths):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.gui
|
@pytest.mark.gui
|
||||||
def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI):
|
def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI, tstPaths):
|
||||||
"""Test the theme part of the class."""
|
"""Test the theme part of the class."""
|
||||||
mainTheme = SHARED.theme
|
mainTheme = SHARED.theme
|
||||||
|
|
||||||
@@ -155,6 +155,28 @@ def testGuiTheme_Theme(qtbot, monkeypatch, nwGUI):
|
|||||||
wCol = QApplication.style().standardPalette().color(QPalette.ColorRole.Window).getRgb()
|
wCol = QApplication.style().standardPalette().color(QPalette.ColorRole.Window).getRgb()
|
||||||
assert mainTheme._guiPalette.color(QPalette.ColorRole.Window).getRgb() == wCol
|
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
|
# Load Default Light Theme
|
||||||
# ========================
|
# ========================
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user