diff --git a/tests/TestCryptoHash.cpp b/tests/TestCryptoHash.cpp index 35bd72e0f..0083c3c5f 100644 --- a/tests/TestCryptoHash.cpp +++ b/tests/TestCryptoHash.cpp @@ -48,4 +48,4 @@ void TestCryptoHash::test() QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4")); } -KEEPASSX_QTEST_CORE_MAIN(TestCryptoHash) +QTEST_GUILESS_MAIN(TestCryptoHash) diff --git a/tests/TestDeletedObjects.cpp b/tests/TestDeletedObjects.cpp index 5ce29cfa0..f12566549 100644 --- a/tests/TestDeletedObjects.cpp +++ b/tests/TestDeletedObjects.cpp @@ -159,4 +159,4 @@ void TestDeletedObjects::testDatabaseChange() delete db2; } -KEEPASSX_QTEST_CORE_MAIN(TestDeletedObjects) +QTEST_GUILESS_MAIN(TestDeletedObjects) diff --git a/tests/TestEntryModel.cpp b/tests/TestEntryModel.cpp index 32cd7a690..286750728 100644 --- a/tests/TestEntryModel.cpp +++ b/tests/TestEntryModel.cpp @@ -311,4 +311,4 @@ void TestEntryModel::testProxyModel() delete db; } -KEEPASSX_QTEST_CORE_MAIN(TestEntryModel) +QTEST_GUILESS_MAIN(TestEntryModel) diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index a91b5a7b9..169178494 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -399,4 +399,4 @@ void TestGroup::testSearch() delete groupRoot; } -KEEPASSX_QTEST_CORE_MAIN(TestGroup) +QTEST_GUILESS_MAIN(TestGroup) diff --git a/tests/TestGroupModel.cpp b/tests/TestGroupModel.cpp index abf727f84..12a806a7c 100644 --- a/tests/TestGroupModel.cpp +++ b/tests/TestGroupModel.cpp @@ -150,4 +150,4 @@ void TestGroupModel::test() delete model; } -KEEPASSX_QTEST_CORE_MAIN(TestGroupModel) +QTEST_GUILESS_MAIN(TestGroupModel) diff --git a/tests/TestHashedBlockStream.cpp b/tests/TestHashedBlockStream.cpp index 74eccd111..b0c97606b 100644 --- a/tests/TestHashedBlockStream.cpp +++ b/tests/TestHashedBlockStream.cpp @@ -70,4 +70,4 @@ void TestHashedBlockStream::testWriteRead() buffer.buffer().clear(); } -KEEPASSX_QTEST_CORE_MAIN(TestHashedBlockStream) +QTEST_GUILESS_MAIN(TestHashedBlockStream) diff --git a/tests/TestKeePass1Reader.cpp b/tests/TestKeePass1Reader.cpp index a7e1114fe..79764817f 100644 --- a/tests/TestKeePass1Reader.cpp +++ b/tests/TestKeePass1Reader.cpp @@ -293,4 +293,4 @@ void TestKeePass1Reader::reopenDatabase(Database* db, const QString& password, c delete newDb; } -KEEPASSX_QTEST_CORE_MAIN(TestKeePass1Reader) +QTEST_GUILESS_MAIN(TestKeePass1Reader) diff --git a/tests/TestKeePass2RandomStream.cpp b/tests/TestKeePass2RandomStream.cpp index f3523bcf6..e7fee8f47 100644 --- a/tests/TestKeePass2RandomStream.cpp +++ b/tests/TestKeePass2RandomStream.cpp @@ -78,4 +78,4 @@ void TestKeePass2RandomStream::test() QCOMPARE(randomStreamData, cipherData); } -KEEPASSX_QTEST_CORE_MAIN(TestKeePass2RandomStream) +QTEST_GUILESS_MAIN(TestKeePass2RandomStream) diff --git a/tests/TestKeePass2Reader.cpp b/tests/TestKeePass2Reader.cpp index e66aa70ba..153f2fb63 100644 --- a/tests/TestKeePass2Reader.cpp +++ b/tests/TestKeePass2Reader.cpp @@ -121,4 +121,4 @@ void TestKeePass2Reader::testFormat200() delete db; } -KEEPASSX_QTEST_CORE_MAIN(TestKeePass2Reader) +QTEST_GUILESS_MAIN(TestKeePass2Reader) diff --git a/tests/TestKeePass2Writer.cpp b/tests/TestKeePass2Writer.cpp index 320996751..cf9ed15c0 100644 --- a/tests/TestKeePass2Writer.cpp +++ b/tests/TestKeePass2Writer.cpp @@ -105,4 +105,4 @@ void TestKeePass2Writer::cleanupTestCase() delete m_dbTest; } -KEEPASSX_QTEST_CORE_MAIN(TestKeePass2Writer) +QTEST_GUILESS_MAIN(TestKeePass2Writer) diff --git a/tests/TestKeePass2XmlReader.cpp b/tests/TestKeePass2XmlReader.cpp index d7e531853..a83c426bf 100644 --- a/tests/TestKeePass2XmlReader.cpp +++ b/tests/TestKeePass2XmlReader.cpp @@ -356,4 +356,4 @@ void TestKeePass2XmlReader::cleanupTestCase() delete m_db; } -KEEPASSX_QTEST_CORE_MAIN(TestKeePass2XmlReader) +QTEST_GUILESS_MAIN(TestKeePass2XmlReader) diff --git a/tests/TestKeys.cpp b/tests/TestKeys.cpp index 51d09495e..107b67417 100644 --- a/tests/TestKeys.cpp +++ b/tests/TestKeys.cpp @@ -165,4 +165,4 @@ void TestKeys::testFileKeyError() errorMsg = ""; } -KEEPASSX_QTEST_CORE_MAIN(TestKeys) +QTEST_GUILESS_MAIN(TestKeys) diff --git a/tests/TestModified.cpp b/tests/TestModified.cpp index 6b96d09c0..a2c4d6801 100644 --- a/tests/TestModified.cpp +++ b/tests/TestModified.cpp @@ -467,4 +467,4 @@ void TestModified::testHistoryItem() delete db; } -KEEPASSX_QTEST_CORE_MAIN(TestModified) +QTEST_GUILESS_MAIN(TestModified) diff --git a/tests/TestQSaveFile.cpp b/tests/TestQSaveFile.cpp index 830ae09b7..537c25637 100644 --- a/tests/TestQSaveFile.cpp +++ b/tests/TestQSaveFile.cpp @@ -195,4 +195,4 @@ QString TestQSaveFile::tmpDir() return dirName; } -KEEPASSX_QTEST_CORE_MAIN(TestQSaveFile) +QTEST_GUILESS_MAIN(TestQSaveFile) diff --git a/tests/TestSymmetricCipher.cpp b/tests/TestSymmetricCipher.cpp index fb786efde..5772b9403 100644 --- a/tests/TestSymmetricCipher.cpp +++ b/tests/TestSymmetricCipher.cpp @@ -193,4 +193,4 @@ void TestSymmetricCipher::testPadding() QCOMPARE(decrypted, plainText); } -KEEPASSX_QTEST_CORE_MAIN(TestSymmetricCipher) +QTEST_GUILESS_MAIN(TestSymmetricCipher) diff --git a/tests/TestWildcardMatcher.cpp b/tests/TestWildcardMatcher.cpp index 0c3c0137b..b10a9f7cd 100644 --- a/tests/TestWildcardMatcher.cpp +++ b/tests/TestWildcardMatcher.cpp @@ -83,4 +83,4 @@ void TestWildcardMatcher::verifyNoMatch(QString pattern) QVERIFY(!matchResult); } -KEEPASSX_QTEST_CORE_MAIN(TestWildcardMatcher) +QTEST_GUILESS_MAIN(TestWildcardMatcher) diff --git a/tests/gui/TestGui.cpp b/tests/gui/TestGui.cpp index b8a28e9fa..5ff5f8b0f 100644 --- a/tests/gui/TestGui.cpp +++ b/tests/gui/TestGui.cpp @@ -380,4 +380,4 @@ void TestGui::dragAndDropGroup(const QModelIndex& sourceIndex, const QModelIndex QCOMPARE(group->parentGroup()->children().indexOf(group), expectedPos); } -KEEPASSX_QTEST_GUI_MAIN(TestGui) +QTEST_MAIN(TestGui) diff --git a/tests/gui/TestGuiPixmaps.cpp b/tests/gui/TestGuiPixmaps.cpp index e9e98a839..483fb3c8c 100644 --- a/tests/gui/TestGuiPixmaps.cpp +++ b/tests/gui/TestGuiPixmaps.cpp @@ -147,4 +147,4 @@ void TestGuiPixmaps::compareImages(const QPixmap& pixmap, const QImage& image) image.convertToFormat(QImage::Format_ARGB32_Premultiplied)); } -KEEPASSX_QTEST_GUI_MAIN(TestGuiPixmaps) +QTEST_MAIN(TestGuiPixmaps) diff --git a/tests/tests.h b/tests/tests.h index 90456dbdb..0714a3b6e 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -21,19 +21,18 @@ #include -#define KEEPASSX_QTEST_CORE_MAIN(TestObject) \ +// backport QTEST_GUILESS_MAIN, QTRY_VERIFY and QTRY_COMPARE from Qt 5 + +#ifndef QTEST_GUILESS_MAIN +#define QTEST_GUILESS_MAIN(TestObject) \ int main(int argc, char* argv[]) \ { \ QCoreApplication app(argc, argv); \ TestObject tc; \ return QTest::qExec(&tc, argc, argv); \ } +#endif // QTEST_GUILESS_MAIN -// just for the sake of a consistent naming scheme -#define KEEPASSX_QTEST_GUI_MAIN QTEST_MAIN - - -// backport QTRY_VERIFY and QTRY_COMPARE from Qt 5 #ifndef QTRY_VERIFY #define KEEPASSX_VERIFY_WITH_TIMEOUT(__expr, __timeout) \ @@ -52,6 +51,7 @@ do { \ #define QTRY_VERIFY(__expr) KEEPASSX_VERIFY_WITH_TIMEOUT(__expr, 5000) #endif // QTRY_VERIFY + #ifndef QTRY_COMPARE #define KEEPASSX_COMPARE_WITH_TIMEOUT(__expr, __expected, __timeout) \ do { \