diff options
Diffstat (limited to 'tests/querytest.cpp')
-rw-r--r-- | tests/querytest.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/querytest.cpp b/tests/querytest.cpp index 6011a99..6348316 100644 --- a/tests/querytest.cpp +++ b/tests/querytest.cpp | |||
@@ -528,6 +528,36 @@ private slots: | |||
528 | QCOMPARE(mails.size(), 1); | 528 | QCOMPARE(mails.size(), 1); |
529 | QCOMPARE(mails.first().getUid().toLatin1(), QByteArray("mail1")); | 529 | QCOMPARE(mails.first().getUid().toLatin1(), QByteArray("mail1")); |
530 | } | 530 | } |
531 | |||
532 | void testResourceSubQuery() | ||
533 | { | ||
534 | using namespace Sink; | ||
535 | using namespace Sink::ApplicationDomain; | ||
536 | |||
537 | //Setup | ||
538 | auto resource1 = ApplicationDomainType::createEntity<SinkResource>(); | ||
539 | resource1.setResourceType("sink.dummy"); | ||
540 | resource1.setCapabilities(QByteArrayList() << "cap1"); | ||
541 | Store::create(resource1).exec().waitForFinished(); | ||
542 | |||
543 | auto resource2 = ApplicationDomainType::createEntity<SinkResource>(); | ||
544 | resource2.setCapabilities(QByteArrayList() << "cap2"); | ||
545 | resource2.setResourceType("sink.dummy"); | ||
546 | Store::create(resource2).exec().waitForFinished(); | ||
547 | |||
548 | Folder folder1(resource1.identifier()); | ||
549 | VERIFYEXEC(Sink::Store::create<Folder>(folder1)); | ||
550 | Folder folder2(resource2.identifier()); | ||
551 | VERIFYEXEC(Sink::Store::create<Folder>(folder2)); | ||
552 | |||
553 | // Test | ||
554 | Sink::Query query; | ||
555 | query.filter<Folder::Resource>(Sink::Query().containsFilter<SinkResource::Capabilities>("cap1")); | ||
556 | |||
557 | // We fetch before the data is available and rely on the live query mechanism to deliver the actual data | ||
558 | auto folders = Sink::Store::read<Folder>(query); | ||
559 | QCOMPARE(folders.size(), 1); | ||
560 | } | ||
531 | }; | 561 | }; |
532 | 562 | ||
533 | QTEST_MAIN(QueryTest) | 563 | QTEST_MAIN(QueryTest) |