diff options
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index ddb59a5..c469796 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -14,7 +14,7 @@ | |||
14 | 14 | ||
15 | static void removeFromDisk(const QString &name) | 15 | static void removeFromDisk(const QString &name) |
16 | { | 16 | { |
17 | Akonadi2::Storage store(Akonadi2::Store::storageLocation(), "org.kde.dummy", Akonadi2::Storage::ReadWrite); | 17 | Akonadi2::Storage store(Akonadi2::Store::storageLocation(), name, Akonadi2::Storage::ReadWrite); |
18 | store.removeFromDisk(); | 18 | store.removeFromDisk(); |
19 | } | 19 | } |
20 | 20 | ||
@@ -33,6 +33,9 @@ private Q_SLOTS: | |||
33 | 33 | ||
34 | void cleanupTestCase() | 34 | void cleanupTestCase() |
35 | { | 35 | { |
36 | removeFromDisk("org.kde.dummy"); | ||
37 | removeFromDisk("org.kde.dummy.userqueue"); | ||
38 | removeFromDisk("org.kde.dummy.synchronizerqueue"); | ||
36 | } | 39 | } |
37 | 40 | ||
38 | void testProcessCommand() | 41 | void testProcessCommand() |
@@ -60,13 +63,23 @@ private Q_SLOTS: | |||
60 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | 63 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); |
61 | 64 | ||
62 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | 65 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); |
66 | { | ||
67 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | ||
68 | QVERIFY(Akonadi2::Commands::VerifyCreateEntityBuffer(verifyer)); | ||
69 | } | ||
63 | 70 | ||
71 | //Actual test | ||
64 | Akonadi2::Pipeline pipeline("org.kde.dummy"); | 72 | Akonadi2::Pipeline pipeline("org.kde.dummy"); |
73 | QSignalSpy revisionSpy(&pipeline, SIGNAL(revisionUpdated())); | ||
65 | DummyResource resource; | 74 | DummyResource resource; |
66 | resource.configurePipeline(&pipeline); | 75 | resource.configurePipeline(&pipeline); |
67 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, command.size(), &pipeline); | 76 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, command.size(), &pipeline); |
68 | //TODO wait until the pipeline has processed the command | 77 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, command.size(), &pipeline); |
69 | QTest::qWait(1000); | 78 | |
79 | QVERIFY(revisionSpy.isValid()); | ||
80 | QTRY_COMPARE(revisionSpy.count(), 2); | ||
81 | QTest::qWait(100); | ||
82 | QCOMPARE(revisionSpy.count(), 2); | ||
70 | } | 83 | } |
71 | 84 | ||
72 | // void testResourceSync() | 85 | // void testResourceSync() |