1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2015-12-13 7 * Description : test cases for tags tree manipulation in database 8 * 9 * Copyright (C) 2015-2021 by Gilles Caulier, <caulier dot gilles at gmail dot com> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #ifndef DIGIKAM_DATABASE_TAGS_UTEST_H 25 #define DIGIKAM_DATABASE_TAGS_UTEST_H 26 27 // Qt includes 28 29 #include <QObject> 30 #include <QMap> 31 #include <QAbstractItemModel> 32 33 namespace Digikam 34 { 35 class PAlbum; 36 class TAlbum; 37 class AlbumModel; 38 } 39 40 class DatabaseTagsTest: public QObject 41 { 42 Q_OBJECT 43 44 public: 45 46 DatabaseTagsTest(QObject* const parent = nullptr); 47 ~DatabaseTagsTest() override; 48 49 private Q_SLOTS: 50 51 void initTestCase(); 52 void cleanupTestCase(); 53 54 void init(); 55 void cleanup(); 56 /* 57 void testPAlbumModel(); 58 void testDisablePAlbumCount(); 59 void testDAlbumModel(); 60 void testDAlbumCount(); 61 void testDAlbumContainsAlbums(); 62 void testDAlbumSorting(); 63 void testTAlbumModel(); 64 void testSAlbumModel(); 65 void testStartAlbumModel(); 66 67 void deletePAlbum(Digikam::PAlbum* album); 68 69 void setLastPAlbumCountMap(const QMap<int, int> &map); 70 71 // slots for ensuring signal order while scanning albums 72 void slotStartModelRowsInserted(const QModelIndex& parent, int start, int end); 73 void slotStartModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight); 74 */ 75 private: 76 77 // void ensureItemCounts(); 78 79 private: 80 81 QString dbPath; 82 QString tempSuffix; 83 84 Digikam::PAlbum* palbumRoot0; 85 Digikam::PAlbum* palbumRoot1; 86 Digikam::PAlbum* palbumRoot2; 87 Digikam::PAlbum* palbumChild0Root0; 88 Digikam::PAlbum* palbumChild1Root0; 89 Digikam::PAlbum* palbumChild2Root0; 90 Digikam::PAlbum* palbumChild0Root1; 91 92 Digikam::TAlbum* rootTag; 93 Digikam::TAlbum* talbumRoot0; 94 Digikam::TAlbum* talbumRoot1; 95 Digikam::TAlbum* talbumChild0Root0; 96 Digikam::TAlbum* talbumChild1Root0; 97 Digikam::TAlbum* talbumChild0Child1Root0; 98 Digikam::TAlbum* talbumChild0Root1; 99 100 QList<int> addedIds; 101 }; 102 103 #endif // DIGIKAM_DATABASE_TAGS_UTEST_H 104