Update tests

This commit is contained in:
Veronica Berglyd Olsen
2024-10-01 12:15:42 +02:00
parent 0f1401eb71
commit 1e812f3f06
9 changed files with 48 additions and 48 deletions
@@ -18,7 +18,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
_Lorem Ipsum_ is simply dummy text[1] of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. _Lorem Ipsum_ is simply dummy text[1] of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
# Title: Act One # Part: Act One
“Fusce maximus felis libero” “Fusce maximus felis libero”
@@ -34,7 +34,7 @@ mark {background: rgb(255, 255, 166);}
<h1 style='page-break-before: always;'>Prologue</h1> <h1 style='page-break-before: always;'>Prologue</h1>
<p class='synopsis'><strong>Synopsis:</strong> Explanation from the lipsum.com website.</p> <p class='synopsis'><strong>Synopsis:</strong> Explanation from the lipsum.com website.</p>
<p><em>Lorem Ipsum</em> is simply dummy text<sup><a href='#footnote_1'>1</a></sup> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p> <p><em>Lorem Ipsum</em> is simply dummy text<sup><a href='#footnote_1'>1</a></sup> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<h1 class='title' style='text-align: center; page-break-before: always;'>Title: Act One</h1> <h1 class='title' style='text-align: center; page-break-before: always;'>Part: Act One</h1>
<p style='text-align: center;'>“Fusce maximus felis libero”</p> <p style='text-align: center;'>“Fusce maximus felis libero”</p>
<h1 style='page-break-before: always;'>Chapter: Chapter One</h1> <h1 style='page-break-before: always;'>Chapter: Chapter One</h1>
<p class='meta meta-pov' style='margin-bottom: 0;'><span class='keyword'>Point of View:</span> <a class='tag' href='#tag_Bod'>Bod</a></p> <p class='meta meta-pov' style='margin-bottom: 0;'><span class='keyword'>Point of View:</span> <a class='tag' href='#tag_Bod'>Bod</a></p>
@@ -2,8 +2,8 @@
"meta": { "meta": {
"projectName": "Lorem Ipsum", "projectName": "Lorem Ipsum",
"novelAuthor": "lipsum.com", "novelAuthor": "lipsum.com",
"buildTime": 1718057434, "buildTime": 1727777646,
"buildTimeStr": "2024-06-11 00:10:34" "buildTimeStr": "2024-10-01 12:14:06"
}, },
"text": { "text": {
"css": [ "css": [
@@ -42,7 +42,7 @@
"<p><em>Lorem Ipsum</em> is simply dummy text<sup><a href='#footnote_1'>1</a></sup> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>" "<p><em>Lorem Ipsum</em> is simply dummy text<sup><a href='#footnote_1'>1</a></sup> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>"
], ],
[ [
"<h1 class='title' style='text-align: center; page-break-before: always;'>Title: Act One</h1>", "<h1 class='title' style='text-align: center; page-break-before: always;'>Part: Act One</h1>",
"<p style='text-align: center;'>\u201cFusce maximus felis libero\u201d</p>" "<p style='text-align: center;'>\u201cFusce maximus felis libero\u201d</p>"
], ],
[ [
@@ -1,13 +1,13 @@
<?xml version='1.0' encoding='utf-8'?> <?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: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> <office:meta>
<meta:creation-date>2024-09-30T14:08:16</meta:creation-date> <meta:creation-date>2024-10-01T12:11:50</meta:creation-date>
<meta:generator>novelWriter/2.6a0</meta:generator> <meta:generator>novelWriter/2.6a0</meta:generator>
<meta:initial-creator>lipsum.com</meta:initial-creator> <meta:initial-creator>lipsum.com</meta:initial-creator>
<meta:editing-cycles>45</meta:editing-cycles> <meta:editing-cycles>45</meta:editing-cycles>
<meta:editing-duration>P0DT0H36M8S</meta:editing-duration> <meta:editing-duration>P0DT0H36M8S</meta:editing-duration>
<dc:title>Lorem Ipsum</dc:title> <dc:title>Lorem Ipsum</dc:title>
<dc:date>2024-09-30T14:08:16</dc:date> <dc:date>2024-10-01T12:11:50</dc:date>
<dc:creator>lipsum.com</dc:creator> <dc:creator>lipsum.com</dc:creator>
</office:meta> </office:meta>
<office:font-face-decls> <office:font-face-decls>
@@ -122,12 +122,12 @@
<text:user-field-decl office:value-type="float" office:value="4163" text:name="ManuscriptAllWords" /> <text:user-field-decl office:value-type="float" office:value="4163" text:name="ManuscriptAllWords" />
<text:user-field-decl office:value-type="float" office:value="3809" text:name="ManuscriptTextWords" /> <text:user-field-decl office:value-type="float" office:value="3809" text:name="ManuscriptTextWords" />
<text:user-field-decl office:value-type="float" office:value="54" text:name="ManuscriptTitleWords" /> <text:user-field-decl office:value-type="float" office:value="54" text:name="ManuscriptTitleWords" />
<text:user-field-decl office:value-type="float" office:value="27849" text:name="ManuscriptAllChars" /> <text:user-field-decl office:value-type="float" office:value="27848" text:name="ManuscriptAllChars" />
<text:user-field-decl office:value-type="float" office:value="25528" text:name="ManuscriptTextChars" /> <text:user-field-decl office:value-type="float" office:value="25528" text:name="ManuscriptTextChars" />
<text:user-field-decl office:value-type="float" office:value="311" text:name="ManuscriptTitleChars" /> <text:user-field-decl office:value-type="float" office:value="310" text:name="ManuscriptTitleChars" />
<text:user-field-decl office:value-type="float" office:value="23782" text:name="ManuscriptAllWordChars" /> <text:user-field-decl office:value-type="float" office:value="23781" text:name="ManuscriptAllWordChars" />
<text:user-field-decl office:value-type="float" office:value="21761" text:name="ManuscriptTextWordChars" /> <text:user-field-decl office:value-type="float" office:value="21761" text:name="ManuscriptTextWordChars" />
<text:user-field-decl office:value-type="float" office:value="276" text:name="ManuscriptTitleWordChars" /> <text:user-field-decl office:value-type="float" office:value="275" text:name="ManuscriptTitleWordChars" />
</text:user-field-decls> </text:user-field-decls>
<text:p text:style-name="Title">Lorem Ipsum</text:p> <text:p text:style-name="Title">Lorem Ipsum</text:p>
<text:p text:style-name="P1"><text:span text:style-name="T1">By lipsum.com</text:span></text:p> <text:p text:style-name="P1"><text:span text:style-name="T1">By lipsum.com</text:span></text:p>
@@ -144,7 +144,7 @@
<text:p text:style-name="Footnote"><text:span text:style-name="T2">Lorem ipsum</text:span> is typically a corrupted version of De finibus bonorum et malorum, a 1st-century BC text by the Roman statesman and philosopher Cicero, with words altered, added, and removed to make it nonsensical and improper Latin. (Source: Wikipedia)</text:p> <text:p text:style-name="Footnote"><text:span text:style-name="T2">Lorem ipsum</text:span> is typically a corrupted version of De finibus bonorum et malorum, a 1st-century BC text by the Roman statesman and philosopher Cicero, with words altered, added, and removed to make it nonsensical and improper Latin. (Source: Wikipedia)</text:p>
</text:note-body> </text:note-body>
</text:note> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</text:p> </text:note> of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</text:p>
<text:h text:style-name="P4" text:outline-level="1">Title: Act One</text:h> <text:h text:style-name="P4" text:outline-level="1">Part: Act One</text:h>
<text:p text:style-name="P1">“Fusce maximus felis libero”</text:p> <text:p text:style-name="P1">“Fusce maximus felis libero”</text:p>
<text:h text:style-name="P3" text:outline-level="2">Chapter: Chapter One</text:h> <text:h text:style-name="P3" text:outline-level="2">Chapter: Chapter One</text:h>
<text:p text:style-name="P5"><text:span text:style-name="T1">Point of View:</text:span> Bod</text:p> <text:p text:style-name="P5"><text:span text:style-name="T1">Point of View:</text:span> Bod</text:p>
@@ -18,7 +18,7 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
_Lorem Ipsum_ is simply dummy text[1] of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. _Lorem Ipsum_ is simply dummy text[1] of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
# Title: Act One # Part: Act One
“Fusce maximus felis libero” “Fusce maximus felis libero”
+1 -1
View File
@@ -147,7 +147,7 @@ def testCoreBuildSettings_BuildValues():
"""Test BuildSettings get/set of build values.""" """Test BuildSettings get/set of build values."""
build = BuildSettings() build = BuildSettings()
strSetting = "headings.fmtTitle" strSetting = "headings.fmtPart"
intSetting = "odt.pageCountOffset" intSetting = "odt.pageCountOffset"
boolSetting = "filter.includeNovel" boolSetting = "filter.includeNovel"
floatSetting = "format.lineHeight" floatSetting = "format.lineHeight"
+1 -1
View File
@@ -45,7 +45,7 @@ BUILD_CONF = {
"filter.includeNovel": True, "filter.includeNovel": True,
"filter.includeNotes": True, "filter.includeNotes": True,
"filter.includeInactive": True, "filter.includeInactive": True,
"headings.fmtTitle": "Title: {Title}", "headings.fmtPart": "Part: {Title}",
"headings.fmtChapter": "Chapter: {Title}", "headings.fmtChapter": "Chapter: {Title}",
"headings.fmtUnnumbered": "{Title}", "headings.fmtUnnumbered": "{Title}",
"headings.fmtScene": "Scene: {Title}", "headings.fmtScene": "Scene: {Title}",
+28 -28
View File
@@ -47,7 +47,7 @@ def testCoreToken_Setters(mockGUI):
tokens = BareTokenizer(project) tokens = BareTokenizer(project)
# Verify defaults # Verify defaults
assert tokens._fmtTitle == nwHeadFmt.TITLE assert tokens._fmtPart == nwHeadFmt.TITLE
assert tokens._fmtChapter == nwHeadFmt.TITLE assert tokens._fmtChapter == nwHeadFmt.TITLE
assert tokens._fmtUnNum == nwHeadFmt.TITLE assert tokens._fmtUnNum == nwHeadFmt.TITLE
assert tokens._fmtScene == nwHeadFmt.TITLE assert tokens._fmtScene == nwHeadFmt.TITLE
@@ -65,7 +65,7 @@ def testCoreToken_Setters(mockGUI):
assert tokens._marginText == (0.000, 0.584) assert tokens._marginText == (0.000, 0.584)
assert tokens._marginMeta == (0.000, 0.584) assert tokens._marginMeta == (0.000, 0.584)
assert tokens._marginSep == (1.168, 1.168) assert tokens._marginSep == (1.168, 1.168)
assert tokens._hideTitle is False assert tokens._hidePart is False
assert tokens._hideChapter is False assert tokens._hideChapter is False
assert tokens._hideUnNum is False assert tokens._hideUnNum is False
assert tokens._hideScene is False assert tokens._hideScene is False
@@ -78,7 +78,7 @@ def testCoreToken_Setters(mockGUI):
assert tokens._doKeywords is False assert tokens._doKeywords is False
# Set new values # Set new values
tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}", True) tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}", True)
tokens.setChapterFormat(f"C: {nwHeadFmt.TITLE}", True) tokens.setChapterFormat(f"C: {nwHeadFmt.TITLE}", True)
tokens.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}", True) tokens.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}", True)
tokens.setSceneFormat(f"S: {nwHeadFmt.TITLE}", True) tokens.setSceneFormat(f"S: {nwHeadFmt.TITLE}", True)
@@ -103,7 +103,7 @@ def testCoreToken_Setters(mockGUI):
tokens.setKeywords(True) tokens.setKeywords(True)
# Check new values # Check new values
assert tokens._fmtTitle == f"T: {nwHeadFmt.TITLE}" assert tokens._fmtPart == f"T: {nwHeadFmt.TITLE}"
assert tokens._fmtChapter == f"C: {nwHeadFmt.TITLE}" assert tokens._fmtChapter == f"C: {nwHeadFmt.TITLE}"
assert tokens._fmtUnNum == f"U: {nwHeadFmt.TITLE}" assert tokens._fmtUnNum == f"U: {nwHeadFmt.TITLE}"
assert tokens._fmtScene == f"S: {nwHeadFmt.TITLE}" assert tokens._fmtScene == f"S: {nwHeadFmt.TITLE}"
@@ -121,7 +121,7 @@ def testCoreToken_Setters(mockGUI):
assert tokens._marginText == (2.0, 2.0) assert tokens._marginText == (2.0, 2.0)
assert tokens._marginMeta == (2.0, 2.0) assert tokens._marginMeta == (2.0, 2.0)
assert tokens._marginSep == (2.0, 2.0) assert tokens._marginSep == (2.0, 2.0)
assert tokens._hideTitle is True assert tokens._hidePart is True
assert tokens._hideChapter is True assert tokens._hideChapter is True
assert tokens._hideUnNum is True assert tokens._hideUnNum is True
assert tokens._hideScene is True assert tokens._hideScene is True
@@ -436,11 +436,11 @@ def testCoreToken_HeaderStyle(mockGUI):
# No Styles # No Styles
# ========= # =========
tokens.setTitleStyle(False, False) tokens.setPartitionStyle(False, False)
tokens.setChapterStyle(False, False) tokens.setChapterStyle(False, False)
tokens.setSceneStyle(False, False) tokens.setSceneStyle(False, False)
assert tokens._titleStyle == Tokenizer.A_NONE assert tokens._partStyle == Tokenizer.A_NONE
assert tokens._chapterStyle == Tokenizer.A_NONE assert tokens._chapterStyle == Tokenizer.A_NONE
assert tokens._sceneStyle == Tokenizer.A_NONE assert tokens._sceneStyle == Tokenizer.A_NONE
@@ -485,11 +485,11 @@ def testCoreToken_HeaderStyle(mockGUI):
# Center Headers # Center Headers
# ============== # ==============
tokens.setTitleStyle(True, False) tokens.setPartitionStyle(True, False)
tokens.setChapterStyle(True, False) tokens.setChapterStyle(True, False)
tokens.setSceneStyle(True, False) tokens.setSceneStyle(True, False)
assert tokens._titleStyle == Tokenizer.A_CENTRE assert tokens._partStyle == Tokenizer.A_CENTRE
assert tokens._chapterStyle == Tokenizer.A_CENTRE assert tokens._chapterStyle == Tokenizer.A_CENTRE
assert tokens._sceneStyle == Tokenizer.A_CENTRE assert tokens._sceneStyle == Tokenizer.A_CENTRE
@@ -534,11 +534,11 @@ def testCoreToken_HeaderStyle(mockGUI):
# Page Break Headers # Page Break Headers
# ================== # ==================
tokens.setTitleStyle(False, True) tokens.setPartitionStyle(False, True)
tokens.setChapterStyle(False, True) tokens.setChapterStyle(False, True)
tokens.setSceneStyle(False, True) tokens.setSceneStyle(False, True)
assert tokens._titleStyle == Tokenizer.A_PBB assert tokens._partStyle == Tokenizer.A_PBB
assert tokens._chapterStyle == Tokenizer.A_PBB assert tokens._chapterStyle == Tokenizer.A_PBB
assert tokens._sceneStyle == Tokenizer.A_PBB assert tokens._sceneStyle == Tokenizer.A_PBB
@@ -583,11 +583,11 @@ def testCoreToken_HeaderStyle(mockGUI):
# Page Break and Centre Headers # Page Break and Centre Headers
# ============================= # =============================
tokens.setTitleStyle(True, True) tokens.setPartitionStyle(True, True)
tokens.setChapterStyle(True, True) tokens.setChapterStyle(True, True)
tokens.setSceneStyle(True, True) tokens.setSceneStyle(True, True)
assert tokens._titleStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._partStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
assert tokens._chapterStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._chapterStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
assert tokens._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
@@ -634,11 +634,11 @@ def testCoreToken_HeaderStyle(mockGUI):
tokens._isNovel = True tokens._isNovel = True
# Title Styles # Title Styles
tokens.setTitleStyle(True, True) tokens.setPartitionStyle(True, True)
tokens.setChapterStyle(False, False) tokens.setChapterStyle(False, False)
tokens.setSceneStyle(False, False) tokens.setSceneStyle(False, False)
assert tokens._titleStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._partStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
assert tokens._chapterStyle == Tokenizer.A_NONE assert tokens._chapterStyle == Tokenizer.A_NONE
assert tokens._sceneStyle == Tokenizer.A_NONE assert tokens._sceneStyle == Tokenizer.A_NONE
@@ -650,11 +650,11 @@ def testCoreToken_HeaderStyle(mockGUI):
assert processStyle("##! Prologue\n", False) == Tokenizer.A_NONE assert processStyle("##! Prologue\n", False) == Tokenizer.A_NONE
# Chapter Styles # Chapter Styles
tokens.setTitleStyle(False, False) tokens.setPartitionStyle(False, False)
tokens.setChapterStyle(True, True) tokens.setChapterStyle(True, True)
tokens.setSceneStyle(False, False) tokens.setSceneStyle(False, False)
assert tokens._titleStyle == Tokenizer.A_NONE assert tokens._partStyle == Tokenizer.A_NONE
assert tokens._chapterStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._chapterStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
assert tokens._sceneStyle == Tokenizer.A_NONE assert tokens._sceneStyle == Tokenizer.A_NONE
@@ -666,11 +666,11 @@ def testCoreToken_HeaderStyle(mockGUI):
assert processStyle("##! Prologue\n", False) == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert processStyle("##! Prologue\n", False) == Tokenizer.A_CENTRE | Tokenizer.A_PBB
# Scene Styles # Scene Styles
tokens.setTitleStyle(False, False) tokens.setPartitionStyle(False, False)
tokens.setChapterStyle(False, False) tokens.setChapterStyle(False, False)
tokens.setSceneStyle(True, True) tokens.setSceneStyle(True, True)
assert tokens._titleStyle == Tokenizer.A_NONE assert tokens._partStyle == Tokenizer.A_NONE
assert tokens._chapterStyle == Tokenizer.A_NONE assert tokens._chapterStyle == Tokenizer.A_NONE
assert tokens._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB assert tokens._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB
@@ -1441,7 +1441,7 @@ def testCoreToken_ProcessHeaders(mockGUI):
# H1: Title, First Page # H1: Title, First Page
assert tokens._isFirst is True assert tokens._isFirst is True
tokens._text = "# Part One\n" tokens._text = "# Part One\n"
tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}") tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
tokens.tokenizeText() tokens.tokenizeText()
assert tokens._tokens == [ assert tokens._tokens == [
(Tokenizer.T_HEAD1, 1, "T: Part One", [], Tokenizer.A_CENTRE), (Tokenizer.T_HEAD1, 1, "T: Part One", [], Tokenizer.A_CENTRE),
@@ -1450,7 +1450,7 @@ def testCoreToken_ProcessHeaders(mockGUI):
# H1: Title, Not First Page # H1: Title, Not First Page
assert tokens._isFirst is False assert tokens._isFirst is False
tokens._text = "# Part One\n" tokens._text = "# Part One\n"
tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}") tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
tokens.tokenizeText() tokens.tokenizeText()
assert tokens._tokens == [ assert tokens._tokens == [
(Tokenizer.T_HEAD1, 1, "T: Part One", [], Tokenizer.A_PBB | Tokenizer.A_CENTRE), (Tokenizer.T_HEAD1, 1, "T: Part One", [], Tokenizer.A_PBB | Tokenizer.A_CENTRE),
@@ -1858,7 +1858,7 @@ def testCoreToken_CountStats(mockGUI, ipsumText):
) )
tokens._counts = {} tokens._counts = {}
tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}") tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
tokens.setChapterFormat(f"C {nwHeadFmt.CH_NUM}: {nwHeadFmt.TITLE}") tokens.setChapterFormat(f"C {nwHeadFmt.CH_NUM}: {nwHeadFmt.TITLE}")
tokens.setSceneFormat("* * *", False) tokens.setSceneFormat("* * *", False)
tokens.setSynopsis(True) tokens.setSynopsis(True)
@@ -1899,7 +1899,7 @@ def testCoreToken_SceneSeparators(mockGUI):
"###! Scene Four\n\n" "###! Scene Four\n\n"
"Text\n\n" "Text\n\n"
) )
md.setTitleFormat(f"T: {nwHeadFmt.TITLE}") md.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
md.setChapterFormat(f"C: {nwHeadFmt.TITLE}") md.setChapterFormat(f"C: {nwHeadFmt.TITLE}")
md.setSectionFormat("", True) md.setSectionFormat("", True)
@@ -1953,7 +1953,7 @@ def testCoreToken_SceneSeparators(mockGUI):
"###! Scene Four\n\n" "###! Scene Four\n\n"
"Text\n\n" "Text\n\n"
) )
md.setTitleFormat(f"T: {nwHeadFmt.TITLE}") md.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
md.setChapterFormat(f"C: {nwHeadFmt.TITLE}") md.setChapterFormat(f"C: {nwHeadFmt.TITLE}")
md.setSectionFormat("", True) md.setSectionFormat("", True)
@@ -2058,7 +2058,7 @@ def testCoreToken_HeaderVisibility(mockGUI):
md._isNovel = True md._isNovel = True
# Show All # Show All
md.setTitleFormat(nwHeadFmt.TITLE, False) md.setPartitionFormat(nwHeadFmt.TITLE, False)
md.setChapterFormat(nwHeadFmt.TITLE, False) md.setChapterFormat(nwHeadFmt.TITLE, False)
md.setUnNumberedFormat(nwHeadFmt.TITLE, False) md.setUnNumberedFormat(nwHeadFmt.TITLE, False)
md.setSceneFormat(nwHeadFmt.TITLE, False) md.setSceneFormat(nwHeadFmt.TITLE, False)
@@ -2086,7 +2086,7 @@ def testCoreToken_HeaderVisibility(mockGUI):
) )
# Hide All # Hide All
md.setTitleFormat(nwHeadFmt.TITLE, True) md.setPartitionFormat(nwHeadFmt.TITLE, True)
md.setChapterFormat(nwHeadFmt.TITLE, True) md.setChapterFormat(nwHeadFmt.TITLE, True)
md.setUnNumberedFormat(nwHeadFmt.TITLE, True) md.setUnNumberedFormat(nwHeadFmt.TITLE, True)
md.setSceneFormat(nwHeadFmt.TITLE, True) md.setSceneFormat(nwHeadFmt.TITLE, True)
@@ -2110,7 +2110,7 @@ def testCoreToken_HeaderVisibility(mockGUI):
md._isNovel = False md._isNovel = False
# Hide All # Hide All
md.setTitleFormat(nwHeadFmt.TITLE, True) md.setPartitionFormat(nwHeadFmt.TITLE, True)
md.setChapterFormat(nwHeadFmt.TITLE, True) md.setChapterFormat(nwHeadFmt.TITLE, True)
md.setUnNumberedFormat(nwHeadFmt.TITLE, True) md.setUnNumberedFormat(nwHeadFmt.TITLE, True)
md.setSceneFormat(nwHeadFmt.TITLE, True) md.setSceneFormat(nwHeadFmt.TITLE, True)
@@ -2179,7 +2179,7 @@ def testCoreToken_CounterHandling(mockGUI):
"###! Scene Four\n\n" "###! Scene Four\n\n"
"Text\n\n" "Text\n\n"
) )
md.setTitleFormat(f"T: {nwHeadFmt.TITLE}") md.setPartitionFormat(f"T: {nwHeadFmt.TITLE}")
md.setChapterFormat(f"C {nwHeadFmt.CH_NUM}: {nwHeadFmt.TITLE}") md.setChapterFormat(f"C {nwHeadFmt.CH_NUM}: {nwHeadFmt.TITLE}")
md.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}") md.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}")
md.setSceneFormat( md.setSceneFormat(
+5 -5
View File
@@ -318,7 +318,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
shTitle = f"Hard Scene: {nwHeadFmt.TITLE}" shTitle = f"Hard Scene: {nwHeadFmt.TITLE}"
sxTitle = f"Section: {nwHeadFmt.TITLE}" sxTitle = f"Section: {nwHeadFmt.TITLE}"
build.setValue("headings.fmtTitle", ttTitle) build.setValue("headings.fmtPart", ttTitle)
build.setValue("headings.fmtChapter", chTitle) build.setValue("headings.fmtChapter", chTitle)
build.setValue("headings.fmtUnnumbered", unTitle) build.setValue("headings.fmtUnnumbered", unTitle)
build.setValue("headings.fmtScene", scTitle) build.setValue("headings.fmtScene", scTitle)
@@ -337,7 +337,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
assert bSettings.toolStack.currentWidget() is headTab assert bSettings.toolStack.currentWidget() is headTab
# Check initial values # Check initial values
assert headTab.fmtTitle.text() == ttTitle assert headTab.fmtPart.text() == ttTitle
assert headTab.fmtChapter.text() == chTitle assert headTab.fmtChapter.text() == chTitle
assert headTab.fmtUnnumbered.text() == unTitle assert headTab.fmtUnnumbered.text() == unTitle
assert headTab.fmtScene.text() == scTitle assert headTab.fmtScene.text() == scTitle
@@ -356,7 +356,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
assert headTab.editTextBox.isEnabled() is False assert headTab.editTextBox.isEnabled() is False
# Title # Title
headTab.btnTitle.click() headTab.btnPart.click()
assert headTab._editing == headTab.EDIT_TITLE assert headTab._editing == headTab.EDIT_TITLE
assert headTab.editTextBox.isEnabled() is True assert headTab.editTextBox.isEnabled() is True
assert headTab.editTextBox.toPlainText() == ttTitle assert headTab.editTextBox.toPlainText() == ttTitle
@@ -434,10 +434,10 @@ def testToolBuildSettings_Headings(qtbot, nwGUI):
) )
# Set all to plain title # Set all to plain title
headTab.btnTitle.click() headTab.btnPart.click()
headTab.editTextBox.setPlainText(nwHeadFmt.TITLE) headTab.editTextBox.setPlainText(nwHeadFmt.TITLE)
headTab.btnApply.click() headTab.btnApply.click()
assert build.getStr("headings.fmtTitle") == nwHeadFmt.TITLE assert build.getStr("headings.fmtPart") == nwHeadFmt.TITLE
headTab.btnChapter.click() headTab.btnChapter.click()
headTab.editTextBox.setPlainText(nwHeadFmt.TITLE) headTab.editTextBox.setPlainText(nwHeadFmt.TITLE)