Fix remaining broken tests
This commit is contained in:
@@ -106,9 +106,5 @@
|
||||
"T0001": {"level": "H1", "title": "Ancient Europe", "line": 1, "tag": "europe", "cCount": 1770, "wCount": 259, "pCount": 3, "synopsis": ""}
|
||||
}
|
||||
}
|
||||
},
|
||||
"novelWriter.textIndex": {
|
||||
"comments": {},
|
||||
"footnotes": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>2024-03-14T23:42:49</meta:creation-date>
|
||||
<meta:generator>novelWriter/2.4a2</meta:generator>
|
||||
<meta:creation-date>2024-04-25T07:39:02</meta:creation-date>
|
||||
<meta:generator>novelWriter/2.5a2</meta:generator>
|
||||
<meta:initial-creator>lipsum.com</meta:initial-creator>
|
||||
<meta:editing-cycles>44</meta:editing-cycles>
|
||||
<meta:editing-duration>P0DT0H33M59S</meta:editing-duration>
|
||||
<dc:title>Lorem Ipsum</dc:title>
|
||||
<dc:date>2024-03-14T23:42:49</dc:date>
|
||||
<dc:date>2024-04-25T07:39:02</dc:date>
|
||||
<dc:creator>lipsum.com</dc:creator>
|
||||
</office:meta>
|
||||
<office:font-face-decls>
|
||||
@@ -31,7 +31,7 @@
|
||||
<style:text-properties style:font-name="Arial" fo:font-family="Arial" fo:font-size="12pt" />
|
||||
</style:style>
|
||||
<style:style style:name="First_20_line_20_indent" style:family="paragraph" style:display-name="First line indent" style:parent-style-name="Text_20_body" style:class="text">
|
||||
<style:paragraph-properties fo:text-indent="0.499cm" />
|
||||
<style:paragraph-properties fo:text-indent="0.593cm" />
|
||||
</style:style>
|
||||
<style:style style:name="Text_20_Meta" style:family="paragraph" style:display-name="Text Meta" style:parent-style-name="Standard" style:class="text">
|
||||
<style:paragraph-properties fo:margin-top="0.000cm" fo:margin-bottom="0.322cm" fo:line-height="150%" />
|
||||
@@ -64,10 +64,14 @@
|
||||
<style:style style:name="Header" style:family="paragraph" style:display-name="Header" style:parent-style-name="Header_20_and_20_Footer">
|
||||
<style:paragraph-properties fo:text-align="right" />
|
||||
</style:style>
|
||||
<style:style style:name="Footnote" style:family="paragraph" style:display-name="Footnote" style:parent-style-name="Standard" style:class="extra">
|
||||
<style:paragraph-properties fo:margin-bottom="0.198cm" fo:margin-left="0.600cm" fo:text-indent="-0.600cm" />
|
||||
<style:text-properties fo:font-size="10pt" />
|
||||
</style:style>
|
||||
</office:styles>
|
||||
<office:automatic-styles>
|
||||
<style:page-layout style:name="PM1">
|
||||
<style:page-layout-properties fo:page-width="21.000cm" fo:page-height="29.700cm" fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm" fo:print-orientation="portrait" />
|
||||
<style:page-layout-properties fo:page-width="21.000cm" fo:page-height="29.700cm" fo:margin-top="2.000cm" fo:margin-bottom="2.000cm" fo:margin-left="2.000cm" fo:margin-right="2.000cm" />
|
||||
<style:header-style>
|
||||
<style:header-footer-properties fo:min-height="0.600cm" fo:margin-left="0.000cm" fo:margin-right="0.000cm" fo:margin-bottom="0.500cm" />
|
||||
</style:header-style>
|
||||
|
||||
@@ -24,8 +24,8 @@ import pytest
|
||||
|
||||
from tools import readFile
|
||||
|
||||
from novelwriter.core.tohtml import ToHtml
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.core.tohtml import ToHtml
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
@@ -453,7 +453,7 @@ def testCoreToHtml_SpecialCases(mockGUI):
|
||||
html.doConvert()
|
||||
assert html.result == (
|
||||
"<p class='comment'>"
|
||||
"<strong>Comment:</strong> Test > text _<**bold**>_ and more."
|
||||
"<strong>Comment:</strong> Test > text <em><<strong>bold</strong>></em> and more."
|
||||
"</p>\n"
|
||||
)
|
||||
|
||||
|
||||
@@ -870,30 +870,31 @@ def testCoreToken_ExtractFormats(mockGUI):
|
||||
# Plain bold
|
||||
text, fmt = tokens._extractFormats("Text with **bold** in it.")
|
||||
assert text == "Text with bold in it."
|
||||
assert fmt == [(10, tokens.FMT_B_B), (14, tokens.FMT_B_E)]
|
||||
assert fmt == [(10, tokens.FMT_B_B, ""), (14, tokens.FMT_B_E, "")]
|
||||
|
||||
# Plain italics
|
||||
text, fmt = tokens._extractFormats("Text with _italics_ in it.")
|
||||
assert text == "Text with italics in it."
|
||||
assert fmt == [(10, tokens.FMT_I_B), (17, tokens.FMT_I_E)]
|
||||
assert fmt == [(10, tokens.FMT_I_B, ""), (17, tokens.FMT_I_E, "")]
|
||||
|
||||
# Plain strikethrough
|
||||
text, fmt = tokens._extractFormats("Text with ~~strikethrough~~ in it.")
|
||||
assert text == "Text with strikethrough in it."
|
||||
assert fmt == [(10, tokens.FMT_D_B), (23, tokens.FMT_D_E)]
|
||||
assert fmt == [(10, tokens.FMT_D_B, ""), (23, tokens.FMT_D_E, "")]
|
||||
|
||||
# Nested bold/italics
|
||||
text, fmt = tokens._extractFormats("Text with **bold and _italics_** in it.")
|
||||
assert text == "Text with bold and italics in it."
|
||||
assert fmt == [
|
||||
(10, tokens.FMT_B_B), (19, tokens.FMT_I_B), (26, tokens.FMT_I_E), (26, tokens.FMT_B_E)
|
||||
(10, tokens.FMT_B_B, ""), (19, tokens.FMT_I_B, ""),
|
||||
(26, tokens.FMT_I_E, ""), (26, tokens.FMT_B_E, ""),
|
||||
]
|
||||
|
||||
# Bold with overlapping italics
|
||||
# Here, bold is ignored because it is not on word boundary
|
||||
text, fmt = tokens._extractFormats("Text with **bold and overlapping _italics**_ in it.")
|
||||
assert text == "Text with **bold and overlapping italics** in it."
|
||||
assert fmt == [(33, tokens.FMT_I_B), (42, tokens.FMT_I_E)]
|
||||
assert fmt == [(33, tokens.FMT_I_B, ""), (42, tokens.FMT_I_E, "")]
|
||||
|
||||
# Shortcodes
|
||||
# ==========
|
||||
@@ -901,43 +902,44 @@ def testCoreToken_ExtractFormats(mockGUI):
|
||||
# Plain bold
|
||||
text, fmt = tokens._extractFormats("Text with [b]bold[/b] in it.")
|
||||
assert text == "Text with bold in it."
|
||||
assert fmt == [(10, tokens.FMT_B_B), (14, tokens.FMT_B_E)]
|
||||
assert fmt == [(10, tokens.FMT_B_B, ""), (14, tokens.FMT_B_E, "")]
|
||||
|
||||
# Plain italics
|
||||
text, fmt = tokens._extractFormats("Text with [i]italics[/i] in it.")
|
||||
assert text == "Text with italics in it."
|
||||
assert fmt == [(10, tokens.FMT_I_B), (17, tokens.FMT_I_E)]
|
||||
assert fmt == [(10, tokens.FMT_I_B, ""), (17, tokens.FMT_I_E, "")]
|
||||
|
||||
# Plain strikethrough
|
||||
text, fmt = tokens._extractFormats("Text with [s]strikethrough[/s] in it.")
|
||||
assert text == "Text with strikethrough in it."
|
||||
assert fmt == [(10, tokens.FMT_D_B), (23, tokens.FMT_D_E)]
|
||||
assert fmt == [(10, tokens.FMT_D_B, ""), (23, tokens.FMT_D_E, "")]
|
||||
|
||||
# Plain underline
|
||||
text, fmt = tokens._extractFormats("Text with [u]underline[/u] 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)]
|
||||
assert fmt == [(10, tokens.FMT_M_B, ""), (19, tokens.FMT_M_E, "")]
|
||||
|
||||
# Plain superscript
|
||||
text, fmt = tokens._extractFormats("Text with super[sup]script[/sup] in it.")
|
||||
assert text == "Text with superscript in it."
|
||||
assert fmt == [(15, tokens.FMT_SUP_B), (21, tokens.FMT_SUP_E)]
|
||||
assert fmt == [(15, tokens.FMT_SUP_B, ""), (21, tokens.FMT_SUP_E, "")]
|
||||
|
||||
# Plain subscript
|
||||
text, fmt = tokens._extractFormats("Text with sub[sub]script[/sub] in it.")
|
||||
assert text == "Text with subscript in it."
|
||||
assert fmt == [(13, tokens.FMT_SUB_B), (19, tokens.FMT_SUB_E)]
|
||||
assert fmt == [(13, tokens.FMT_SUB_B, ""), (19, tokens.FMT_SUB_E, "")]
|
||||
|
||||
# Nested bold/italics
|
||||
text, fmt = tokens._extractFormats("Text with [b]bold and [i]italics[/i][/b] in it.")
|
||||
assert text == "Text with bold and italics in it."
|
||||
assert fmt == [
|
||||
(10, tokens.FMT_B_B), (19, tokens.FMT_I_B), (26, tokens.FMT_I_E), (26, tokens.FMT_B_E)
|
||||
(10, tokens.FMT_B_B, ""), (19, tokens.FMT_I_B, ""),
|
||||
(26, tokens.FMT_I_E, ""), (26, tokens.FMT_B_E, ""),
|
||||
]
|
||||
|
||||
# Bold with overlapping italics
|
||||
@@ -947,7 +949,8 @@ def testCoreToken_ExtractFormats(mockGUI):
|
||||
)
|
||||
assert text == "Text with bold and overlapping italics in it."
|
||||
assert fmt == [
|
||||
(10, tokens.FMT_B_B), (31, tokens.FMT_I_B), (38, tokens.FMT_B_E), (38, tokens.FMT_I_E)
|
||||
(10, tokens.FMT_B_B, ""), (31, tokens.FMT_I_B, ""),
|
||||
(38, tokens.FMT_B_E, ""), (38, tokens.FMT_I_E, ""),
|
||||
]
|
||||
|
||||
# So does this
|
||||
@@ -956,7 +959,8 @@ def testCoreToken_ExtractFormats(mockGUI):
|
||||
)
|
||||
assert text == "Text with bold and overlapping italics in it."
|
||||
assert fmt == [
|
||||
(10, tokens.FMT_B_B), (31, tokens.FMT_I_B), (38, tokens.FMT_B_E), (41, tokens.FMT_I_E)
|
||||
(10, tokens.FMT_B_B, ""), (31, tokens.FMT_I_B, ""),
|
||||
(38, tokens.FMT_B_E, ""), (41, tokens.FMT_I_E, ""),
|
||||
]
|
||||
|
||||
# END Test testCoreToken_ExtractFormats
|
||||
@@ -999,8 +1003,8 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
Tokenizer.T_TEXT, 0,
|
||||
"Some bolded text on this lines",
|
||||
[
|
||||
(5, Tokenizer.FMT_B_B),
|
||||
(16, Tokenizer.FMT_B_E),
|
||||
(5, Tokenizer.FMT_B_B, ""),
|
||||
(16, Tokenizer.FMT_B_E, ""),
|
||||
],
|
||||
Tokenizer.A_NONE
|
||||
),
|
||||
@@ -1015,8 +1019,8 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
Tokenizer.T_TEXT, 0,
|
||||
"Some italic text on this lines",
|
||||
[
|
||||
(5, Tokenizer.FMT_I_B),
|
||||
(16, Tokenizer.FMT_I_E),
|
||||
(5, Tokenizer.FMT_I_B, ""),
|
||||
(16, Tokenizer.FMT_I_E, ""),
|
||||
],
|
||||
Tokenizer.A_NONE
|
||||
),
|
||||
@@ -1031,10 +1035,10 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
Tokenizer.T_TEXT, 0,
|
||||
"Some bold italic text on this lines",
|
||||
[
|
||||
(5, Tokenizer.FMT_B_B),
|
||||
(5, Tokenizer.FMT_I_B),
|
||||
(21, Tokenizer.FMT_I_E),
|
||||
(21, Tokenizer.FMT_B_E),
|
||||
(5, Tokenizer.FMT_B_B, ""),
|
||||
(5, Tokenizer.FMT_I_B, ""),
|
||||
(21, Tokenizer.FMT_I_E, ""),
|
||||
(21, Tokenizer.FMT_B_E, ""),
|
||||
],
|
||||
Tokenizer.A_NONE
|
||||
),
|
||||
@@ -1049,8 +1053,8 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
Tokenizer.T_TEXT, 0,
|
||||
"Some strikethrough text on this lines",
|
||||
[
|
||||
(5, Tokenizer.FMT_D_B),
|
||||
(23, Tokenizer.FMT_D_E),
|
||||
(5, Tokenizer.FMT_D_B, ""),
|
||||
(23, Tokenizer.FMT_D_E, ""),
|
||||
],
|
||||
Tokenizer.A_NONE
|
||||
),
|
||||
@@ -1065,12 +1069,12 @@ def testCoreToken_TextFormat(mockGUI):
|
||||
Tokenizer.T_TEXT, 0,
|
||||
"Some nested bold and italic and strikethrough text here",
|
||||
[
|
||||
(5, Tokenizer.FMT_B_B),
|
||||
(21, Tokenizer.FMT_I_B),
|
||||
(27, Tokenizer.FMT_I_E),
|
||||
(32, Tokenizer.FMT_D_B),
|
||||
(45, Tokenizer.FMT_D_E),
|
||||
(50, Tokenizer.FMT_B_E),
|
||||
(5, Tokenizer.FMT_B_B, ""),
|
||||
(21, Tokenizer.FMT_I_B, ""),
|
||||
(27, Tokenizer.FMT_I_E, ""),
|
||||
(32, Tokenizer.FMT_D_B, ""),
|
||||
(45, Tokenizer.FMT_D_E, ""),
|
||||
(50, Tokenizer.FMT_B_E, ""),
|
||||
],
|
||||
Tokenizer.A_NONE
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user