Merge branch 'release' into dev

This commit is contained in:
Veronica K. B. Olsen
2021-02-01 23:02:40 +01:00
7 changed files with 179 additions and 35 deletions
+19 -1
View File
@@ -1,5 +1,23 @@
# -*- coding: utf-8 -*-
"""novelWriter Test Config
"""
novelWriter Test Suite Configuration
======================================
This file is a part of novelWriter
Copyright 20182021, Veronica Berglyd Olsen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import sys
+19 -1
View File
@@ -1,5 +1,23 @@
# -*- coding: utf-8 -*-
"""novelWriter Test Dummy GUI Classes
"""
novelWriter Test Suite Dummy Classes
======================================
This file is a part of novelWriter
Copyright 20182021, Veronica Berglyd Olsen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
# =========================================================================== #
+32 -12
View File
@@ -538,12 +538,12 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
"@char: Jane\n\n"
"% this is a comment\n\n"
"This is a story about Jane Smith.\n\n"
"Well, not really.\n"
"Well, not really. She's still awesome though.\n"
))
# Whole document
cC, wC, pC = theIndex.getCounts(nHandle)
assert cC == 124
assert wC == 24
assert cC == 152
assert wC == 28
assert pC == 4
# First part
@@ -554,8 +554,8 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
# Second part
cC, wC, pC = theIndex.getCounts(nHandle, "T000011")
assert cC == 62
assert wC == 12
assert cC == 90
assert wC == 16
assert pC == 2
# Get section counts for a note file
@@ -571,12 +571,12 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
"@char: Jane\n\n"
"% this is a comment\n\n"
"This is a story about Jane Smith.\n\n"
"Well, not really.\n"
"Well, not really. She's still awesome though.\n"
))
# Whole document
cC, wC, pC = theIndex.getCounts(cHandle)
assert cC == 124
assert wC == 24
assert cC == 152
assert wC == 28
assert pC == 4
# First part
@@ -587,8 +587,8 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
# Second part
cC, wC, pC = theIndex.getCounts(cHandle, "T000011")
assert cC == 62
assert wC == 12
assert cC == 90
assert wC == 16
assert pC == 2
# getFirstTitle
@@ -620,7 +620,7 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
theProject.projTree._treeOrder.remove("0000000000000")
# Extract stats
assert theIndex.getNovelWordCount(False) == 30
assert theIndex.getNovelWordCount(False) == 34
assert theIndex.getNovelWordCount(True) == 6
assert theIndex.getNovelTitleCounts(False) == [0, 2, 1, 2, 0]
assert theIndex.getNovelTitleCounts(True) == [0, 0, 1, 2, 0]
@@ -640,11 +640,31 @@ def testCoreIndex_ExtractData(nwMinimal, dummyGUI):
assert theIndex.getTableOfContents(0, False) == []
assert theIndex.getTableOfContents(1, False) == [
("%s:T000001" % nHandle, 1, "Hello World!", 12),
("%s:T000011" % nHandle, 1, "Hello World!", 18),
("%s:T000011" % nHandle, 1, "Hello World!", 22),
]
# Header Word Counts
bHandle = "0000000000000"
assert theIndex.getHandleWordCounts(bHandle) == []
assert theIndex.getHandleWordCounts(hHandle) == [("%s:T000001" % hHandle, 2)]
assert theIndex.getHandleWordCounts(sHandle) == [("%s:T000001" % sHandle, 2)]
assert theIndex.getHandleWordCounts(tHandle) == [("%s:T000001" % tHandle, 2)]
assert theIndex.getHandleWordCounts(nHandle) == [
("%s:T000001" % nHandle, 12), ("%s:T000011" % nHandle, 16)
]
assert theProject.closeProject()
# Header Record
bHandle = "0000000000000"
assert theIndex.getHandleHeaders(bHandle) == []
assert theIndex.getHandleHeaders(hHandle) == [("T000001", "H2", "Chapter One")]
assert theIndex.getHandleHeaders(sHandle) == [("T000001", "H3", "Scene One")]
assert theIndex.getHandleHeaders(tHandle) == [("T000001", "H3", "Scene Two")]
assert theIndex.getHandleHeaders(nHandle) == [
("T000001", "H1", "Hello World!"), ("T000011", "H1", "Hello World!")
]
# END Test testCoreIndex_ExtractData
@pytest.mark.core
+19 -1
View File
@@ -1,5 +1,23 @@
# -*- coding: utf-8 -*-
"""novelWriter Test Tools
"""
novelWriter Test Suite Tools
==============================
This file is a part of novelWriter
Copyright 20182021, Veronica Berglyd Olsen
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import os