summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/UnitTest')
-rw-r--r--Swift/Controllers/UnitTest/MockChatWindow.h22
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindow.h6
-rw-r--r--Swift/Controllers/UnitTest/PresenceNotifierTest.cpp13
3 files changed, 22 insertions, 19 deletions
diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h
index 03adcfe..27b9c9e 100644
--- a/Swift/Controllers/UnitTest/MockChatWindow.h
+++ b/Swift/Controllers/UnitTest/MockChatWindow.h
@@ -14,14 +14,14 @@ namespace Swift {
MockChatWindow() {};
virtual ~MockChatWindow();
- virtual String addMessage(const String& message, const String& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const String& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";};
- virtual String addAction(const String& message, const String& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const String& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";};
- virtual void addSystemMessage(const String& /*message*/) {};
- virtual void addErrorMessage(const String& /*message*/) {};
- virtual void addPresenceMessage(const String& /*message*/) {};
+ virtual std::string addMessage(const std::string& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";};
+ virtual std::string addAction(const std::string& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, const boost::optional<SecurityLabel>& /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime&) {lastMessageBody_ = message; return "";};
+ virtual void addSystemMessage(const std::string& /*message*/) {};
+ virtual void addErrorMessage(const std::string& /*message*/) {};
+ virtual void addPresenceMessage(const std::string& /*message*/) {};
virtual void setContactChatState(ChatState::ChatStateType /*state*/) {};
- virtual void setName(const String& name) {name_ = name;};
+ virtual void setName(const std::string& name) {name_ = name;};
virtual void show() {};
virtual void activate() {};
virtual void setAvailableSecurityLabels(const std::vector<SecurityLabel>& labels) {labels_ = labels;};
@@ -33,16 +33,16 @@ namespace Swift {
virtual void setInputEnabled(bool /*enabled*/) {};
virtual void setRosterModel(Roster* /*roster*/) {};
virtual void setTabComplete(TabComplete*) {};
- virtual void replaceLastMessage(const Swift::String&) {};
- void setAckState(const String& /*id*/, AckState /*state*/) {};
+ virtual void replaceLastMessage(const std::string&) {};
+ void setAckState(const std::string& /*id*/, AckState /*state*/) {};
virtual void flash() {};
boost::signal<void ()> onClosed;
boost::signal<void ()> onAllMessagesRead;
- boost::signal<void (const String&)> onSendMessageRequest;
+ boost::signal<void (const std::string&)> onSendMessageRequest;
- String name_;
- String lastMessageBody_;
+ std::string name_;
+ std::string lastMessageBody_;
std::vector<SecurityLabel> labels_;
bool labelsEnabled_;
};
diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h
index 9da5490..afa5c2a 100644
--- a/Swift/Controllers/UnitTest/MockMainWindow.h
+++ b/Swift/Controllers/UnitTest/MockMainWindow.h
@@ -15,10 +15,10 @@ namespace Swift {
MockMainWindow() : roster(NULL) {};
virtual ~MockMainWindow() {};
virtual void setRosterModel(Roster* roster) {this->roster = roster;};
- virtual void setMyNick(const String& /*name*/) {};;
+ virtual void setMyNick(const std::string& /*name*/) {};;
virtual void setMyJID(const JID& /*jid*/) {};;
- virtual void setMyAvatarPath(const String& /*path*/) {};
- virtual void setMyStatusText(const String& /*status*/) {};
+ virtual void setMyAvatarPath(const std::string& /*path*/) {};
+ virtual void setMyStatusText(const std::string& /*status*/) {};
virtual void setMyStatusType(StatusShow::Type /*type*/) {};
virtual void setConnecting() {};
Roster* roster;
diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
index 969555c..42cfc5f 100644
--- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
+++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp
@@ -165,12 +165,13 @@ class PresenceNotifierTest : public CppUnit::TestFixture {
void testNotificationSubjectContainsNameForJIDInRoster() {
std::auto_ptr<PresenceNotifier> testling = createNotifier();
- roster->addContact(user1.toBare(), "User 1", std::vector<String>(), RosterItemPayload::Both);
+ roster->addContact(user1.toBare(), "User 1", std::vector<std::string>(), RosterItemPayload::Both);
sendPresence(user1, StatusShow::Online);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size()));
- CPPUNIT_ASSERT(notifier->notifications[0].subject.contains("User 1"));
+ std::string subject = notifier->notifications[0].subject;
+ CPPUNIT_ASSERT(subject.find("User 1") != std::string::npos);
}
void testNotificationSubjectContainsJIDForJIDNotInRoster() {
@@ -179,7 +180,8 @@ class PresenceNotifierTest : public CppUnit::TestFixture {
sendPresence(user1, StatusShow::Online);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size()));
- CPPUNIT_ASSERT(notifier->notifications[0].subject.contains(user1.toBare().toString()));
+ std::string subject = notifier->notifications[0].subject;
+ CPPUNIT_ASSERT(subject.find(user1.toBare().toString()) != std::string::npos);
}
void testNotificationSubjectContainsStatus() {
@@ -188,7 +190,8 @@ class PresenceNotifierTest : public CppUnit::TestFixture {
sendPresence(user1, StatusShow::Away);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size()));
- CPPUNIT_ASSERT(notifier->notifications[0].subject.contains("Away"));
+ std::string subject = notifier->notifications[0].subject;
+ CPPUNIT_ASSERT(subject.find("Away") != std::string::npos);
}
void testNotificationMessageContainsStatusMessage() {
@@ -197,7 +200,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture {
sendPresence(user1, StatusShow::Away);
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(notifier->notifications.size()));
- CPPUNIT_ASSERT(notifier->notifications[0].description.contains("Status Message"));
+ CPPUNIT_ASSERT(notifier->notifications[0].description.find("Status Message") != std::string::npos);
}
void testReceiveFirstPresenceWithQuietPeriodDoesNotNotify() {