diff --git a/tests/files/nwProject-1.5.nwx b/tests/files/nwProject-1.5.nwx index 7823c057..35eab583 100644 --- a/tests/files/nwProject-1.5.nwx +++ b/tests/files/nwProject-1.5.nwx @@ -1,5 +1,5 @@ - + Sample Project Jane Smith @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/reference/coreProject_NewFileFolder_nwProject.nwx b/tests/reference/coreProject_NewFileFolder_nwProject.nwx index 2422fc02..4aba7481 100644 --- a/tests/reference/coreProject_NewFileFolder_nwProject.nwx +++ b/tests/reference/coreProject_NewFileFolder_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/coreProject_NewRoot_nwProject.nwx b/tests/reference/coreProject_NewRoot_nwProject.nwx index 028da14c..4bfbb568 100644 --- a/tests/reference/coreProject_NewRoot_nwProject.nwx +++ b/tests/reference/coreProject_NewRoot_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/coreTools_DocDuplicator_nwProject.nwx b/tests/reference/coreTools_DocDuplicator_nwProject.nwx index bab9a82d..5f6685a6 100644 --- a/tests/reference/coreTools_DocDuplicator_nwProject.nwx +++ b/tests/reference/coreTools_DocDuplicator_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/coreTools_ProjectBuilderA_nwProject.nwx b/tests/reference/coreTools_ProjectBuilderA_nwProject.nwx index 60c0fce3..01d3a0ef 100644 --- a/tests/reference/coreTools_ProjectBuilderA_nwProject.nwx +++ b/tests/reference/coreTools_ProjectBuilderA_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Project A Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/coreTools_ProjectBuilderB_nwProject.nwx b/tests/reference/coreTools_ProjectBuilderB_nwProject.nwx index 86980406..ed43d5cd 100644 --- a/tests/reference/coreTools_ProjectBuilderB_nwProject.nwx +++ b/tests/reference/coreTools_ProjectBuilderB_nwProject.nwx @@ -1,5 +1,5 @@ - + Test Project B Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/guiEditor_Main_Final_nwProject.nwx b/tests/reference/guiEditor_Main_Final_nwProject.nwx index c3ee941f..2c6603eb 100644 --- a/tests/reference/guiEditor_Main_Final_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Final_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/guiEditor_Main_Initial_nwProject.nwx b/tests/reference/guiEditor_Main_Initial_nwProject.nwx index aa9c3a74..f5119a55 100644 --- a/tests/reference/guiEditor_Main_Initial_nwProject.nwx +++ b/tests/reference/guiEditor_Main_Initial_nwProject.nwx @@ -1,5 +1,5 @@ - + New Project Jane Doe @@ -16,16 +16,16 @@ - New - Note - Draft - Finished + New + Note + Draft + Finished - New - Minor - Major - Main + New + Minor + Major + Main diff --git a/tests/reference/projectXML_ReadLegacy10.nwx b/tests/reference/projectXML_ReadLegacy10.nwx index a8f9e945..70885cfd 100644 --- a/tests/reference/projectXML_ReadLegacy10.nwx +++ b/tests/reference/projectXML_ReadLegacy10.nwx @@ -1,5 +1,5 @@ - + Sample Project Jay Doh @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/reference/projectXML_ReadLegacy11.nwx b/tests/reference/projectXML_ReadLegacy11.nwx index c216f88a..1d93bd02 100644 --- a/tests/reference/projectXML_ReadLegacy11.nwx +++ b/tests/reference/projectXML_ReadLegacy11.nwx @@ -1,5 +1,5 @@ - + Sample Project Jay Doh @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/reference/projectXML_ReadLegacy12.nwx b/tests/reference/projectXML_ReadLegacy12.nwx index b3cad791..d344f378 100644 --- a/tests/reference/projectXML_ReadLegacy12.nwx +++ b/tests/reference/projectXML_ReadLegacy12.nwx @@ -1,5 +1,5 @@ - + Sample Project Jay Doh @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/reference/projectXML_ReadLegacy13.nwx b/tests/reference/projectXML_ReadLegacy13.nwx index 4bd25a9a..05a4dfa5 100644 --- a/tests/reference/projectXML_ReadLegacy13.nwx +++ b/tests/reference/projectXML_ReadLegacy13.nwx @@ -1,5 +1,5 @@ - + Sample Project Jay Doh @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/reference/projectXML_ReadLegacy14.nwx b/tests/reference/projectXML_ReadLegacy14.nwx index 1ca92061..2a7e24d0 100644 --- a/tests/reference/projectXML_ReadLegacy14.nwx +++ b/tests/reference/projectXML_ReadLegacy14.nwx @@ -1,5 +1,5 @@ - + Sample Project Jay Doh @@ -20,19 +20,19 @@ D - New - Notes - Started - 1st Draft - 2nd Draft - 3rd Draft - Finished + New + Notes + Started + 1st Draft + 2nd Draft + 3rd Draft + Finished - None - Minor - Major - Main + None + Minor + Major + Main diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 151d89da..784b86ac 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -553,8 +553,8 @@ def testCoreItem_ClassDefaults(mockGUI): def testCoreItem_PackUnpack(mockGUI, caplog, mockRnd): """Test packing and unpacking entries for the NWItem class.""" project = NWProject() - project.data.itemStatus.write(None, "New", (100, 100, 100)) - project.data.itemImport.write(None, "New", (100, 100, 100)) + project.data.itemStatus.write(None, "New", (100, 100, 100), "SQUARE") + project.data.itemImport.write(None, "New", (100, 100, 100), "SQUARE") # Invalid item = NWItem(project, "0000000000000") diff --git a/tests/test_core/test_core_projectxml.py b/tests/test_core/test_core_projectxml.py index 534aaed2..3971e136 100644 --- a/tests/test_core/test_core_projectxml.py +++ b/tests/test_core/test_core_projectxml.py @@ -131,7 +131,7 @@ def testCoreProjectXML_ReadCurrent(monkeypatch, tstPaths, fncPath): assert xmlReader.state == XMLReadState.PARSED_OK assert xmlReader.xmlRoot == "novelWriterXML" assert xmlReader.xmlVersion == 0x0105 - assert xmlReader.xmlRevision == 3 + assert xmlReader.xmlRevision == 4 assert xmlReader.appVersion == "2.0-rc1" assert xmlReader.hexVersion == 0x020000c1 diff --git a/tests/test_core/test_core_status.py b/tests/test_core/test_core_status.py index 9e30d9c4..11a8ab7b 100644 --- a/tests/test_core/test_core_status.py +++ b/tests/test_core/test_core_status.py @@ -27,6 +27,7 @@ from tools import C from PyQt5.QtGui import QIcon from novelwriter.core.status import NWStatus +from novelwriter.enum import nwStatusShape statusKeys = [C.sNew, C.sNote, C.sDraft, C.sFinished] importKeys = [C.iNew, C.iMinor, C.iMajor, C.iMain] @@ -34,13 +35,12 @@ importKeys = [C.iNew, C.iMinor, C.iMajor, C.iMain] @pytest.mark.core def testCoreStatus_Internal(mockRnd): - """Test all the internal functions of the NWStatus class. - """ + """Test all the internal functions of the NWStatus class.""" nStatus = NWStatus(NWStatus.STATUS) nImport = NWStatus(NWStatus.IMPORT) with pytest.raises(Exception): - NWStatus(999) + NWStatus(999) # type: ignore # Generate Key # ============ @@ -49,14 +49,14 @@ def testCoreStatus_Internal(mockRnd): assert nStatus._newKey() == statusKeys[1] # Key collision, should move to key 3 - nStatus.write(statusKeys[2], "Crash", (0, 0, 0)) + nStatus.write(statusKeys[2], "Crash", (0, 0, 0), nwStatusShape.SQUARE) assert nStatus._newKey() == statusKeys[3] assert nImport._newKey() == importKeys[0] assert nImport._newKey() == importKeys[1] # Key collision, should move to key 3 - nImport.write(importKeys[2], "Crash", (0, 0, 0)) + nImport.write(importKeys[2], "Crash", (0, 0, 0), nwStatusShape.SQUARE) assert nImport._newKey() == importKeys[3] # Check Key @@ -87,14 +87,13 @@ def testCoreStatus_Internal(mockRnd): @pytest.mark.core def testCoreStatus_Iterator(mockRnd): - """Test the iterator functions of the NWStatus class. - """ + """Test the iterator functions of the NWStatus class.""" nStatus = NWStatus(NWStatus.STATUS) - nStatus.write(None, "New", (100, 100, 100)) - nStatus.write(None, "Note", (200, 50, 0)) - nStatus.write(None, "Draft", (200, 150, 0)) - nStatus.write(None, "Finished", (50, 200, 0)) + nStatus.write(None, "New", (100, 100, 100), nwStatusShape.SQUARE) + nStatus.write(None, "Note", (200, 50, 0), nwStatusShape.SQUARE) + nStatus.write(None, "Draft", (200, 150, 0), nwStatusShape.SQUARE) + nStatus.write(None, "Finished", (50, 200, 0), nwStatusShape.SQUARE) # Direct access entry = nStatus[statusKeys[0]] @@ -131,30 +130,29 @@ def testCoreStatus_Iterator(mockRnd): @pytest.mark.core def testCoreStatus_Entries(mockRnd): - """Test all the simple setters for the NWStatus class. - """ + """Test all the simple setters for the NWStatus class.""" nStatus = NWStatus(NWStatus.STATUS) # Write # ===== # Have a key - nStatus.write(statusKeys[0], "Entry 1", (200, 100, 50)) + nStatus.write(statusKeys[0], "Entry 1", (200, 100, 50), nwStatusShape.SQUARE) assert nStatus[statusKeys[0]]["name"] == "Entry 1" assert nStatus[statusKeys[0]]["cols"] == (200, 100, 50) # Don't have a key - nStatus.write(None, "Entry 2", (210, 110, 60)) + nStatus.write(None, "Entry 2", (210, 110, 60), nwStatusShape.SQUARE) assert nStatus[statusKeys[1]]["name"] == "Entry 2" assert nStatus[statusKeys[1]]["cols"] == (210, 110, 60) # Wrong colour spec - nStatus.write(None, "Entry 3", "what?") + nStatus.write(None, "Entry 3", "what?", nwStatusShape.SQUARE) # type: ignore assert nStatus[statusKeys[2]]["name"] == "Entry 3" assert nStatus[statusKeys[2]]["cols"] == (100, 100, 100) # Wrong colour count - nStatus.write(None, "Entry 4", (10, 20)) + nStatus.write(None, "Entry 4", (10, 20), nwStatusShape.SQUARE) assert nStatus[statusKeys[3]]["name"] == "Entry 4" assert nStatus[statusKeys[3]]["cols"] == (100, 100, 100) @@ -283,7 +281,7 @@ def testCoreStatus_Entries(mockRnd): # Delete default entry, Entry 2 is new default firstName = nStatus.name(nStatus._default) assert firstName == "Entry 1" - assert nStatus.remove(nStatus._default) is True + assert nStatus.remove(nStatus._default) is True # type: ignore assert nStatus.name(firstName) == "Entry 2" # Remove remaining entries @@ -298,13 +296,12 @@ def testCoreStatus_Entries(mockRnd): @pytest.mark.core def testCoreStatus_PackUnpack(mockRnd): - """Test all the pack/unpack of the NWStatus class. - """ + """Test all the pack/unpack of the NWStatus class.""" nStatus = NWStatus(NWStatus.STATUS) - nStatus.write(None, "New", (100, 100, 100)) - nStatus.write(None, "Note", (200, 50, 0)) - nStatus.write(None, "Draft", (200, 150, 0)) - nStatus.write(None, "Finished", (50, 200, 0)) + nStatus.write(None, "New", (100, 100, 100), nwStatusShape.SQUARE) + nStatus.write(None, "Note", (200, 50, 0), nwStatusShape.SQUARE) + nStatus.write(None, "Draft", (200, 150, 0), nwStatusShape.SQUARE) + nStatus.write(None, "Finished", (50, 200, 0), nwStatusShape.SQUARE) countTo = [3, 5, 7, 9] for i, n in enumerate(countTo): @@ -318,52 +315,33 @@ def testCoreStatus_PackUnpack(mockRnd): "count": "3", "red": "100", "green": "100", - "blue": "100" + "blue": "100", + "shape": "SQUARE", }), ("Note", { "key": statusKeys[1], "count": "5", "red": "200", "green": "50", - "blue": "0" + "blue": "0", + "shape": "SQUARE", }), ("Draft", { "key": statusKeys[2], "count": "7", "red": "200", "green": "150", - "blue": "0" + "blue": "0", + "shape": "SQUARE", }), ("Finished", { "key": statusKeys[3], "count": "9", "red": "50", "green": "200", - "blue": "0" + "blue": "0", + "shape": "SQUARE", }), ] - # Unpack - nStatus = NWStatus(NWStatus.STATUS) - nStatus.unpack({ - statusKeys[0]: {"label": "New0", "colour": (100, 100, 100), "count": countTo[0]}, - statusKeys[1]: {"label": "New1", "colour": (150, 150, 150), "count": countTo[1]}, - statusKeys[2]: {"label": "New2", "colour": (200, 200, 200), "count": countTo[2]}, - statusKeys[3]: {"label": "New3", "colour": (250, 250, 250), "count": countTo[3]}, - }) - assert len(nStatus._store) == 4 - assert list(nStatus._store.keys()) == statusKeys - assert nStatus._store[statusKeys[0]]["name"] == "New0" - assert nStatus._store[statusKeys[1]]["name"] == "New1" - assert nStatus._store[statusKeys[2]]["name"] == "New2" - assert nStatus._store[statusKeys[3]]["name"] == "New3" - assert nStatus._store[statusKeys[0]]["cols"] == (100, 100, 100) - assert nStatus._store[statusKeys[1]]["cols"] == (150, 150, 150) - assert nStatus._store[statusKeys[2]]["cols"] == (200, 200, 200) - assert nStatus._store[statusKeys[3]]["cols"] == (250, 250, 250) - assert nStatus._store[statusKeys[0]]["count"] == countTo[0] - assert nStatus._store[statusKeys[1]]["count"] == countTo[1] - assert nStatus._store[statusKeys[2]]["count"] == countTo[2] - assert nStatus._store[statusKeys[3]]["count"] == countTo[3] - # END Test testCoreStatus_PackUnpack