fix delete; test for it
This commit is contained in:
parent
1ee07ca959
commit
6d6826e603
@ -94,7 +94,7 @@ void StorageJob::start()
|
||||
} else if (operationName() == "retrieve") {
|
||||
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "retrieve", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap&, params));
|
||||
} else if (operationName() == "delete") {
|
||||
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "delete", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap&, params));
|
||||
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "deleteEntry", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap&, params));
|
||||
} else if (operationName() == "expire") {
|
||||
QMetaObject::invokeMethod(Plasma::StorageThread::self(), "expire", Qt::QueuedConnection, Q_ARG(QWeakPointer<StorageJob>, me), Q_ARG(const QVariantMap&, params));
|
||||
} else {
|
||||
|
@ -270,6 +270,7 @@ void StorageThread::deleteEntry(QWeakPointer<StorageJob> wcaller, const QVariant
|
||||
}
|
||||
|
||||
const bool success = query.exec();
|
||||
m_db.commit();
|
||||
|
||||
emit newResult(caller, success);
|
||||
}
|
||||
|
@ -64,5 +64,33 @@ void StorageTest::retrieve()
|
||||
}
|
||||
}
|
||||
|
||||
void StorageTest::deleteEntry()
|
||||
{
|
||||
Storage storage;
|
||||
KConfigGroup op = storage.operationDescription("delete");
|
||||
op.writeEntry("group", "Test");
|
||||
Plasma::ServiceJob *job = storage.startOperationCall(op);
|
||||
StorageJob *storageJob = qobject_cast<StorageJob *>(job);
|
||||
|
||||
QVERIFY(storageJob);
|
||||
if (storageJob) {
|
||||
storageJob->setData(m_data);
|
||||
QVERIFY(storageJob->exec());
|
||||
QVERIFY(storageJob->result().toBool());
|
||||
}
|
||||
|
||||
op = storage.operationDescription("retrieve");
|
||||
op.writeEntry("group", "Test");
|
||||
job = storage.startOperationCall(op);
|
||||
storageJob = qobject_cast<StorageJob *>(job);
|
||||
|
||||
QVERIFY(storageJob);
|
||||
if (storageJob) {
|
||||
QVERIFY(storageJob->exec());
|
||||
QVERIFY(storageJob->result().type() != QVariant::Bool);
|
||||
QVERIFY(storageJob->data().isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_KDEMAIN(StorageTest, NoGUI)
|
||||
|
||||
|
@ -32,6 +32,7 @@ public Q_SLOTS:
|
||||
private Q_SLOTS:
|
||||
void store();
|
||||
void retrieve();
|
||||
void deleteEntry();
|
||||
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user