diff options
Diffstat (limited to 'Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp')
| -rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 08609ee..ac62942 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp | |||
| @@ -1235,6 +1235,11 @@ public: | |||
| 1235 | 1235 | ||
| 1236 | CPPUNIT_ASSERT_EQUAL(forwardedBody, MockChatWindow::bodyFromMessage(window->lastAddedMessage_)); | 1236 | CPPUNIT_ASSERT_EQUAL(forwardedBody, MockChatWindow::bodyFromMessage(window->lastAddedMessage_)); |
| 1237 | CPPUNIT_ASSERT_EQUAL(false, window->lastAddedMessageSenderIsSelf_); | 1237 | CPPUNIT_ASSERT_EQUAL(false, window->lastAddedMessageSenderIsSelf_); |
| 1238 | |||
| 1239 | auto recentChats = manager_->getRecentChats(); | ||
| 1240 | CPPUNIT_ASSERT_EQUAL(recentChats.size(), size_t(1)); | ||
| 1241 | CPPUNIT_ASSERT_EQUAL(recentChats[0].jid, originalMessage->getFrom().toBare()); | ||
| 1242 | CPPUNIT_ASSERT_EQUAL(recentChats[0].activity, std::string("Some further text.")); | ||
| 1238 | } | 1243 | } |
| 1239 | } | 1244 | } |
| 1240 | 1245 | ||
| @@ -1271,6 +1276,11 @@ public: | |||
| 1271 | CPPUNIT_ASSERT_EQUAL(true, window->lastAddedMessageSenderIsSelf_); | 1276 | CPPUNIT_ASSERT_EQUAL(true, window->lastAddedMessageSenderIsSelf_); |
| 1272 | CPPUNIT_ASSERT_EQUAL(size_t(1), window->receiptChanges_.size()); | 1277 | CPPUNIT_ASSERT_EQUAL(size_t(1), window->receiptChanges_.size()); |
| 1273 | CPPUNIT_ASSERT_EQUAL(ChatWindow::ReceiptRequested, window->receiptChanges_[0].second); | 1278 | CPPUNIT_ASSERT_EQUAL(ChatWindow::ReceiptRequested, window->receiptChanges_[0].second); |
| 1279 | |||
| 1280 | auto recentChats = manager_->getRecentChats(); | ||
| 1281 | CPPUNIT_ASSERT_EQUAL(recentChats.size(), size_t(1)); | ||
| 1282 | CPPUNIT_ASSERT_EQUAL(recentChats[0].jid, originalMessage->getTo().toBare()); | ||
| 1283 | CPPUNIT_ASSERT_EQUAL(recentChats[0].activity, std::string("Some text my other resource sent.")); | ||
| 1274 | } | 1284 | } |
| 1275 | 1285 | ||
| 1276 | // incoming carbons message for the received delivery receipt to the other resource | 1286 | // incoming carbons message for the received delivery receipt to the other resource |
| @@ -1287,6 +1297,12 @@ public: | |||
| 1287 | 1297 | ||
| 1288 | CPPUNIT_ASSERT_EQUAL(size_t(2), window->receiptChanges_.size()); | 1298 | CPPUNIT_ASSERT_EQUAL(size_t(2), window->receiptChanges_.size()); |
| 1289 | CPPUNIT_ASSERT_EQUAL(ChatWindow::ReceiptReceived, window->receiptChanges_[1].second); | 1299 | CPPUNIT_ASSERT_EQUAL(ChatWindow::ReceiptReceived, window->receiptChanges_[1].second); |
| 1300 | |||
| 1301 | //Delivery receipt should not change the latest recent entry. Checking for the original message. | ||
| 1302 | auto recentChats = manager_->getRecentChats(); | ||
| 1303 | CPPUNIT_ASSERT_EQUAL(recentChats.size(), size_t(1)); | ||
| 1304 | CPPUNIT_ASSERT_EQUAL(recentChats[0].jid, messageJID.toBare()); | ||
| 1305 | CPPUNIT_ASSERT_EQUAL(recentChats[0].activity, std::string("Some text my other resource sent.")); | ||
| 1290 | } | 1306 | } |
| 1291 | } | 1307 | } |
| 1292 | 1308 | ||
| @@ -1326,6 +1342,11 @@ public: | |||
| 1326 | manager_->handleIncomingMessage(messageWrapper); | 1342 | manager_->handleIncomingMessage(messageWrapper); |
| 1327 | CPPUNIT_ASSERT_EQUAL(std::string(), MockChatWindow::bodyFromMessage(window->lastAddedMessage_)); | 1343 | CPPUNIT_ASSERT_EQUAL(std::string(), MockChatWindow::bodyFromMessage(window->lastAddedMessage_)); |
| 1328 | CPPUNIT_ASSERT_EQUAL(false, window->lastAddedMessageSenderIsSelf_); | 1344 | CPPUNIT_ASSERT_EQUAL(false, window->lastAddedMessageSenderIsSelf_); |
| 1345 | |||
| 1346 | auto recentChats = manager_->getRecentChats(); | ||
| 1347 | CPPUNIT_ASSERT_EQUAL(recentChats.size(), size_t(1)); | ||
| 1348 | CPPUNIT_ASSERT_EQUAL(recentChats[0].jid, originalMessage->getFrom().toBare()); | ||
| 1349 | CPPUNIT_ASSERT_EQUAL(recentChats[0].activity, std::string("Some further text.")); | ||
| 1329 | } | 1350 | } |
| 1330 | } | 1351 | } |
| 1331 | 1352 | ||
Swift