Updated project tests

This commit is contained in:
Veronica K. B. Olsen
2020-08-10 21:33:53 +02:00
parent 7d803a2eb7
commit 7bc62db5e3
4 changed files with 115 additions and 43 deletions
+32 -8
View File
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 20:58:52">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:26:47">
<project>
<name>New Project</name>
<title></title>
<saveCount>1</saveCount>
<autoCount>0</autoCount>
<autoCount>1</autoCount>
<editTime>0</editTime>
</project>
<settings>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<content count="8">
<item handle="73475cb40a568" order="None" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,16 +46,16 @@
<expanded>False</expanded>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
@@ -67,13 +67,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="None" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="None" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="None" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
+36 -12
View File
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 21:03:18">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:28:02">
<project>
<name>New Project</name>
<title></title>
<saveCount>4</saveCount>
<autoCount>0</autoCount>
<autoCount>1</autoCount>
<editTime>0</editTime>
</project>
<settings>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="10">
<content count="12">
<item handle="73475cb40a568" order="None" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,16 +46,16 @@
<expanded>False</expanded>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
@@ -67,13 +67,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="None" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="None" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="None" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -85,28 +109,28 @@
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="98010bd9270f9" order="None" parent="None">
<item handle="1a6562590ef19" order="None" parent="None">
<name>Timeline</name>
<type>ROOT</type>
<class>TIMELINE</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="0e17daca5f3e1" order="None" parent="None">
<item handle="031b4af5197ec" order="None" parent="None">
<name>Object</name>
<type>ROOT</type>
<class>OBJECT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="1a6562590ef19" order="None" parent="None">
<item handle="41cfc0d1f2d12" order="None" parent="None">
<name>Custom1</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="031b4af5197ec" order="None" parent="None">
<item handle="2858dcd1057d3" order="None" parent="None">
<name>Custom2</name>
<type>ROOT</type>
<class>CUSTOM</class>
+38 -14
View File
@@ -1,10 +1,10 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 21:04:10">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:29:43">
<project>
<name>New Project</name>
<title></title>
<saveCount>5</saveCount>
<autoCount>0</autoCount>
<autoCount>1</autoCount>
<editTime>0</editTime>
</project>
<settings>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="12">
<content count="14">
<item handle="73475cb40a568" order="None" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,16 +46,16 @@
<expanded>False</expanded>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
@@ -67,13 +67,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="None" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="None" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="None" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -85,35 +109,35 @@
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="98010bd9270f9" order="None" parent="None">
<item handle="1a6562590ef19" order="None" parent="None">
<name>Timeline</name>
<type>ROOT</type>
<class>TIMELINE</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="0e17daca5f3e1" order="None" parent="None">
<item handle="031b4af5197ec" order="None" parent="None">
<name>Object</name>
<type>ROOT</type>
<class>OBJECT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="1a6562590ef19" order="None" parent="None">
<item handle="41cfc0d1f2d12" order="None" parent="None">
<name>Custom1</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="031b4af5197ec" order="None" parent="None">
<item handle="2858dcd1057d3" order="None" parent="None">
<name>Custom2</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="41cfc0d1f2d12" order="None" parent="73475cb40a568">
<item handle="2fca346db6561" order="None" parent="73475cb40a568">
<name>Hello</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -125,7 +149,7 @@
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="2858dcd1057d3" order="None" parent="44cb730c42048">
<item handle="02d20bbd7e394" order="None" parent="71ee45a3c0db9">
<name>Jane</name>
<type>FILE</type>
<class>CHARACTER</class>
+9 -9
View File
@@ -82,7 +82,7 @@ def testProjectNewFile(nwTempProj,nwRef):
refFile = path.join(nwRef,"proj","3_nwProject.nwx")
assert theProject.openProject(projFile)
assert isinstance(theProject.newFile("Hello", nwItemClass.NOVEL, "73475cb40a568"), str)
assert isinstance(theProject.newFile("Jane", nwItemClass.CHARACTER, "44cb730c42048"), str)
assert isinstance(theProject.newFile("Jane", nwItemClass.CHARACTER, "71ee45a3c0db9"), str)
assert theProject.projChanged
assert theProject.saveProject()
assert theProject.closeProject()
@@ -142,9 +142,9 @@ def testIndexCheckThese(nwTempProj):
assert theProject.openProject(projFile)
theIndex = NWIndex(theProject, theMain)
nHandle = "41cfc0d1f2d12"
nHandle = "0e17daca5f3e1"
nItem = theProject.projTree[nHandle]
cHandle = "2858dcd1057d3"
cHandle = "02d20bbd7e394"
cItem = theProject.projTree[cHandle]
assert theIndex.scanText(cHandle, (
@@ -155,7 +155,7 @@ def testIndexCheckThese(nwTempProj):
"# Hello World!\n"
"@pov: Jane"
))
assert str(theIndex.tagIndex) == "{'Jane': [2, '2858dcd1057d3', 'CHARACTER', 'T000001']}"
assert str(theIndex.tagIndex) == "{'Jane': [2, '02d20bbd7e394', 'CHARACTER', 'T000001']}"
assert theIndex.novelIndex[nHandle]["T000001"]["title"] == "Hello World!"
assert str(theIndex.checkThese(["@tag", "Jane"], cItem)) == "[True, True]"
@@ -175,9 +175,9 @@ def testIndexMeta(nwTempProj):
assert theProject.openProject(projFile)
theIndex = NWIndex(theProject, theMain)
nHandle = "41cfc0d1f2d12"
nHandle = "0e17daca5f3e1"
nItem = theProject.projTree[nHandle]
cHandle = "2858dcd1057d3"
cHandle = "02d20bbd7e394"
cItem = theProject.projTree[cHandle]
assert theIndex.scanText(cHandle, (
@@ -195,11 +195,11 @@ def testIndexMeta(nwTempProj):
"\n"
"Well, not really.\n"
))
assert str(theIndex.tagIndex) == "{'Jane': [2, '2858dcd1057d3', 'CHARACTER', 'T000001']}"
assert str(theIndex.tagIndex) == "{'Jane': [2, '02d20bbd7e394', 'CHARACTER', 'T000001']}"
assert theIndex.novelIndex[nHandle]["T000001"]["title"] == "Hello World!"
# The novel structure should contain the pointer to the novel file header
assert str(theIndex.getNovelStructure()) == "['41cfc0d1f2d12:T000001']"
assert str(theIndex.getNovelStructure()) == "['0e17daca5f3e1:T000001']"
# The novel file should have the correct counts
cC, wC, pC = theIndex.getCounts(nHandle)
@@ -214,6 +214,6 @@ def testIndexMeta(nwTempProj):
# The character file should have a record of the reference from the novel file
theRefs = theIndex.getBackReferenceList(cHandle)
assert str(theRefs) == "{'41cfc0d1f2d12': 'T000001'}"
assert str(theRefs) == "{'0e17daca5f3e1': 'T000001'}"
assert theProject.closeProject()