diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-12-03 20:32:29 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2014-12-03 20:32:29 +0100 |
commit | 21138cfb7a4537626e11bdf084fcf9d672361059 (patch) | |
tree | 819702ab7d0eb7a11695995b95aac92352599195 /client/test/clientapitest.cpp | |
parent | 430799c3fc8ef473e390f6a6977a7aca695796ad (diff) | |
download | sink-21138cfb7a4537626e11bdf084fcf9d672361059.tar.gz sink-21138cfb7a4537626e11bdf084fcf9d672361059.zip |
Return QSharedPointer wrapped and heap allocated results.
Diffstat (limited to 'client/test/clientapitest.cpp')
-rw-r--r-- | client/test/clientapitest.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/client/test/clientapitest.cpp b/client/test/clientapitest.cpp index 8d8f552..bff910b 100644 --- a/client/test/clientapitest.cpp +++ b/client/test/clientapitest.cpp | |||
@@ -11,7 +11,7 @@ public: | |||
11 | virtual void create(const Akonadi2::Domain::Event &domainObject){}; | 11 | virtual void create(const Akonadi2::Domain::Event &domainObject){}; |
12 | virtual void modify(const Akonadi2::Domain::Event &domainObject){}; | 12 | virtual void modify(const Akonadi2::Domain::Event &domainObject){}; |
13 | virtual void remove(const Akonadi2::Domain::Event &domainObject){}; | 13 | virtual void remove(const Akonadi2::Domain::Event &domainObject){}; |
14 | virtual void load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event &)> &resultCallback) | 14 | virtual void load(const Akonadi2::Query &query, const std::function<void(const Akonadi2::Domain::Event::Ptr &)> &resultCallback) |
15 | { | 15 | { |
16 | qDebug() << "load called"; | 16 | qDebug() << "load called"; |
17 | for(const auto &result : results) { | 17 | for(const auto &result : results) { |
@@ -19,7 +19,7 @@ public: | |||
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | QList<Akonadi2::Domain::Event> results; | 22 | QList<Akonadi2::Domain::Event::Ptr> results; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | class ClientAPITest : public QObject | 25 | class ClientAPITest : public QObject |
@@ -30,7 +30,7 @@ private Q_SLOTS: | |||
30 | void testLoad() | 30 | void testLoad() |
31 | { | 31 | { |
32 | DummyResourceFacade facade; | 32 | DummyResourceFacade facade; |
33 | facade.results << Akonadi2::Domain::Event(); | 33 | facade.results << QSharedPointer<Akonadi2::Domain::Event>::create("resource", "id", 0); |
34 | 34 | ||
35 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::Domain::Event, DummyResourceFacade>("dummyresource", [facade](){ return new DummyResourceFacade(facade); }); | 35 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::Domain::Event, DummyResourceFacade>("dummyresource", [facade](){ return new DummyResourceFacade(facade); }); |
36 | 36 | ||
@@ -39,8 +39,8 @@ private Q_SLOTS: | |||
39 | 39 | ||
40 | auto result = Akonadi2::Store::load<Akonadi2::Domain::Event>(query); | 40 | auto result = Akonadi2::Store::load<Akonadi2::Domain::Event>(query); |
41 | 41 | ||
42 | QList<Akonadi2::Domain::Event> resultSet; | 42 | QList<Akonadi2::Domain::Event::Ptr> resultSet; |
43 | result->onAdded([&resultSet](const Akonadi2::Domain::Event &event){ resultSet << event; qDebug() << "result added";}); | 43 | result->onAdded([&resultSet](const Akonadi2::Domain::Event::Ptr &event){ resultSet << event; qDebug() << "result added";}); |
44 | 44 | ||
45 | bool complete; | 45 | bool complete; |
46 | result->onComplete([&complete]{ complete = true; qDebug() << "complete";}); | 46 | result->onComplete([&complete]{ complete = true; qDebug() << "complete";}); |