Updated GUI tests

This commit is contained in:
Veronica K. B. Olsen
2020-08-10 21:25:45 +02:00
parent 8a50590a5d
commit 7d803a2eb7
11 changed files with 206 additions and 107 deletions
+31 -7
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 21:05:07">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:06:05">
<project>
<name>New Project</name>
<title></title>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<content count="8">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,13 +46,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="1" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="0" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="1" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -65,16 +89,16 @@
<cursorPos>0</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
+6
View File
@@ -0,0 +1,6 @@
%%~ 031b4af5197ec:44cb730c42048:PLOT:NOTE:New File
# Main Plot
@tag: MainPlot
This is a file detailing the main plot.
+21 -4
View File
@@ -1,6 +1,23 @@
%%~ 0e17daca5f3e1:71ee45a3c0db9:PLOT:NOTE:New File
# Main Plot
%%~ 0e17daca5f3e1:31489056e0916:73475cb40a568:NOVEL:SCENE:New Scene
# Novel
@tag: MainPlot
## Chapter
@pov: Jane
@plot: MainPlot
### Scene
% How about a comment?
@pov: Jane
@plot: MainPlot
@location: Home
#### Some Section
@char: Jane
This is a paragraph of dummy text.
This is another paragraph of much longer dummy text. It is in fact very very dumb dummy text! We can also try replacing “quotes”, even singles quotes are replaced. We can hyphen-ate, make dashes and even longer dashes — if we want. Ellipsis? Not a problem either …
This is a file detailing the main plot.
+4 -4
View File
@@ -1,6 +1,6 @@
%%~ 1a6562590ef19:811786ad1ae74:WORLD:NOTE:New File
# Main Location
%%~ 1a6562590ef19:71ee45a3c0db9:CHARACTER:NOTE:New File
# Jane Doe
@tag: Home
@tag: Jane
This is a file describing Janes home.
This is a file about Jane.
-23
View File
@@ -1,23 +0,0 @@
%%~ 31489056e0916:25fc0e7096fc6:73475cb40a568:NOVEL:SCENE:New Scene
# Novel
## Chapter
@pov: Jane
@plot: MainPlot
### Scene
% How about a comment?
@pov: Jane
@plot: MainPlot
@location: Home
#### Some Section
@char: Jane
This is a paragraph of dummy text.
This is another paragraph of much longer dummy text. It is in fact very very dumb dummy text! We can also try replacing “quotes”, even singles quotes are replaced. We can hyphen-ate, make dashes and even longer dashes — if we want. Ellipsis? Not a problem either …
+6
View File
@@ -0,0 +1,6 @@
%%~ 41cfc0d1f2d12:811786ad1ae74:WORLD:NOTE:New File
# Main Location
@tag: Home
This is a file describing Janes home.
-6
View File
@@ -1,6 +0,0 @@
%%~ 98010bd9270f9:44cb730c42048:CHARACTER:NOTE:New File
# Jane Doe
@tag: Jane
This is a file about Jane.
+52 -28
View File
@@ -1,17 +1,17 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.8.0rc1" hexVersion="0x000800c1" fileVersion="1.1" timeStamp="2020-06-05 21:06:00">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:15:06">
<project>
<name>New Project</name>
<title></title>
<saveCount>5</saveCount>
<saveCount>4</saveCount>
<autoCount>1</autoCount>
<editTime>11</editTime>
<editTime>13</editTime>
</project>
<settings>
<doBackup>True</doBackup>
<spellCheck>True</spellCheck>
<autoOutline>True</autoOutline>
<lastEdited>31489056e0916</lastEdited>
<lastEdited>0e17daca5f3e1</lastEdited>
<lastViewed>None</lastViewed>
<lastWordCount>86</lastWordCount>
<novelWordCount>59</novelWordCount>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="10">
<content count="12">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,13 +46,37 @@
<expanded>True</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="1" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="0" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="1" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -65,32 +89,13 @@
<cursorPos>465</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="98010bd9270f9" order="0" parent="44cb730c42048">
<name>New File</name>
<type>FILE</type>
<class>CHARACTER</class>
<status>New</status>
<exported>True</exported>
<layout>NOTE</layout>
<charCount>34</charCount>
<wordCount>8</wordCount>
<paraCount>1</paraCount>
<cursorPos>51</cursorPos>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<type>ROOT</type>
<class>PLOT</class>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="0e17daca5f3e1" order="0" parent="71ee45a3c0db9">
<item handle="031b4af5197ec" order="0" parent="44cb730c42048">
<name>New File</name>
<type>FILE</type>
<class>PLOT</class>
@@ -102,6 +107,25 @@
<paraCount>1</paraCount>
<cursorPos>69</cursorPos>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Characters</name>
<type>ROOT</type>
<class>CHARACTER</class>
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="1a6562590ef19" order="0" parent="71ee45a3c0db9">
<name>New File</name>
<type>FILE</type>
<class>CHARACTER</class>
<status>New</status>
<exported>True</exported>
<layout>NOTE</layout>
<charCount>34</charCount>
<wordCount>8</wordCount>
<paraCount>1</paraCount>
<cursorPos>51</cursorPos>
</item>
<item handle="811786ad1ae74" order="3" parent="None">
<name>World</name>
<type>ROOT</type>
@@ -109,7 +133,7 @@
<status>New</status>
<expanded>True</expanded>
</item>
<item handle="1a6562590ef19" order="0" parent="811786ad1ae74">
<item handle="41cfc0d1f2d12" order="0" parent="811786ad1ae74">
<name>New File</name>
<type>FILE</type>
<class>WORLD</class>
@@ -121,7 +145,7 @@
<paraCount>1</paraCount>
<cursorPos>68</cursorPos>
</item>
<item handle="41cfc0d1f2d12" order="4" parent="None">
<item handle="2fca346db6561" order="4" parent="None">
<name>Trash</name>
<type>TRASH</type>
<class>TRASH</class>
+32 -8
View File
@@ -1,11 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.10.0rc1" hexVersion="0x001000c1" fileVersion="1.1" timeStamp="2020-06-26 19:32:47">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:21:39">
<project>
<name>Project Name</name>
<title>Project Title</title>
<author>Jane Doe</author>
<author>John Doh</author>
<saveCount>2</saveCount>
<saveCount>1</saveCount>
<autoCount>1</autoCount>
<editTime>1</editTime>
</project>
@@ -41,7 +41,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<content count="8">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -50,13 +50,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="1" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="0" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="1" parent="31489056e0916">
<name>New Scene</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -69,16 +93,16 @@
<cursorPos>0</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
+32 -8
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.9.0rc1" hexVersion="0x000900c1" fileVersion="1.1" timeStamp="2020-06-18 22:17:32">
<novelWriterXML appVersion="0.11.1" hexVersion="0x001101f0" fileVersion="1.2" timeStamp="2020-08-10 21:24:22">
<project>
<name>New Project</name>
<title></title>
@@ -11,7 +11,7 @@
<doBackup>True</doBackup>
<spellCheck>False</spellCheck>
<autoOutline>True</autoOutline>
<lastEdited>31489056e0916</lastEdited>
<lastEdited>0e17daca5f3e1</lastEdited>
<lastViewed>None</lastViewed>
<lastWordCount>59</lastWordCount>
<novelWordCount>59</novelWordCount>
@@ -37,7 +37,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="6">
<content count="8">
<item handle="73475cb40a568" order="0" parent="None">
<name>Novel</name>
<type>ROOT</type>
@@ -46,13 +46,37 @@
<expanded>False</expanded>
</item>
<item handle="25fc0e7096fc6" order="0" parent="73475cb40a568">
<name>Title Page</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>TITLE</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="31489056e0916" order="1" parent="73475cb40a568">
<name>New Chapter</name>
<type>FOLDER</type>
<class>NOVEL</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="31489056e0916" order="0" parent="25fc0e7096fc6">
<item handle="98010bd9270f9" order="0" parent="31489056e0916">
<name>New Chapter</name>
<type>FILE</type>
<class>NOVEL</class>
<status>New</status>
<exported>True</exported>
<layout>CHAPTER</layout>
<charCount>0</charCount>
<wordCount>0</wordCount>
<paraCount>0</paraCount>
<cursorPos>0</cursorPos>
</item>
<item handle="0e17daca5f3e1" order="1" parent="31489056e0916">
<name>Just a Page</name>
<type>FILE</type>
<class>NOVEL</class>
@@ -65,16 +89,16 @@
<cursorPos>0</cursorPos>
</item>
<item handle="44cb730c42048" order="1" parent="None">
<name>Characters</name>
<name>Plot</name>
<type>ROOT</type>
<class>CHARACTER</class>
<class>PLOT</class>
<status>New</status>
<expanded>False</expanded>
</item>
<item handle="71ee45a3c0db9" order="2" parent="None">
<name>Plot</name>
<name>Characters</name>
<type>ROOT</type>
<class>PLOT</class>
<class>CHARACTER</class>
<status>New</status>
<expanded>False</expanded>
</item>
+22 -19
View File
@@ -55,8 +55,8 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
# Check that we loaded the data
assert len(nwGUI.theProject.projTree) == 6
assert len(nwGUI.theProject.projTree._treeOrder) == 6
assert len(nwGUI.theProject.projTree) == 8
assert len(nwGUI.theProject.projTree._treeOrder) == 8
assert len(nwGUI.theProject.projTree._treeRoots) == 4
assert nwGUI.theProject.projTree.trashRoot() is None
assert nwGUI.theProject.projPath == nwTempGUI
@@ -71,6 +71,8 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
assert nwGUI.treeView._getTreeItem("73475cb40a568") is not None
assert nwGUI.treeView._getTreeItem("25fc0e7096fc6") is not None
assert nwGUI.treeView._getTreeItem("31489056e0916") is not None
assert nwGUI.treeView._getTreeItem("98010bd9270f9") is not None
assert nwGUI.treeView._getTreeItem("0e17daca5f3e1") is not None
assert nwGUI.treeView._getTreeItem("44cb730c42048") is not None
assert nwGUI.treeView._getTreeItem("71ee45a3c0db9") is not None
assert nwGUI.treeView._getTreeItem("811786ad1ae74") is not None
@@ -81,7 +83,7 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# Add a Character File
nwGUI.setFocus(1)
nwGUI.treeView.clearSelection()
nwGUI.treeView._getTreeItem("44cb730c42048").setSelected(True)
nwGUI.treeView._getTreeItem("71ee45a3c0db9").setSelected(True)
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
assert nwGUI.openSelectedItem()
@@ -102,7 +104,7 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# Add a Plot File
nwGUI.setFocus(1)
nwGUI.treeView.clearSelection()
nwGUI.treeView._getTreeItem("71ee45a3c0db9").setSelected(True)
nwGUI.treeView._getTreeItem("44cb730c42048").setSelected(True)
nwGUI.treeView.newTreeItem(nwItemType.FILE, None)
assert nwGUI.openSelectedItem()
@@ -150,8 +152,8 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
nwGUI.setFocus(1)
nwGUI.treeView.clearSelection()
nwGUI.treeView._getTreeItem("73475cb40a568").setExpanded(True)
nwGUI.treeView._getTreeItem("25fc0e7096fc6").setExpanded(True)
nwGUI.treeView._getTreeItem("31489056e0916").setSelected(True)
nwGUI.treeView._getTreeItem("31489056e0916").setExpanded(True)
nwGUI.treeView._getTreeItem("0e17daca5f3e1").setSelected(True)
assert nwGUI.openSelectedItem()
# Type something into the document
@@ -233,8 +235,8 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# Open and view the edited document
nwGUI.setFocus(3)
assert nwGUI.openDocument("31489056e0916")
assert nwGUI.viewDocument("31489056e0916")
assert nwGUI.openDocument("0e17daca5f3e1")
assert nwGUI.viewDocument("0e17daca5f3e1")
qtbot.wait(stepDelay)
assert nwGUI.saveProject()
assert nwGUI.closeDocViewer()
@@ -243,23 +245,24 @@ def testMainWindows(qtbot, nwTempGUI, nwRef, nwTemp):
# 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.theProject.projTree["2858dcd1057d3"] is not None
assert nwGUI.treeView.deleteItem()
assert nwGUI.treeView.setSelectedHandle(newHandle)
assert nwGUI.treeView.deleteItem()
assert nwGUI.theProject.projTree["2fca346db6561"] is not None # Trash
assert nwGUI.saveProject()
# Check the files
refFile = path.join(nwTempGUI, "nwProject.nwx")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_nwProject.nwx"), [2, 6, 7, 8])
refFile = path.join(nwTempGUI, "content", "0e17daca5f3e1.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_0e17daca5f3e1.nwd"))
refFile = path.join(nwTempGUI, "content", "98010bd9270f9.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_98010bd9270f9.nwd"))
refFile = path.join(nwTempGUI, "content", "31489056e0916.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_31489056e0916.nwd"))
refFile = path.join(nwTempGUI, "content", "031b4af5197ec.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_031b4af5197ec.nwd"))
refFile = path.join(nwTempGUI, "content", "1a6562590ef19.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_1a6562590ef19.nwd"))
refFile = path.join(nwTempGUI, "content", "0e17daca5f3e1.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_0e17daca5f3e1.nwd"))
refFile = path.join(nwTempGUI, "content", "41cfc0d1f2d12.nwd")
assert cmpFiles(refFile, path.join(nwRef, "gui", "1_41cfc0d1f2d12.nwd"))
nwGUI.closeMain()
# qtbot.stopForInteraction()
@@ -364,9 +367,9 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
# Create new, save, open project
nwGUI.theProject.projTree.setSeed(42)
assert nwGUI.newProject({"projPath": nwTempGUI}, True)
assert nwGUI.openDocument("31489056e0916")
assert nwGUI.openDocument("0e17daca5f3e1")
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "0e17daca5f3e1")
qtbot.addWidget(itemEdit)
assert itemEdit.editName.text() == "New Scene"
@@ -383,7 +386,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
assert not itemEdit.editExport.isChecked()
itemEdit._doSave()
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "31489056e0916")
itemEdit = GuiItemEditor(nwGUI, nwGUI.theProject, "0e17daca5f3e1")
qtbot.addWidget(itemEdit)
assert itemEdit.editName.text() == "Just a Page"
assert itemEdit.editStatus.currentData() == "Note"
@@ -391,7 +394,7 @@ def testItemEditor(qtbot, nwTempGUI, nwRef, nwTemp):
itemEdit._doClose()
# Check that the header is updated
nwGUI.docEditor.updateDocInfo("31489056e0916")
nwGUI.docEditor.updateDocInfo("0e17daca5f3e1")
assert nwGUI.docEditor.docHeader.theTitle.text() == "Novel New Chapter Just a Page"
assert not nwGUI.docEditor.setCursorLine("where?")
assert nwGUI.docEditor.setCursorLine(2)