Commit e41cf81d authored by mardy's avatar mardy

Tests, QContactManager: wipe contacts after each test

parent 73633d6a
......@@ -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);
......
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