diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-07 03:13:12 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-07 03:13:12 +0200 |
commit | 9e967283190d36510fbcf73a79cc239dc696ec85 (patch) | |
tree | dd47c2b0da875cd283cc665bd43c284fa9d8a6f7 /tests/clientapitest.cpp | |
parent | 4cc398f059d3aed8236e528a4992e7799790859e (diff) | |
download | sink-9e967283190d36510fbcf73a79cc239dc696ec85.tar.gz sink-9e967283190d36510fbcf73a79cc239dc696ec85.zip |
Remove externallyManaged hack now that we use std::shared_ptr
Diffstat (limited to 'tests/clientapitest.cpp')
-rw-r--r-- | tests/clientapitest.cpp | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/tests/clientapitest.cpp b/tests/clientapitest.cpp index 30c52fc..081e6ad 100644 --- a/tests/clientapitest.cpp +++ b/tests/clientapitest.cpp | |||
@@ -106,13 +106,12 @@ private Q_SLOTS: | |||
106 | 106 | ||
107 | void testLoad() | 107 | void testLoad() |
108 | { | 108 | { |
109 | DummyResourceFacade facade; | 109 | auto facade = std::make_shared<DummyResourceFacade>(); |
110 | facade.results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 110 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
111 | 111 | ||
112 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", | 112 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", |
113 | [&facade](bool &externallyManaged) { | 113 | [facade]() { |
114 | externallyManaged = true; | 114 | return facade; |
115 | return &facade; | ||
116 | } | 115 | } |
117 | ); | 116 | ); |
118 | 117 | ||
@@ -127,13 +126,12 @@ private Q_SLOTS: | |||
127 | 126 | ||
128 | void testLiveQuery() | 127 | void testLiveQuery() |
129 | { | 128 | { |
130 | DummyResourceFacade facade; | 129 | auto facade = std::make_shared<DummyResourceFacade>(); |
131 | facade.results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 130 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
132 | 131 | ||
133 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", | 132 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", |
134 | [&facade](bool &externallyManaged){ | 133 | [facade](){ |
135 | externallyManaged = true; | 134 | return facade; |
136 | return &facade; | ||
137 | } | 135 | } |
138 | ); | 136 | ); |
139 | 137 | ||
@@ -146,22 +144,20 @@ private Q_SLOTS: | |||
146 | QCOMPARE(result.size(), 1); | 144 | QCOMPARE(result.size(), 1); |
147 | 145 | ||
148 | //Enter a second result | 146 | //Enter a second result |
149 | facade.results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 147 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id2", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
150 | qWarning() << &facade; | 148 | QVERIFY(facade->notifier); |
151 | QVERIFY(facade.notifier); | 149 | facade->notifier->revisionChanged(2); |
152 | facade.notifier->revisionChanged(2); | ||
153 | QTRY_COMPARE(result.size(), 2); | 150 | QTRY_COMPARE(result.size(), 2); |
154 | } | 151 | } |
155 | 152 | ||
156 | void testQueryLifetime() | 153 | void testQueryLifetime() |
157 | { | 154 | { |
158 | DummyResourceFacade facade; | 155 | auto facade = std::make_shared<DummyResourceFacade>(); |
159 | facade.results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); | 156 | facade->results << QSharedPointer<Akonadi2::ApplicationDomain::Event>::create("resource", "id", 0, QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor>()); |
160 | 157 | ||
161 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", | 158 | Akonadi2::FacadeFactory::instance().registerFacade<Akonadi2::ApplicationDomain::Event, DummyResourceFacade>("dummyresource", |
162 | [&facade](bool &externallyManaged){ | 159 | [facade](){ |
163 | externallyManaged = true; | 160 | return facade; |
164 | return &facade; | ||
165 | } | 161 | } |
166 | ); | 162 | ); |
167 | 163 | ||
@@ -175,7 +171,7 @@ private Q_SLOTS: | |||
175 | QCOMPARE(result.size(), 1); | 171 | QCOMPARE(result.size(), 1); |
176 | } | 172 | } |
177 | //It's running in a separate thread, so we have to wait for a moment. | 173 | //It's running in a separate thread, so we have to wait for a moment. |
178 | QTRY_VERIFY(!facade.capturedResultProvider); | 174 | QTRY_VERIFY(!facade->capturedResultProvider); |
179 | } | 175 | } |
180 | 176 | ||
181 | }; | 177 | }; |