File indexing completed on 2024-04-28 05:52:33
0001 /* 0002 This file is part of the Okteta Core library, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2008 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef VERSIONABLEIFTEST_HPP 0010 #define VERSIONABLEIFTEST_HPP 0011 0012 // Qt 0013 #include <QObject> 0014 0015 class QSignalSpy; 0016 0017 namespace Okteta { 0018 0019 class Versionable; 0020 0021 class VersionableIfTest : public QObject 0022 { 0023 Q_OBJECT 0024 0025 protected: 0026 VersionableIfTest(); 0027 0028 protected: // our API 0029 virtual QObject* createVersionable() = 0; 0030 virtual void deleteVersionable(QObject* versionable) = 0; 0031 0032 private: 0033 void checkRevertedToVersionIndex(int versionIndex); 0034 void checkHeadVersionDescriptionChanged(const QString& versionDescription); 0035 void checkHeadVersionChanged(int newHeadVersionIndex); 0036 void clearSignalSpys(); 0037 0038 private Q_SLOTS: // test functions 0039 void init(); 0040 void cleanup(); 0041 0042 void testBegin(); 0043 0044 private: // used in all tests 0045 /** pointer to the class to test */ 0046 QObject* mObject = nullptr; 0047 Versionable* mVersionableControl = nullptr; 0048 0049 QSignalSpy* mRevertedToVersionIndexSpy = nullptr; 0050 QSignalSpy* mHeadVersionDescriptionChangedSpy = nullptr; 0051 QSignalSpy* mHeadVersionChangedSpy = nullptr; 0052 }; 0053 0054 inline VersionableIfTest::VersionableIfTest() = default; 0055 0056 } 0057 0058 #endif