Update tests

This commit is contained in:
Veronica Berglyd Olsen
2023-07-19 18:17:18 +02:00
parent c123ef9258
commit bebf487776
5 changed files with 65 additions and 53 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.0.7" hexVersion="0x020007f0" fileVersion="1.5" fileRevision="1" timeStamp="2023-06-19 08:41:53">
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="1510" autoCount="237" editTime="75111">
<novelWriterXML appVersion="2.0.7" hexVersion="0x020007f0" fileVersion="1.5" fileRevision="1" timeStamp="2023-07-19 18:03:08">
<project id="e2be99af-f9bf-4403-857a-c3d1ac25abea" saveCount="1513" autoCount="237" editTime="75226">
<name>Sample Project</name>
<title>Sample Project</title>
<author>Jane Smith</author>
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<office:document xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2023-05-29T22:10:15</meta:creation-date>
<meta:generator>novelWriter/2.0.7</meta:generator>
<meta:creation-date>2023-07-19T18:05:15</meta:creation-date>
<meta:generator>novelWriter/2.1-beta1</meta:generator>
<meta:initial-creator>Jane Smith</meta:initial-creator>
<meta:editing-cycles>1234</meta:editing-cycles>
<meta:editing-duration>P42DT12H34M56S</meta:editing-duration>
<dc:title>Test Project</dc:title>
<dc:date>2023-05-29T22:10:15</dc:date>
<dc:date>2023-07-19T18:05:15</dc:date>
<dc:creator>Jane Smith</dc:creator>
</office:meta>
<office:font-face-decls>
@@ -38,6 +38,10 @@
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-align="center" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="30pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Separator" style:family="paragraph" style:display-name="Separator" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.247cm" fo:line-height="115%" fo:text-align="center" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="12pt" />
</style:style>
<style:style style:name="Heading_20_1" style:family="paragraph" style:display-name="Heading 1" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="24pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
@@ -28,6 +28,10 @@
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:text-align="center" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="30pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Separator" style:family="paragraph" style:display-name="Separator" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.247cm" fo:line-height="115%" fo:text-align="center" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="12pt" />
</style:style>
<style:style style:name="Heading_20_1" style:family="paragraph" style:display-name="Heading 1" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" />
<style:text-properties style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" fo:font-size="24pt" fo:font-weight="bold" />
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<office:document xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta>
<meta:creation-date>2023-05-29T22:20:22</meta:creation-date>
<meta:generator>novelWriter/2.0.7</meta:generator>
<meta:creation-date>2023-07-19T18:05:14</meta:creation-date>
<meta:generator>novelWriter/2.1-beta1</meta:generator>
<meta:initial-creator>lipsum.com</meta:initial-creator>
<meta:editing-cycles>40</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M45S</meta:editing-duration>
<meta:editing-cycles>42</meta:editing-cycles>
<meta:editing-duration>P0DT0H31M53S</meta:editing-duration>
<dc:title>Lorem Ipsum</dc:title>
<dc:date>2023-05-29T22:20:22</dc:date>
<dc:date>2023-07-19T18:05:14</dc:date>
<dc:creator>lipsum.com</dc:creator>
</office:meta>
<office:font-face-decls>
@@ -38,6 +38,10 @@
<style:paragraph-properties fo:margin-top="0.552cm" fo:margin-bottom="0.276cm" fo:text-align="center" />
<style:text-properties style:font-name="Arial" fo:font-family="Arial" fo:font-size="30pt" fo:font-weight="bold" />
</style:style>
<style:style style:name="Separator" style:family="paragraph" style:display-name="Separator" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.322cm" fo:line-height="150%" fo:text-align="center" />
<style:text-properties style:font-name="Arial" fo:font-family="Arial" fo:font-size="12pt" />
</style:style>
<style:style style:name="Heading_20_1" style:family="paragraph" style:display-name="Heading 1" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="1" style:class="text">
<style:paragraph-properties fo:margin-top="0.552cm" fo:margin-bottom="0.276cm" />
<style:text-properties style:font-name="Arial" fo:font-family="Arial" fo:font-size="24pt" fo:font-weight="bold" fo:color="#2a6099" loext:opacity="100%" />
+43 -43
View File
@@ -129,8 +129,8 @@ def testCoreToOdt_TextFormatting(mockGUI):
assert theDoc._paraStyle("Text_20_body", oStyle) == "P1"
assert list(theDoc._mainPara.keys()) == [
"Text_20_body", "Text_20_Meta", "Title", "Heading_20_1",
"Heading_20_2", "Heading_20_3", "Heading_20_4", "Header"
"Text_20_body", "Text_20_Meta", "Title", "Separator",
"Heading_20_1", "Heading_20_2", "Heading_20_3", "Heading_20_4", "Header",
]
theKey = "071d6b2e4764749f8c78d3c1ab9099fa04c07d2d53fd3de61eb1bdf1cb4845c3"
@@ -145,9 +145,9 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc.initDocument()
theDoc._addTextPar("Standard", oStyle, "")
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:p text:style-name=\"Standard\" />"
"</office:text>"
'<office:text>'
'<text:p text:style-name="Standard" />'
'</office:text>'
)
# No Format
@@ -155,9 +155,9 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, "Hello World")
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:p text:style-name=\"Standard\">Hello World</text:p>"
"</office:text>"
'<office:text>'
'<text:p text:style-name="Standard">Hello World</text:p>'
'</office:text>'
)
# Heading Level None
@@ -165,9 +165,9 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, "Hello World", isHead=True)
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:h text:style-name=\"Standard\">Hello World</text:h>"
"</office:text>"
'<office:text>'
'<text:h text:style-name="Standard">Hello World</text:h>'
'</office:text>'
)
# Heading Level 1
@@ -175,9 +175,9 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, "Hello World", isHead=True, oLevel="1")
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:h text:style-name=\"Standard\" text:outline-level=\"1\">Hello World</text:h>"
"</office:text>"
'<office:text>'
'<text:h text:style-name="Standard" text:outline-level="1">Hello World</text:h>'
'</office:text>'
)
# Formatted Text
@@ -187,11 +187,11 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, theTxt, tFmt=theFmt)
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:p text:style-name=\"Standard\">A <text:span text:style-name=\"T1\">few</text:span> "
"<text:span text:style-name=\"T2\">words</text:span> from <text:span text:style-name=\"T3"
"\">our</text:span> sponsor</text:p>"
"</office:text>"
'<office:text>'
'<text:p text:style-name="Standard">A <text:span text:style-name="T1">few</text:span> '
'<text:span text:style-name="T2">words</text:span> from <text:span text:style-name="T3">'
'our</text:span> sponsor</text:p>'
'</office:text>'
)
# Incorrectly Formatted Text
@@ -201,11 +201,11 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, theTxt, tFmt=theFmt)
assert theDoc.errData == ["Unknown format tag encountered"]
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:p text:style-name=\"Standard\">"
"A few <text:span text:style-name=\"T2\">words</text:span>"
"</text:p>"
"</office:text>"
'<office:text>'
'<text:p text:style-name="Standard">'
'A few <text:span text:style-name="T2">words</text:span>'
'</text:p>'
'</office:text>'
)
# Formatted Text
@@ -215,9 +215,9 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, theTxt, tFmt=theFmt)
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
"<office:text>"
"<text:p text:style-name=\"Standard\">Hello<text:line-break /><text:tab />World</text:p>"
"</office:text>"
'<office:text>'
'<text:p text:style-name="Standard">Hello<text:line-break /><text:tab />World</text:p>'
'</office:text>'
)
# Test for issue #1412
@@ -230,10 +230,10 @@ def testCoreToOdt_TextFormatting(mockGUI):
theDoc._addTextPar("Standard", oStyle, theTxt, tFmt=theFmt)
assert theDoc.errData == []
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>"
'<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
@@ -454,9 +454,9 @@ def testCoreToOdt_Convert(mockGUI):
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
'<office:text>'
'<text:p text:style-name="P3">* * *</text:p>'
'<text:p text:style-name="Separator">* * *</text:p>'
'<text:p text:style-name="Text_20_body">Text</text:p>'
'<text:p text:style-name="P3">* * *</text:p>'
'<text:p text:style-name="Separator">* * *</text:p>'
'<text:p text:style-name="Text_20_body">Text</text:p>'
'</office:text>'
)
@@ -472,9 +472,9 @@ def testCoreToOdt_Convert(mockGUI):
assert theDoc.errData == []
assert xmlToText(theDoc._xText) == (
'<office:text>'
'<text:p text:style-name="Text_20_body" />'
'<text:p text:style-name="Separator" />'
'<text:p text:style-name="Text_20_body">Text</text:p>'
'<text:p text:style-name="Text_20_body" />'
'<text:p text:style-name="Separator" />'
'<text:p text:style-name="Text_20_body">Text</text:p>'
'</office:text>'
)
@@ -500,24 +500,24 @@ def testCoreToOdt_Convert(mockGUI):
assert xmlToText(theDoc._xText) == (
'<office:text>'
'<text:h text:style-name="Heading_20_3" text:outline-level="3">Scene</text:h>'
'<text:p text:style-name="P4"><text:span text:style-name="T4">'
'<text:p text:style-name="P3"><text:span text:style-name="T4">'
'Point of View:</text:span> Jane</text:p>'
'<text:p text:style-name="P5"><text:span text:style-name="T4">'
'<text:p text:style-name="P4"><text:span text:style-name="T4">'
'Characters:</text:span> John</text:p>'
'<text:p text:style-name="Text_20_Meta"><text:span text:style-name="T4">'
'Plot:</text:span> Main</text:p>'
'<text:p text:style-name="P6">Right align</text:p>'
'<text:p text:style-name="P5">Right align</text:p>'
'<text:p text:style-name="Text_20_body">Left Align</text:p>'
'<text:p text:style-name="P3">Centered</text:p>'
'<text:p text:style-name="P6">Centered</text:p>'
'<text:p text:style-name="P7">Left indent</text:p>'
'<text:p text:style-name="P8">Right indent</text:p>'
'</office:text>'
)
assert getStyle("P3")._pAttr["margin-bottom"] == ["fo", "0.000cm"]
assert getStyle("P4")._pAttr["margin-bottom"] == ["fo", "0.000cm"]
assert getStyle("P5")._pAttr["margin-bottom"] == ["fo", "0.000cm"]
assert getStyle("P5")._pAttr["margin-top"] == ["fo", "0.000cm"]
assert getStyle("P6")._pAttr["text-align"] == ["fo", "right"]
assert getStyle("P3")._pAttr["text-align"] == ["fo", "center"]
assert getStyle("P4")._pAttr["margin-top"] == ["fo", "0.000cm"]
assert getStyle("P5")._pAttr["text-align"] == ["fo", "right"]
assert getStyle("P6")._pAttr["text-align"] == ["fo", "center"]
assert getStyle("P7")._pAttr["margin-left"] == ["fo", "1.693cm"]
assert getStyle("P8")._pAttr["margin-right"] == ["fo", "1.693cm"]