summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-05-04 14:50:51 (GMT)
committerKevin Smith <kevin.smith@isode.com>2017-05-10 08:56:38 (GMT)
commit1cb2bb760d6487764a9480c84cf2d2edc65ff564 (patch)
treeaa5d01bb3c0fc74d28c96343571ff934447f059a /Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
parent473a73c7112e9fbcd441fa1bf5ff7b1f96ee28bd (diff)
downloadswift-1cb2bb760d6487764a9480c84cf2d2edc65ff564.zip
swift-1cb2bb760d6487764a9480c84cf2d2edc65ff564.tar.bz2
Fix chat window title being displayed incorrectly
Test-Information: Open Swift app, from Recent Chat List click on entry that was created from offline invitees. New chat window will be opened and the title will be the same as Recent Chat List entry. Change-Id: Ia8730aaabfd78e7026d15f3162d4fa46b1489397
Diffstat (limited to 'Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp')
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 52537a9..20c959c 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -152,6 +152,7 @@ class ChatsManagerTest : public CppUnit::TestFixture {
//Imptomptu test
CPPUNIT_TEST(testImpromptuChatTitle);
+ CPPUNIT_TEST(testImpromptuChatWindowTitle);
CPPUNIT_TEST_SUITE_END();
@@ -1511,13 +1512,11 @@ public:
CPPUNIT_ASSERT_EQUAL(std::string("Some correctly spelled message."), window->bodyFromMessage(window->lastReplacedMessage_));
}
- void testImpromptuChatTitle() {
+ void impromptuChatSetup(MockChatWindow* window) {
stanzaChannel_->uniqueIDs_ = true;
JID mucJID("795B7BBE-9099-4A0D-81BA-C816F78E275C@test.com");
manager_->setOnline(true);
- // Open chat window to a sender.
- MockChatWindow* window = new MockChatWindow();
std::shared_ptr<IQ> infoRequest = std::dynamic_pointer_cast<IQ>(stanzaChannel_->sentStanzas[1]);
CPPUNIT_ASSERT(infoRequest);
@@ -1569,11 +1568,23 @@ public:
for (const auto& participantJID : jids) {
stanzaChannel_->onPresenceReceived(mucParticipantJoined(participantJID));
}
+ }
+ void testImpromptuChatTitle() {
+ // Open a new chat window to a sender.
+ MockChatWindow* window = new MockChatWindow();
+ impromptuChatSetup(window);
// After people joined, the title is the list of participant nicknames or names coming from Roster (if nicknames are unavailable)
CPPUNIT_ASSERT_EQUAL(std::string("bar@test.com, foo@test.com"), manager_->getRecentChats()[0].getTitle());
}
+ void testImpromptuChatWindowTitle() {
+ // Open a new chat window to a sender.
+ MockChatWindow* window = new MockChatWindow();
+ impromptuChatSetup(window);
+ // After people joined, the title of chat window is combined of participant nicknames or names coming from Roster (if nicknames are unavailable)
+ CPPUNIT_ASSERT_EQUAL(std::string("bar@test.com, foo@test.com"), window->name_);
+ }
private:
std::shared_ptr<Message> makeDeliveryReceiptTestMessage(const JID& from, const std::string& id) {