diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-24 12:51:58 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-27 23:22:10 +0200 |
commit | 4430eabdfeddf02c20424508a2a4207b6b4a764e (patch) | |
tree | e0eea7a4ba9e109fbc8e2baa774c3397e888757d /tests/dummyresourcetest.cpp | |
parent | 71aace61b7b1c27ac9296a882b209fe966be5848 (diff) | |
download | sink-4430eabdfeddf02c20424508a2a4207b6b4a764e.tar.gz sink-4430eabdfeddf02c20424508a2a4207b6b4a764e.zip |
Test generic stuff separately from the dummyresource
Diffstat (limited to 'tests/dummyresourcetest.cpp')
-rw-r--r-- | tests/dummyresourcetest.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/tests/dummyresourcetest.cpp b/tests/dummyresourcetest.cpp index ab2ca78..10cd7e3 100644 --- a/tests/dummyresourcetest.cpp +++ b/tests/dummyresourcetest.cpp | |||
@@ -52,59 +52,6 @@ private Q_SLOTS: | |||
52 | qDebug(); | 52 | qDebug(); |
53 | } | 53 | } |
54 | 54 | ||
55 | void testProcessCommand() | ||
56 | { | ||
57 | flatbuffers::FlatBufferBuilder eventFbb; | ||
58 | eventFbb.Clear(); | ||
59 | { | ||
60 | auto summary = eventFbb.CreateString("summary"); | ||
61 | Akonadi2::ApplicationDomain::Buffer::EventBuilder eventBuilder(eventFbb); | ||
62 | eventBuilder.add_summary(summary); | ||
63 | auto eventLocation = eventBuilder.Finish(); | ||
64 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(eventFbb, eventLocation); | ||
65 | } | ||
66 | |||
67 | flatbuffers::FlatBufferBuilder localFbb; | ||
68 | { | ||
69 | auto uid = localFbb.CreateString("testuid"); | ||
70 | auto localBuilder = Akonadi2::ApplicationDomain::Buffer::EventBuilder(localFbb); | ||
71 | localBuilder.add_uid(uid); | ||
72 | auto location = localBuilder.Finish(); | ||
73 | Akonadi2::ApplicationDomain::Buffer::FinishEventBuffer(localFbb, location); | ||
74 | } | ||
75 | |||
76 | flatbuffers::FlatBufferBuilder entityFbb; | ||
77 | Akonadi2::EntityBuffer::assembleEntityBuffer(entityFbb, 0, 0, eventFbb.GetBufferPointer(), eventFbb.GetSize(), localFbb.GetBufferPointer(), localFbb.GetSize()); | ||
78 | |||
79 | flatbuffers::FlatBufferBuilder fbb; | ||
80 | auto type = fbb.CreateString(Akonadi2::ApplicationDomain::getTypeName<Akonadi2::ApplicationDomain::Event>().toStdString().data()); | ||
81 | auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); | ||
82 | Akonadi2::Commands::CreateEntityBuilder builder(fbb); | ||
83 | builder.add_domainType(type); | ||
84 | builder.add_delta(delta); | ||
85 | auto location = builder.Finish(); | ||
86 | Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); | ||
87 | |||
88 | const QByteArray command(reinterpret_cast<const char *>(fbb.GetBufferPointer()), fbb.GetSize()); | ||
89 | { | ||
90 | flatbuffers::Verifier verifyer(reinterpret_cast<const uint8_t *>(command.data()), command.size()); | ||
91 | QVERIFY(Akonadi2::Commands::VerifyCreateEntityBuffer(verifyer)); | ||
92 | } | ||
93 | |||
94 | //Actual test | ||
95 | Akonadi2::Pipeline pipeline("org.kde.dummy.instance1"); | ||
96 | QSignalSpy revisionSpy(&pipeline, SIGNAL(revisionUpdated())); | ||
97 | DummyResource resource("org.kde.dummy.instance1"); | ||
98 | resource.configurePipeline(&pipeline); | ||
99 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, &pipeline); | ||
100 | resource.processCommand(Akonadi2::Commands::CreateEntityCommand, command, &pipeline); | ||
101 | |||
102 | QVERIFY(revisionSpy.isValid()); | ||
103 | QTRY_COMPARE(revisionSpy.count(), 2); | ||
104 | QTest::qWait(100); | ||
105 | QCOMPARE(revisionSpy.count(), 2); | ||
106 | } | ||
107 | |||
108 | void testProperty() | 55 | void testProperty() |
109 | { | 56 | { |
110 | Akonadi2::ApplicationDomain::Event event; | 57 | Akonadi2::ApplicationDomain::Event event; |