Fix the GUI tests

This commit is contained in:
Veronica K. B. Olsen
2019-05-22 21:21:02 +02:00
parent 823426f4f8
commit 20418f79ca
7 changed files with 129 additions and 62 deletions
+28 -16
View File
@@ -1,60 +1,72 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.2" fileVersion="1.0" timeStamp="2019-05-18 14:55:20">
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-22 21:14:26">
<project>
<name></name>
<title></title>
</project>
<settings>
<spellCheck>False</spellCheck>
<lastEdited>None</lastEdited>
<lastViewed>None</lastViewed>
<spellCheck>True</spellCheck>
<lastEdited>31489056e0916</lastEdited>
<lastViewed>31489056e0916</lastViewed>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
<entry blue="0" green="150" red="200">Draft</entry>
<entry blue="0" green="200" red="50">Finished</entry>
</status>
<importance>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Minor</entry>
<entry blue="0" green="150" red="200">Major</entry>
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
<class>NOVEL</class>
<status>0</status>
<expanded>False</expanded>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>0</status>
<expanded>False</expanded>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
<charCount>377</charCount>
<wordCount>69</wordCount>
<paraCount>2</paraCount>
<cursorPos>443</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
<type>ROOT</type>
<class>WORLD</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
</content>
+19 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.2" fileVersion="1.0" timeStamp="2019-05-18 14:58:58">
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-22 21:19:46">
<project>
<name>Project Name</name>
<title>Project Title</title>
@@ -10,27 +10,39 @@
<spellCheck>False</spellCheck>
<lastEdited>None</lastEdited>
<lastViewed>None</lastViewed>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
<entry blue="0" green="150" red="200">Draft</entry>
<entry blue="0" green="200" red="50">Finished</entry>
</status>
<importance>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Minor</entry>
<entry blue="0" green="150" red="200">Major</entry>
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>0</charCount>
@@ -42,21 +54,21 @@
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
<type>ROOT</type>
<class>WORLD</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
</content>
+19 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.2" fileVersion="1.0" timeStamp="2019-05-18 15:00:34">
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-22 21:16:34">
<project>
<name></name>
<title></title>
@@ -8,27 +8,39 @@
<spellCheck>False</spellCheck>
<lastEdited>None</lastEdited>
<lastViewed>None</lastViewed>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
<entry blue="0" green="150" red="200">Draft</entry>
<entry blue="0" green="200" red="50">Finished</entry>
</status>
<importance>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Minor</entry>
<entry blue="0" green="150" red="200">Major</entry>
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<name>Just a Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>1</status>
<status>Note</status>
<expanded>False</expanded>
<layout>PAGE</layout>
<charCount>0</charCount>
@@ -40,21 +52,21 @@
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
<type>ROOT</type>
<class>WORLD</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
</content>
+19 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.2" fileVersion="1.0" timeStamp="2019-05-18 14:46:29">
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-22 20:48:51">
<project>
<name></name>
<title></title>
@@ -8,48 +8,60 @@
<spellCheck>False</spellCheck>
<lastEdited>None</lastEdited>
<lastViewed>None</lastViewed>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
<entry blue="0" green="150" red="200">Draft</entry>
<entry blue="0" green="200" red="50">Finished</entry>
</status>
<importance>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Minor</entry>
<entry blue="0" green="150" red="200">Major</entry>
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<item handle="73475cb40a568" order="None" parent="None">
<name>Novel</name>
<type>ROOT</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
<type>ROOT</type>
<class>WORLD</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>0</charCount>
+23 -11
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.0" fileVersion="1.0" timeStamp="2019-05-12 14:40:19">
<novelWriterXML appVersion="0.1.3" fileVersion="1.0" timeStamp="2019-05-22 20:52:32">
<project>
<name></name>
<title></title>
@@ -8,48 +8,60 @@
<spellCheck>False</spellCheck>
<lastEdited>None</lastEdited>
<lastViewed>None</lastViewed>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Note</entry>
<entry blue="0" green="150" red="200">Draft</entry>
<entry blue="0" green="200" red="50">Finished</entry>
</status>
<importance>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Minor</entry>
<entry blue="0" green="150" red="200">Major</entry>
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="10">
<item handle="73475cb40a568" order="None" parent="None">
<name>Novel</name>
<type>ROOT</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="44cb730c42048" order="None" parent="None">
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="None" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="811786ad1ae74" order="None" parent="None">
<name>World</name>
<type>ROOT</type>
<class>WORLD</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="None" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="None" parent="25fc0e7096fc6">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>0</charCount>
@@ -61,28 +73,28 @@
<name>Timeline</name>
<type>ROOT</type>
<class>TIMELINE</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="d029fa3a95e17" order="None" parent="None">
<name>Object</name>
<type>ROOT</type>
<class>OBJECT</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="81b8a03f97e87" order="None" parent="None">
<name>Custom1</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="da4ea2a5506f2" order="None" parent="None">
<name>Custom2</name>
<type>ROOT</type>
<class>CUSTOM</class>
<status>0</status>
<status>New</status>
<expanded>False</expanded>
</item>
</content>
+16 -12
View File
@@ -99,15 +99,19 @@ def testMainWindows(qtbot, nwTempGUI, nwRef):
qtbot.wait(stepDelay)
nwGUI.docEditor.wCounter.run()
qtbot.wait(stepDelay)
nwGUI.docEditor._updateCounts()
# Save the document
assert nwGUI.docEditor.docChanged
assert nwGUI.saveDocument()
assert not nwGUI.docEditor.docChanged
qtbot.wait(stepDelay)
# Open and view the edited document
assert nwGUI.openDocument("31489056e0916")
assert nwGUI.viewDocument("31489056e0916")
qtbot.wait(stepDelay)
assert nwGUI.saveProject()
# Check the files
projFile = path.join(nwTempGUI,"nwProject.nwx")
@@ -135,27 +139,27 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef):
qtbot.addWidget(projEdit)
for c in "Project Name":
qtbot.keyClick(projEdit.editName, c, delay=keyDelay)
qtbot.keyClick(projEdit.tabMain.editName, c, delay=keyDelay)
for c in "Project Title":
qtbot.keyClick(projEdit.editTitle, c, delay=keyDelay)
qtbot.keyClick(projEdit.tabMain.editTitle, c, delay=keyDelay)
for c in "Jane Doe":
qtbot.keyClick(projEdit.editAuthors, c, delay=keyDelay)
qtbot.keyClick(projEdit.editAuthors, Qt.Key_Return, delay=keyDelay)
qtbot.keyClick(projEdit.tabMain.editAuthors, c, delay=keyDelay)
qtbot.keyClick(projEdit.tabMain.editAuthors, Qt.Key_Return, delay=keyDelay)
for c in "John Doh":
qtbot.keyClick(projEdit.editAuthors, c, delay=keyDelay)
qtbot.keyClick(projEdit.tabMain.editAuthors, c, delay=keyDelay)
qtbot.mouseClick(projEdit.saveButton, Qt.LeftButton)
projEdit._doSave()
projEdit = GuiProjectEditor(nwGUI, nwGUI.theProject)
qtbot.addWidget(projEdit)
assert projEdit.editName.text() == "Project Name"
assert projEdit.editTitle.text() == "Project Title"
theAuth = projEdit.editAuthors.toPlainText().strip().splitlines()
assert projEdit.tabMain.editName.text() == "Project Name"
assert projEdit.tabMain.editTitle.text() == "Project Title"
theAuth = projEdit.tabMain.editAuthors.toPlainText().strip().splitlines()
assert len(theAuth) == 2
assert theAuth[0] == "Jane Doe"
assert theAuth[1] == "John Doh"
qtbot.mouseClick(projEdit.closeButton, Qt.LeftButton)
projEdit._doClose()
qtbot.wait(stepDelay)
assert nwGUI.saveProject()
@@ -185,7 +189,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef):
qtbot.addWidget(itemEdit)
assert itemEdit.editName.text() == "New Scene"
assert itemEdit.editStatus.currentData() == 0
assert itemEdit.editStatus.currentData() == "New"
assert itemEdit.editLayout.currentData() == nwItemLayout.SCENE
for c in "Just a Page":
@@ -199,7 +203,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef):
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
qtbot.addWidget(itemEdit)
assert itemEdit.editName.text() == "Just a Page"
assert itemEdit.editStatus.currentData() == 1
assert itemEdit.editStatus.currentData() == "Note"
assert itemEdit.editLayout.currentData() == nwItemLayout.PAGE
qtbot.mouseClick(itemEdit.closeButton, Qt.LeftButton)