From b948ffa771054e8a7780ccfc38de11762bcdfcd6 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Tue, 12 Jul 2016 16:08:14 +0200 Subject: React to new resources --- tests/querytest.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tests') 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 @@ #include -#include "dummyresource/resourcefactory.h" +#include "resource.h" #include "store.h" #include "resourcecontrol.h" #include "commands.h" @@ -10,6 +10,7 @@ #include "log.h" #include "modelresult.h" #include "test.h" +#include "testutils.h" /** * Test of the query system using the dummy resource. @@ -323,6 +324,22 @@ private slots: // We can't make any assumptions about the order of the indexes // QCOMPARE(model->index(1, 0).data(Sink::Store::DomainObjectRole).value()->getProperty("uid").toByteArray(), QByteArray("testSecond")); } + + void testReactToNewResource() + { + Sink::Query query; + query.liveQuery = true; + auto model = Sink::Store::loadModel(query); + QTRY_COMPARE(model->rowCount(QModelIndex()), 0); + + auto res = Sink::ApplicationDomain::DummyResource::create(""); + VERIFYEXEC(Sink::Store::create(res)); + auto folder = Sink::ApplicationDomain::Folder::create(res.identifier()); + VERIFYEXEC(Sink::Store::create(folder)); + QTRY_COMPARE(model->rowCount(QModelIndex()), 1); + + VERIFYEXEC(Sink::Store::remove(res)); + } }; QTEST_MAIN(QueryTest) -- cgit v1.2.3