Add alignment precedence test to HTML tests
This commit is contained in:
@@ -147,9 +147,6 @@ def testFmtToHtml_ConvertParagraphs(mockGUI):
|
|||||||
html._isNovel = True
|
html._isNovel = True
|
||||||
html._isFirst = True
|
html._isFirst = True
|
||||||
|
|
||||||
# Paragraphs
|
|
||||||
# ==========
|
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
html._text = "Some **nested bold and _italic_ and ~~strikethrough~~ text** here\n"
|
html._text = "Some **nested bold and _italic_ and ~~strikethrough~~ text** here\n"
|
||||||
html.tokenizeText()
|
html.tokenizeText()
|
||||||
@@ -280,6 +277,54 @@ def testFmtToHtml_ConvertParagraphs(mockGUI):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.core
|
||||||
|
def testFmtToHtml_Alignment(mockGUI):
|
||||||
|
"""Test paragraph alignment in the ToHtml class."""
|
||||||
|
project = NWProject()
|
||||||
|
html = ToHtml(project)
|
||||||
|
html.initDocument()
|
||||||
|
|
||||||
|
# Left
|
||||||
|
html._text = "This is text <<\nspanning multiple\nlines"
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html._pages[-1] == (
|
||||||
|
"<p style='text-align: left;'>This is text<br>spanning multiple<br>lines</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Right
|
||||||
|
html._text = ">> This is text\nspanning multiple\nlines"
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html._pages[-1] == (
|
||||||
|
"<p style='text-align: right;'>This is text<br>spanning multiple<br>lines</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Centre
|
||||||
|
html._text = ">> This is text <<\nspanning multiple\nlines"
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html._pages[-1] == (
|
||||||
|
"<p style='text-align: center;'>This is text<br>spanning multiple<br>lines</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Left before Right
|
||||||
|
html._text = ">> This is text\nspanning multiple <<\nlines"
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html._pages[-1] == (
|
||||||
|
"<p style='text-align: left;'>This is text<br>spanning multiple<br>lines</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Right before Centre
|
||||||
|
html._text = ">> This is text <<\n>> spanning multiple\nlines"
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html._pages[-1] == (
|
||||||
|
"<p style='text-align: right;'>This is text<br>spanning multiple<br>lines</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testFmtToHtml_Dialog(mockGUI):
|
def testFmtToHtml_Dialog(mockGUI):
|
||||||
"""Test paragraph formats in the ToHtml class."""
|
"""Test paragraph formats in the ToHtml class."""
|
||||||
|
|||||||
Reference in New Issue
Block a user