Added some extra checks for deleting files when the file is brand new, and updated the test to check it works

This commit is contained in:
Veronica K. B. Olsen
2020-05-30 15:34:28 +02:00
parent f3f61c43f0
commit 724e597d9c
4 changed files with 36 additions and 16 deletions
+10 -3
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.7.0rc1" hexVersion="0x000700c1" fileVersion="1.1" saveCount="4" autoCount="0" timeStamp="2020-05-29 23:06:02">
<novelWriterXML appVersion="0.7.0rc1" hexVersion="0x000700c1" fileVersion="1.1" saveCount="4" autoCount="1" timeStamp="2020-05-30 15:31:30" editTime="12">
<project>
<name>New Project</name>
<title></title>
@@ -9,7 +9,7 @@
<spellCheck>True</spellCheck>
<autoOutline>True</autoOutline>
<lastEdited>31489056e0916</lastEdited>
<lastViewed>31489056e0916</lastViewed>
<lastViewed>None</lastViewed>
<lastWordCount>86</lastWordCount>
<autoReplace/>
<titleFormat>
@@ -35,7 +35,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="9">
<content count="10">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -119,5 +119,12 @@
<paraCount>1</paraCount>
<cursorPos>68</cursorPos>
</item>
<item handle="41cfc0d1f2d12" order="4" parent="None">
<name>Trash</name>
<type>TRASH</type>
<class>TRASH</class>
<status>None</status>
<expanded>True</expanded>
</item>
</content>
</novelWriterXML>
+9
View File
@@ -235,6 +235,15 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
assert nwGUI.closeDocViewer()
qtbot.wait(stepDelay)
# Check a Quick Create and Delete
assert nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
newHandle = nwGUI.treeView.getSelectedHandle()
assert nwGUI.theProject.projTree["031b4af5197ec"] is not None
assert nwGUI.treeView.deleteItem()
assert nwGUI.treeView.setSelectedHandle(newHandle)
assert nwGUI.treeView.deleteItem()
assert nwGUI.saveProject()
# Check the files
refFile = path.join(nwTempGUI, "nwProject.nwx")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_nwProject.nwx"), [2])