Fix tests

This commit is contained in:
Veronica K. B. Olsen
2020-05-10 16:12:47 +02:00
parent cf3fc2ef4f
commit 5ab1402854
10 changed files with 119 additions and 12 deletions
+1 -1
View File
@@ -358,7 +358,7 @@ class NWProject():
elif xItem.tag == "titleFormat":
titleFormat = self.titleFormat.copy()
for xEntry in xItem:
titleFormat[xEntry.tag] = checkString(xEntry.text, None, False)
titleFormat[xEntry.tag] = checkString(xEntry.text, "", False)
self.setTitleFormat(titleFormat)
elif xChild.tag == "content":
logger.debug("Found project content")
+10 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="162" autoCount="19" timeStamp="2020-05-09 20:50:45">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="171" autoCount="20" timeStamp="2020-05-10 15:56:41">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -18,6 +18,15 @@
<B>E</B>
<C>D</C>
</autoReplace>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene>None</scene>
<sceneSep>* * *</sceneSep>
<section>None</section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Notes</entry>
+16 -1
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:30:38">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 16:05:01">
<project>
<name></name>
<title></title>
@@ -12,6 +12,15 @@
<lastViewed>None</lastViewed>
<lastWordCount>0</lastWordCount>
<autoReplace/>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -32,6 +41,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -39,6 +49,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -46,6 +57,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>SCENE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
@@ -58,6 +70,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -65,6 +78,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -72,6 +86,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+19 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-07 22:03:17">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 16:05:52">
<project>
<name></name>
<title></title>
@@ -12,6 +12,15 @@
<lastViewed>31489056e0916</lastViewed>
<lastWordCount>86</lastWordCount>
<autoReplace/>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -32,6 +41,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -39,6 +49,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -46,6 +57,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>SCENE</layout>
<charCount>331</charCount>
<wordCount>59</wordCount>
@@ -58,6 +70,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="98010bd9270f9" order="0" parent="44cb730c42048">
<name>New File</name>
@@ -65,6 +78,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>NOTE</layout>
<charCount>34</charCount>
<wordCount>8</wordCount>
@@ -77,6 +91,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="0e17daca5f3e1" order="0" parent="71ee45a3c0db9">
<name>New File</name>
@@ -84,6 +99,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>NOTE</layout>
<charCount>48</charCount>
<wordCount>10</wordCount>
@@ -96,6 +112,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>True</expanded>
<exported>True</exported>
</item>
<item handle="1a6562590ef19" order="0" parent="811786ad1ae74">
<name>New File</name>
@@ -103,6 +120,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>NOTE</layout>
<charCount>51</charCount>
<wordCount>9</wordCount>
+16 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-06-08 21:05:51">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="2" autoCount="0" timeStamp="2020-05-10 16:07:36">
<project>
<name>Project Name</name>
<title>Project Title</title>
@@ -16,6 +16,15 @@
<autoReplace>
<This>With This Stuff </This>
</autoReplace>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -36,6 +45,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -43,6 +53,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -50,6 +61,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>SCENE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
@@ -62,6 +74,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -69,6 +82,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -76,6 +90,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+16 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-06-08 20:49:50">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="1" autoCount="0" timeStamp="2020-05-10 16:10:27">
<project>
<name></name>
<title></title>
@@ -12,6 +12,15 @@
<lastViewed>None</lastViewed>
<lastWordCount>0</lastWordCount>
<autoReplace/>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -32,6 +41,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
@@ -39,6 +49,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>Just a Page</name>
@@ -46,6 +57,7 @@
<class>NOVEL</class>
<status>Note</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>PAGE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
@@ -58,6 +70,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
@@ -65,6 +78,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
@@ -72,6 +86,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+16 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-06-08 20:52:21">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="1" autoCount="0" timeStamp="2020-05-10 16:01:19">
<project>
<name></name>
<title></title>
@@ -12,6 +12,15 @@
<lastViewed>None</lastViewed>
<lastWordCount>0</lastWordCount>
<autoReplace/>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -32,6 +41,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
@@ -39,6 +49,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
@@ -46,6 +57,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
@@ -53,6 +65,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
@@ -60,6 +73,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -67,6 +81,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>SCENE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
+20 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.4.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-07 22:52:18">
<novelWriterXML appVersion="0.5" fileVersion="1.0" saveCount="4" autoCount="0" timeStamp="2020-05-10 16:03:54">
<project>
<name></name>
<title></title>
@@ -12,6 +12,15 @@
<lastViewed>None</lastViewed>
<lastWordCount>0</lastWordCount>
<autoReplace/>
<titleFormat>
<title>%title%</title>
<chapter>Chapter %num%</chapter>
<chapterSub>%title%</chapterSub>
<unnumbered>%title%</unnumbered>
<scene></scene>
<sceneSep>* * *</sceneSep>
<section></section>
</titleFormat>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
@@ -32,6 +41,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
@@ -39,6 +49,7 @@
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
@@ -46,6 +57,7 @@
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
@@ -53,6 +65,7 @@
<class>WORLD</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
@@ -60,6 +73,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
@@ -67,6 +81,7 @@
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
<layout>SCENE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
@@ -79,6 +94,7 @@
<class>TIMELINE</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="0e17daca5f3e1" order="None" parent="None">
<name>Object</name>
@@ -86,6 +102,7 @@
<class>OBJECT</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="1a6562590ef19" order="None" parent="None">
<name>Custom1</name>
@@ -93,6 +110,7 @@
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
<item handle="031b4af5197ec" order="None" parent="None">
<name>Custom2</name>
@@ -100,6 +118,7 @@
<class>CUSTOM</class>
<status>New</status>
<expanded>False</expanded>
<exported>True</exported>
</item>
</content>
</novelWriterXML>
+3 -3
View File
@@ -13,7 +13,7 @@ from nw.gui.dialogs.itemeditor import GuiItemEditor
from nw.constants import *
keyDelay = 10
keyDelay = 5
stepDelay = 50
@pytest.mark.gui
@@ -361,7 +361,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
layoutIdx = itemEdit.editLayout.findData(nwItemLayout.PAGE)
itemEdit.editLayout.setCurrentIndex(layoutIdx)
qtbot.mouseClick(itemEdit.saveButton, Qt.LeftButton)
itemEdit._doSave()
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
qtbot.addWidget(itemEdit)
@@ -369,7 +369,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
assert itemEdit.editStatus.currentData() == "Note"
assert itemEdit.editLayout.currentData() == nwItemLayout.PAGE
qtbot.mouseClick(itemEdit.closeButton, Qt.LeftButton)
itemEdit._doClose()
qtbot.wait(stepDelay)
assert nwGUI.saveProject()
+2 -1
View File
@@ -197,7 +197,8 @@ def testItemXMLPackUnpack():
assert etree.tostring(xContent, pretty_print=False, encoding="utf-8") == (
b"<content>"
b"<item handle=\"0123456789abc\" order=\"1\" parent=\"0123456789abc\">"
b"<name>A Name</name><type>TRASH</type><class>TRASH</class><status>Main</status><expanded>True</expanded>"
b"<name>A Name</name><type>TRASH</type><class>TRASH</class><status>Main</status>"
b"<expanded>True</expanded><exported>True</exported>"
b"</item>"
b"</content>"
)