Merge branch 'dev' into project_handling

This commit is contained in:
Veronica Berglyd Olsen
2024-01-27 14:42:43 +01:00
68 changed files with 2045 additions and 2222 deletions
+2 -2
View File
@@ -230,7 +230,7 @@ def testCoreDocBuild_HTML(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
assert error == []
copyfile(docFile, tstFile)
assert cmpFiles(tstFile, cmpFile, ignoreLines=[6, 7])
assert cmpFiles(tstFile, cmpFile, ignoreLines=[5, 6])
# Check Error Handling
# ====================
@@ -370,7 +370,7 @@ def testCoreDocBuild_NWD(monkeypatch, mockGUI, prjLipsum, fncPath, tstPaths):
assert error == []
copyfile(docFile, tstFile)
assert cmpFiles(tstFile, cmpFile, ignoreLines=[6, 7])
assert cmpFiles(tstFile, cmpFile, ignoreLines=[5, 6])
# Check Error Handling
# ====================
+5
View File
@@ -695,6 +695,7 @@ def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
"This is a story about Jane Smith.\n\n"
"Well, not really. She's still awesome though.\n"
))
# Whole document
cC, wC, pC = index.getCounts(nHandle)
assert cC == 152
@@ -798,6 +799,10 @@ def testCoreIndex_ExtractData(mockGUI, fncPath, mockRnd):
# Extract stats
assert index.getNovelWordCount(activeOnly=False) == 43
assert index.getNovelWordCount(activeOnly=True) == 15
assert index.getNovelWordCount(rootHandle=C.hNovelRoot, activeOnly=False) == 43
assert index.getNovelWordCount(rootHandle=C.hNovelRoot, activeOnly=True) == 15
assert index.getNovelWordCount(rootHandle=C.hWorldRoot, activeOnly=False) == 0
assert index.getNovelWordCount(rootHandle=C.hWorldRoot, activeOnly=True) == 0
assert index.getNovelTitleCounts(activeOnly=False) == [0, 3, 2, 3, 0]
assert index.getNovelTitleCounts(activeOnly=True) == [0, 1, 2, 3, 0]
+16 -16
View File
@@ -121,27 +121,27 @@ def testCoreOptions_SetGet(mockGUI):
assert options.setValue("GuiProjectSettings", "winWidth", 100) is True
# Set some values of different types
assert options.setValue("GuiProjectDetails", "winWidth", 100) is True
assert options.setValue("GuiProjectDetails", "winHeight", 12.34) is True
assert options.setValue("GuiProjectDetails", "clearDouble", True) is True
assert options.setValue("GuiNovelDetails", "winWidth", 100) is True
assert options.setValue("GuiNovelDetails", "winHeight", 12.34) is True
assert options.setValue("GuiNovelDetails", "clearDouble", True) is True
assert options.setValue("GuiNovelView", "lastCol", nwColHidden) is True
# Generic get, doesn't check type
assert options.getValue("GuiProjectDetails", "winWidth", None) == 100
assert options.getValue("GuiProjectDetails", "winHeight", None) == 12.34
assert options.getValue("GuiProjectDetails", "clearDouble", None) is True
assert options.getValue("GuiProjectDetails", "mockItem", None) is None
assert options.getValue("GuiNovelDetails", "winWidth", None) == 100
assert options.getValue("GuiNovelDetails", "winHeight", None) == 12.34
assert options.getValue("GuiNovelDetails", "clearDouble", None) is True
assert options.getValue("GuiNovelDetails", "mockItem", None) is None
# Get type-specific
assert options.getString("GuiProjectDetails", "winWidth", None) is None # type: ignore
assert options.getString("GuiProjectDetails", "mockItem", None) is None # type: ignore
assert options.getInt("GuiProjectDetails", "winWidth", None) == 100 # type: ignore
assert options.getInt("GuiProjectDetails", "textFont", None) is None # type: ignore
assert options.getInt("GuiProjectDetails", "mockItem", None) is None # type: ignore
assert options.getFloat("GuiProjectDetails", "winWidth", None) == 100.0 # type: ignore
assert options.getFloat("GuiProjectDetails", "mockItem", None) is None # type: ignore
assert options.getBool("GuiProjectDetails", "clearDouble", None) is True # type: ignore
assert options.getBool("GuiProjectDetails", "mockItem", None) is None # type: ignore
assert options.getString("GuiNovelDetails", "winWidth", None) is None # type: ignore
assert options.getString("GuiNovelDetails", "mockItem", None) is None # type: ignore
assert options.getInt("GuiNovelDetails", "winWidth", None) == 100 # type: ignore
assert options.getInt("GuiNovelDetails", "textFont", None) is None # type: ignore
assert options.getInt("GuiNovelDetails", "mockItem", None) is None # type: ignore
assert options.getFloat("GuiNovelDetails", "winWidth", None) == 100.0 # type: ignore
assert options.getFloat("GuiNovelDetails", "mockItem", None) is None # type: ignore
assert options.getBool("GuiNovelDetails", "clearDouble", None) is True # type: ignore
assert options.getBool("GuiNovelDetails", "mockItem", None) is None # type: ignore
assert options.getEnum("GuiNovelView", "lastCol", NovelTreeColumn, nwColHidden) == nwColHidden
# Get from non-existent groups
-4
View File
@@ -482,10 +482,6 @@ def testCoreProject_Methods(monkeypatch, mockGUI, fncPath, mockRnd):
project.data.setName(" A Name ")
assert project.data.name == "A Name"
# Project Title
project.data.setTitle(" A Title ")
assert project.data.title == "A Title"
# Project Author
project.data.setAuthor(" Jane\tDoe ")
assert project.data.author == "Jane Doe"
+1 -7
View File
@@ -131,13 +131,12 @@ def testCoreProjectXML_ReadCurrent(monkeypatch, tstPaths, fncPath):
assert xmlReader.state == XMLReadState.PARSED_OK
assert xmlReader.xmlRoot == "novelWriterXML"
assert xmlReader.xmlVersion == 0x0105
assert xmlReader.xmlRevision == 1
assert xmlReader.xmlRevision == 2
assert xmlReader.appVersion == "2.0-rc1"
assert xmlReader.hexVersion == 0x020000c1
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jane Smith"
assert data.saveCount == 5
assert data.autoCount == 10
@@ -256,7 +255,6 @@ def testCoreProjectXML_ReadLegacy10(tstPaths, fncPath, mockRnd):
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jay Doh" # Only last author is preserved
assert data.saveCount == 0 # Doesn't exist in 1.0
assert data.autoCount == 0 # Doesn't exist in 1.0
@@ -391,7 +389,6 @@ def testCoreProjectXML_ReadLegacy11(tstPaths, fncPath, mockRnd):
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jay Doh" # Only last author is preserved
assert data.saveCount == 5
assert data.autoCount == 10
@@ -526,7 +523,6 @@ def testCoreProjectXML_ReadLegacy12(tstPaths, fncPath, mockRnd):
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jay Doh" # Only last author is preserved
assert data.saveCount == 5
assert data.autoCount == 10
@@ -664,7 +660,6 @@ def testCoreProjectXML_ReadLegacy13(tstPaths, fncPath, mockRnd):
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jay Doh" # Only last author is preserved
assert data.saveCount == 5
assert data.autoCount == 10
@@ -802,7 +797,6 @@ def testCoreProjectXML_ReadLegacy14(tstPaths, fncPath, mockRnd):
# Check loaded data
assert data.name == "Sample Project"
assert data.title == "Sample Project"
assert data.author == "Jay Doh" # Only last author is preserved
assert data.saveCount == 5
assert data.autoCount == 10