summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-02-05 17:04:44 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-02-05 17:04:44 (GMT)
commit0468ee852e54f81043ff9589951c1d9f88a1848e (patch)
treed4d7369c470bc4269c309fa84724ae5939365a4d /Swiften/MUC/UnitTest/MUCTest.cpp
parent374ebf0f8c32c4fd8758af4b8381ac5cff0d151c (diff)
downloadswift-0468ee852e54f81043ff9589951c1d9f88a1848e.zip
swift-0468ee852e54f81043ff9589951c1d9f88a1848e.tar.bz2
Fixed some bugs with MUC joining.
Diffstat (limited to 'Swiften/MUC/UnitTest/MUCTest.cpp')
-rw-r--r--Swiften/MUC/UnitTest/MUCTest.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp
index 1e3582b..fd07711 100644
--- a/Swiften/MUC/UnitTest/MUCTest.cpp
+++ b/Swiften/MUC/UnitTest/MUCTest.cpp
@@ -21,7 +21,8 @@ using namespace Swift;
class MUCTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MUCTest);
CPPUNIT_TEST(testJoin);
- CPPUNIT_TEST(testJoin_ChangePresenceDuringJoin);
+ CPPUNIT_TEST(testJoin_ChangePresenceDuringJoinDoesNotSendPresenceBeforeJoinSuccess);
+ CPPUNIT_TEST(testJoin_ChangePresenceDuringJoinResendsPresenceAfterJoinSuccess);
/*CPPUNIT_TEST(testJoin_Success);
CPPUNIT_TEST(testJoin_Fail);*/
CPPUNIT_TEST_SUITE_END();
@@ -53,15 +54,26 @@ class MUCTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/Alice"), p->getTo());
}
- void testJoin_ChangePresenceDuringJoin() {
+ void testJoin_ChangePresenceDuringJoinDoesNotSendPresenceBeforeJoinSuccess() {
MUC::ref testling = createMUC(JID("foo@bar.com"));
testling->joinAs("Alice");
presenceSender->sendPresence(Presence::create("Test"));
+ CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(channel->sentStanzas.size()));
+ }
+
+ void testJoin_ChangePresenceDuringJoinResendsPresenceAfterJoinSuccess() {
+ MUC::ref testling = createMUC(JID("foo@bar.com"));
+ testling->joinAs("Alice");
+
+ presenceSender->sendPresence(Presence::create("Test"));
+ receivePresence(JID("foo@bar.com/Rabbit"), "Here");
+
CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(channel->sentStanzas.size()));
Presence::ref p = channel->getStanzaAtIndex<Presence>(2);
CPPUNIT_ASSERT(p);
CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/Alice"), p->getTo());
+ CPPUNIT_ASSERT_EQUAL(String("Test"), p->getStatus());
}
/*void testJoin_Success() {
@@ -91,14 +103,14 @@ class MUCTest : public CppUnit::TestFixture {
joinResults.push_back(r);
}
- /*void receivePresence(const JID& jid, const String& status, const MUCUserPayload::Item& item) {
+ void receivePresence(const JID& jid, const String& status) {
Presence::ref p = Presence::create(status);
p->setFrom(jid);
- MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>();
- mucUserPayload->addItem(item);
- p->addPayload(mucUserPayload);
+ //MUCUserPayload::ref mucUserPayload = boost::make_shared<MUCUserPayload>();
+ //mucUserPayload->addItem(item);
+ //p->addPayload(mucUserPayload);
channel->onPresenceReceived(p);
- }*/
+ }
private:
DummyStanzaChannel* channel;