summaryrefslogtreecommitdiffstats
path: root/tests/querytest.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-12 16:08:14 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-12 16:08:14 +0200
commitb948ffa771054e8a7780ccfc38de11762bcdfcd6 (patch)
treec80d412f04e4c09133d7567e7cbc184e62ab1ef5 /tests/querytest.cpp
parenta867e3cdc35a4a3efc65c6ba292b62f3e1cbeb72 (diff)
downloadsink-b948ffa771054e8a7780ccfc38de11762bcdfcd6.tar.gz
sink-b948ffa771054e8a7780ccfc38de11762bcdfcd6.zip
React to new resources
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r--tests/querytest.cpp19
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
328QTEST_MAIN(QueryTest) 345QTEST_MAIN(QueryTest)