diff --git a/tests/test_core/test_core_itemmodel.py b/tests/test_core/test_core_itemmodel.py index c67f9197..d6efd718 100644 --- a/tests/test_core/test_core_itemmodel.py +++ b/tests/test_core/test_core_itemmodel.py @@ -23,11 +23,12 @@ from __future__ import annotations import pytest from PyQt6.QtCore import QMimeData, QModelIndex, Qt +from PyQt6.QtTest import QAbstractItemModelTester from novelwriter.common import decodeMimeHandles from novelwriter.constants import nwConst from novelwriter.core.item import NWItem -from novelwriter.core.itemmodel import INV_ROOT, NODE_FLAGS, ProjectNode +from novelwriter.core.itemmodel import INV_ROOT, NODE_FLAGS, ProjectModel, ProjectNode from novelwriter.core.project import NWProject from novelwriter.enum import nwItemLayout, nwItemType @@ -253,6 +254,14 @@ def testCoreItemModel_ProjectNode_Data(mockGUI, mockRnd, fncPath): assert scene.flags() == NODE_FLAGS | Qt.ItemFlag.ItemIsDragEnabled +@pytest.mark.core +def testCoreItemModel_ProjectModel_ModelTest(mockGUI): + """Run the Qt model tester on the model.""" + project = NWProject() + model = ProjectModel(project.tree) + QAbstractItemModelTester(model) + + @pytest.mark.core def testCoreItemModel_ProjectModel_Interface(mockGUI, mockRnd, fncPath): """Test the model interface for the project model.""" diff --git a/tests/test_core/test_core_novelmodel.py b/tests/test_core/test_core_novelmodel.py index b042f5e6..22955c70 100644 --- a/tests/test_core/test_core_novelmodel.py +++ b/tests/test_core/test_core_novelmodel.py @@ -23,6 +23,7 @@ from __future__ import annotations import pytest from PyQt6.QtCore import QModelIndex, Qt +from PyQt6.QtTest import QAbstractItemModelTester from novelwriter.core.indexdata import IndexHeading from novelwriter.core.novelmodel import NovelModel @@ -32,6 +33,13 @@ from novelwriter.enum import nwNovelExtra from tests.tools import C, buildTestProject +@pytest.mark.core +def testCoreNovelModel_ModelTest(nwGUI): + """Run the Qt model tester on the model.""" + model = NovelModel() + QAbstractItemModelTester(model) + + @pytest.mark.core def testCoreNovelModel_Interface(nwGUI, fncPath, mockRnd): """Test the novel model interface."""