Merge branch 'main' into dev
This commit is contained in:
@@ -410,6 +410,7 @@ class NWProject:
|
|||||||
def closeProject(self, idleTime: float = 0.0) -> None:
|
def closeProject(self, idleTime: float = 0.0) -> None:
|
||||||
"""Close the project."""
|
"""Close the project."""
|
||||||
logger.info("Closing project")
|
logger.info("Closing project")
|
||||||
|
self._index.clearIndex() # Triggers clear signal, see #1718
|
||||||
self._options.saveSettings()
|
self._options.saveSettings()
|
||||||
self._tree.writeToCFile()
|
self._tree.writeToCFile()
|
||||||
self._session.appendSession(idleTime)
|
self._session.appendSession(idleTime)
|
||||||
|
|||||||
@@ -25,18 +25,19 @@ import pytest
|
|||||||
|
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
|
||||||
from mocked import causeException
|
|
||||||
from novelwriter.core.item import NWItem
|
|
||||||
from tools import C, buildTestProject, cmpFiles, writeFile
|
from tools import C, buildTestProject, cmpFiles, writeFile
|
||||||
|
from mocked import causeException
|
||||||
|
|
||||||
|
from novelwriter import SHARED
|
||||||
from novelwriter.enum import nwComment, nwItemClass, nwItemLayout
|
from novelwriter.enum import nwComment, nwItemClass, nwItemLayout
|
||||||
from novelwriter.constants import nwFiles
|
from novelwriter.constants import nwFiles
|
||||||
|
from novelwriter.core.item import NWItem
|
||||||
from novelwriter.core.index import IndexItem, NWIndex, TagsIndex, processComment
|
from novelwriter.core.index import IndexItem, NWIndex, TagsIndex, processComment
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.core
|
@pytest.mark.core
|
||||||
def testCoreIndex_LoadSave(monkeypatch, prjLipsum, mockGUI, tstPaths):
|
def testCoreIndex_LoadSave(qtbot, monkeypatch, prjLipsum, mockGUI, tstPaths):
|
||||||
"""Test core functionality of scanning, saving, loading and checking
|
"""Test core functionality of scanning, saving, loading and checking
|
||||||
the index cache file.
|
the index cache file.
|
||||||
"""
|
"""
|
||||||
@@ -148,8 +149,10 @@ def testCoreIndex_LoadSave(monkeypatch, prjLipsum, mockGUI, tstPaths):
|
|||||||
assert "fb609cd8319dc" in index._itemIndex
|
assert "fb609cd8319dc" in index._itemIndex
|
||||||
assert "7a992350f3eb6" in index._itemIndex
|
assert "7a992350f3eb6" in index._itemIndex
|
||||||
|
|
||||||
# Finalise
|
# Close Project
|
||||||
project.closeProject()
|
with qtbot.waitSignal(SHARED.indexCleared, timeout=1000):
|
||||||
|
# Regression test for issue #1718
|
||||||
|
project.closeProject()
|
||||||
|
|
||||||
# END Test testCoreIndex_LoadSave
|
# END Test testCoreIndex_LoadSave
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user