diff options
Diffstat (limited to 'Swift/Controllers/UnitTest')
-rw-r--r-- | Swift/Controllers/UnitTest/MockChatWindow.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index 4f874e1..d7942ff 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -7,8 +7,7 @@ #pragma once #include <memory> - -#include <Swiften/Base/foreach.h> +#include <string> #include <Swift/Controllers/UIInterfaces/ChatWindow.h> @@ -18,13 +17,17 @@ namespace Swift { MockChatWindow() : labelsEnabled_(false), impromptuMUCSupported_(false) {} virtual ~MockChatWindow(); - virtual std::string addMessage(const ChatMessage& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { + virtual std::string addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { lastAddedMessage_ = message; + lastAddedMessageSenderName_ = senderName; + lastAddedMessageSenderIsSelf_ = senderIsSelf; return "id"; } - virtual std::string addAction(const ChatMessage& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { + virtual std::string addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { lastAddedAction_ = message; + lastAddedActionSenderName_ = senderName; + lastAddedActionSenderIsSelf_ = senderIsSelf; return "id"; } @@ -52,7 +55,9 @@ namespace Swift { virtual void setFileTransferProgress(std::string /*id*/, const int /*alreadyTransferedBytes*/) { } virtual void setFileTransferStatus(std::string /*id*/, const FileTransferState /*state*/, const std::string& /*msg*/) { } - virtual void setMessageReceiptState(const std::string &/* id */, ReceiptState /* state */) { } + virtual void setMessageReceiptState(const std::string & id, ReceiptState state) { + receiptChanges_.emplace_back(id, state); + } virtual void setContactChatState(ChatState::ChatStateType /*state*/) {} virtual void setName(const std::string& name) {name_ = name;} @@ -101,7 +106,7 @@ namespace Swift { std::string body; std::shared_ptr<ChatTextMessagePart> text; std::shared_ptr<ChatHighlightingMessagePart> highlight; - foreach (std::shared_ptr<ChatMessagePart> part, message.getParts()) { + for (auto &&part : message.getParts()) { if ((text = std::dynamic_pointer_cast<ChatTextMessagePart>(part))) { body += text->text; } @@ -114,11 +119,17 @@ namespace Swift { void resetLastMessages() { lastAddedMessage_ = lastAddedAction_ = lastAddedPresence_ = lastReplacedMessage_ = lastAddedSystemMessage_ = lastReplacedSystemMessage_ = ChatMessage(); + lastAddedMessageSenderName_ = lastAddedActionSenderName_ = ""; + lastAddedMessageSenderIsSelf_ = lastAddedActionSenderIsSelf_ = false; } std::string name_; ChatMessage lastAddedMessage_; + std::string lastAddedMessageSenderName_; + bool lastAddedMessageSenderIsSelf_; ChatMessage lastAddedAction_; + std::string lastAddedActionSenderName_; + bool lastAddedActionSenderIsSelf_; ChatMessage lastAddedPresence_; ChatMessage lastReplacedMessage_; ChatMessage lastAddedSystemMessage_; @@ -129,6 +140,7 @@ namespace Swift { bool impromptuMUCSupported_; SecurityLabelsCatalog::Item label_; Roster* roster_; + std::vector<std::pair<std::string, ReceiptState>> receiptChanges_; }; } |