File indexing completed on 2024-05-12 04:19:58
0001 /* 0002 Gwenview: an image viewer 0003 Copyright 2008 Aurélien Gâteau <agateau@kde.org> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU General Public License 0007 as published by the Free Software Foundation; either version 2 0008 of the License, or (at your option) any later version. 0009 0010 This program is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 GNU General Public License for more details. 0014 0015 You should have received a copy of the GNU General Public License 0016 along with this program; if not, write to the Free Software 0017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0018 0019 */ 0020 #ifndef SEMANTICINFOBACKENDTEST_H 0021 #define SEMANTICINFOBACKENDTEST_H 0022 0023 // Qt 0024 #include <QHash> 0025 #include <QObject> 0026 #include <QUrl> 0027 0028 // KF 0029 0030 // Local 0031 #include <lib/semanticinfo/abstractsemanticinfobackend.h> 0032 0033 namespace Gwenview 0034 { 0035 /** 0036 * Helper class which gathers the metadata retrieved when 0037 * AbstractSemanticInfoBackEnd::retrieveSemanticInfo() is called. 0038 */ 0039 class SemanticInfoBackEndClient : public QObject 0040 { 0041 Q_OBJECT 0042 public: 0043 SemanticInfoBackEndClient(AbstractSemanticInfoBackEnd *); 0044 0045 SemanticInfo semanticInfoForUrl(const QUrl &url) const 0046 { 0047 return mSemanticInfoForUrl.value(url); 0048 } 0049 0050 private Q_SLOTS: 0051 void slotSemanticInfoRetrieved(const QUrl &, const SemanticInfo &); 0052 0053 private: 0054 QHash<QUrl, SemanticInfo> mSemanticInfoForUrl; 0055 AbstractSemanticInfoBackEnd *mBackEnd; 0056 }; 0057 0058 class SemanticInfoBackEndTest : public QObject 0059 { 0060 Q_OBJECT 0061 0062 private Q_SLOTS: 0063 void initTestCase(); 0064 void init(); 0065 void cleanup(); 0066 void testRating(); 0067 #if 0 0068 void testTagForLabel(); 0069 #endif 0070 0071 private: 0072 AbstractSemanticInfoBackEnd *mBackEnd; 0073 }; 0074 0075 } // namespace 0076 0077 #endif // SEMANTICINFOBACKENDTEST_H