Updated tests to work with new project tree class

This commit is contained in:
Veronica K. B. Olsen
2020-05-07 23:08:43 +02:00
parent 58eb8e78ba
commit 5b3291e4ee
7 changed files with 25 additions and 25 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.5" fileVersion="1.0" timeStamp="2019-06-27 20:31:37">
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-07 22:03:17">
<project>
<name></name>
<title></title>
@@ -59,7 +59,7 @@
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="2fca346db6561" order="0" parent="44cb730c42048">
<item handle="98010bd9270f9" order="0" parent="44cb730c42048">
<name>New File</name>
<type>FILE</type>
<class>CHARACTER</class>
@@ -78,7 +78,7 @@
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="02d20bbd7e394" order="0" parent="71ee45a3c0db9">
<item handle="0e17daca5f3e1" order="0" parent="71ee45a3c0db9">
<name>New File</name>
<type>FILE</type>
<class>PLOT</class>
@@ -97,7 +97,7 @@
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="7688b6ef52555" order="0" parent="811786ad1ae74">
<item handle="1a6562590ef19" order="0" parent="811786ad1ae74">
<name>New File</name>
<type>FILE</type>
<class>WORLD</class>
+5 -5
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" timeStamp="2020-02-26 22:05:41">
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-07 22:52:18">
<project>
<name></name>
<title></title>
@@ -73,28 +73,28 @@
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="8722616204217" order="None" parent="None">
<item handle="98010bd9270f9" order="None" parent="None">
<name>Timeline</name>
<type>ROOT</type>
<class>TIMELINE</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="96061e92f58e4" order="None" parent="None">
<item handle="0e17daca5f3e1" order="None" parent="None">
<name>Object</name>
<type>ROOT</type>
<class>OBJECT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="eb624dbe56eb6" order="None" parent="None">
<item handle="1a6562590ef19" order="None" parent="None">
<name>Custom1</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="f369cb89fc627" order="None" parent="None">
<item handle="031b4af5197ec" order="None" parent="None">
<name>Custom2</name>
<type>ROOT</type>
<class>CUSTOM</class>
+15 -15
View File
@@ -25,15 +25,15 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
# Create new, save, close project
nwGUI.theProject.handleSeed = 42
nwGUI.theProject.projTree.setSeed(42)
assert nwGUI.newProject(nwTempGUI, True)
assert nwGUI.saveProject()
assert nwGUI.closeProject()
assert len(nwGUI.theProject.projTree) == 0
assert len(nwGUI.theProject.treeOrder) == 0
assert len(nwGUI.theProject.treeRoots) == 0
assert nwGUI.theProject.trashRoot is None
assert len(nwGUI.theProject.projTree._treeOrder) == 0
assert len(nwGUI.theProject.projTree._treeRoots) == 0
assert nwGUI.theProject.projTree.trashRoot() is None
assert nwGUI.theProject.projPath is None
assert nwGUI.theProject.projMeta is None
assert nwGUI.theProject.projFile == "nwProject.nwx"
@@ -55,9 +55,9 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# Check that we loaded the data
assert len(nwGUI.theProject.projTree) == 6
assert len(nwGUI.theProject.treeOrder) == 6
assert len(nwGUI.theProject.treeRoots) == 4
assert nwGUI.theProject.trashRoot is None
assert len(nwGUI.theProject.projTree._treeOrder) == 6
assert len(nwGUI.theProject.projTree._treeRoots) == 4
assert nwGUI.theProject.projTree.trashRoot() is None
assert nwGUI.theProject.projPath == nwTempGUI
assert nwGUI.theProject.projMeta == path.join(nwTempGUI,"meta")
assert nwGUI.theProject.projFile == "nwProject.nwx"
@@ -237,14 +237,14 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# Check the files
refFile = path.join(nwTempGUI,"nwProject.nwx")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_nwProject.nwx"), [2])
refFile = path.join(nwTempGUI,"data_0","2d20bbd7e394_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_2d20bbd7e394_main.nwd"))
refFile = path.join(nwTempGUI,"data_2","fca346db6561_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_fca346db6561_main.nwd"))
refFile = path.join(nwTempGUI,"data_0","e17daca5f3e1_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_e17daca5f3e1_main.nwd"))
refFile = path.join(nwTempGUI,"data_9","8010bd9270f9_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_8010bd9270f9_main.nwd"))
refFile = path.join(nwTempGUI,"data_3","1489056e0916_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_1489056e0916_main.nwd"))
refFile = path.join(nwTempGUI,"data_7","688b6ef52555_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_688b6ef52555_main.nwd"))
refFile = path.join(nwTempGUI,"data_1","a6562590ef19_main.nwd")
assert cmpFiles(refFile, path.join(nwRef,"gui","1_a6562590ef19_main.nwd"))
nwGUI.closeMain()
# qtbot.stopForInteraction()
@@ -258,7 +258,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
# Create new, save, open project
nwGUI.theProject.handleSeed = 42
nwGUI.theProject.projTree.setSeed(42)
assert nwGUI.newProject(nwTempGUI, True)
nwGUI.mainConf.backupPath = nwTempGUI
@@ -345,7 +345,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
# Create new, save, open project
nwGUI.theProject.handleSeed = 42
nwGUI.theProject.projTree.setSeed(42)
assert nwGUI.newProject(nwTempGUI, True)
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
+1 -1
View File
@@ -19,7 +19,7 @@ theMain = DummyMain()
theMain.mainConf = theConf
theProject = NWProject(theMain)
theProject.handleSeed = 42
theProject.projTree.setSeed(42)
@pytest.mark.project
def testProjectNew(nwTempProj,nwRef,nwTemp):