[telepathy-qt4/master] text-chan test: Wait untill messages have been received.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Wed Jun 3 05:45:37 PDT 2009


TextChannel now becomes ready even if message queue is empty, so let's wait
until messages have been received.
---
 tests/dbus/text-chan.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tests/dbus/text-chan.cpp b/tests/dbus/text-chan.cpp
index ffedd50..bfa249e 100644
--- a/tests/dbus/text-chan.cpp
+++ b/tests/dbus/text-chan.cpp
@@ -86,6 +86,7 @@ private:
 void TestTextChan::onMessageReceived(const ReceivedMessage &message)
 {
     received << message;
+    mLoop->exit(0);
 }
 
 void TestTextChan::onMessageRemoved(const ReceivedMessage &message)
@@ -306,6 +307,9 @@ void TestTextChan::commonTest(bool withMessages)
     QVERIFY(mChan->isReady(features));
 
     // Assert that both our sent messages were echoed by the remote contact
+    while (received.size() != 2) {
+        QCOMPARE(mLoop->exec(), 0);
+    }
     QCOMPARE(received.size(), 2);
     QCOMPARE(mChan->messageQueue().size(), 2);
     QVERIFY(mChan->messageQueue().at(0) == received.at(0));
-- 
1.5.6.5




More information about the telepathy-commits mailing list