Test that STATUS_NONE can be forwarded

This commit is contained in:
Jan Kaluza 2015-12-03 06:07:41 +01:00
parent 720cce82f8
commit f2385971a2

View file

@ -21,6 +21,7 @@ class LocalBuddyTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
CPPUNIT_TEST(getSafeName);
CPPUNIT_TEST(sendPresence);
CPPUNIT_TEST(setAlias);
CPPUNIT_TEST(sendPresenceTypeNone);
CPPUNIT_TEST_SUITE_END();
public:
@ -126,6 +127,24 @@ class LocalBuddyTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
CPPUNIT_ASSERT_EQUAL(std::string("Buddy 2"), item.getName());
}
void sendPresenceTypeNone() {
User *user = userManager->getUser("user@localhost");
CPPUNIT_ASSERT(user);
std::vector<std::string> grp;
grp.push_back("group1");
LocalBuddy *buddy = new LocalBuddy(user->getRosterManager(), -1, "buddy1", "Buddy 1", grp, BUDDY_JID_ESCAPING);
buddy->setStatus(Swift::StatusShow(Swift::StatusShow::Away), "");
user->getRosterManager()->setBuddy(buddy);
received.clear();
buddy->setStatus(Swift::StatusShow(Swift::StatusShow::None), "");
dumpReceived();
CPPUNIT_ASSERT_EQUAL(1, (int) received.size());
CPPUNIT_ASSERT(dynamic_cast<Swift::Presence *>(getStanza(received[0])));
CPPUNIT_ASSERT_EQUAL(Swift::StatusShow::None, dynamic_cast<Swift::Presence *>(getStanza(received[0]))->getShow());
}
};
CPPUNIT_TEST_SUITE_REGISTRATION (LocalBuddyTest);