[Telepathy-commits] [telepathy-qt4/master] text-chan: verify that we're notified about removed messages iff the channel has Messages
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Feb 20 08:39:05 PST 2009
---
tests/dbus/text-chan.cpp | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/tests/dbus/text-chan.cpp b/tests/dbus/text-chan.cpp
index e64a8f4..e3d042e 100644
--- a/tests/dbus/text-chan.cpp
+++ b/tests/dbus/text-chan.cpp
@@ -18,6 +18,7 @@
#include <tests/lib/test.h>
using namespace Telepathy::Client;
+using Telepathy::UIntList;
struct SentMessageDetails
{
@@ -386,6 +387,33 @@ void TestTextChan::commonTest(bool withMessages)
} else {
QCOMPARE(m.text(), QString::fromAscii("You said: Two"));
}
+
+ uint id = received.at(0).header().value(
+ QLatin1String("pending-message-id")).variant().toUInt();
+ // go behind the TextChannel's back to acknowledge the first message:
+ // this emulates another client doing so
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(
+ mChan->textInterface()->AcknowledgePendingMessages(
+ UIntList() << id));
+ QVERIFY(connect(watcher,
+ SIGNAL(finished(QDBusPendingCallWatcher *)),
+ SLOT(expectSuccessfulCall(QDBusPendingCallWatcher *))));
+ QCOMPARE(mLoop->exec(), 0);
+ delete watcher;
+
+ // on a channel with Messages, we're notified; on a channel with only Text,
+ // we're not notified
+ if (withMessages) {
+ QCOMPARE(mChan->messageQueue().size(), 1);
+ QVERIFY(mChan->messageQueue().at(0) == received.at(1));
+ QCOMPARE(removed.size(), 1);
+ QVERIFY(removed.at(0) == received.at(0));
+ } else {
+ QCOMPARE(mChan->messageQueue().size(), 2);
+ QVERIFY(mChan->messageQueue().at(0) == received.at(0));
+ QVERIFY(mChan->messageQueue().at(1) == received.at(1));
+ QCOMPARE(removed.size(), 0);
+ }
}
void TestTextChan::testMessages()
--
1.5.6.5
More information about the telepathy-commits
mailing list