diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-18 18:36:41 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-01-18 18:36:41 +0100 |
commit | 67e83aadde8db2bb1293cee61e8c6306a4ffcca0 (patch) | |
tree | 10531201cb5dca7617e17a4e4393bda20694c4ca /tests/inspectiontest.cpp | |
parent | a857d9b36f80adf045cd195653cb2f8b91452981 (diff) | |
download | sink-67e83aadde8db2bb1293cee61e8c6306a4ffcca0.tar.gz sink-67e83aadde8db2bb1293cee61e8c6306a4ffcca0.zip |
Working resource inspection
Diffstat (limited to 'tests/inspectiontest.cpp')
-rw-r--r-- | tests/inspectiontest.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/tests/inspectiontest.cpp b/tests/inspectiontest.cpp index e332844..29cce6c 100644 --- a/tests/inspectiontest.cpp +++ b/tests/inspectiontest.cpp | |||
@@ -4,11 +4,7 @@ | |||
4 | 4 | ||
5 | #include "dummyresource/resourcefactory.h" | 5 | #include "dummyresource/resourcefactory.h" |
6 | #include "clientapi.h" | 6 | #include "clientapi.h" |
7 | #include "commands.h" | ||
8 | #include "entitybuffer.h" | ||
9 | #include "resourceconfig.h" | 7 | #include "resourceconfig.h" |
10 | #include "modelresult.h" | ||
11 | #include "pipeline.h" | ||
12 | #include "log.h" | 8 | #include "log.h" |
13 | 9 | ||
14 | /** | 10 | /** |
@@ -38,25 +34,30 @@ private Q_SLOTS: | |||
38 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 34 | Akonadi2::Store::start(QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); |
39 | } | 35 | } |
40 | 36 | ||
41 | void init() | 37 | void testInspection_data() |
42 | { | 38 | { |
43 | qDebug(); | 39 | QTest::addColumn<bool>("success"); |
44 | qDebug() << "-----------------------------------------"; | 40 | QTest::newRow("success") << true; |
45 | qDebug(); | 41 | QTest::newRow("fail") << false; |
46 | } | 42 | } |
47 | 43 | ||
48 | void testMarkMailAsRead() | 44 | void testInspection() |
49 | { | 45 | { |
46 | QFETCH(bool, success); | ||
50 | using namespace Akonadi2; | 47 | using namespace Akonadi2; |
51 | using namespace Akonadi2::ApplicationDomain; | 48 | using namespace Akonadi2::ApplicationDomain; |
52 | 49 | ||
53 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); | 50 | Mail mail(QByteArray("org.kde.dummy.instance1"), QByteArray("identifier"), 0, QSharedPointer<MemoryBufferAdaptor::MemoryBufferAdaptor>::create()); |
54 | 51 | ||
55 | auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "unread", true); | 52 | //testInspection is a magic property that the dummyresource supports |
53 | auto inspectionCommand = Resources::Inspection::PropertyInspection(mail, "testInspection", success); | ||
56 | auto result = Resources::inspect<Mail>(inspectionCommand).exec(); | 54 | auto result = Resources::inspect<Mail>(inspectionCommand).exec(); |
57 | result.waitForFinished(); | 55 | result.waitForFinished(); |
58 | QVERIFY(!result.errorCode()); | 56 | if (success) { |
59 | Akonadi2::Store::flushMessageQueue(QByteArrayList() << QByteArray("org.kde.dummy.instance1")).exec().waitForFinished(); | 57 | QVERIFY(!result.errorCode()); |
58 | } else { | ||
59 | QVERIFY(result.errorCode()); | ||
60 | } | ||
60 | } | 61 | } |
61 | }; | 62 | }; |
62 | 63 | ||