diff options
Diffstat (limited to 'tests/resourcecommunicationtest.cpp')
-rw-r--r-- | tests/resourcecommunicationtest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/resourcecommunicationtest.cpp b/tests/resourcecommunicationtest.cpp index fa2b5a1..18e9223 100644 --- a/tests/resourcecommunicationtest.cpp +++ b/tests/resourcecommunicationtest.cpp | |||
@@ -63,6 +63,35 @@ private Q_SLOTS: | |||
63 | QTRY_COMPARE(complete, count); | 63 | QTRY_COMPARE(complete, count); |
64 | QVERIFY(!errors); | 64 | QVERIFY(!errors); |
65 | } | 65 | } |
66 | |||
67 | void testResourceAccessReuse() | ||
68 | { | ||
69 | qDebug(); | ||
70 | const QByteArray resourceIdentifier("test"); | ||
71 | Listener listener(resourceIdentifier); | ||
72 | Akonadi2::ResourceAccess resourceAccess(resourceIdentifier); | ||
73 | resourceAccess.open(); | ||
74 | |||
75 | const int count = 10; | ||
76 | int complete = 0; | ||
77 | int errors = 0; | ||
78 | for (int i = 0; i < count; i++) { | ||
79 | resourceAccess.sendCommand(Akonadi2::Commands::PingCommand) | ||
80 | .then<void>([&complete]() { | ||
81 | complete++; | ||
82 | }, | ||
83 | [&errors, &complete](int error, const QString &msg) { | ||
84 | qWarning() << msg; | ||
85 | errors++; | ||
86 | complete++; | ||
87 | }).then<void>([&resourceAccess]() { | ||
88 | resourceAccess.close(); | ||
89 | resourceAccess.open(); | ||
90 | }).exec().waitForFinished(); | ||
91 | } | ||
92 | QTRY_COMPARE(complete, count); | ||
93 | QVERIFY(!errors); | ||
94 | } | ||
66 | }; | 95 | }; |
67 | 96 | ||
68 | QTEST_MAIN(ResourceCommunicationTest) | 97 | QTEST_MAIN(ResourceCommunicationTest) |