diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-13 18:43:51 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-14 09:41:14 (GMT) |
commit | a83ddaace71688abc7f2b6a6dd1b821f2194e890 (patch) | |
tree | e654cefc1ac259296519230e78821872b9e993d7 /Swift/Controllers/Chat/UnitTest | |
parent | b9ad76af13fc1d253845e027f91f22039bf14f9c (diff) | |
download | swift-a83ddaace71688abc7f2b6a6dd1b821f2194e890.zip swift-a83ddaace71688abc7f2b6a6dd1b821f2194e890.tar.bz2 |
Fix bug of /me commands not being shown as actions
Test-Information:
Added a test case that verifies this behavior. This test case
succeeded before the refactoring in 74e5131 and now succeeds
again.
Tested Swift UI 1-to-1 and MUC messages with /me commands.
Tested on OS X 10.11.4 with open-source clang.
Change-Id: I270a0b4e2ddc595919646bddcc5e1f27074c9e1f
Diffstat (limited to 'Swift/Controllers/Chat/UnitTest')
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 90600dc..0a36180 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -80,6 +80,7 @@ class ChatsManagerTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLocalMUCServiceDiscoveryResetOnDisconnect); CPPUNIT_TEST(testChatControllerHighlightingNotificationTesting); CPPUNIT_TEST(testChatControllerHighlightingNotificationDeduplicateSounds); + CPPUNIT_TEST(testChatControllerMeMessageHandling); CPPUNIT_TEST_SUITE_END(); public: @@ -803,6 +804,20 @@ public: CPPUNIT_ASSERT(soundsPlayed_.find(keywordRuleB.getAction().getSoundFile()) != soundsPlayed_.end()); } + void testChatControllerMeMessageHandling() { + JID messageJID("testling@test.com/resource1"); + + MockChatWindow* window = new MockChatWindow(); + mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); + + std::shared_ptr<Message> message(new Message()); + message->setFrom(messageJID); + std::string body("/me is feeling delighted."); + message->setBody(body); + manager_->handleIncomingMessage(message); + CPPUNIT_ASSERT_EQUAL(std::string("is feeling delighted."), window->lastAddedActionBody_); + } + private: std::shared_ptr<Message> makeDeliveryReceiptTestMessage(const JID& from, const std::string& id) { std::shared_ptr<Message> message = std::make_shared<Message>(); |