diff options
Diffstat (limited to 'tests/pipelinetest.cpp')
-rw-r--r-- | tests/pipelinetest.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/pipelinetest.cpp b/tests/pipelinetest.cpp index c74d319..baa67f6 100644 --- a/tests/pipelinetest.cpp +++ b/tests/pipelinetest.cpp | |||
@@ -52,7 +52,7 @@ static QByteArray getEntity(const QByteArray &dbEnv, const QByteArray &name, con | |||
52 | return result; | 52 | return result; |
53 | } | 53 | } |
54 | 54 | ||
55 | flatbuffers::FlatBufferBuilder &createEvent(flatbuffers::FlatBufferBuilder &entityFbb, const QString &s = QString("summary")) | 55 | flatbuffers::FlatBufferBuilder &createEvent(flatbuffers::FlatBufferBuilder &entityFbb, const QString &s = QString("summary"), const QString &d = QString()) |
56 | { | 56 | { |
57 | flatbuffers::FlatBufferBuilder eventFbb; | 57 | flatbuffers::FlatBufferBuilder eventFbb; |
58 | eventFbb.Clear(); | 58 | eventFbb.Clear(); |
@@ -66,9 +66,13 @@ flatbuffers::FlatBufferBuilder &createEvent(flatbuffers::FlatBufferBuilder &enti | |||
66 | { | 66 | { |
67 | auto uid = localFbb.CreateString("testuid"); | 67 | auto uid = localFbb.CreateString("testuid"); |
68 | auto summary = localFbb.CreateString(s.toStdString()); | 68 | auto summary = localFbb.CreateString(s.toStdString()); |
69 | auto description = localFbb.CreateString(d.toStdString()); | ||
69 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); | 70 | auto localBuilder = Sink::ApplicationDomain::Buffer::EventBuilder(localFbb); |
70 | localBuilder.add_uid(uid); | 71 | localBuilder.add_uid(uid); |
71 | localBuilder.add_summary(summary); | 72 | localBuilder.add_summary(summary); |
73 | if (!d.isEmpty()) { | ||
74 | localBuilder.add_description(description); | ||
75 | } | ||
72 | auto location = localBuilder.Finish(); | 76 | auto location = localBuilder.Finish(); |
73 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | 77 | Sink::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); |
74 | } | 78 | } |
@@ -203,7 +207,7 @@ private Q_SLOTS: | |||
203 | void testModify() | 207 | void testModify() |
204 | { | 208 | { |
205 | flatbuffers::FlatBufferBuilder entityFbb; | 209 | flatbuffers::FlatBufferBuilder entityFbb; |
206 | auto command = createEntityCommand(createEvent(entityFbb)); | 210 | auto command = createEntityCommand(createEvent(entityFbb, "summary", "description")); |
207 | 211 | ||
208 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); | 212 | Sink::Pipeline pipeline("org.kde.pipelinetest.instance1"); |
209 | 213 | ||
@@ -233,7 +237,9 @@ private Q_SLOTS: | |||
233 | QVERIFY(!buffer.isEmpty()); | 237 | QVERIFY(!buffer.isEmpty()); |
234 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); | 238 | Sink::EntityBuffer entityBuffer(buffer.data(), buffer.size()); |
235 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); | 239 | auto adaptor = adaptorFactory->createAdaptor(entityBuffer.entity()); |
236 | QCOMPARE(adaptor->getProperty("summary").toString(), QString("summary2")); | 240 | QVERIFY2(adaptor->getProperty("summary").toString() == QString("summary2"), "The modification isn't applied."); |
241 | //Ensure we didn't modify anything else | ||
242 | QVERIFY2(adaptor->getProperty("description").toString() == QString("description"), "The modification has sideeffects."); | ||
237 | 243 | ||
238 | //Both revisions are in the store at this point | 244 | //Both revisions are in the store at this point |
239 | QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); | 245 | QCOMPARE(getKeys("org.kde.pipelinetest.instance1", "event.main").size(), 2); |