diff options
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r-- | tests/querytest.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index d3a97f6..d72dc7d 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | #include <QString> | 3 | #include <QString> |
4 | 4 | ||
5 | #include "dummyresource/resourcefactory.h" | 5 | #include "resource.h" |
6 | #include "store.h" | 6 | #include "store.h" |
7 | #include "resourcecontrol.h" | 7 | #include "resourcecontrol.h" |
8 | #include "commands.h" | 8 | #include "commands.h" |
@@ -10,6 +10,7 @@ | |||
10 | #include "log.h" | 10 | #include "log.h" |
11 | #include "modelresult.h" | 11 | #include "modelresult.h" |
12 | #include "test.h" | 12 | #include "test.h" |
13 | #include "testutils.h" | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * Test of the query system using the dummy resource. | 16 | * Test of the query system using the dummy resource. |
@@ -323,6 +324,22 @@ private slots: | |||
323 | // We can't make any assumptions about the order of the indexes | 324 | // We can't make any assumptions about the order of the indexes |
324 | // QCOMPARE(model->index(1, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->getProperty("uid").toByteArray(), QByteArray("testSecond")); | 325 | // QCOMPARE(model->index(1, 0).data(Sink::Store::DomainObjectRole).value<Sink::ApplicationDomain::Mail::Ptr>()->getProperty("uid").toByteArray(), QByteArray("testSecond")); |
325 | } | 326 | } |
327 | |||
328 | void testReactToNewResource() | ||
329 | { | ||
330 | Sink::Query query; | ||
331 | query.liveQuery = true; | ||
332 | auto model = Sink::Store::loadModel<Sink::ApplicationDomain::Folder>(query); | ||
333 | QTRY_COMPARE(model->rowCount(QModelIndex()), 0); | ||
334 | |||
335 | auto res = Sink::ApplicationDomain::DummyResource::create(""); | ||
336 | VERIFYEXEC(Sink::Store::create(res)); | ||
337 | auto folder = Sink::ApplicationDomain::Folder::create(res.identifier()); | ||
338 | VERIFYEXEC(Sink::Store::create(folder)); | ||
339 | QTRY_COMPARE(model->rowCount(QModelIndex()), 1); | ||
340 | |||
341 | VERIFYEXEC(Sink::Store::remove(res)); | ||
342 | } | ||
326 | }; | 343 | }; |
327 | 344 | ||
328 | QTEST_MAIN(QueryTest) | 345 | QTEST_MAIN(QueryTest) |