Fixed tests
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-06-08 20:53:03">
|
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" timeStamp="2020-02-26 22:05:41">
|
||||||
<project>
|
<project>
|
||||||
<name></name>
|
<name></name>
|
||||||
<title></title>
|
<title></title>
|
||||||
@@ -72,28 +72,28 @@
|
|||||||
<paraCount>0</paraCount>
|
<paraCount>0</paraCount>
|
||||||
<cursorPos>0</cursorPos>
|
<cursorPos>0</cursorPos>
|
||||||
</item>
|
</item>
|
||||||
<item handle="39fa9ec190eee" order="None" parent="None">
|
<item handle="8722616204217" order="None" parent="None">
|
||||||
<name>Timeline</name>
|
<name>Timeline</name>
|
||||||
<type>ROOT</type>
|
<type>ROOT</type>
|
||||||
<class>TIMELINE</class>
|
<class>TIMELINE</class>
|
||||||
<status>New</status>
|
<status>New</status>
|
||||||
<expanded>False</expanded>
|
<expanded>False</expanded>
|
||||||
</item>
|
</item>
|
||||||
<item handle="d029fa3a95e17" order="None" parent="None">
|
<item handle="96061e92f58e4" order="None" parent="None">
|
||||||
<name>Object</name>
|
<name>Object</name>
|
||||||
<type>ROOT</type>
|
<type>ROOT</type>
|
||||||
<class>OBJECT</class>
|
<class>OBJECT</class>
|
||||||
<status>New</status>
|
<status>New</status>
|
||||||
<expanded>False</expanded>
|
<expanded>False</expanded>
|
||||||
</item>
|
</item>
|
||||||
<item handle="81b8a03f97e87" order="None" parent="None">
|
<item handle="eb624dbe56eb6" order="None" parent="None">
|
||||||
<name>Custom1</name>
|
<name>Custom1</name>
|
||||||
<type>ROOT</type>
|
<type>ROOT</type>
|
||||||
<class>CUSTOM</class>
|
<class>CUSTOM</class>
|
||||||
<status>New</status>
|
<status>New</status>
|
||||||
<expanded>False</expanded>
|
<expanded>False</expanded>
|
||||||
</item>
|
</item>
|
||||||
<item handle="da4ea2a5506f2" order="None" parent="None">
|
<item handle="f369cb89fc627" order="None" parent="None">
|
||||||
<name>Custom2</name>
|
<name>Custom2</name>
|
||||||
<type>ROOT</type>
|
<type>ROOT</type>
|
||||||
<class>CUSTOM</class>
|
<class>CUSTOM</class>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ def testProjectNew(nwTempProj,nwRef,nwTemp):
|
|||||||
assert theProject.newProject()
|
assert theProject.newProject()
|
||||||
assert theProject.setProjectPath(nwTempProj)
|
assert theProject.setProjectPath(nwTempProj)
|
||||||
assert theProject.saveProject()
|
assert theProject.saveProject()
|
||||||
|
assert theProject.closeProject()
|
||||||
assert cmpFiles(projFile, refFile, [2])
|
assert cmpFiles(projFile, refFile, [2])
|
||||||
|
|
||||||
@pytest.mark.project
|
@pytest.mark.project
|
||||||
@@ -41,9 +42,21 @@ def testProjectSave(nwTempProj,nwRef):
|
|||||||
projFile = path.join(nwTempProj,"nwProject.nwx")
|
projFile = path.join(nwTempProj,"nwProject.nwx")
|
||||||
refFile = path.join(nwRef,"proj","1_nwProject.nwx")
|
refFile = path.join(nwRef,"proj","1_nwProject.nwx")
|
||||||
assert theProject.saveProject()
|
assert theProject.saveProject()
|
||||||
|
assert theProject.closeProject()
|
||||||
assert cmpFiles(projFile, refFile, [2])
|
assert cmpFiles(projFile, refFile, [2])
|
||||||
assert not theProject.projChanged
|
assert not theProject.projChanged
|
||||||
|
|
||||||
|
@pytest.mark.project
|
||||||
|
def testProjectOpenTwice(nwTempProj,nwRef):
|
||||||
|
projFile = path.join(nwTempProj,"nwProject.nwx")
|
||||||
|
refFile = path.join(nwRef,"proj","1_nwProject.nwx")
|
||||||
|
assert theProject.openProject(projFile)
|
||||||
|
assert not theProject.openProject(projFile)
|
||||||
|
assert theProject.openProject(projFile, overrideLock=True)
|
||||||
|
assert theProject.saveProject()
|
||||||
|
assert theProject.closeProject()
|
||||||
|
assert cmpFiles(projFile, refFile, [2])
|
||||||
|
|
||||||
@pytest.mark.project
|
@pytest.mark.project
|
||||||
def testProjectNewRoot(nwTempProj,nwRef):
|
def testProjectNewRoot(nwTempProj,nwRef):
|
||||||
projFile = path.join(nwTempProj,"nwProject.nwx")
|
projFile = path.join(nwTempProj,"nwProject.nwx")
|
||||||
@@ -59,6 +72,7 @@ def testProjectNewRoot(nwTempProj,nwRef):
|
|||||||
assert isinstance(theProject.newRoot("Custom2", nwItemClass.CUSTOM), str)
|
assert isinstance(theProject.newRoot("Custom2", nwItemClass.CUSTOM), str)
|
||||||
assert theProject.projChanged
|
assert theProject.projChanged
|
||||||
assert theProject.saveProject()
|
assert theProject.saveProject()
|
||||||
|
assert theProject.closeProject()
|
||||||
assert cmpFiles(projFile, refFile, [2])
|
assert cmpFiles(projFile, refFile, [2])
|
||||||
assert not theProject.projChanged
|
assert not theProject.projChanged
|
||||||
|
|
||||||
@@ -96,6 +110,8 @@ def testIndexScanThis(nwTempProj):
|
|||||||
assert str(theBits) == "['@tag', 'this', 'and this']"
|
assert str(theBits) == "['@tag', 'this', 'and this']"
|
||||||
assert str(thePos) == "[0, 6, 12]"
|
assert str(thePos) == "[0, 6, 12]"
|
||||||
|
|
||||||
|
assert theProject.closeProject()
|
||||||
|
|
||||||
@pytest.mark.project
|
@pytest.mark.project
|
||||||
def testBuildIndex(nwTempProj):
|
def testBuildIndex(nwTempProj):
|
||||||
projFile = path.join(nwTempProj,"nwProject.nwx")
|
projFile = path.join(nwTempProj,"nwProject.nwx")
|
||||||
@@ -117,3 +133,4 @@ def testBuildIndex(nwTempProj):
|
|||||||
assert theIndex.buildNovelList()
|
assert theIndex.buildNovelList()
|
||||||
assert str(theIndex.novelList) == "[[1, 1, 'Novel', 'SCENE'], [3, 2, 'Chapter', 'SCENE'], [5, 3, 'Scene', 'SCENE'], [7, 4, 'Section', 'SCENE']]"
|
assert str(theIndex.novelList) == "[[1, 1, 'Novel', 'SCENE'], [3, 2, 'Chapter', 'SCENE'], [5, 3, 'Scene', 'SCENE'], [7, 4, 'Section', 'SCENE']]"
|
||||||
assert str(theIndex.novelOrder) == "['31489056e0916:1', '31489056e0916:3', '31489056e0916:5', '31489056e0916:7']"
|
assert str(theIndex.novelOrder) == "['31489056e0916:1', '31489056e0916:3', '31489056e0916:5', '31489056e0916:7']"
|
||||||
|
assert theProject.closeProject()
|
||||||
|
|||||||
Reference in New Issue
Block a user