File indexing completed on 2025-01-19 03:57:45

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2010-01-16
0007  * Description : test for the model holding markers
0008  *
0009  * SPDX-FileCopyrightText: 2010-2011 by Michael G. Hansen <mike at mghansen dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_ITEM_MARKER_TILER_UTEST_H
0016 #define DIGIKAM_ITEM_MARKER_TILER_UTEST_H
0017 
0018 // Qt includes
0019 
0020 #include <QTest>
0021 
0022 // Local includes
0023 
0024 #include "itemmarkertiler.h"
0025 #include "geomodelhelper.h"
0026 
0027 using namespace Digikam;
0028 
0029 class MarkerModelHelper : public GeoModelHelper
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034 
0035     explicit MarkerModelHelper(QAbstractItemModel* const itemModel,
0036                                QItemSelectionModel* const itemSelectionModel);
0037     ~MarkerModelHelper()                                          override;
0038 
0039     QAbstractItemModel*  model()                            const override;
0040     QItemSelectionModel* selectionModel()                   const override;
0041     bool itemCoordinates(const QModelIndex& index,
0042                          GeoCoordinates* const coordinates) const override;
0043 
0044 private Q_SLOTS:
0045 
0046     void slotDataChanged(const QModelIndex& topLeft,
0047                          const QModelIndex& bottomRight);
0048 
0049 private:
0050 
0051     QAbstractItemModel* const  m_itemModel;
0052     QItemSelectionModel* const m_itemSelectionModel;
0053 };
0054 
0055 // --------------------------------------------------------------------------------
0056 
0057 class TestItemMarkerTiler : public QObject
0058 {
0059     Q_OBJECT
0060 
0061 public:
0062 
0063     explicit TestItemMarkerTiler(QObject* const parent = nullptr)
0064         : QObject(parent)
0065     {
0066     }
0067 
0068 private Q_SLOTS:
0069 
0070     void testNoOp();
0071     void testIndices();
0072     void testAddMarkers1();
0073     void testRemoveMarkers1();
0074     void testRemoveMarkers2();
0075     void testMoveMarkers1();
0076     void testMoveMarkers2();
0077     void testIteratorWholeWorldNoBackingModel();
0078     void testIteratorWholeWorld();
0079     void testIteratorPartial1();
0080     void testIteratorPartial2();
0081     void testPreExistingMarkers();
0082     void testSelectionState1();
0083     void benchmarkIteratorWholeWorld();
0084 };
0085 
0086 #endif // DIGIKAM_ITEM_MARKER_TILER_UTEST_H