Commit 72470504 authored by chriadam's avatar chriadam

Merge branch 'test_wipe_mer' into 'master'

Tests, QContactManager: wipe contacts after each test

See merge request mer-core/qtcontacts-sqlite!25
parents 0ae95a4d 831f1da7
......@@ -170,6 +170,7 @@ private:
public slots:
void initTestCase();
void cleanup();
void cleanupTestCase();
private slots:
......@@ -339,6 +340,28 @@ void tst_QContactManager::initTestCase()
//QVERIFY(!QContactManager::availableManagers().contains("maliciousplugin"));
}
void tst_QContactManager::cleanup()
{
QMap<QString, QString> params;
params.insert("autoTest", "true");
params.insert("mergePresenceChanges", "false");
QString mgrUri = QContactManager::buildUri(QLatin1String(SQLITE_MANAGER), params);
QScopedPointer<QContactManager> cm(QContactManager::fromUri(mgrUri));
if (cm) {
QList<QContact> contacts = cm->contacts();
QList<QContactId> ids;
for (const QContact &contact: contacts) {
ids.append(retrievalId(contact));
}
if (!ids.isEmpty()) {
QSignalSpy removedSpy(cm.data(), contactsRemovedSignal);
cm->removeContacts(ids, 0);
removedSpy.wait();
}
}
}
void tst_QContactManager::cleanupTestCase()
{
managerDataHolder.reset(0);
......@@ -4669,6 +4692,9 @@ void tst_QContactManager::constituentOfSelf()
// Verify that the new contact was not aggregated into the self contact
newContact = m->contact(retrievalId(newContact));
QVERIFY(!relatedContactIds(newContact.relatedContacts()).contains(m->selfContactId()));
// Cleanup
QVERIFY(m->removeContact(constituent.id()));
}
void tst_QContactManager::searchSensitivity()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment