summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-10-27 14:51:07 (GMT)
committerSwift Review <review@swift.im>2014-10-30 13:58:51 (GMT)
commit286ef105d813a12640d64b71101cafe53f212234 (patch)
tree39e3814048dd639b9a118a3b16f22b49235efd93 /Swiften/MUC/UnitTest
parent190cdcf7478950a90a5c8666d82047e4f33e0d2c (diff)
downloadswift-286ef105d813a12640d64b71101cafe53f212234.zip
swift-286ef105d813a12640d64b71101cafe53f212234.tar.bz2
Resend presence to MUC on join completion only if it changed since join.
Test-Information: Added test case to assure presence is not resend after join completion if it did not change. The other test cases are untouched and still all succeed. Change-Id: I2aace1aee8ca3deab9cd9050a25233617b3b0678
Diffstat (limited to 'Swiften/MUC/UnitTest')
-rw-r--r--Swiften/MUC/UnitTest/MUCTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/MUC/UnitTest/MUCTest.cpp b/Swiften/MUC/UnitTest/MUCTest.cpp
index 773edb6..e6f4608 100644
--- a/Swiften/MUC/UnitTest/MUCTest.cpp
+++ b/Swiften/MUC/UnitTest/MUCTest.cpp
@@ -28,6 +28,7 @@ class MUCTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testJoin);
CPPUNIT_TEST(testJoin_ChangePresenceDuringJoinDoesNotSendPresenceBeforeJoinSuccess);
CPPUNIT_TEST(testJoin_ChangePresenceDuringJoinResendsPresenceAfterJoinSuccess);
+ CPPUNIT_TEST(testJoin_NoPresenceChangeDuringJoinDoesNotResendAfterJoinSuccess);
CPPUNIT_TEST(testCreateInstant);
CPPUNIT_TEST(testReplicateBug);
CPPUNIT_TEST(testNicknameChange);
@@ -85,6 +86,19 @@ class MUCTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT_EQUAL(std::string("Test"), p->getStatus());
}
+ void testJoin_NoPresenceChangeDuringJoinDoesNotResendAfterJoinSuccess() {
+ MUC::ref testling = createMUC(JID("foo@bar.com"));
+ testling->joinAs("Alice");
+
+ receivePresence(JID("foo@bar.com/Rabbit"), "Here");
+
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(channel->sentStanzas.size()));
+ Presence::ref p = channel->getStanzaAtIndex<Presence>(0);
+ CPPUNIT_ASSERT(p);
+ CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com/Alice"), p->getTo());
+ CPPUNIT_ASSERT_EQUAL(std::string(""), p->getStatus());
+ }
+
void testCreateInstant() {
MUC::ref testling = createMUC(JID("rabbithole@wonderland.lit"));
testling->joinAs("Alice");