summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Sanders <don.sanders@nokia.com>2011-05-31 20:39:08 +0300
committerDon Sanders <don.sanders@nokia.com>2011-05-31 20:39:08 +0300
commit223ec43f71e0e4f1d1c78c60f97379a2290f02f2 (patch)
treeadef74ce8bb386025f6259906ba9b93b7fa9fb89
parent295a829d8a13a144e2748d948d6241748071bdce (diff)
Improve unit test coverage by Eugeny Sychev
Reviewed and minor changes by Eric.
-rw-r--r--src/libraries/qmfclient/qmailstore.h1
-rw-r--r--tests/tests.pro2
-rw-r--r--tests/tests.xml253
-rw-r--r--tests/tst_qcop/tst_qcop.cpp24
-rw-r--r--tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp85
-rw-r--r--tests/tst_storagemanager/tst_storagemanager.cpp23
6 files changed, 301 insertions, 87 deletions
diff --git a/src/libraries/qmfclient/qmailstore.h b/src/libraries/qmfclient/qmailstore.h
index 606ab795..458bc0d6 100644
--- a/src/libraries/qmfclient/qmailstore.h
+++ b/src/libraries/qmfclient/qmailstore.h
@@ -249,6 +249,7 @@ private:
friend class QMailMessageMetaDataPrivate; // for ensureCustomFields
friend class tst_QMailStore;
friend class tst_QMailStoreKeys;
+ friend class tst_qmailthread;
QMailStore();
diff --git a/tests/tests.pro b/tests/tests.pro
index 57cf8d6a..8c46c4a2 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -23,6 +23,8 @@ SUBDIRS = \
tst_qmaildisconnected \
tst_qmailnamespace \
tst_qlogsystem \
+ tst_locks \
+ tst_qmailthread \
CONFIG += unittest
diff --git a/tests/tests.xml b/tests/tests.xml
index 27e39742..ecebe435 100644
--- a/tests/tests.xml
+++ b/tests/tests.xml
@@ -852,7 +852,6 @@
<hardware>true</hardware>
</environments>
</set>
- <!--
<set name="_usr_tests_qmf_tst_qmailstorekeys">
<description>libqmf-tests:tst_qmailstorekeys</description>
<case name="tst_qmailstorekeys-simpleKeys">
@@ -1004,6 +1003,256 @@
<hardware>true</hardware>
</environments>
</set>
- -->
+ <set name="_usr_tests_qmf_tst_longstream">
+ <description>libqmf-tests:tst_longstream</description>
+ <case name="tst_longstream-test_new_stream">
+ <description>libqmf-tests:tst_longstream:test_new_stream</description>
+ <step>/usr/tests/qmf/tst_longstream test_new_stream</step>
+ </case>
+ <case name="tst_longstream-test_status">
+ <description>libqmf-tests:tst_longstream:test_status</description>
+ <step>/usr/tests/qmf/tst_longstream test_status</step>
+ </case>
+ <case name="tst_longstream-test_errorMessage">
+ <description>libqmf-tests:tst_longstream:test_errorMessage</description>
+ <step>/usr/tests/qmf/tst_longstream test_errorMessage</step>
+ </case>
+ <case name="tst_longstream-test_temp_files">
+ <description>libqmf-tests:tst_longstream:test_temp_files</description>
+ <step>/usr/tests/qmf/tst_longstream test_temp_files</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_locks">
+ <description>libqmf-tests:tst_locks</description>
+ <case name="tst_locks-testLock">
+ <description>libqmf-tests:tst_locks:testLock</description>
+ <step>/usr/tests/qmf/tst_locks testLock</step>
+ </case>
+ <case name="tst_locks-testQMailAccountKey">
+ <description>libqmf-tests:tst_locks:testQMailAccountKey</description>
+ <step>/usr/tests/qmf/tst_locks testQMailAccountKey</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qcop">
+ <description>libqmf-tests:tst_qcop</description>
+ <case name="tst_qcop-test_qcopchannel">
+ <description>libqmf-tests:tst_qcop:test_qcopchannel</description>
+ <step>/usr/tests/qmf/tst_qcop test_qcopchannel</step>
+ </case>
+ <case name="tst_qcop-test_qcopserver">
+ <description>libqmf-tests:tst_qcop:test_qcopserver</description>
+ <step>/usr/tests/qmf/tst_qcop test_qcopserver</step>
+ </case>
+ <case name="tst_qcop-test_qcopclient">
+ <description>libqmf-tests:tst_qcop:test_qcopclient</description>
+ <step>/usr/tests/qmf/tst_qcop test_qcopclient</step>
+ </case>
+ <case name="tst_qcop-test_qcopadaptor">
+ <description>libqmf-tests:tst_qcop:test_qcopadaptor</description>
+ <step>/usr/tests/qmf/tst_qcop test_qcopadaptor</step>
+ </case>
+ <case name="tst_qcop-test_secondqcopserver">
+ <description>libqmf-tests:tst_qcop:test_secondqcopserver</description>
+ <step>/usr/tests/qmf/tst_qcop test_secondqcopserver</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmaillog">
+ <description>libqmf-tests:tst_qmaillog</description>
+ <case name="tst_qmaillog-test_qmaillog">
+ <description>libqmf-tests:tst_qmaillog:test_qmaillog</description>
+ <step>/usr/tests/qmf/tst_qmaillog test_qmaillog</step>
+ </case>
+ <case name="tst_qmaillog-test_logsystem">
+ <description>libqmf-tests:tst_qmaillog:test_logsystem</description>
+ <step>/usr/tests/qmf/tst_qmaillog test_logsystem</step>
+ </case>
+ <case name="tst_qmaillog-test_loggers">
+ <description>libqmf-tests:tst_qmaillog:test_loggers</description>
+ <step>/usr/tests/qmf/tst_qmaillog test_loggers</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmailnamespace">
+ <description>libqmf-tests:tst_qmailnamespace</description>
+ <case name="tst_qmailnamespace-test_qmailnamespace">
+ <description>libqmf-tests:tst_qmailnamespace:test_qmailnamespace</description>
+ <step>/usr/tests/qmf/tst_qmailnamespace test_qmailnamespace</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmail_listmodels">
+ <description>libqmf-tests:tst_qmail_listmodels</description>
+ <case name="tst_qmail_listmodels-test_qmailaccountlistmodel">
+ <description>libqmf-tests:tst_qmail_listmodels:test_qmailaccountlistmodel</description>
+ <step>/usr/tests/qmf/tst_qmail_listmodels test_qmailaccountlistmodel</step>
+ </case>
+ <case name="tst_qmail_listmodels-test_qmailmessagelistmodel">
+ <description>libqmf-tests:tst_qmail_listmodels:test_qmailmessagelistmodel</description>
+ <step>/usr/tests/qmf/tst_qmail_listmodels test_qmailmessagelistmodel</step>
+ </case>
+ <case name="tst_qmail_listmodels-test_messagethreadedmodel">
+ <description>libqmf-tests:tst_qmail_listmodels:test_messagethreadedmodel</description>
+ <step>/usr/tests/qmf/tst_qmail_listmodels test_messagethreadedmodel</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmail_sortkeys">
+ <description>libqmf-tests:tst_qmail_sortkeys</description>
+ <case name="tst_qmail_sortkeys-test_foldersortkey">
+ <description>libqmf-tests:tst_qmail_sortkeys:test_foldersortkey</description>
+ <step>/usr/tests/qmf/tst_qmail_sortkeys test_foldersortkey</step>
+ </case>
+ <case name="tst_qmail_sortkeys-test_accountsortkey">
+ <description>libqmf-tests:tst_qmail_sortkeys:test_accountsortkey</description>
+ <step>/usr/tests/qmf/tst_qmail_sortkeys test_accountsortkey</step>
+ </case>
+ <case name="tst_qmail_sortkeys-test_messagesortkey">
+ <description>libqmf-tests:tst_qmail_sortkeys:test_messagesortkey</description>
+ <step>/usr/tests/qmf/tst_qmail_sortkeys test_messagesortkey</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmaildisconnected">
+ <description>libqmf-tests:tst_qmaildisconnected</description>
+ <case name="tst_qmaildisconnected-test_qmaildisconnected">
+ <description>libqmf-tests:tst_qmaildisconnected:test_qmaildisconnected</description>
+ <step>/usr/tests/qmf/tst_qmaildisconnected test_qmaildisconnected</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmailmessageset">
+ <description>libqmf-tests:tst_qmailmessageset</description>
+ <case name="tst_qmailmessageset-test_foldermessageset">
+ <description>libqmf-tests:tst_qmailmessageset:test_foldermessageset</description>
+ <step>/usr/tests/qmf/tst_qmailmessageset test_foldermessageset</step>
+ </case>
+ <case name="tst_qmailmessageset-test_accountmessageset">
+ <description>libqmf-tests:tst_qmailmessageset:test_accountmessageset</description>
+ <step>/usr/tests/qmf/tst_qmailmessageset test_accountmessageset</step>
+ </case>
+ <case name="tst_qmailmessageset-test_filtermessageset">
+ <description>libqmf-tests:tst_qmailmessageset:test_filtermessageset</description>
+ <step>/usr/tests/qmf/tst_qmailmessageset test_filtermessageset</step>
+ </case>
+ <case name="tst_qmailmessageset-test_messagesetcontainer">
+ <description>libqmf-tests:tst_qmailmessageset:test_messagesetcontainer</description>
+ <step>/usr/tests/qmf/tst_qmailmessageset test_messagesetcontainer</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmailserviceaction">
+ <description>libqmf-tests:tst_qmailserviceaction</description>
+ <case name="tst_qmailserviceaction-test_retrievalaction">
+ <description>libqmf-tests:tst_qmailserviceaction:test_retrievalaction</description>
+ <step>/usr/tests/qmf/tst_qmailserviceaction test_retrievalaction</step>
+ </case>
+ <case name="tst_qmailserviceaction-test_transmitaction">
+ <description>libqmf-tests:tst_qmailserviceaction:test_transmitaction</description>
+ <step>/usr/tests/qmf/tst_qmailserviceaction test_transmitaction</step>
+ </case>
+ <case name="tst_qmailserviceaction-test_storageaction">
+ <description>libqmf-tests:tst_qmailserviceaction:test_storageaction</description>
+ <step>/usr/tests/qmf/tst_qmailserviceaction test_storageaction</step>
+ </case>
+ <case name="tst_qmailserviceaction-test_searchaction">
+ <description>libqmf-tests:tst_qmailserviceaction:test_searchaction</description>
+ <step>/usr/tests/qmf/tst_qmailserviceaction test_searchaction</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_storagemanager">
+ <description>libqmf-tests:tst_storagemanager</description>
+ <case name="tst_storagemanager-test_init">
+ <description>libqmf-tests:tst_storagemanager:test_init</description>
+ <step>/usr/tests/qmf/tst_storagemanager test_init</step>
+ </case>
+ <case name="tst_storagemanager-test_add">
+ <description>libqmf-tests:tst_storagemanager:test_add</description>
+ <step>/usr/tests/qmf/tst_storagemanager test_add</step>
+ </case>
+ <case name="tst_storagemanager-test_remove">
+ <description>libqmf-tests:tst_storagemanager:test_remove</description>
+ <step>/usr/tests/qmf/tst_storagemanager test_remove</step>
+ </case>
+ <case name="tst_storagemanager-test_update">
+ <description>libqmf-tests:tst_storagemanager:test_update</description>
+ <step>/usr/tests/qmf/tst_storagemanager test_update</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <set name="_usr_tests_qmf_tst_qmailthread">
+ <description>libqmf-tests:tst_qmailthread</description>
+ <case name="tst_qmailthread-test_messageCount">
+ <description>libqmf-tests:tst_qmailthread:test_messageCount</description>
+ <step>/usr/tests/qmf/tst_qmailthread test_messageCount</step>
+ </case>
+ <case name="tst_qmailthread-test_UnreadCount">
+ <description>libqmf-tests:tst_qmailthread:test_UnreadCount</description>
+ <step>/usr/tests/qmf/tst_qmailthread test_UnreadCount</step>
+ </case>
+ <case name="tst_qmailthread-test_parentId">
+ <description>libqmf-tests:tst_qmailthread:test_parentId</description>
+ <step>/usr/tests/qmf/tst_qmailthread test_parentId</step>
+ </case>
+ <case name="tst_qmailthread-test_cloneId">
+ <description>libqmf-tests:tst_qmailthread:test_cloneId</description>
+ <step>/usr/tests/qmf/tst_qmailthread test_cloneId</step>
+ </case>
+ <case name="tst_qmailthread-test_threadKeys">
+ <description>libqmf-tests:tst_qmailthread:test_threadKeys</description>
+ <step>/usr/tests/qmf/tst_qmailthread test_threadKeys</step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set>
+ <!--set name="_usr_tests_qmf_">
+ <description>libqmf-tests:</description>
+ <case name="-">
+ <description>libqmf-tests::</description>
+ <step>/usr/tests/qmf/ </step>
+ </case>
+ <environments>
+ <scratchbox>true</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+ </set-->
</suite>
</testdefinition>
diff --git a/tests/tst_qcop/tst_qcop.cpp b/tests/tst_qcop/tst_qcop.cpp
index a9345f20..04d3e44d 100644
--- a/tests/tst_qcop/tst_qcop.cpp
+++ b/tests/tst_qcop/tst_qcop.cpp
@@ -71,6 +71,7 @@ private slots:
void test_qcopserver();
void test_qcopclient();
void test_qcopadaptor();
+ void test_secondqcopserver();
private:
TestQCopServer *server;
@@ -248,3 +249,26 @@ void tst_QCop::test_qcopadaptor()
adapt.send(SIGNAL(arg1(QVariant)), QVariantList() << "one");
}
+
+void tst_QCop::test_secondqcopserver()
+{
+ QCopLocalSocket * sock = new QCopLocalSocket;
+ QCopClient *client = new QCopClient(sock, sock);
+ sock->setParent(client);
+
+ QString channel("testserverchannel");
+ QCopServerRegexp regexp(channel, client);
+ QVERIFY(regexp.match(channel));
+
+ QString channel_star=channel+"*";
+ QCopServerRegexp regexp1(channel_star, client);
+ QVERIFY(regexp1.match(channel)); // match only the non-* part
+
+ //QCopServer server;
+ TestQCopServer *server1 = new TestQCopServer();
+ QCOMPARE(server1->activateApp("invalidAppName"), qint64(-1));
+ server1->appExited(1391);
+
+ client->handleRegistered(channel);
+ delete server1;
+}
diff --git a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
index f3cbdfa2..8ce07dd9 100644
--- a/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
+++ b/tests/tst_qmailstorekeys/tst_qmailstorekeys.cpp
@@ -101,8 +101,6 @@ private slots:
void listModel();
void threadedModel();
- void locks();
-
private:
// We only want to compare sets, disregarding ordering
const QSet<QMailAccountId> accountSet(const QMailAccountKey &key) const
@@ -702,14 +700,6 @@ void tst_QMailStoreKeys::accountMessageType()
QCOMPARE(accountSet(QMailAccountKey::messageType(QMailMessage::Instant, NotEqual)), accountSet() << accountId1 << accountId3 << accountId4);
QCOMPARE(accountSet(~QMailAccountKey::messageType(QMailMessage::Instant, NotEqual)), accountSet() << accountId2);
- // Bitwise inclusion
- QCOMPARE(accountSet(QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Mms, Includes)), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Mms, Includes)), allAccounts);
- QCOMPARE(accountSet(QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Email, Includes)), accountSet() << accountId1);
- QCOMPARE(accountSet(~QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Email, Includes)), accountSet() << accountId2 << accountId3 << accountId4);
- QCOMPARE(accountSet(QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Instant, Includes)), accountSet() << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Instant, Includes)), accountSet() << accountId1 << accountId3 << accountId4);
-
// Bitwise exclusion
QCOMPARE(accountSet(QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Mms, Excludes)), allAccounts);
QCOMPARE(accountSet(~QMailAccountKey::messageType(QMailMessage::Sms | QMailMessage::Mms, Excludes)), noAccounts);
@@ -798,16 +788,6 @@ void tst_QMailStoreKeys::accountStatus()
QCOMPARE(accountSet(QMailAccountKey::status(accountStatus2, NotEqual)), accountSet() << accountId1 << accountId3 << accountId4);
QCOMPARE(accountSet(~QMailAccountKey::status(accountStatus2, NotEqual)), accountSet() << accountId2);
- // Bitwise inclusion
- QCOMPARE(accountSet(QMailAccountKey::status(allSet, Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::status(allSet, Includes)), accountSet() << accountId3 << accountId4);
- QCOMPARE(accountSet(QMailAccountKey::status(sourceSet, Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::status(sourceSet, Includes)), accountSet() << accountId3 << accountId4);
- QCOMPARE(accountSet(QMailAccountKey::status(sinkSet, Includes)), accountSet() << accountId1);
- QCOMPARE(accountSet(~QMailAccountKey::status(sinkSet, Includes)), accountSet() << accountId2 << accountId3 << accountId4);
- QCOMPARE(accountSet(QMailAccountKey::status(QMailAccount::SynchronizationEnabled | QMailAccount::CanTransmit, Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::status(QMailAccount::SynchronizationEnabled | QMailAccount::CanTransmit, Includes)), accountSet() << accountId3 << accountId4);
-
// Bitwise exclusion
QCOMPARE(accountSet(QMailAccountKey::status(allSet, Excludes)), accountSet() << accountId3 << accountId4);
QCOMPARE(accountSet(~QMailAccountKey::status(allSet, Excludes)), accountSet() << accountId1 << accountId2);
@@ -848,65 +828,6 @@ void tst_QMailStoreKeys::accountCustomField()
QCOMPARE(accountSet(~QMailAccountKey::customField(QString(""), Absent)), noAccounts);
QCOMPARE(accountSet(QMailAccountKey::customField(QString(), Absent)), allAccounts);
QCOMPARE(accountSet(~QMailAccountKey::customField(QString(), Absent)), noAccounts);
-
- // Test for content equality
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "true")), verifiedAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "true")), accountSet() << accountId3);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "false")), accountSet() << accountId3);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "false")), verifiedAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "bicycle")), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "bicycle")), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", QString(""))), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", QString(""))), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", QString())), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", QString())), accountSet() << accountId1 << accountId2 << accountId3);
-
- // Test for content inequality
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "true", NotEqual)), accountSet() << accountId3);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "true", NotEqual)), verifiedAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "false", NotEqual)), verifiedAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "false", NotEqual)), accountSet() << accountId3);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", "bicycle", NotEqual)), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", "bicycle", NotEqual)), noAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", QString(""), NotEqual)), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", QString(""), NotEqual)), noAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("verified", QString(), NotEqual)), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(~QMailAccountKey::customField("verified", QString(), NotEqual)), noAccounts);
-
- // Test for partial matches
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "Fi", Includes)), accountSet() << accountId1);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "Fi", Includes)), accountSet() << accountId2);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "assi", Includes)), accountSet() << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "assi", Includes)), accountSet() << accountId1);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "bicycle", Includes)), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "bicycle", Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", QString(""), Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", QString(""), Includes)), noAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", QString(), Includes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", QString(), Includes)), noAccounts);
-
- // Test for partial match exclusion
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "Fi", Excludes)), accountSet() << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "Fi", Excludes)), accountSet() << accountId1);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "assi", Excludes)), accountSet() << accountId1);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "assi", Excludes)), accountSet() << accountId2);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", "bicycle", Excludes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", "bicycle", Excludes)), noAccounts);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", QString(""), Excludes)), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", QString(""), Excludes)), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(QMailAccountKey::customField("answer", QString(), Excludes)), noAccounts);
- QCOMPARE(accountSet(~QMailAccountKey::customField("answer", QString(), Excludes)), accountSet() << accountId1 << accountId2);
-
- // Test combinations
- QMailAccountKey hasVerifiedKey(QMailAccountKey::customField("verified"));
- QMailAccountKey hasQuestionKey(QMailAccountKey::customField("question"));
-
- QCOMPARE(accountSet(hasVerifiedKey & hasQuestionKey), accountSet() << accountId1 << accountId2);
- QCOMPARE(accountSet(hasVerifiedKey | hasQuestionKey), accountSet() << accountId1 << accountId2 << accountId3);
- QCOMPARE(accountSet(hasVerifiedKey & ~hasQuestionKey), accountSet() << accountId3);
- QCOMPARE(accountSet(hasVerifiedKey | ~hasQuestionKey), allAccounts);
- QCOMPARE(accountSet(~hasVerifiedKey & hasQuestionKey), noAccounts);
- QCOMPARE(accountSet(~hasVerifiedKey | hasQuestionKey), accountSet() << accountId1 << accountId2 << accountId4);
}
void tst_QMailStoreKeys::folderId()
@@ -2549,9 +2470,3 @@ void tst_QMailStoreKeys::threadedModel()
QCOMPARE(model.idFromIndex(model.index(1, 0)), savedMessage2);
QCOMPARE(model.idFromIndex(model.index(0, 0, model.indexFromId(inboxMessage1))), inboxMessage2);
}
-
-void tst_QMailStoreKeys::locks()
-{
- ProcessMutex mutex("invalid path", 0);
- mutex.lock();
-}
diff --git a/tests/tst_storagemanager/tst_storagemanager.cpp b/tests/tst_storagemanager/tst_storagemanager.cpp
index 42d3a70e..bac82e0e 100644
--- a/tests/tst_storagemanager/tst_storagemanager.cpp
+++ b/tests/tst_storagemanager/tst_storagemanager.cpp
@@ -248,6 +248,29 @@ void tst_StorageManager::test_add()
void tst_StorageManager::test_remove()
{
+ QMailMessage msg4;
+ msg4.setMessageType(QMailMessage::Email);
+ msg4.setParentAccountId(account1.id());
+ msg4.setParentFolderId(QMailFolder::LocalStorageFolderId);
+ msg4.setFrom(QMailAddress("newguy@example.org"));
+ msg4.setTo(QMailAddress("old@example.org"));
+ msg4.setCc(QMailAddressList() << QMailAddress("anotherguy@example.org"));
+ msg4.setSubject("email message test");
+ msg4.setDate(QMailTimeStamp(QDateTime(QDate::currentDate())));
+ msg4.setReceivedDate(QMailTimeStamp(QDateTime(QDate::currentDate())));
+ msg4.setStatus(QMailMessage::Incoming, true);
+ msg4.setStatus(QMailMessage::New, true);
+ msg4.setStatus(QMailMessage::Read, false);
+ msg4.setServerUid("unique-inboxmsg22");
+ msg4.setSize(5 * 1024);
+ msg4.setContent(QMailMessage::PlainTextContent);
+ msg4.setCustomField("present", "true");
+ msg4.setBody(QMailMessageBody::fromData("plaintext",QMailMessageContentType("text/plain"),QMailMessageBody::QuotedPrintable));
+ msg4.setCustomField("qmf-detached-filename", "non-existent");
+ msg4.setAttachments(QStringList() << "/fake/path");
+ msg4.setAttachments(QStringList() << "qmf-detached-filename");
+ QVERIFY(QMailStore::instance()->addMessage(&msg4));
+
}
void tst_StorageManager::test_update()