Move QTEST_GUILESS_MAIN statements before test cases.

This commit is contained in:
Florian Geyer 2014-05-16 12:32:52 +02:00
parent ea3375490c
commit 77af79498c
21 changed files with 40 additions and 41 deletions

View File

@ -31,6 +31,8 @@
#include "autotype/test/AutoTypeTestInterface.h"
#include "gui/MessageBox.h"
QTEST_GUILESS_MAIN(TestAutoType)
void TestAutoType::initTestCase()
{
Crypto::init();
@ -154,5 +156,3 @@ void TestAutoType::testGlobalAutoTypeTitleMatchDisabled()
QCOMPARE(m_test->actionChars(), QString());
}
QTEST_GUILESS_MAIN(TestAutoType)

View File

@ -23,6 +23,8 @@
#include "crypto/Crypto.h"
#include "crypto/CryptoHash.h"
QTEST_GUILESS_MAIN(TestCryptoHash)
void TestCryptoHash::initTestCase()
{
Crypto::init();
@ -47,5 +49,3 @@ void TestCryptoHash::test()
QCOMPARE(cryptoHash3.result(),
QByteArray::fromHex("0b56e5f65263e747af4a833bd7dd7ad26a64d7a4de7c68e52364893dca0766b4"));
}
QTEST_GUILESS_MAIN(TestCryptoHash)

View File

@ -26,6 +26,8 @@
#include "format/KeePass2XmlReader.h"
#include "config-keepassx-tests.h"
QTEST_GUILESS_MAIN(TestDeletedObjects)
void TestDeletedObjects::initTestCase()
{
Crypto::init();
@ -158,5 +160,3 @@ void TestDeletedObjects::testDatabaseChange()
delete db;
delete db2;
}
QTEST_GUILESS_MAIN(TestDeletedObjects)

View File

@ -23,6 +23,8 @@
#include "core/Entry.h"
#include "crypto/Crypto.h"
QTEST_GUILESS_MAIN(TestEntry)
void TestEntry::initTestCase()
{
Crypto::init();
@ -121,5 +123,3 @@ void TestEntry::testClone()
QCOMPARE(entryCloneHistory->historyItems().first()->title(), QString("Original Title"));
QCOMPARE(entryCloneHistory->timeInfo().creationTime(), entryOrg->timeInfo().creationTime());
}
QTEST_GUILESS_MAIN(TestEntry)

View File

@ -33,6 +33,8 @@
#include "gui/entry/EntryAttachmentsModel.h"
#include "gui/entry/EntryAttributesModel.h"
QTEST_GUILESS_MAIN(TestEntryModel)
void TestEntryModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
@ -341,5 +343,3 @@ void TestEntryModel::testDatabaseDelete()
delete modelTest;
delete model;
}
QTEST_GUILESS_MAIN(TestEntryModel)

View File

@ -21,7 +21,6 @@
#include "tests.h"
QTEST_GUILESS_MAIN(TestEntrySearcher)
void TestEntrySearcher::initTestCase()

View File

@ -27,6 +27,8 @@
#include "core/Metadata.h"
#include "crypto/Crypto.h"
QTEST_GUILESS_MAIN(TestGroup)
void TestGroup::initTestCase()
{
qRegisterMetaType<Entry*>("Entry*");
@ -440,5 +442,3 @@ void TestGroup::testCopyCustomIcons()
QCOMPARE(metaTarget->customIcon(group1Icon).pixel(0, 0), qRgb(1, 2, 3));
QCOMPARE(metaTarget->customIcon(group2Icon).pixel(0, 0), qRgb(4, 5, 6));
}
QTEST_GUILESS_MAIN(TestGroup)

View File

@ -27,6 +27,8 @@
#include "crypto/Crypto.h"
#include "gui/group/GroupModel.h"
QTEST_GUILESS_MAIN(TestGroupModel)
void TestGroupModel::initTestCase()
{
qRegisterMetaType<QModelIndex>("QModelIndex");
@ -149,5 +151,3 @@ void TestGroupModel::test()
delete modelTest;
delete model;
}
QTEST_GUILESS_MAIN(TestGroupModel)

View File

@ -24,6 +24,8 @@
#include "crypto/Crypto.h"
#include "streams/HashedBlockStream.h"
QTEST_GUILESS_MAIN(TestHashedBlockStream)
void TestHashedBlockStream::initTestCase()
{
Crypto::init();
@ -69,5 +71,3 @@ void TestHashedBlockStream::testWriteRead()
buffer.reset();
buffer.buffer().clear();
}
QTEST_GUILESS_MAIN(TestHashedBlockStream)

View File

@ -33,6 +33,8 @@
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
QTEST_GUILESS_MAIN(TestKeePass1Reader)
void TestKeePass1Reader::initTestCase()
{
Crypto::init();
@ -292,5 +294,3 @@ void TestKeePass1Reader::reopenDatabase(Database* db, const QString& password, c
QVERIFY(!reader.hasError());
delete newDb;
}
QTEST_GUILESS_MAIN(TestKeePass1Reader)

View File

@ -26,6 +26,8 @@
#include "format/KeePass2.h"
#include "format/KeePass2RandomStream.h"
QTEST_GUILESS_MAIN(TestKeePass2RandomStream)
void TestKeePass2RandomStream::initTestCase()
{
Crypto::init();
@ -77,5 +79,3 @@ void TestKeePass2RandomStream::test()
QCOMPARE(cipherData, cipherDataEncrypt);
QCOMPARE(randomStreamData, cipherData);
}
QTEST_GUILESS_MAIN(TestKeePass2RandomStream)

View File

@ -28,6 +28,8 @@
#include "format/KeePass2Reader.h"
#include "keys/PasswordKey.h"
QTEST_GUILESS_MAIN(TestKeePass2Reader)
void TestKeePass2Reader::initTestCase()
{
Crypto::init();
@ -154,5 +156,3 @@ void TestKeePass2Reader::testFormat300()
delete db;
}
QTEST_GUILESS_MAIN(TestKeePass2Reader)

View File

@ -29,6 +29,8 @@
#include "format/KeePass2Writer.h"
#include "keys/PasswordKey.h"
QTEST_GUILESS_MAIN(TestKeePass2Writer)
void TestKeePass2Writer::initTestCase()
{
Crypto::init();
@ -104,5 +106,3 @@ void TestKeePass2Writer::cleanupTestCase()
delete m_dbOrg;
delete m_dbTest;
}
QTEST_GUILESS_MAIN(TestKeePass2Writer)

View File

@ -28,6 +28,8 @@
#include "format/KeePass2XmlReader.h"
#include "config-keepassx-tests.h"
QTEST_GUILESS_MAIN(TestKeePass2XmlReader)
namespace QTest {
template<>
char* toString(const Uuid& uuid)
@ -378,5 +380,3 @@ void TestKeePass2XmlReader::cleanupTestCase()
{
delete m_db;
}
QTEST_GUILESS_MAIN(TestKeePass2XmlReader)

View File

@ -31,6 +31,8 @@
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
QTEST_GUILESS_MAIN(TestKeys)
void TestKeys::initTestCase()
{
Crypto::init();
@ -184,5 +186,3 @@ void TestKeys::benchmarkTransformKey()
compositeKey.transform(seed, 1e6);
}
}
QTEST_GUILESS_MAIN(TestKeys)

View File

@ -27,6 +27,8 @@
#include "core/Tools.h"
#include "crypto/Crypto.h"
QTEST_GUILESS_MAIN(TestModified)
void TestModified::initTestCase()
{
Crypto::init();
@ -466,5 +468,3 @@ void TestModified::testHistoryItem()
delete db;
}
QTEST_GUILESS_MAIN(TestModified)

View File

@ -46,6 +46,8 @@
#include "tests.h"
#include "core/qcommandlineparser.h"
QTEST_GUILESS_MAIN(TestQCommandLineParser)
Q_DECLARE_METATYPE(char**)
static char *empty_argv[] = { 0 };
@ -412,5 +414,3 @@ void TestQCommandLineParser::testSingleDashWordOptionModes()
QCOMPARE(parser.value(parser.optionNames().at(i)), expectedOptionValues.at(i));
QCOMPARE(parser.unknownOptionNames(), QStringList());
}
QTEST_GUILESS_MAIN(TestQCommandLineParser)

View File

@ -29,6 +29,8 @@
#include "tests.h"
#include "core/qsavefile.h"
QTEST_GUILESS_MAIN(TestQSaveFile)
class DirCleanup
{
public:
@ -197,5 +199,3 @@ QString TestQSaveFile::tmpDir()
return dirName;
}
QTEST_GUILESS_MAIN(TestQSaveFile)

View File

@ -22,6 +22,8 @@
#include <QTest>
QTEST_GUILESS_MAIN(TestRandom)
void TestRandom::initTestCase()
{
m_backend = new RandomBackendTest();
@ -93,5 +95,3 @@ void RandomBackendTest::setNextBytes(const QByteArray& nextBytes)
m_nextBytes = nextBytes;
m_bytesIndex = 0;
}
QTEST_GUILESS_MAIN(TestRandom)

View File

@ -25,6 +25,8 @@
#include "crypto/SymmetricCipher.h"
#include "streams/SymmetricCipherStream.h"
QTEST_GUILESS_MAIN(TestSymmetricCipher)
void TestSymmetricCipher::initTestCase()
{
Crypto::init();
@ -192,5 +194,3 @@ void TestSymmetricCipher::testPadding()
QByteArray decrypted = streamDec.readAll();
QCOMPARE(decrypted, plainText);
}
QTEST_GUILESS_MAIN(TestSymmetricCipher)

View File

@ -22,6 +22,8 @@
#include "tests.h"
#include "autotype/WildcardMatcher.h"
QTEST_GUILESS_MAIN(TestWildcardMatcher)
const QString TestWildcardMatcher::DefaultText = QString("some text");
const QString TestWildcardMatcher::AlternativeText = QString("some other text");
@ -82,5 +84,3 @@ void TestWildcardMatcher::verifyNoMatch(QString pattern)
bool matchResult = m_matcher->match(pattern);
QVERIFY(!matchResult);
}
QTEST_GUILESS_MAIN(TestWildcardMatcher)