telepathy-qt: Modernize TestConnHelper::ensureChannel()
Alexandr Akulich
kaffeine at kemper.freedesktop.org
Mon Nov 11 17:28:14 UTC 2019
Module: telepathy-qt
Branch: master
Commit: 2d1512d5c7ef58dcd5e20ab42f1306ac6a8ad6dd
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=2d1512d5c7ef58dcd5e20ab42f1306ac6a8ad6dd
Author: Alexander Akulich <akulichalexander at gmail.com>
Date: Sun Oct 27 19:09:41 2019 +0300
Modernize TestConnHelper::ensureChannel()
---
tests/lib/glib-helpers/test-conn-helper.cpp | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/tests/lib/glib-helpers/test-conn-helper.cpp b/tests/lib/glib-helpers/test-conn-helper.cpp
index c9d5cca8..05cec558 100644
--- a/tests/lib/glib-helpers/test-conn-helper.cpp
+++ b/tests/lib/glib-helpers/test-conn-helper.cpp
@@ -289,16 +289,21 @@ Tp::ChannelPtr TestConnHelper::ensureChannel(const QVariantMap &request)
{
mLoop->processEvents();
- Tp::ChannelPtr ret;
Tp::PendingChannel *pc = mClient->lowlevel()->ensureChannel(request);
- QObject::connect(pc,
- SIGNAL(finished(Tp::PendingOperation*)),
- SLOT(expectEnsureChannelFinished(Tp::PendingOperation*)));
- if (mLoop->exec() == 0) {
- ret = mChannel;
+ QSignalSpy pcSpy(pc, &Tp::PendingOperation::finished);
+ if (!pcSpy.wait()) {
+ qWarning() << "Unable to wait!";
+ return Tp::ChannelPtr();
}
- mChannel.reset();
- return ret;
+
+ if (pc->isError()) {
+ qWarning().nospace() << pc->errorName() << ": " << pc->errorMessage();
+ return Tp::ChannelPtr();
+ }
+ if (pc->yours()) {
+ qDebug() << "ensureChannel() created a new channel for this call!";
+ }
+ return pc->channel();
}
Tp::ChannelPtr TestConnHelper::ensureChannel(const QString &channelType, const Tp::ContactPtr &target)
More information about the telepathy-commits
mailing list