diff options
author | Kevin Smith <git@kismith.co.uk> | 2011-02-11 21:49:56 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-02-11 21:49:56 (GMT) |
commit | 7d323757a6bbd93148fc25b94778e92c4ab3d665 (patch) | |
tree | c24e8c2d8325c17214d8ee0a2a59878732845976 /Swift/Controllers/Roster/UnitTest | |
parent | 7fe127240ecebd163f65a5078f8dc927fe17e47b (diff) | |
download | swift-7d323757a6bbd93148fc25b94778e92c4ab3d665.zip swift-7d323757a6bbd93148fc25b94778e92c4ab3d665.tar.bz2 |
Allow group changes at the same time as nick changes.
Resolves: #696
Also hopefully
Resolves: #764
Diffstat (limited to 'Swift/Controllers/Roster/UnitTest')
-rw-r--r-- | Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index 604cda6..466a528 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp @@ -40,6 +40,7 @@ class RosterControllerTest : public CppUnit::TestFixture { CPPUNIT_TEST(testAdd); CPPUNIT_TEST(testAddSubscription); CPPUNIT_TEST(testReceiveRename); + CPPUNIT_TEST(testReceiveRegroup); CPPUNIT_TEST(testSendRename); CPPUNIT_TEST(testPresence); CPPUNIT_TEST(testHighestPresence); @@ -237,6 +238,32 @@ class RosterControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(String("NewName"), groupChild(0)->getChildren()[0]->getDisplayName()); }; + void testReceiveRegroup() { + std::vector<String> oldGroups; + std::vector<String> newGroups; + newGroups.push_back("A Group"); + std::vector<String> newestGroups; + newestGroups.push_back("Best Group"); + JID jid("test@testdomain.com"); + xmppRoster_->addContact(jid, "", oldGroups, RosterItemPayload::Both); + + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); + CPPUNIT_ASSERT_EQUAL(jid.toString(), groupChild(0)->getChildren()[0]->getDisplayName()); + + xmppRoster_->addContact(jid, "new name", newGroups, RosterItemPayload::Both); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); + CPPUNIT_ASSERT_EQUAL(String("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(String("A Group"), groupChild(0)->getDisplayName()); + + xmppRoster_->addContact(jid, "new name", newestGroups, RosterItemPayload::Both); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(CHILDREN.size())); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(groupChild(0)->getChildren().size())); + CPPUNIT_ASSERT_EQUAL(String("new name"), groupChild(0)->getChildren()[0]->getDisplayName()); + CPPUNIT_ASSERT_EQUAL(String("Best Group"), groupChild(0)->getDisplayName()); + }; + void testSendRename() { JID jid("testling@wonderland.lit"); std::vector<String> groups; |