From 1e812f3f063a7f25992dbc076fd4b62f62cea742 Mon Sep 17 00:00:00 2001 From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com> Date: Tue, 1 Oct 2024 12:15:42 +0200 Subject: [PATCH] Update tests --- ...dDocBuild_Extended_Markdown_Lorem_Ipsum.md | 2 +- .../mBuildDocBuild_HTML5_Lorem_Ipsum.htm | 2 +- .../mBuildDocBuild_HTML5_Lorem_Ipsum.json | 6 +- ...uildDocBuild_OpenDocument_Lorem_Ipsum.fodt | 14 ++--- ...dDocBuild_Standard_Markdown_Lorem_Ipsum.md | 2 +- tests/test_core/test_core_buildsettings.py | 2 +- tests/test_core/test_core_docbuild.py | 2 +- tests/test_core/test_core_tokenizer.py | 56 +++++++++---------- tests/test_tools/test_tools_manussettings.py | 10 ++-- 9 files changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/reference/mBuildDocBuild_Extended_Markdown_Lorem_Ipsum.md b/tests/reference/mBuildDocBuild_Extended_Markdown_Lorem_Ipsum.md index c7c7d743..e18f6b6d 100644 --- a/tests/reference/mBuildDocBuild_Extended_Markdown_Lorem_Ipsum.md +++ b/tests/reference/mBuildDocBuild_Extended_Markdown_Lorem_Ipsum.md @@ -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. -# Title: Act One +# Part: Act One “Fusce maximus felis libero” diff --git a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm index d5348e24..992581d7 100644 --- a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm +++ b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.htm @@ -34,7 +34,7 @@ mark {background: rgb(255, 255, 166);}

Prologue

Synopsis: Explanation from the lipsum.com website.

Lorem Ipsum is simply dummy text1 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”

Chapter: Chapter One

Point of View: Bod

diff --git a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json index ab8b2d8f..d8fcd492 100644 --- a/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json +++ b/tests/reference/mBuildDocBuild_HTML5_Lorem_Ipsum.json @@ -2,8 +2,8 @@ "meta": { "projectName": "Lorem Ipsum", "novelAuthor": "lipsum.com", - "buildTime": 1718057434, - "buildTimeStr": "2024-06-11 00:10:34" + "buildTime": 1727777646, + "buildTimeStr": "2024-10-01 12:14:06" }, "text": { "css": [ @@ -42,7 +42,7 @@ "

Lorem Ipsum is simply dummy text1 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

", "

\u201cFusce maximus felis libero\u201d

" ], [ diff --git a/tests/reference/mBuildDocBuild_OpenDocument_Lorem_Ipsum.fodt b/tests/reference/mBuildDocBuild_OpenDocument_Lorem_Ipsum.fodt index b6870a6c..8608fbbc 100644 --- a/tests/reference/mBuildDocBuild_OpenDocument_Lorem_Ipsum.fodt +++ b/tests/reference/mBuildDocBuild_OpenDocument_Lorem_Ipsum.fodt @@ -1,13 +1,13 @@ - 2024-09-30T14:08:16 + 2024-10-01T12:11:50 novelWriter/2.6a0 lipsum.com 45 P0DT0H36M8S Lorem Ipsum - 2024-09-30T14:08:16 + 2024-10-01T12:11:50 lipsum.com @@ -122,12 +122,12 @@ - + - - + + - + Lorem Ipsum By lipsum.com @@ -144,7 +144,7 @@ Lorem ipsum 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) 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” Chapter: Chapter One Point of View: Bod diff --git a/tests/reference/mBuildDocBuild_Standard_Markdown_Lorem_Ipsum.md b/tests/reference/mBuildDocBuild_Standard_Markdown_Lorem_Ipsum.md index c7c7d743..e18f6b6d 100644 --- a/tests/reference/mBuildDocBuild_Standard_Markdown_Lorem_Ipsum.md +++ b/tests/reference/mBuildDocBuild_Standard_Markdown_Lorem_Ipsum.md @@ -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. -# Title: Act One +# Part: Act One “Fusce maximus felis libero” diff --git a/tests/test_core/test_core_buildsettings.py b/tests/test_core/test_core_buildsettings.py index b1308ea7..9cca3844 100644 --- a/tests/test_core/test_core_buildsettings.py +++ b/tests/test_core/test_core_buildsettings.py @@ -147,7 +147,7 @@ def testCoreBuildSettings_BuildValues(): """Test BuildSettings get/set of build values.""" build = BuildSettings() - strSetting = "headings.fmtTitle" + strSetting = "headings.fmtPart" intSetting = "odt.pageCountOffset" boolSetting = "filter.includeNovel" floatSetting = "format.lineHeight" diff --git a/tests/test_core/test_core_docbuild.py b/tests/test_core/test_core_docbuild.py index 62461dd3..784630b2 100644 --- a/tests/test_core/test_core_docbuild.py +++ b/tests/test_core/test_core_docbuild.py @@ -45,7 +45,7 @@ BUILD_CONF = { "filter.includeNovel": True, "filter.includeNotes": True, "filter.includeInactive": True, - "headings.fmtTitle": "Title: {Title}", + "headings.fmtPart": "Part: {Title}", "headings.fmtChapter": "Chapter: {Title}", "headings.fmtUnnumbered": "{Title}", "headings.fmtScene": "Scene: {Title}", diff --git a/tests/test_core/test_core_tokenizer.py b/tests/test_core/test_core_tokenizer.py index 31ced909..3eef5e9c 100644 --- a/tests/test_core/test_core_tokenizer.py +++ b/tests/test_core/test_core_tokenizer.py @@ -47,7 +47,7 @@ def testCoreToken_Setters(mockGUI): tokens = BareTokenizer(project) # Verify defaults - assert tokens._fmtTitle == nwHeadFmt.TITLE + assert tokens._fmtPart == nwHeadFmt.TITLE assert tokens._fmtChapter == nwHeadFmt.TITLE assert tokens._fmtUnNum == nwHeadFmt.TITLE assert tokens._fmtScene == nwHeadFmt.TITLE @@ -65,7 +65,7 @@ def testCoreToken_Setters(mockGUI): assert tokens._marginText == (0.000, 0.584) assert tokens._marginMeta == (0.000, 0.584) assert tokens._marginSep == (1.168, 1.168) - assert tokens._hideTitle is False + assert tokens._hidePart is False assert tokens._hideChapter is False assert tokens._hideUnNum is False assert tokens._hideScene is False @@ -78,7 +78,7 @@ def testCoreToken_Setters(mockGUI): assert tokens._doKeywords is False # 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.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}", True) tokens.setSceneFormat(f"S: {nwHeadFmt.TITLE}", True) @@ -103,7 +103,7 @@ def testCoreToken_Setters(mockGUI): tokens.setKeywords(True) # 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._fmtUnNum == f"U: {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._marginMeta == (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._hideUnNum is True assert tokens._hideScene is True @@ -436,11 +436,11 @@ def testCoreToken_HeaderStyle(mockGUI): # No Styles # ========= - tokens.setTitleStyle(False, False) + tokens.setPartitionStyle(False, False) tokens.setChapterStyle(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._sceneStyle == Tokenizer.A_NONE @@ -485,11 +485,11 @@ def testCoreToken_HeaderStyle(mockGUI): # Center Headers # ============== - tokens.setTitleStyle(True, False) + tokens.setPartitionStyle(True, False) tokens.setChapterStyle(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._sceneStyle == Tokenizer.A_CENTRE @@ -534,11 +534,11 @@ def testCoreToken_HeaderStyle(mockGUI): # Page Break Headers # ================== - tokens.setTitleStyle(False, True) + tokens.setPartitionStyle(False, True) tokens.setChapterStyle(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._sceneStyle == Tokenizer.A_PBB @@ -583,11 +583,11 @@ def testCoreToken_HeaderStyle(mockGUI): # Page Break and Centre Headers # ============================= - tokens.setTitleStyle(True, True) + tokens.setPartitionStyle(True, True) tokens.setChapterStyle(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._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB @@ -634,11 +634,11 @@ def testCoreToken_HeaderStyle(mockGUI): tokens._isNovel = True # Title Styles - tokens.setTitleStyle(True, True) + tokens.setPartitionStyle(True, True) tokens.setChapterStyle(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._sceneStyle == Tokenizer.A_NONE @@ -650,11 +650,11 @@ def testCoreToken_HeaderStyle(mockGUI): assert processStyle("##! Prologue\n", False) == Tokenizer.A_NONE # Chapter Styles - tokens.setTitleStyle(False, False) + tokens.setPartitionStyle(False, False) tokens.setChapterStyle(True, True) 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._sceneStyle == Tokenizer.A_NONE @@ -666,11 +666,11 @@ def testCoreToken_HeaderStyle(mockGUI): assert processStyle("##! Prologue\n", False) == Tokenizer.A_CENTRE | Tokenizer.A_PBB # Scene Styles - tokens.setTitleStyle(False, False) + tokens.setPartitionStyle(False, False) tokens.setChapterStyle(False, False) tokens.setSceneStyle(True, True) - assert tokens._titleStyle == Tokenizer.A_NONE + assert tokens._partStyle == Tokenizer.A_NONE assert tokens._chapterStyle == Tokenizer.A_NONE assert tokens._sceneStyle == Tokenizer.A_CENTRE | Tokenizer.A_PBB @@ -1441,7 +1441,7 @@ def testCoreToken_ProcessHeaders(mockGUI): # H1: Title, First Page assert tokens._isFirst is True tokens._text = "# Part One\n" - tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}") + tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}") tokens.tokenizeText() assert tokens._tokens == [ (Tokenizer.T_HEAD1, 1, "T: Part One", [], Tokenizer.A_CENTRE), @@ -1450,7 +1450,7 @@ def testCoreToken_ProcessHeaders(mockGUI): # H1: Title, Not First Page assert tokens._isFirst is False tokens._text = "# Part One\n" - tokens.setTitleFormat(f"T: {nwHeadFmt.TITLE}") + tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}") tokens.tokenizeText() assert tokens._tokens == [ (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.setTitleFormat(f"T: {nwHeadFmt.TITLE}") + tokens.setPartitionFormat(f"T: {nwHeadFmt.TITLE}") tokens.setChapterFormat(f"C {nwHeadFmt.CH_NUM}: {nwHeadFmt.TITLE}") tokens.setSceneFormat("* * *", False) tokens.setSynopsis(True) @@ -1899,7 +1899,7 @@ def testCoreToken_SceneSeparators(mockGUI): "###! Scene Four\n\n" "Text\n\n" ) - md.setTitleFormat(f"T: {nwHeadFmt.TITLE}") + md.setPartitionFormat(f"T: {nwHeadFmt.TITLE}") md.setChapterFormat(f"C: {nwHeadFmt.TITLE}") md.setSectionFormat("", True) @@ -1953,7 +1953,7 @@ def testCoreToken_SceneSeparators(mockGUI): "###! Scene Four\n\n" "Text\n\n" ) - md.setTitleFormat(f"T: {nwHeadFmt.TITLE}") + md.setPartitionFormat(f"T: {nwHeadFmt.TITLE}") md.setChapterFormat(f"C: {nwHeadFmt.TITLE}") md.setSectionFormat("", True) @@ -2058,7 +2058,7 @@ def testCoreToken_HeaderVisibility(mockGUI): md._isNovel = True # Show All - md.setTitleFormat(nwHeadFmt.TITLE, False) + md.setPartitionFormat(nwHeadFmt.TITLE, False) md.setChapterFormat(nwHeadFmt.TITLE, False) md.setUnNumberedFormat(nwHeadFmt.TITLE, False) md.setSceneFormat(nwHeadFmt.TITLE, False) @@ -2086,7 +2086,7 @@ def testCoreToken_HeaderVisibility(mockGUI): ) # Hide All - md.setTitleFormat(nwHeadFmt.TITLE, True) + md.setPartitionFormat(nwHeadFmt.TITLE, True) md.setChapterFormat(nwHeadFmt.TITLE, True) md.setUnNumberedFormat(nwHeadFmt.TITLE, True) md.setSceneFormat(nwHeadFmt.TITLE, True) @@ -2110,7 +2110,7 @@ def testCoreToken_HeaderVisibility(mockGUI): md._isNovel = False # Hide All - md.setTitleFormat(nwHeadFmt.TITLE, True) + md.setPartitionFormat(nwHeadFmt.TITLE, True) md.setChapterFormat(nwHeadFmt.TITLE, True) md.setUnNumberedFormat(nwHeadFmt.TITLE, True) md.setSceneFormat(nwHeadFmt.TITLE, True) @@ -2179,7 +2179,7 @@ def testCoreToken_CounterHandling(mockGUI): "###! Scene Four\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.setUnNumberedFormat(f"U: {nwHeadFmt.TITLE}") md.setSceneFormat( diff --git a/tests/test_tools/test_tools_manussettings.py b/tests/test_tools/test_tools_manussettings.py index 026b27ee..07b0ec45 100644 --- a/tests/test_tools/test_tools_manussettings.py +++ b/tests/test_tools/test_tools_manussettings.py @@ -318,7 +318,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI): shTitle = f"Hard Scene: {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.fmtUnnumbered", unTitle) build.setValue("headings.fmtScene", scTitle) @@ -337,7 +337,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI): assert bSettings.toolStack.currentWidget() is headTab # Check initial values - assert headTab.fmtTitle.text() == ttTitle + assert headTab.fmtPart.text() == ttTitle assert headTab.fmtChapter.text() == chTitle assert headTab.fmtUnnumbered.text() == unTitle assert headTab.fmtScene.text() == scTitle @@ -356,7 +356,7 @@ def testToolBuildSettings_Headings(qtbot, nwGUI): assert headTab.editTextBox.isEnabled() is False # Title - headTab.btnTitle.click() + headTab.btnPart.click() assert headTab._editing == headTab.EDIT_TITLE assert headTab.editTextBox.isEnabled() is True assert headTab.editTextBox.toPlainText() == ttTitle @@ -434,10 +434,10 @@ def testToolBuildSettings_Headings(qtbot, nwGUI): ) # Set all to plain title - headTab.btnTitle.click() + headTab.btnPart.click() headTab.editTextBox.setPlainText(nwHeadFmt.TITLE) headTab.btnApply.click() - assert build.getStr("headings.fmtTitle") == nwHeadFmt.TITLE + assert build.getStr("headings.fmtPart") == nwHeadFmt.TITLE headTab.btnChapter.click() headTab.editTextBox.setPlainText(nwHeadFmt.TITLE)