Improve test coverage
This commit is contained in:
@@ -378,7 +378,7 @@ def testCoreToHtml_ConvertDirect(mockGUI):
|
|||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testCoreToHtml_SpecialCases(mockGUI):
|
def testCoreToHtml_SpecialCases(mockGUI):
|
||||||
"""Test some special cases that has caused errors in the past.
|
"""Test some special cases that have caused errors in the past.
|
||||||
"""
|
"""
|
||||||
theProject = NWProject(mockGUI)
|
theProject = NWProject(mockGUI)
|
||||||
theHtml = ToHtml(theProject)
|
theHtml = ToHtml(theProject)
|
||||||
@@ -415,8 +415,8 @@ def testCoreToHtml_SpecialCases(mockGUI):
|
|||||||
"<p>Test > text <em><<strong>bold</strong>></em> and more.</p>\n"
|
"<p>Test > text <em><<strong>bold</strong>></em> and more.</p>\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test for bug #950
|
# Test for issue #950
|
||||||
# =================
|
# ===================
|
||||||
# See: https://github.com/vkbo/novelWriter/issues/950
|
# See: https://github.com/vkbo/novelWriter/issues/950
|
||||||
|
|
||||||
theHtml.setComments(True)
|
theHtml.setComments(True)
|
||||||
@@ -436,6 +436,17 @@ def testCoreToHtml_SpecialCases(mockGUI):
|
|||||||
"<h1 style='page-break-before: always;'>Heading <1></h1>\n"
|
"<h1 style='page-break-before: always;'>Heading <1></h1>\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Test for issue #1412
|
||||||
|
# ====================
|
||||||
|
# See: https://github.com/vkbo/novelWriter/issues/1412
|
||||||
|
|
||||||
|
theHtml._theText = "Test text \\**_bold_** and more.\n"
|
||||||
|
theHtml.tokenizeText()
|
||||||
|
theHtml.doConvert()
|
||||||
|
assert theHtml.theResult == (
|
||||||
|
"<p>Test text **<em>bold</em>** and more.</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
# END Test testCoreToHtml_SpecialCases
|
# END Test testCoreToHtml_SpecialCases
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -222,10 +222,12 @@ def testCoreToken_TextOps(monkeypatch, mockGUI, mockRnd, fncPath):
|
|||||||
def testCoreToken_StripEscape():
|
def testCoreToken_StripEscape():
|
||||||
"""Test the stripEscape helper function.
|
"""Test the stripEscape helper function.
|
||||||
"""
|
"""
|
||||||
text = r"This is text with escapes: \** \~~ \__"
|
text1 = "This is text with escapes: \\** \\~~ \\__"
|
||||||
assert stripEscape(text) == "This is text with escapes: ** ~~ __"
|
text2 = "This is text with escapes: ** ~~ __"
|
||||||
|
assert stripEscape(text1) == "This is text with escapes: ** ~~ __"
|
||||||
|
assert stripEscape(text2) == "This is text with escapes: ** ~~ __"
|
||||||
|
|
||||||
return
|
# END Test testCoreToken_StripEscape
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
|
|||||||
@@ -221,7 +221,21 @@ def testCoreToOdt_TextFormatting(mockGUI):
|
|||||||
"</office:text>"
|
"</office:text>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Tabs and Breaks
|
# Test for issue #1412
|
||||||
|
# ====================
|
||||||
|
# See: https://github.com/vkbo/novelWriter/issues/1412
|
||||||
|
|
||||||
|
theDoc.initDocument()
|
||||||
|
theTxt = "Test text \\**_bold_** and more."
|
||||||
|
theFmt = " I i "
|
||||||
|
theDoc._addTextPar("Standard", oStyle, theTxt, theFmt=theFmt)
|
||||||
|
assert theDoc.getErrors() == []
|
||||||
|
assert xmlToText(theDoc._xText) == (
|
||||||
|
"<office:text>"
|
||||||
|
"<text:p text:style-name=\"Standard\">Test text **<text:span text:style-name=\"T2\">"
|
||||||
|
"bold</text:span>** and more.</text:p>"
|
||||||
|
"</office:text>"
|
||||||
|
)
|
||||||
|
|
||||||
# END Test testCoreToOdt_TextFormatting
|
# END Test testCoreToOdt_TextFormatting
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user