diff --git a/src/tests/conversationmanager.cpp b/src/tests/conversationmanager.cpp index 82f34cd31c45ecc2a2d9b9645fcde6071b767655..27e8b3c857e0fd8f6e1a29c93dabf602a86c5154 100644 --- a/src/tests/conversationmanager.cpp +++ b/src/tests/conversationmanager.cpp @@ -23,6 +23,7 @@ using namespace Transport; class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTest { CPPUNIT_TEST_SUITE(ConversationManagerTest); + CPPUNIT_TEST(conversationSize); CPPUNIT_TEST(handleNormalMessages); CPPUNIT_TEST(handleNormalMessagesHeadline); CPPUNIT_TEST(handleGroupchatMessages); @@ -61,6 +62,10 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe tearMeDown(); } + void conversationSize() { + std::cout << " = " << sizeof(Conversation) << " B"; + } + void handleMessageReceived(TestingConversation *_conv, boost::shared_ptr &_msg) { m_conv = _conv; m_msg = _msg; @@ -309,6 +314,10 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe conv->setNickname("nickname"); conv->addJID("user@localhost/resource"); + boost::shared_ptr msg0(new Swift::Message()); + msg0->setSubject("subject"); + conv->handleMessage(msg0, "anotheruser"); + CPPUNIT_ASSERT(!user->shouldCacheMessages()); // disconnectUser @@ -346,7 +355,7 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe injectPresence(response); loop->processEvents(); - CPPUNIT_ASSERT_EQUAL(3, (int) received.size()); + CPPUNIT_ASSERT_EQUAL(4, (int) received.size()); CPPUNIT_ASSERT(dynamic_cast(getStanza(received[1]))); CPPUNIT_ASSERT_EQUAL(std::string("hi there!"), dynamic_cast(getStanza(received[1]))->getBody()); CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast(getStanza(received[1]))->getTo().toString()); @@ -357,6 +366,10 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast(getStanza(received[2]))->getTo().toString()); CPPUNIT_ASSERT_EQUAL(std::string("#room@localhost/anotheruser"), dynamic_cast(getStanza(received[2]))->getFrom().toString()); + CPPUNIT_ASSERT(dynamic_cast(getStanza(received[3]))); + CPPUNIT_ASSERT_EQUAL(std::string("subject"), dynamic_cast(getStanza(received[3]))->getSubject()); + CPPUNIT_ASSERT_EQUAL(std::string("user@localhost/resource"), dynamic_cast(getStanza(received[3]))->getTo().toString()); + CPPUNIT_ASSERT_EQUAL(std::string("#room@localhost/anotheruser"), dynamic_cast(getStanza(received[3]))->getFrom().toString()); } void handleGroupchatMessagesBouncerLeave() {