[telepathy-qt4/master] Channel: Check if change-reason is being used properly on invalidate (Closed) when removing self handle.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Fri Jul 24 10:59:53 PDT 2009
---
tests/dbus/chan-group.cpp | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/tests/dbus/chan-group.cpp b/tests/dbus/chan-group.cpp
index 2416ea9..843ba8f 100644
--- a/tests/dbus/chan-group.cpp
+++ b/tests/dbus/chan-group.cpp
@@ -35,6 +35,7 @@ public:
protected Q_SLOTS:
void expectConnReady(uint, uint);
void expectConnInvalidated();
+ void expectChanInvalidated(Tp::DBusProxy*,const QString &, const QString &);
void expectPendingRoomHandlesFinished(Tp::PendingOperation*);
void expectPendingContactHandlesFinished(Tp::PendingOperation*);
void expectCreateChannelFinished(Tp::PendingOperation *);
@@ -82,6 +83,8 @@ private:
Contacts mChangedRemoved;
Channel::GroupMemberChangeDetails mDetails;
bool mRequested;
+ QString mChanInvalidatedErrorName;
+ QString mChanInvalidatedErrorMessage;
};
void TestChanGroup::expectConnReady(uint newStatus, uint newStatusReason)
@@ -112,6 +115,15 @@ void TestChanGroup::expectConnInvalidated()
mLoop->exit(0);
}
+void TestChanGroup::expectChanInvalidated(Tp::DBusProxy *proxy,
+ const QString &errorName, const QString &errorMessage)
+{
+ Q_UNUSED(proxy);
+ mChanInvalidatedErrorName = errorName;
+ mChanInvalidatedErrorMessage = errorMessage;
+ mLoop->exit(0);
+}
+
void TestChanGroup::expectPendingRoomHandlesFinished(PendingOperation *op)
{
if (!op->isFinished()) {
@@ -560,6 +572,10 @@ void TestChanGroup::doTestCreateChannel()
expectedIds.sort();
checkExpectedIds(mChan->groupContacts(), expectedIds);
+ QVERIFY(connect(mChan.data(),
+ SIGNAL(invalidated(Tp::DBusProxy *, const QString &, const QString &)),
+ SLOT(expectChanInvalidated(Tp::DBusProxy *, const QString &, const QString &))));
+
mChan->groupRemoveContacts(QList<ContactPtr>() << mChan->groupSelfContact(), "I want to remove myself");
QCOMPARE(mLoop->exec(), 0);
QCOMPARE(mChan->groupSelfContactRemoveInfo().hasActor(), true);
@@ -568,6 +584,13 @@ void TestChanGroup::doTestCreateChannel()
QCOMPARE(mChan->groupSelfContactRemoveInfo().message(), QString("I want to remove myself"));
QCOMPARE(mChan->groupSelfContactRemoveInfo().hasError(), false);
+ // wait until chan gets invalidated
+ while (mChan->isValid()) {
+ QCOMPARE(mLoop->exec(), 0);
+ }
+ QCOMPARE(mChanInvalidatedErrorName, QString(TELEPATHY_ERROR_CANCELLED));
+ QCOMPARE(mChanInvalidatedErrorMessage, QString("I want to remove myself"));
+
mChan.reset();
}
--
1.5.6.5
More information about the telepathy-commits
mailing list