aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-07 14:21:13 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-07 14:21:13 (GMT)
commitdbe3e080eaa5848ffe2a2378805afdff932b7a8a (patch)
treebf89f07746aca3a0b8d95780e19ccfa70700ad6f
parent9f8129f817291a2cafb7e7a935fa689f91e0543d (diff)
Fix crash in ItemRetrieverTest
-rw-r--r--autotests/server/fakeakonadiserver.cpp10
-rw-r--r--autotests/server/fakeakonadiserver.h2
-rw-r--r--autotests/server/itemretrievertest.cpp1
3 files changed, 12 insertions, 1 deletions
diff --git a/autotests/server/fakeakonadiserver.cpp b/autotests/server/fakeakonadiserver.cpp
index 96417ea..9d0f717 100644
--- a/autotests/server/fakeakonadiserver.cpp
+++ b/autotests/server/fakeakonadiserver.cpp
@@ -111,6 +111,7 @@ FakeAkonadiServer::FakeAkonadiServer()
, mServerLoop(Q_NULLPTR)
, mNtfCollector(Q_NULLPTR)
, mPopulateDb(true)
+ , mDisableItemRetrievalManager(false)
{
qputenv("AKONADI_INSTANCE", qPrintable(instanceName()));
qputenv("XDG_DATA_HOME", qPrintable(QString(basePath() + QLatin1String("/local"))));
@@ -169,6 +170,11 @@ TestScenario::List FakeAkonadiServer::selectResourceScenario(const QString &name
};
}
+void FakeAkonadiServer::disableItemRetrievalManager()
+{
+ mDisableItemRetrievalManager = true;
+}
+
bool FakeAkonadiServer::init()
{
qDebug() << "==== Fake Akonadi Server starting up ====";
@@ -222,7 +228,9 @@ bool FakeAkonadiServer::init()
PreprocessorManager::instance()->setEnabled(false);
mSearchManager = new FakeSearchManager();
- mRetrievalManager = new FakeItemRetrievalManager();
+ if (!mDisableItemRetrievalManager) {
+ mRetrievalManager = new FakeItemRetrievalManager();
+ }
const QString socketFile = basePath() + QLatin1String("/local/share/akonadi/akonadiserver.socket");
diff --git a/autotests/server/fakeakonadiserver.h b/autotests/server/fakeakonadiserver.h
index d393dee..ddfc32c 100644
--- a/autotests/server/fakeakonadiserver.h
+++ b/autotests/server/fakeakonadiserver.h
@@ -110,6 +110,7 @@ public:
QSharedPointer<QSignalSpy> notificationSpy() const;
void setPopulateDb(bool populate);
+ void disableItemRetrievalManager();
protected:
void newCmdConnection(quintptr socketDescriptor) Q_DECL_OVERRIDE;
@@ -131,6 +132,7 @@ private:
QSharedPointer<QSignalSpy> mNotificationSpy;
bool mPopulateDb;
+ bool mDisableItemRetrievalManager;
static FakeAkonadiServer *sInstance;
};
diff --git a/autotests/server/itemretrievertest.cpp b/autotests/server/itemretrievertest.cpp
index bd79e83..9aa46b6 100644
--- a/autotests/server/itemretrievertest.cpp
+++ b/autotests/server/itemretrievertest.cpp
@@ -159,6 +159,7 @@ public:
{
try {
FakeAkonadiServer::instance()->setPopulateDb(false);
+ FakeAkonadiServer::instance()->disableItemRetrievalManager();
FakeAkonadiServer::instance()->init();
} catch (const FakeAkonadiServerException &e) {
qWarning() << "Server exception: " << e.what();