summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2025-09-17 11:03:49 +0300
committerPekka Vuorela <pvuorela@iki.fi>2025-09-19 13:59:24 +0300
commitf53ed1dd6116353d5fb6051f7739784e73208ca3 (patch)
tree570f3dd91402867b659bb35f8c8155df2252ed2a /tests
parent41caf5b0db008520a64be005a0d7eab9548e43ec (diff)
Clean up some cosmetic details
Mostly coding conventions here. - Method opening braces to their own lines - Adjusted some inconsistent init list styles - Removed some redundant static declarations inside anon namespace - Replaced one delete loop with qDeleteAll() - Remove some trailing extra new lines - Added some missing spaces after commas - for (), if (), switch as common qt style - Removed some unnecessary scopes within switch cases Etc. Change-Id: Ide9ad7fea6f5fce3b854af2bf05874623c474028 Reviewed-by: <matti.viljanen@kapsi.fi> Reviewed-by: Damien Caliste <dcaliste@free.fr> Reviewed-by: Pekka Vuorela <pvuorela@iki.fi>
Diffstat (limited to 'tests')
-rw-r--r--tests/tst_imap/tst_imap.cpp23
-rw-r--r--tests/tst_locks/tst_locks.cpp11
-rw-r--r--tests/tst_longstring/tst_longstring.cpp30
-rw-r--r--tests/tst_python_email/tst_python_email.cpp1
-rw-r--r--tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp10
-rw-r--r--tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp8
-rw-r--r--tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp1
-rw-r--r--tests/tst_qmailaddress/tst_qmailaddress.cpp8
-rw-r--r--tests/tst_qmailcodec/tst_qmailcodec.cpp23
-rw-r--r--tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp7
-rw-r--r--tests/tst_qmailmessage/tst_qmailmessage.cpp8
-rw-r--r--tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp54
-rw-r--r--tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp3
-rw-r--r--tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp7
-rw-r--r--tests/tst_qmailmessageset/tst_qmailmessageset.cpp8
-rw-r--r--tests/tst_qmailnamespace/tst_qmailnamespace.cpp8
-rw-r--r--tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp8
-rw-r--r--tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp8
-rw-r--r--tests/tst_qmailstore/tst_qmailstore.cpp15
-rw-r--r--tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp8
-rw-r--r--tests/tst_qmailthread/tst_qmailthread.cpp7
-rw-r--r--tests/tst_qmflist/tst_qmflist.cpp5
-rw-r--r--tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp8
-rw-r--r--tests/tst_smtp/tst_smtp.cpp8
-rw-r--r--tests/tst_storagemanager/tst_storagemanager.cpp6
25 files changed, 109 insertions, 174 deletions
diff --git a/tests/tst_imap/tst_imap.cpp b/tests/tst_imap/tst_imap.cpp
index a64c5630..04855e86 100644
--- a/tests/tst_imap/tst_imap.cpp
+++ b/tests/tst_imap/tst_imap.cpp
@@ -57,10 +57,6 @@ private:
ImapClient *mClient = nullptr;
};
-QTEST_MAIN(tst_ImapClient)
-
-#include "tst_imap.moc"
-
void tst_ImapClient::initTestCase()
{
QMailAccount account;
@@ -102,14 +98,13 @@ public:
if (op != OpOk)
qWarning() << "Test response to cmd:" << cmd << " is not ok: " << op;
- switch (cmd)
- {
- case IMAP_Login:
- context->operationCompleted();
- break;
- default:
- qWarning() << "Unhandled test response:" << cmd;
- }
+ switch (cmd) {
+ case IMAP_Login:
+ context->operationCompleted();
+ break;
+ default:
+ qWarning() << "Unhandled test response:" << cmd;
+ }
}
};
@@ -129,3 +124,7 @@ void tst_ImapClient::test_connection()
QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Checking capabilities"));
QCOMPARE(updateStatus.takeFirst().first().toString(), QString::fromLatin1("Logging in"));
}
+
+QTEST_MAIN(tst_ImapClient)
+
+#include "tst_imap.moc"
diff --git a/tests/tst_locks/tst_locks.cpp b/tests/tst_locks/tst_locks.cpp
index 76430bfa..423b4657 100644
--- a/tests/tst_locks/tst_locks.cpp
+++ b/tests/tst_locks/tst_locks.cpp
@@ -54,13 +54,8 @@ private slots:
virtual void cleanup();
void testQMailAccountKey();
-
};
-QTEST_MAIN(tst_locks)
-#include "tst_locks.moc"
-
-
tst_locks::tst_locks()
{
}
@@ -79,7 +74,6 @@ void tst_locks::cleanupTestCase()
void tst_locks::init()
{
-
}
void tst_locks::cleanup()
@@ -97,6 +91,7 @@ void tst_locks::testQMailAccountKey()
QCOMPARE(firstKey, testKey);
testKey |= secondKey;
QVERIFY((testKey | firstKey) == secondKey);
-
-
}
+
+QTEST_MAIN(tst_locks)
+#include "tst_locks.moc"
diff --git a/tests/tst_longstring/tst_longstring.cpp b/tests/tst_longstring/tst_longstring.cpp
index ba05242e..76be3b77 100644
--- a/tests/tst_longstring/tst_longstring.cpp
+++ b/tests/tst_longstring/tst_longstring.cpp
@@ -69,13 +69,9 @@ private slots:
void mid();
};
-QTEST_MAIN(tst_LongString)
-#include "tst_longstring.moc"
-
static void verifyIndexOf( const LongString& container, const QByteArray& content )
{
- if (content.length() > 1)
- {
+ if (content.length() > 1) {
QByteArray target = content.mid(1, -1);
// Invert the case of the first character
@@ -302,12 +298,9 @@ void tst_LongString::left()
LongString ls( source );
LongString comparator;
- if ( nested_size == -1 )
- {
+ if (nested_size == -1) {
comparator = ls.left( size );
- }
- else
- {
+ } else {
LongString nested = ls.left( nested_size );
comparator = nested.left( size );
}
@@ -400,12 +393,9 @@ void tst_LongString::right()
LongString ls( source );
LongString comparator;
- if ( nested_size == -1 )
- {
+ if (nested_size == -1) {
comparator = ls.right( size );
- }
- else
- {
+ } else {
LongString nested = ls.right( nested_size );
comparator = nested.right( size );
}
@@ -876,12 +866,9 @@ void tst_LongString::mid()
LongString ls( source );
LongString comparator;
- if ( nested_size == -1 )
- {
+ if (nested_size == -1) {
comparator = ls.mid( from, size );
- }
- else
- {
+ } else {
LongString nested = ls.mid( nested_from, nested_size );
comparator = nested.mid( from, size );
}
@@ -901,3 +888,6 @@ void tst_LongString::mid()
// Ensure that indexOf works correctly on result of mid
verifyIndexOf( comparator, streamOutput );
}
+
+QTEST_MAIN(tst_LongString)
+#include "tst_longstring.moc"
diff --git a/tests/tst_python_email/tst_python_email.cpp b/tests/tst_python_email/tst_python_email.cpp
index 619fd7d6..b539983f 100644
--- a/tests/tst_python_email/tst_python_email.cpp
+++ b/tests/tst_python_email/tst_python_email.cpp
@@ -1961,4 +1961,3 @@ CRLF;
QVERIFY( msg.contentType().isParameterEncoded("name") == false );
QCOMPARE( QMailMessageHeaderField::decodeParameter(msg.contentType().name()), QString("My Document For You") );
}
-
diff --git a/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp b/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp
index 2ef9fb1c..aaa4e1d0 100644
--- a/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp
+++ b/tests/tst_qmail_listmodels/tst_qmail_listmodels.cpp
@@ -70,11 +70,6 @@ private:
QMailMessage msg2;
};
-QTEST_MAIN(tst_QMail_ListModels)
-
-#include "tst_qmail_listmodels.moc"
-
-
QMailAccountConfiguration tst_QMail_ListModels::makeConfig(const QString &accountName)
{
QMailAccountConfiguration config;
@@ -267,7 +262,6 @@ void tst_QMail_ListModels::test_qmailmessagelistmodel()
idx = model.indexFromId(msg1.id());
QString data = model.data(idx).toString();
QString stop;
-
}
void tst_QMail_ListModels::test_messagethreadedmodel()
@@ -275,3 +269,7 @@ void tst_QMail_ListModels::test_messagethreadedmodel()
QMailMessageThreadedModel model;
model.generateIndex(0, 0, 0);
}
+
+QTEST_MAIN(tst_QMail_ListModels)
+
+#include "tst_qmail_listmodels.moc"
diff --git a/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp b/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp
index 1266d68f..7dd59785 100644
--- a/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp
+++ b/tests/tst_qmail_sortkeys/tst_qmail_sortkeys.cpp
@@ -63,10 +63,6 @@ private:
QSet<QMailMessageId> noMessages, allMessages, allEmailMessages;
};
-QTEST_MAIN(tst_QMail_SortKeys)
-
-#include "tst_qmail_sortkeys.moc"
-
void tst_QMail_SortKeys::initTestCase()
{
// Instantiate the store to initialise the values of the status flags and create the standard folders
@@ -500,3 +496,7 @@ void tst_QMail_SortKeys::test_messagesortkey()
ids = QMailStore::instance()->queryMessages(key, QMailMessageSortKey::rfcId());
QCOMPARE(ids.count(), allMessages.count());
}
+
+QTEST_MAIN(tst_QMail_SortKeys)
+
+#include "tst_qmail_sortkeys.moc"
diff --git a/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp b/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp
index 17443850..2478b7ce 100644
--- a/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp
+++ b/tests/tst_qmailaccountconfiguration/tst_qmailaccountconfiguration.cpp
@@ -127,6 +127,5 @@ void tst_QMailAccountConfiguration::test_service()
QCOMPARE(service.listValue(QStringLiteral("some element list")), list2);
}
-
#include "tst_qmailaccountconfiguration.moc"
QTEST_MAIN(tst_QMailAccountConfiguration)
diff --git a/tests/tst_qmailaddress/tst_qmailaddress.cpp b/tests/tst_qmailaddress/tst_qmailaddress.cpp
index 85d4c287..91ae102c 100644
--- a/tests/tst_qmailaddress/tst_qmailaddress.cpp
+++ b/tests/tst_qmailaddress/tst_qmailaddress.cpp
@@ -84,11 +84,6 @@ private slots:
void removeWhitespace();
};
-QTEST_MAIN(tst_QMailAddress)
-
-#include "tst_qmailaddress.moc"
-
-
tst_QMailAddress::tst_QMailAddress()
{
}
@@ -1274,3 +1269,6 @@ void tst_QMailAddress::removeWhitespace()
QTEST( QMailAddress::removeWhitespace(input), "output" );
}
+QTEST_MAIN(tst_QMailAddress)
+
+#include "tst_qmailaddress.moc"
diff --git a/tests/tst_qmailcodec/tst_qmailcodec.cpp b/tests/tst_qmailcodec/tst_qmailcodec.cpp
index e7adb1f7..a30723bf 100644
--- a/tests/tst_qmailcodec/tst_qmailcodec.cpp
+++ b/tests/tst_qmailcodec/tst_qmailcodec.cpp
@@ -69,11 +69,6 @@ private slots:
void encodeDecodeModifiedUtf7();
};
-QTEST_MAIN(tst_QMailCodec)
-
-#include "tst_qmailcodec.moc"
-
-
tst_QMailCodec::tst_QMailCodec()
{
}
@@ -171,8 +166,7 @@ void tst_QMailCodec::encode()
QCOMPARE(reversed, plaintext);
// Ensure that the byte-array-to-byte-array conversion matches the QString-to-byte-array conversion
- if (codec)
- {
+ if (codec) {
QByteArray octet_data = codec->fromUnicode(plaintext);
QByteArray base64_data;
{
@@ -208,8 +202,7 @@ void tst_QMailCodec::encode()
}
QCOMPARE(reversed, plaintext);
- if (codec)
- {
+ if (codec) {
// Ensure that the byte-array-to-byte-array conversion matches
QByteArray octet_data = codec->fromUnicode(plaintext);
QByteArray qp_data;
@@ -233,8 +226,7 @@ void tst_QMailCodec::encode()
QCOMPARE(reversed, octet_data);
}
- if (!qp2047_encoded.isEmpty())
- {
+ if (!qp2047_encoded.isEmpty()) {
// Test the the quoted-printable encoding works, conforming to RFC 2047
{
QMailQuotedPrintableCodec qpCodec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047);
@@ -255,8 +247,7 @@ void tst_QMailCodec::encode()
encoded = ptCodec.encode(plaintext, charset);
}
- if (codec)
- {
+ if (codec) {
QByteArray octet_data = codec->fromUnicode(plaintext);
QCOMPARE(encoded, octet_data);
}
@@ -457,8 +448,7 @@ void tst_QMailCodec::line_lengths()
QCOMPARE(reversed, plaintext);
}
- if (!qp2047_encoded.isEmpty())
- {
+ if (!qp2047_encoded.isEmpty()) {
{
QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2047);
encoded = codec.encode(plaintext, charset);
@@ -725,3 +715,6 @@ void tst_QMailCodec::encodeDecodeModifiedUtf7()
QCOMPARE(QMailCodec::encodeModifiedUtf7(QString()), QString());
}
+QTEST_MAIN(tst_QMailCodec)
+
+#include "tst_qmailcodec.moc"
diff --git a/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp b/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp
index a2641bc5..bb08d638 100644
--- a/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp
+++ b/tests/tst_qmaildisconnected/tst_qmaildisconnected.cpp
@@ -62,11 +62,6 @@ private:
};
-QTEST_MAIN(tst_QMailDisconnected)
-
-#include "tst_qmaildisconnected.moc"
-
-
void tst_QMailDisconnected::initTestCase()
{
// Instantiate the store to initialise the values of the status flags and create the standard folders
@@ -424,4 +419,6 @@ void tst_QMailDisconnected::test_qmaildisconnected()
//QMailDisconnected::clearPreviousFolder(dstKey);
}
+QTEST_MAIN(tst_QMailDisconnected)
+#include "tst_qmaildisconnected.moc"
diff --git a/tests/tst_qmailmessage/tst_qmailmessage.cpp b/tests/tst_qmailmessage/tst_qmailmessage.cpp
index ed21106c..c2308c84 100644
--- a/tests/tst_qmailmessage/tst_qmailmessage.cpp
+++ b/tests/tst_qmailmessage/tst_qmailmessage.cpp
@@ -141,10 +141,6 @@ private slots:
void readReceipt();
};
-QTEST_MAIN(tst_QMailMessage)
-
-#include "tst_qmailmessage.moc"
-
static void testHeader(const QString& name, void (QMailMessage::*setter)(const QString&), QString (QMailMessage::*getter)() const, bool expandEncodedWords = false)
{
QString value1("This is a string value");
@@ -1754,3 +1750,7 @@ void tst_QMailMessage::readReceipt()
QMailMessageHeaderField::UnstructuredField).content(),
QByteArray("manual-action/MDN-sent-manually; displayed"));
}
+
+QTEST_MAIN(tst_QMailMessage)
+
+#include "tst_qmailmessage.moc"
diff --git a/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp b/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp
index 2a61ce19..05823728 100644
--- a/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp
+++ b/tests/tst_qmailmessagebody/tst_qmailmessagebody.cpp
@@ -89,19 +89,12 @@ private slots:
void toFile();
};
-QTEST_MAIN(tst_QMailMessageBody)
-
-#include "tst_qmailmessagebody.moc"
-
static QByteArray encode(const QByteArray& input, QMailMessageBody::TransferEncoding encoding)
{
- if (encoding == QMailMessageBody::Base64)
- {
+ if (encoding == QMailMessageBody::Base64) {
QMailBase64Codec codec(QMailBase64Codec::Text);
return codec.encode(input);
- }
- else if (encoding == QMailMessageBody::QuotedPrintable)
- {
+ } else if (encoding == QMailMessageBody::QuotedPrintable) {
QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2045);
return codec.encode(input);
}
@@ -111,18 +104,13 @@ static QByteArray encode(const QByteArray& input, QMailMessageBody::TransferEnco
static QByteArray encode(const QString& input, const QByteArray& charset, QMailMessageBody::TransferEncoding encoding)
{
- if (encoding == QMailMessageBody::Base64)
- {
+ if (encoding == QMailMessageBody::Base64) {
QMailBase64Codec codec(QMailBase64Codec::Text);
return codec.encode(input, charset);
- }
- else if (encoding == QMailMessageBody::QuotedPrintable)
- {
+ } else if (encoding == QMailMessageBody::QuotedPrintable) {
QMailQuotedPrintableCodec codec(QMailQuotedPrintableCodec::Text, QMailQuotedPrintableCodec::Rfc2045);
return codec.encode(input, charset);
- }
- else
- {
+ } else {
QMailPassThroughCodec codec;
return codec.encode(input, charset);
}
@@ -537,8 +525,8 @@ void tst_QMailMessageBody::fromFile()
QTemporaryFile file(QString("%1/%2").arg(QDir::tempPath()).arg(metaObject()->className()));
QVERIFY( file.open() );
QString name = file.fileName();
- if ( !string_input.isEmpty() )
- {
+
+ if (!string_input.isEmpty()) {
{
QTextStream out( &file );
out << string_input;
@@ -553,9 +541,7 @@ void tst_QMailMessageBody::fromFile()
QCOMPARE( body.contentType().type().toLower(), content_properties[0].toLatin1().toLower() );
QCOMPARE( body.contentType().subType().toLower(), content_properties[1].toLatin1().toLower() );
QCOMPARE( body.contentType().charset().toLower(), content_properties[2].toLatin1().toLower() );
- }
- else
- {
+ } else {
{
QDataStream out( &file );
out.writeRawData( bytearray_input.constData(), bytearray_input.length() );
@@ -682,27 +668,21 @@ void tst_QMailMessageBody::toFile()
QMailMessageContentType contentType( type );
// Create a body from whatever data was supplied
- if ( !string_input.isEmpty() )
- {
+ if (!string_input.isEmpty()) {
QMailMessageBody body = QMailMessageBody::fromData( string_input, contentType, QMailMessageBody::Base64 );
body.toFile( name, format );
- }
- else
- {
+ } else {
QMailMessageBody body = QMailMessageBody::fromData( bytearray_input, contentType, QMailMessageBody::Base64, QMailMessageBody::RequiresEncoding );
body.toFile( name, format );
}
QVERIFY( file.open() );
- if ( !string_input.isEmpty() && format == QMailMessageBody::Decoded )
- {
+ if (!string_input.isEmpty() && format == QMailMessageBody::Decoded) {
// Read the string from the file and compare
QTextStream in( &file );
QString data = in.readAll();
QCOMPARE( data, string_input );
- }
- else
- {
+ } else {
// Find the size of the file data
QFileInfo fi( name );
QByteArray data( fi.size(), '\0' );
@@ -711,14 +691,14 @@ void tst_QMailMessageBody::toFile()
QDataStream in( &file );
in.readRawData( data.data(), data.length() );
- if ( !bytearray_output.isEmpty() )
- {
+ if (!bytearray_output.isEmpty()) {
QCOMPARE( data, bytearray_output );
- }
- else
- {
+ } else {
QCOMPARE( data, bytearray_input );
}
}
}
+QTEST_MAIN(tst_QMailMessageBody)
+
+#include "tst_qmailmessagebody.moc"
diff --git a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
index cf1a0fca..18c29242 100644
--- a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
+++ b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp
@@ -203,8 +203,6 @@ int main(int argc, char *argv[])
return 0;
}
-#include "tst_qmailmessageheader.moc"
-
Q_DECLARE_METATYPE(QMailMessageHeaderField::ParameterType)
Q_DECLARE_METATYPE(QList<QMailMessageHeaderField::ParameterType>)
Q_DECLARE_METATYPE(QMailMessageHeaderField::FieldType)
@@ -1666,3 +1664,4 @@ void tst_QMailMessageContentDisposition::setSize()
QCOMPARE( disposition2.toString(), QByteArray("Content-Disposition: attachment; filename=sample.txt; size=54321") );
}
+#include "tst_qmailmessageheader.moc"
diff --git a/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp b/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp
index d76efd7e..74442f08 100644
--- a/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp
+++ b/tests/tst_qmailmessagepart/tst_qmailmessagepart.cpp
@@ -92,10 +92,6 @@ private slots:
void testSerialization();
};
-QTEST_MAIN(tst_QMailMessagePart)
-#include "tst_qmailmessagepart.moc"
-
-
tst_QMailMessagePart::tst_QMailMessagePart()
{
setQMailMessageBoundaryString(BOUNDARY);
@@ -491,3 +487,6 @@ void tst_QMailMessagePart::testBody()
QCOMPARE(part.multipartType(), QMailMessagePart::MultipartNone);
QCOMPARE(part.partCount(), static_cast<uint>(0));
}
+
+QTEST_MAIN(tst_QMailMessagePart)
+#include "tst_qmailmessagepart.moc"
diff --git a/tests/tst_qmailmessageset/tst_qmailmessageset.cpp b/tests/tst_qmailmessageset/tst_qmailmessageset.cpp
index fe040695..ff0e029d 100644
--- a/tests/tst_qmailmessageset/tst_qmailmessageset.cpp
+++ b/tests/tst_qmailmessageset/tst_qmailmessageset.cpp
@@ -69,10 +69,6 @@ private:
};
-QTEST_MAIN(tst_QMailMessageSet)
-
-#include "tst_qmailmessageset.moc"
-
void tst_QMailMessageSet::initTestCase()
{
// Instantiate the store to initialise the values of the status flags and create the standard folders
@@ -512,3 +508,7 @@ void tst_QMailMessageSet::test_messagesetcontainer()
model.removeDescendants();
QCOMPARE(model.count(), 0);
}
+
+QTEST_MAIN(tst_QMailMessageSet)
+
+#include "tst_qmailmessageset.moc"
diff --git a/tests/tst_qmailnamespace/tst_qmailnamespace.cpp b/tests/tst_qmailnamespace/tst_qmailnamespace.cpp
index c3062f6b..a43a12fa 100644
--- a/tests/tst_qmailnamespace/tst_qmailnamespace.cpp
+++ b/tests/tst_qmailnamespace/tst_qmailnamespace.cpp
@@ -49,12 +49,12 @@ private slots:
void test_qmailnamespace();
};
-QTEST_MAIN(tst_QMailnamespace)
-
-#include "tst_qmailnamespace.moc"
-
void tst_QMailnamespace::test_qmailnamespace()
{
messageServerPath();
messageSettingsPath();
}
+
+QTEST_MAIN(tst_QMailnamespace)
+
+#include "tst_qmailnamespace.moc"
diff --git a/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp b/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp
index a0ae627b..bed5dafc 100644
--- a/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp
+++ b/tests/tst_qmailserviceaction/tst_qmailserviceaction.cpp
@@ -67,10 +67,6 @@ private:
QSet<QMailMessageId> noMessages, allMessages, allEmailMessages;
};
-QTEST_MAIN(tst_QMailServiceAction)
-
-#include "tst_qmailserviceaction.moc"
-
void tst_QMailServiceAction::initTestCase()
{
// Instantiate the store to initialise the values of the status flags and create the standard folders
@@ -459,3 +455,7 @@ void tst_QMailServiceAction::test_searchaction()
// action.searchMessages(QMailMessageKey::customField("present"), QString(), QMailSearchAction::Local);
// QCOMPARE(match.count(), 1);
}
+
+QTEST_MAIN(tst_QMailServiceAction)
+
+#include "tst_qmailserviceaction.moc"
diff --git a/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp b/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp
index 513eddce..e90402e2 100644
--- a/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp
+++ b/tests/tst_qmailstorageaction/tst_qmailstorageaction.cpp
@@ -73,10 +73,6 @@ private:
QSet<QMailMessageId> noMessages, allMessages, allEmailMessages;
};
-QTEST_MAIN(tst_QMailStorageAction)
-
-#include "tst_qmailstorageaction.moc"
-
void tst_QMailStorageAction::initTestCase()
{
QVERIFY2(QMail::isMessageServerRunning(), "tst_QMailStorageAction requires messageserver to be running");
@@ -873,3 +869,7 @@ void tst_QMailStorageAction::test_storageaction_discardMessages()
QVERIFY(QMailStore::instance()->countMessages(savedMessage4Key) == 0);
}
+
+QTEST_MAIN(tst_QMailStorageAction)
+
+#include "tst_qmailstorageaction.moc"
diff --git a/tests/tst_qmailstore/tst_qmailstore.cpp b/tests/tst_qmailstore/tst_qmailstore.cpp
index 279fc1bd..8d552ba7 100644
--- a/tests/tst_qmailstore/tst_qmailstore.cpp
+++ b/tests/tst_qmailstore/tst_qmailstore.cpp
@@ -80,10 +80,6 @@ private slots:
void implementationbase();
};
-QTEST_MAIN(tst_QMailStore)
-
-#include "tst_qmailstore.moc"
-
#define CRLF "\015\012"
tst_QMailStore::tst_QMailStore()
@@ -1568,8 +1564,7 @@ void tst_QMailStore::remove1000Messages()
static const int largeMessageCount = 10;
- for (int i = 0; i < largeMessageCount; ++i)
- {
+ for (int i = 0; i < largeMessageCount; ++i) {
QMailMessage message1;
message1.setServerUid(QString("%1|Just some message").arg(i));
message1.setParentAccountId(account.id());
@@ -1593,8 +1588,7 @@ void tst_QMailStore::remove1000Messages()
//with message removal record
- for (int i = 0; i < largeMessageCount; ++i)
- {
+ for (int i = 0; i < largeMessageCount; ++i) {
QMailMessage message1;
message1.setServerUid(QString("Just some message$%1").arg(i));
message1.setParentAccountId(account.id());
@@ -1827,5 +1821,8 @@ void tst_QMailStore::implementationbase()
impl.setRetrievalInProgress(QMailAccountIdList()<<account1.id());
impl.notifyRetrievalInProgress(QMailAccountIdList()<<account1.id());
-
}
+
+QTEST_MAIN(tst_QMailStore)
+
+#include "tst_qmailstore.moc"
diff --git a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
index af11b9f8..68eeae44 100644
--- a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
+++ b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
@@ -137,10 +137,6 @@ private:
QSet<QMailMessageId> noMessages, allMessages, allEmailMessages;
};
-QTEST_MAIN(tst_QMailStoreKeys)
-
-#include "tst_qmailstorekeys.moc"
-
tst_QMailStoreKeys::tst_QMailStoreKeys()
{
}
@@ -2473,3 +2469,7 @@ void tst_QMailStoreKeys::threadedModel()
QCOMPARE(model.idFromIndex(model.index(1, 0)), inboxMessage1);
QCOMPARE(model.idFromIndex(model.index(0, 0, model.indexFromId(inboxMessage1))), inboxMessage2);
}
+
+QTEST_MAIN(tst_QMailStoreKeys)
+
+#include "tst_qmailstorekeys.moc"
diff --git a/tests/tst_qmailthread/tst_qmailthread.cpp b/tests/tst_qmailthread/tst_qmailthread.cpp
index 936f9c85..504257e0 100644
--- a/tests/tst_qmailthread/tst_qmailthread.cpp
+++ b/tests/tst_qmailthread/tst_qmailthread.cpp
@@ -75,19 +75,14 @@ private:
QSet<QMailMessageId> noMessages, allMessages, allEmailMessages;
};
-QTEST_MAIN(tst_qmailthread)
-#include "tst_qmailthread.moc"
-
#define CRLF "\015\012"
tst_qmailthread::tst_qmailthread()
{
-
}
tst_qmailthread::~tst_qmailthread()
{
-
}
void tst_qmailthread::initTestCase()
@@ -691,3 +686,5 @@ void tst_qmailthread::test_threadKeys()
QCOMPARE(skey1, skey4);
}
+QTEST_MAIN(tst_qmailthread)
+#include "tst_qmailthread.moc"
diff --git a/tests/tst_qmflist/tst_qmflist.cpp b/tests/tst_qmflist/tst_qmflist.cpp
index 85401c7f..30f37c4f 100644
--- a/tests/tst_qmflist/tst_qmflist.cpp
+++ b/tests/tst_qmflist/tst_qmflist.cpp
@@ -73,9 +73,6 @@ private slots:
void fromQList();
};
-QTEST_MAIN(tst_QmfList)
-#include "tst_qmflist.moc"
-
tst_QmfList::tst_QmfList()
{
}
@@ -295,3 +292,5 @@ void tst_QmfList::fromQList()
QCOMPARE(QmfList<int>::fromQList(qlist), qmflist);
}
+QTEST_MAIN(tst_QmfList)
+#include "tst_qmflist.moc"
diff --git a/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp b/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp
index 4a96d78f..5d48cd22 100644
--- a/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp
+++ b/tests/tst_qprivateimplementation/tst_qprivateimplementation.cpp
@@ -221,11 +221,6 @@ private slots:
void basicTest();
};
-QTEST_MAIN(tst_QPrivateImplementation)
-
-#include "tst_qprivateimplementation.moc"
-
-
tst_QPrivateImplementation::tst_QPrivateImplementation()
{
}
@@ -289,3 +284,6 @@ void tst_QPrivateImplementation::basicTest()
QCOMPARE(b1.toString(), marge + ':' + evergreen);
}
+QTEST_MAIN(tst_QPrivateImplementation)
+
+#include "tst_qprivateimplementation.moc"
diff --git a/tests/tst_smtp/tst_smtp.cpp b/tests/tst_smtp/tst_smtp.cpp
index 8dcfbe3a..99d534af 100644
--- a/tests/tst_smtp/tst_smtp.cpp
+++ b/tests/tst_smtp/tst_smtp.cpp
@@ -57,10 +57,6 @@ private:
SmtpClient *mClient = nullptr;
};
-QTEST_MAIN(tst_SmtpClient)
-
-#include "tst_smtp.moc"
-
void tst_SmtpClient::initTestCase()
{
QMailAccount account;
@@ -134,3 +130,7 @@ void tst_SmtpClient::test_auth()
QCOMPARE(updateStatus.takeFirst().first(), QString::fromLatin1("Connected"));
QCOMPARE(updateStatus.takeFirst().first(), QString::fromLatin1("Connected"));
}
+
+QTEST_MAIN(tst_SmtpClient)
+
+#include "tst_smtp.moc"
diff --git a/tests/tst_storagemanager/tst_storagemanager.cpp b/tests/tst_storagemanager/tst_storagemanager.cpp
index 6247f02a..8724db84 100644
--- a/tests/tst_storagemanager/tst_storagemanager.cpp
+++ b/tests/tst_storagemanager/tst_storagemanager.cpp
@@ -64,9 +64,6 @@ private:
};
-QTEST_MAIN(tst_StorageManager)
-#include "tst_storagemanager.moc"
-
#define CRLF "\015\012"
QMailAccountConfiguration tst_StorageManager::makeConfig(const QString &accountName)
@@ -259,6 +256,7 @@ void tst_StorageManager::test_remove()
void tst_StorageManager::test_update()
{
-
}
+QTEST_MAIN(tst_StorageManager)
+#include "tst_storagemanager.moc"