diff options
Diffstat (limited to 'tests/resourcecommunicationtest.cpp')
-rw-r--r-- | tests/resourcecommunicationtest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp index f1cef50..1ab516a 100644 --- a/tests/resourcecommunicationtest.cpp +++ b/tests/resourcecommunicationtest.cpp | |||
@@ -35,6 +35,31 @@ private Q_SLOTS: | |||
35 | result.waitForFinished(); | 35 | result.waitForFinished(); |
36 | QVERIFY(!result.errorCode()); | 36 | QVERIFY(!result.errorCode()); |
37 | } | 37 | } |
38 | |||
39 | void testCommandLoop() | ||
40 | { | ||
41 | const QByteArray resourceIdentifier("test"); | ||
42 | Listener listener(resourceIdentifier); | ||
43 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | ||
44 | resourceAccess.open(); | ||
45 | |||
46 | const int count = 500; | ||
47 | int complete = 0; | ||
48 | int errors = 0; | ||
49 | for (int i = 0; i < count; i++) { | ||
50 | auto result = resourceAccess.sendCommand(Akonadi2::Commands::PingCommand) | ||
51 | .then<void>([&complete]() { | ||
52 | complete++; | ||
53 | }, | ||
54 | [&errors, &complete](int error, const QString &msg) { | ||
55 | qWarning() << msg; | ||
56 | errors++; | ||
57 | complete++; | ||
58 | }).exec(); | ||
59 | } | ||
60 | QTRY_COMPARE(complete, count); | ||
61 | QVERIFY(!errors); | ||
62 | } | ||
38 | }; | 63 | }; |
39 | 64 | ||
40 | QTEST_MAIN(ResourceCommunicationTest) | 65 | QTEST_MAIN(ResourceCommunicationTest) |