Add test coverage
This commit is contained in:
@@ -29,8 +29,8 @@ from novelwriter.core.project import NWProject
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testCoreToHtml_ConvertFormat(mockGUI):
|
def testCoreToHtml_ConvertHeaders(mockGUI):
|
||||||
"""Test the tokenizer and converter chain using the ToHtml class."""
|
"""Test header formats in the ToHtml class."""
|
||||||
project = NWProject()
|
project = NWProject()
|
||||||
html = ToHtml(project)
|
html = ToHtml(project)
|
||||||
|
|
||||||
@@ -129,6 +129,19 @@ def testCoreToHtml_ConvertFormat(mockGUI):
|
|||||||
html.doConvert()
|
html.doConvert()
|
||||||
assert html.result == "<h2><a name='T0001'></a>Heading Two</h2>\n"
|
assert html.result == "<h2><a name='T0001'></a>Heading Two</h2>\n"
|
||||||
|
|
||||||
|
# END Test testCoreToHtml_ConvertHeaders
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.core
|
||||||
|
def testCoreToHtml_ConvertParagraphs(mockGUI):
|
||||||
|
"""Test paragraph formats in the ToHtml class."""
|
||||||
|
project = NWProject()
|
||||||
|
html = ToHtml(project)
|
||||||
|
|
||||||
|
html._isNovel = True
|
||||||
|
html._isNote = False
|
||||||
|
html._isFirst = True
|
||||||
|
|
||||||
# Paragraphs
|
# Paragraphs
|
||||||
# ==========
|
# ==========
|
||||||
|
|
||||||
@@ -141,6 +154,19 @@ def testCoreToHtml_ConvertFormat(mockGUI):
|
|||||||
"<del>strikethrough</del> text</strong> here</p>\n"
|
"<del>strikethrough</del> text</strong> here</p>\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Shortcodes
|
||||||
|
html._text = (
|
||||||
|
"Some [b]bold[/b], [i]italic[/i], [s]strike[/s], [u]underline[/u], [m]mark[/m], "
|
||||||
|
"super[sup]script[/sup], sub[sub]script[/sub] here\n"
|
||||||
|
)
|
||||||
|
html.tokenizeText()
|
||||||
|
html.doConvert()
|
||||||
|
assert html.result == (
|
||||||
|
"<p>Some <strong>bold</strong>, <em>italic</em>, <del>strike</del>, "
|
||||||
|
"<span style='text-decoration: underline;'>underline</span>, <mark>mark</mark>, "
|
||||||
|
"super<sup>script</sup>, sub<sub>script</sub> here</p>\n"
|
||||||
|
)
|
||||||
|
|
||||||
# Text w/Hard Break
|
# Text w/Hard Break
|
||||||
html._text = "Line one \nLine two \nLine three\n"
|
html._text = "Line one \nLine two \nLine three\n"
|
||||||
html.tokenizeText()
|
html.tokenizeText()
|
||||||
@@ -206,17 +232,13 @@ def testCoreToHtml_ConvertFormat(mockGUI):
|
|||||||
html.tokenizeText()
|
html.tokenizeText()
|
||||||
html.doConvert()
|
html.doConvert()
|
||||||
assert html.result == (
|
assert html.result == (
|
||||||
"<h2>"
|
"<h1 style='page-break-before: always;'>Chapter</h1>\n"
|
||||||
"<a name='T0001'></a>Chapter</h2>\n"
|
"<p style='margin-bottom: 0;'><span class='tags'>Point of View:</span> "
|
||||||
"<p style='margin-bottom: 0;'>"
|
"<a href='#tag_Bod'>Bod</a></p>\n"
|
||||||
"<span class='tags'>Point of View:</span> <a href='#tag_Bod'>Bod</a>"
|
"<p style='margin-bottom: 0; margin-top: 0;'><span class='tags'>Plot:</span> "
|
||||||
"</p>\n"
|
"<a href='#tag_Main'>Main</a></p>\n"
|
||||||
"<p style='margin-bottom: 0; margin-top: 0;'>"
|
"<p style='margin-top: 0;'><span class='tags'>Locations:</span> "
|
||||||
"<span class='tags'>Plot:</span> <a href='#tag_Main'>Main</a>"
|
"<a href='#tag_Europe'>Europe</a></p>\n"
|
||||||
"</p>\n"
|
|
||||||
"<p style='margin-top: 0;'>"
|
|
||||||
"<span class='tags'>Locations:</span> <a href='#tag_Europe'>Europe</a>"
|
|
||||||
"</p>\n"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Preview Mode
|
# Preview Mode
|
||||||
@@ -234,7 +256,7 @@ def testCoreToHtml_ConvertFormat(mockGUI):
|
|||||||
"text</b> here</p>\n"
|
"text</b> here</p>\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
# END Test testCoreToHtml_ConvertFormat
|
# END Test testCoreToHtml_ConvertParagraphs
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
|
|||||||
@@ -638,6 +638,11 @@ def testCoreToken_ExtractFormats(mockGUI):
|
|||||||
assert text == "Text with underline in it."
|
assert text == "Text with underline in it."
|
||||||
assert fmt == [(10, tokens.FMT_U_B), (19, tokens.FMT_U_E)]
|
assert fmt == [(10, tokens.FMT_U_B), (19, tokens.FMT_U_E)]
|
||||||
|
|
||||||
|
# Plain mark
|
||||||
|
text, fmt = tokens._extractFormats("Text with [m]highlight[/m] in it.")
|
||||||
|
assert text == "Text with highlight in it."
|
||||||
|
assert fmt == [(10, tokens.FMT_M_B), (19, tokens.FMT_M_E)]
|
||||||
|
|
||||||
# Plain superscript
|
# Plain superscript
|
||||||
text, fmt = tokens._extractFormats("Text with super[sup]script[/sup] in it.")
|
text, fmt = tokens._extractFormats("Text with super[sup]script[/sup] in it.")
|
||||||
assert text == "Text with superscript in it."
|
assert text == "Text with superscript in it."
|
||||||
|
|||||||
@@ -29,16 +29,11 @@ from novelwriter.core.project import NWProject
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testCoreToMarkdown_ConvertFormat(mockGUI):
|
def testCoreToMarkdown_ConvertHeaders(mockGUI):
|
||||||
"""Test the tokenizer and converter chain using the ToMarkdown
|
"""Test header formats in the ToMarkdown class."""
|
||||||
class.
|
|
||||||
"""
|
|
||||||
project = NWProject()
|
project = NWProject()
|
||||||
toMD = ToMarkdown(project)
|
toMD = ToMarkdown(project)
|
||||||
|
|
||||||
# Headers
|
|
||||||
# =======
|
|
||||||
|
|
||||||
toMD._isNovel = True
|
toMD._isNovel = True
|
||||||
toMD._isNote = False
|
toMD._isNote = False
|
||||||
toMD._isFirst = True
|
toMD._isFirst = True
|
||||||
@@ -79,8 +74,18 @@ def testCoreToMarkdown_ConvertFormat(mockGUI):
|
|||||||
toMD.doConvert()
|
toMD.doConvert()
|
||||||
assert toMD.result == "## Prologue\n\n"
|
assert toMD.result == "## Prologue\n\n"
|
||||||
|
|
||||||
# Paragraphs
|
# END Test testCoreToMarkdown_ConvertHeaders
|
||||||
# ==========
|
|
||||||
|
|
||||||
|
@pytest.mark.core
|
||||||
|
def testCoreToMarkdown_ConvertParagraphs(mockGUI):
|
||||||
|
"""Test paragraph formats in the ToMarkdown class."""
|
||||||
|
project = NWProject()
|
||||||
|
toMD = ToMarkdown(project)
|
||||||
|
|
||||||
|
toMD._isNovel = True
|
||||||
|
toMD._isNote = False
|
||||||
|
toMD._isFirst = True
|
||||||
|
|
||||||
# Text for Extended Markdown
|
# Text for Extended Markdown
|
||||||
toMD.setExtendedMarkdown()
|
toMD.setExtendedMarkdown()
|
||||||
@@ -100,6 +105,31 @@ def testCoreToMarkdown_ConvertFormat(mockGUI):
|
|||||||
"Some **nested bold and _italic_ and strikethrough text** here\n\n"
|
"Some **nested bold and _italic_ and strikethrough text** here\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Shortcodes for Extended Markdown
|
||||||
|
toMD.setExtendedMarkdown()
|
||||||
|
toMD._text = (
|
||||||
|
"Some [b]bold[/b], [i]italic[/i], [s]strike[/s], [u]underline[/u], [m]mark[/m], "
|
||||||
|
"super[sup]script[/sup], sub[sub]script[/sub] here\n"
|
||||||
|
)
|
||||||
|
toMD.tokenizeText()
|
||||||
|
toMD.doConvert()
|
||||||
|
assert toMD.result == (
|
||||||
|
"Some **bold**, _italic_, ~~strike~~, underline, ==mark==, "
|
||||||
|
"super^script^, sub~script~ here\n\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Shortcodes for Standard Markdown
|
||||||
|
toMD.setStandardMarkdown()
|
||||||
|
toMD._text = (
|
||||||
|
"Some [b]bold[/b], [i]italic[/i], [s]strike[/s], [u]underline[/u], [m]mark[/m], "
|
||||||
|
"super[sup]script[/sup], sub[sub]script[/sub] here\n"
|
||||||
|
)
|
||||||
|
toMD.tokenizeText()
|
||||||
|
toMD.doConvert()
|
||||||
|
assert toMD.result == (
|
||||||
|
"Some **bold**, _italic_, strike, underline, mark, superscript, subscript here\n\n"
|
||||||
|
)
|
||||||
|
|
||||||
# Text w/Hard Break
|
# Text w/Hard Break
|
||||||
toMD._text = "Line one \nLine two \nLine three\n"
|
toMD._text = "Line one \nLine two \nLine three\n"
|
||||||
toMD.tokenizeText()
|
toMD.tokenizeText()
|
||||||
@@ -160,7 +190,7 @@ def testCoreToMarkdown_ConvertFormat(mockGUI):
|
|||||||
"**Locations:** Europe\n\n"
|
"**Locations:** Europe\n\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
# END Test testCoreToMarkdown_ConvertFormat
|
# END Test testCoreToMarkdown_ConvertParagraphs
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
|
|||||||
@@ -237,22 +237,12 @@ def testCoreToOdt_TextFormatting(mockGUI):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testCoreToOdt_Convert(mockGUI):
|
def testCoreToOdt_ConvertHeaders(mockGUI):
|
||||||
"""Test the converter of the ToOdt class."""
|
"""Test the converter of the ToOdt class."""
|
||||||
project = NWProject()
|
project = NWProject()
|
||||||
odt = ToOdt(project, isFlat=True)
|
odt = ToOdt(project, isFlat=True)
|
||||||
|
|
||||||
odt._isNovel = True
|
odt._isNovel = True
|
||||||
|
|
||||||
def getStyle(styleName):
|
|
||||||
for aSet in odt._autoPara.values():
|
|
||||||
if aSet[0] == styleName:
|
|
||||||
return aSet[1]
|
|
||||||
return None
|
|
||||||
|
|
||||||
# Headers
|
|
||||||
# =======
|
|
||||||
|
|
||||||
# Header 1
|
# Header 1
|
||||||
odt._text = "# Title\n"
|
odt._text = "# Title\n"
|
||||||
odt.tokenizeText()
|
odt.tokenizeText()
|
||||||
@@ -331,8 +321,21 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Paragraphs
|
# END Test testCoreToOdt_ConvertHeaders
|
||||||
# ==========
|
|
||||||
|
|
||||||
|
@pytest.mark.core
|
||||||
|
def testCoreToOdt_ConvertParagraphs(mockGUI):
|
||||||
|
"""Test the converter of the ToOdt class."""
|
||||||
|
project = NWProject()
|
||||||
|
odt = ToOdt(project, isFlat=True)
|
||||||
|
odt._isNovel = True
|
||||||
|
|
||||||
|
def getStyle(styleName):
|
||||||
|
for aSet in odt._autoPara.values():
|
||||||
|
if aSet[0] == styleName:
|
||||||
|
return aSet[1]
|
||||||
|
return None
|
||||||
|
|
||||||
# Nested Markdown Text
|
# Nested Markdown Text
|
||||||
odt._text = "Some ~~nested **bold** and _italics_ text~~ text."
|
odt._text = "Some ~~nested **bold** and _italics_ text~~ text."
|
||||||
@@ -372,7 +375,7 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Nested Shortcode Text, Super/Subscript
|
# Shortcode Text, Super/Subscript
|
||||||
odt._text = "Some super[sup]script[/sup] and sub[sub]script[/sub] text."
|
odt._text = "Some super[sup]script[/sup] and sub[sub]script[/sub] text."
|
||||||
odt.tokenizeText()
|
odt.tokenizeText()
|
||||||
odt.initDocument()
|
odt.initDocument()
|
||||||
@@ -387,6 +390,21 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Shortcode Text, Underline/Highlight
|
||||||
|
odt._text = "Some [u]underlined and [m]highlighted[/m][/u] text."
|
||||||
|
odt.tokenizeText()
|
||||||
|
odt.initDocument()
|
||||||
|
odt.doConvert()
|
||||||
|
odt.closeDocument()
|
||||||
|
assert odt.errData == []
|
||||||
|
assert xmlToText(odt._xText) == (
|
||||||
|
'<office:text>'
|
||||||
|
'<text:p text:style-name="Text_20_body">Some '
|
||||||
|
'<text:span text:style-name="T7">underlined and </text:span>'
|
||||||
|
'<text:span text:style-name="T8">highlighted</text:span> text.</text:p>'
|
||||||
|
'</office:text>'
|
||||||
|
)
|
||||||
|
|
||||||
# Hard Break
|
# Hard Break
|
||||||
odt._text = "Some text.\nNext line\n"
|
odt._text = "Some text.\nNext line\n"
|
||||||
odt.tokenizeText()
|
odt.tokenizeText()
|
||||||
@@ -422,7 +440,7 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:p text:style-name="Text_20_body">Some <text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_body">Some <text:span text:style-name="T9">'
|
||||||
'bold<text:tab />text</text:span></text:p>'
|
'bold<text:tab />text</text:span></text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
@@ -467,13 +485,13 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T9">'
|
||||||
'Point of View:</text:span> Jane</text:p>'
|
'Point of View:</text:span> Jane</text:p>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T9">'
|
||||||
'Synopsis:</text:span> So it begins</text:p>'
|
'Synopsis:</text:span> So it begins</text:p>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T9">'
|
||||||
'Short Description:</text:span> Then what</text:p>'
|
'Short Description:</text:span> Then what</text:p>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T9">'
|
||||||
'Comment:</text:span> A plain comment</text:p>'
|
'Comment:</text:span> A plain comment</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
@@ -535,26 +553,26 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
||||||
'<text:p text:style-name="P3"><text:span text:style-name="T7">'
|
'<text:p text:style-name="P1"><text:span text:style-name="T9">'
|
||||||
'Point of View:</text:span> Jane</text:p>'
|
'Point of View:</text:span> Jane</text:p>'
|
||||||
'<text:p text:style-name="P4"><text:span text:style-name="T7">'
|
'<text:p text:style-name="P2"><text:span text:style-name="T9">'
|
||||||
'Characters:</text:span> John</text:p>'
|
'Characters:</text:span> John</text:p>'
|
||||||
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T7">'
|
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T9">'
|
||||||
'Plot:</text:span> Main</text:p>'
|
'Plot:</text:span> Main</text:p>'
|
||||||
'<text:p text:style-name="P5">Right align</text:p>'
|
'<text:p text:style-name="P3">Right align</text:p>'
|
||||||
'<text:p text:style-name="Text_20_body">Left Align</text:p>'
|
'<text:p text:style-name="Text_20_body">Left Align</text:p>'
|
||||||
'<text:p text:style-name="P6">Centered</text:p>'
|
'<text:p text:style-name="P4">Centered</text:p>'
|
||||||
'<text:p text:style-name="P7">Left indent</text:p>'
|
'<text:p text:style-name="P5">Left indent</text:p>'
|
||||||
'<text:p text:style-name="P8">Right indent</text:p>'
|
'<text:p text:style-name="P6">Right indent</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
assert getStyle("P3")._pAttr["margin-bottom"] == ["fo", "0.000cm"] # type: ignore
|
assert getStyle("P1")._pAttr["margin-bottom"] == ["fo", "0.000cm"] # type: ignore
|
||||||
assert getStyle("P4")._pAttr["margin-bottom"] == ["fo", "0.000cm"] # type: ignore
|
assert getStyle("P2")._pAttr["margin-bottom"] == ["fo", "0.000cm"] # type: ignore
|
||||||
assert getStyle("P4")._pAttr["margin-top"] == ["fo", "0.000cm"] # type: ignore
|
assert getStyle("P2")._pAttr["margin-top"] == ["fo", "0.000cm"] # type: ignore
|
||||||
assert getStyle("P5")._pAttr["text-align"] == ["fo", "right"] # type: ignore
|
assert getStyle("P3")._pAttr["text-align"] == ["fo", "right"] # type: ignore
|
||||||
assert getStyle("P6")._pAttr["text-align"] == ["fo", "center"] # type: ignore
|
assert getStyle("P4")._pAttr["text-align"] == ["fo", "center"] # type: ignore
|
||||||
assert getStyle("P7")._pAttr["margin-left"] == ["fo", "1.693cm"] # type: ignore
|
assert getStyle("P5")._pAttr["margin-left"] == ["fo", "1.693cm"] # type: ignore
|
||||||
assert getStyle("P8")._pAttr["margin-right"] == ["fo", "1.693cm"] # type: ignore
|
assert getStyle("P6")._pAttr["margin-right"] == ["fo", "1.693cm"] # type: ignore
|
||||||
|
|
||||||
# Justified
|
# Justified
|
||||||
odt._text = (
|
odt._text = (
|
||||||
@@ -573,11 +591,11 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Regular paragraph</text:p>'
|
'<text:p text:style-name="Text_20_body">Regular paragraph</text:p>'
|
||||||
'<text:p text:style-name="P9">with<text:line-break />break</text:p>'
|
'<text:p text:style-name="P7">with<text:line-break />break</text:p>'
|
||||||
'<text:p text:style-name="P9">Left Align</text:p>'
|
'<text:p text:style-name="P7">Left Align</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
assert getStyle("P9")._pAttr["text-align"] == ["fo", "left"] # type: ignore
|
assert getStyle("P7")._pAttr["text-align"] == ["fo", "left"] # type: ignore
|
||||||
|
|
||||||
# Page Breaks
|
# Page Breaks
|
||||||
odt._text = (
|
odt._text = (
|
||||||
@@ -593,9 +611,9 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:h text:style-name="P2" text:outline-level="2">Chapter One</text:h>'
|
'<text:h text:style-name="P8" text:outline-level="2">Chapter One</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
||||||
'<text:h text:style-name="P2" text:outline-level="2">Chapter Two</text:h>'
|
'<text:h text:style-name="P8" text:outline-level="2">Chapter Two</text:h>'
|
||||||
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
'<text:p text:style-name="Text_20_body">Text</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
@@ -612,12 +630,12 @@ def testCoreToOdt_Convert(mockGUI):
|
|||||||
assert odt.errData == []
|
assert odt.errData == []
|
||||||
assert xmlToText(odt._xText) == (
|
assert xmlToText(odt._xText) == (
|
||||||
'<office:text>'
|
'<office:text>'
|
||||||
'<text:p text:style-name="Text_20_body">Test text **<text:span text:style-name="T8">'
|
'<text:p text:style-name="Text_20_body">Test text **<text:span text:style-name="T10">'
|
||||||
'bold</text:span>** and more.</text:p>'
|
'bold</text:span>** and more.</text:p>'
|
||||||
'</office:text>'
|
'</office:text>'
|
||||||
)
|
)
|
||||||
|
|
||||||
# END Test testCoreToOdt_Convert
|
# END Test testCoreToOdt_ConvertParagraphs
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
@@ -1081,6 +1099,17 @@ def testCoreToOdt_ODTTextStyle():
|
|||||||
txtStyle.setFontStyle("stuff")
|
txtStyle.setFontStyle("stuff")
|
||||||
assert txtStyle._tAttr["font-style"] == ["fo", None]
|
assert txtStyle._tAttr["font-style"] == ["fo", None]
|
||||||
|
|
||||||
|
# Background Color
|
||||||
|
assert txtStyle._tAttr["background-color"] == ["fo", None]
|
||||||
|
txtStyle.setBackgroundColor("stuff")
|
||||||
|
assert txtStyle._tAttr["background-color"] == ["fo", None]
|
||||||
|
txtStyle.setBackgroundColor("012345")
|
||||||
|
assert txtStyle._tAttr["background-color"] == ["fo", None]
|
||||||
|
txtStyle.setBackgroundColor("#012345")
|
||||||
|
assert txtStyle._tAttr["background-color"] == ["fo", "#012345"]
|
||||||
|
txtStyle.setBackgroundColor("stuff")
|
||||||
|
assert txtStyle._tAttr["background-color"] == ["fo", None]
|
||||||
|
|
||||||
# Text Position
|
# Text Position
|
||||||
assert txtStyle._tAttr["text-position"] == ["style", None]
|
assert txtStyle._tAttr["text-position"] == ["style", None]
|
||||||
txtStyle.setTextPosition("stuff")
|
txtStyle.setTextPosition("stuff")
|
||||||
|
|||||||
@@ -491,6 +491,13 @@ def testGuiEditor_Actions(qtbot, nwGUI, projPath, ipsumText, mockRnd):
|
|||||||
assert nwGUI.docEditor.docAction(nwDocAction.UNDO) is True
|
assert nwGUI.docEditor.docAction(nwDocAction.UNDO) is True
|
||||||
assert nwGUI.docEditor.getText() == text
|
assert nwGUI.docEditor.getText() == text
|
||||||
|
|
||||||
|
# Mark
|
||||||
|
nwGUI.docEditor.setCursorPosition(46)
|
||||||
|
assert nwGUI.docEditor.docAction(nwDocAction.SC_MARK) is True
|
||||||
|
assert nwGUI.docEditor.getText() == text.replace("consectetur", "[m]consectetur[/m]")
|
||||||
|
assert nwGUI.docEditor.docAction(nwDocAction.UNDO) is True
|
||||||
|
assert nwGUI.docEditor.getText() == text
|
||||||
|
|
||||||
# Superscript
|
# Superscript
|
||||||
nwGUI.docEditor.setCursorPosition(46)
|
nwGUI.docEditor.setCursorPosition(46)
|
||||||
assert nwGUI.docEditor.docAction(nwDocAction.SC_SUP) is True
|
assert nwGUI.docEditor.docAction(nwDocAction.SC_SUP) is True
|
||||||
|
|||||||
Reference in New Issue
Block a user