Update tests

This commit is contained in:
Veronica Berglyd Olsen
2025-07-17 15:31:13 +02:00
parent 20709145c8
commit c816b24437
4 changed files with 17 additions and 6 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
%%~name: Scene %%~name: Scene
%%~path: 09f22ae8369f7/5aec885635c85 %%~path: f4ed1ae756a1f/5aec885635c85
%%~kind: TEMPLATE/DOCUMENT %%~kind: TEMPLATE/DOCUMENT
%%~hash: 05c9750b00020f8cf9a7bc7362bf19681022cc03 %%~hash: 537fb0132a80101060b40b42ad8875ebbcb40a5b
%%~date: 2024-02-02 10:58:47/2024-02-02 10:59:32 %%~date: 2024-02-02 10:58:47/2024-02-02 10:59:32
### Scene ### Scene
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="2.8a0" hexVersion="0x020800a0" fileVersion="1.5" fileRevision="6" timeStamp="2025-06-12 18:02:57"> <novelWriterXML appVersion="2.8a2" hexVersion="0x020800a2" fileVersion="1.5" fileRevision="6" timeStamp="2025-07-17 15:27:23">
<project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0"> <project id="d0f3fe10-c6e6-4310-8bfd-181eb4224eed" saveCount="1" autoCount="1" editTime="0">
<name>New Project</name> <name>New Project</name>
<author>Jane Doe</author> <author>Jane Doe</author>
@@ -22,13 +22,13 @@
<entry key="s000003" count="0" color="green" shape="STAR">Finished</entry> <entry key="s000003" count="0" color="green" shape="STAR">Finished</entry>
</status> </status>
<importance> <importance>
<entry key="i000004" count="5" color="purple" shape="SQUARE">New</entry> <entry key="i000004" count="6" color="purple" shape="SQUARE">New</entry>
<entry key="i000005" count="0" color="purple" shape="BLOCK_2">Minor</entry> <entry key="i000005" count="0" color="purple" shape="BLOCK_2">Minor</entry>
<entry key="i000006" count="0" color="purple" shape="BLOCK_3">Major</entry> <entry key="i000006" count="0" color="purple" shape="BLOCK_3">Major</entry>
<entry key="i000007" count="0" color="purple" shape="BLOCK_4">Main</entry> <entry key="i000007" count="0" color="purple" shape="BLOCK_4">Main</entry>
</importance> </importance>
</settings> </settings>
<content items="12" novelWords="10" notesWords="6" novelChars="45" notesChars="22"> <content items="13" novelWords="10" notesWords="9" novelChars="45" notesChars="33">
<item handle="0000000000008" parent="None" root="0000000000008" order="0" type="ROOT" class="NOVEL"> <item handle="0000000000008" parent="None" root="0000000000008" order="0" type="ROOT" class="NOVEL">
<meta expanded="no" /> <meta expanded="no" />
<name status="s000000" import="i000004">Novel</name> <name status="s000000" import="i000004">Novel</name>
@@ -73,6 +73,10 @@
<meta expanded="no" heading="H1" charCount="11" wordCount="3" paraCount="1" cursorPos="0" /> <meta expanded="no" heading="H1" charCount="11" wordCount="3" paraCount="1" cursorPos="0" />
<name status="s000000" import="i000004" active="yes">John</name> <name status="s000000" import="i000004" active="yes">John</name>
</item> </item>
<item handle="0000000000014" parent="000000000000a" root="000000000000a" order="2" type="FILE" class="CHARACTER" layout="NOTE">
<meta expanded="no" heading="H1" charCount="11" wordCount="3" paraCount="1" cursorPos="0" />
<name status="s000000" import="i000004" active="yes">Mike</name>
</item>
<item handle="000000000000b" parent="None" root="000000000000b" order="3" type="ROOT" class="WORLD"> <item handle="000000000000b" parent="None" root="000000000000b" order="3" type="ROOT" class="WORLD">
<meta expanded="no" /> <meta expanded="no" />
<name status="s000000" import="i000004">Locations</name> <name status="s000000" import="i000004">Locations</name>
+7
View File
@@ -100,6 +100,7 @@ def testCoreProject_NewFileFolder(monkeypatch, fncPath, tstPaths, mockGUI, mockR
bHandle = "0000000000011" bHandle = "0000000000011"
cHandle = "0000000000012" cHandle = "0000000000012"
dHandle = "0000000000013" dHandle = "0000000000013"
eHandle = "0000000000014"
xHandle = "1234567890abc" xHandle = "1234567890abc"
# Invalid call # Invalid call
@@ -111,11 +112,13 @@ def testCoreProject_NewFileFolder(monkeypatch, fncPath, tstPaths, mockGUI, mockR
assert project.newFile("Hello", aHandle) == bHandle assert project.newFile("Hello", aHandle) == bHandle
assert project.newFile("Jane", C.hCharRoot) == cHandle assert project.newFile("Jane", C.hCharRoot) == cHandle
assert project.newFile("John", C.hCharRoot) == dHandle assert project.newFile("John", C.hCharRoot) == dHandle
assert project.newFile("Mike", C.hCharRoot) == eHandle
assert aHandle in project.tree assert aHandle in project.tree
assert bHandle in project.tree assert bHandle in project.tree
assert cHandle in project.tree assert cHandle in project.tree
assert dHandle in project.tree assert dHandle in project.tree
assert eHandle in project.tree
# Write to file, failed # Write to file, failed
assert project.writeNewFile("blabla", 1, True) is False # Not a handle assert project.writeNewFile("blabla", 1, True) is False # Not a handle
@@ -151,6 +154,10 @@ def testCoreProject_NewFileFolder(monkeypatch, fncPath, tstPaths, mockGUI, mockR
assert dText == cText assert dText == cText
# Copy file content, and update title
assert project.copyFileContent(eHandle, cHandle, "Lars") is True
assert project.storage.getDocument(eHandle).readDocument() == "# Lars\n\nHi Jane\n\n"
# Save, close and check # Save, close and check
assert project.projChanged is True assert project.projChanged is True
assert project.saveProject() is True assert project.saveProject() is True
+1 -1
View File
@@ -1454,7 +1454,7 @@ def testGuiProjTree_Templates(qtbot, monkeypatch, nwGUI, projPath, mockRnd):
nwNewCharacter = project.tree[hNewCharacter] nwNewCharacter = project.tree[hNewCharacter]
assert nwNewCharacter is not None assert nwNewCharacter is not None
assert nwNewCharacter.itemName == "Note" assert nwNewCharacter.itemName == "Note"
assert project.storage.getDocument(hNewCharacter).readDocument() == "# Jane\n\n@tag: Jane\n\n" assert project.storage.getDocument(hNewCharacter).readDocument() == "# Note\n\n@tag: Jane\n\n"
# Clearing the menu and rebuilding it should work # Clearing the menu and rebuilding it should work
projBar.mTemplates.clearMenu() projBar.mTemplates.clearMenu()