diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-02-14 18:57:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-02-14 21:36:32 (GMT) |
commit | cb05f5a908e20006c954ce38755c2e422ecc2388 (patch) | |
tree | a793551a5fe279a57d4330119560e8542f745484 /Slimber/UnitTest | |
parent | cad974b45c0fb9355e68d9728e42c9ae3dbcebc7 (diff) | |
download | swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.zip swift-contrib-cb05f5a908e20006c954ce38755c2e422ecc2388.tar.bz2 |
Removed Swift::String.
Diffstat (limited to 'Slimber/UnitTest')
-rw-r--r-- | Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp | 26 | ||||
-rw-r--r-- | Slimber/UnitTest/MenuletControllerTest.cpp | 74 |
2 files changed, 49 insertions, 51 deletions
diff --git a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp index 8c6710a..47eb05c 100644 --- a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp +++ b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp @@ -71,7 +71,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(rosterChanges[0]->getItems().size())); boost::optional<RosterItemPayload> item = rosterChanges[0]->getItem(JID("alice@wonderland")); CPPUNIT_ASSERT(item); - CPPUNIT_ASSERT_EQUAL(String("Alice"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), item->getName()); CPPUNIT_ASSERT_EQUAL(RosterItemPayload::Both, item->getSubscription()); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(presenceChanges.size())); CPPUNIT_ASSERT(StatusShow::Online == presenceChanges[0]->getShow()); @@ -101,7 +101,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(presenceChanges.size())); CPPUNIT_ASSERT(StatusShow::Away == presenceChanges[1]->getShow()); CPPUNIT_ASSERT(JID("alice@wonderland") == presenceChanges[1]->getFrom()); - CPPUNIT_ASSERT_EQUAL(String("I'm Away"), presenceChanges[1]->getStatus()); + CPPUNIT_ASSERT_EQUAL(std::string("I'm Away"), presenceChanges[1]->getStatus()); } void testGetAllPresence() { @@ -131,11 +131,11 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { boost::optional<RosterItemPayload> item; item = roster->getItem(JID("alice@wonderland")); CPPUNIT_ASSERT(item); - CPPUNIT_ASSERT_EQUAL(String("Alice"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), item->getName()); CPPUNIT_ASSERT_EQUAL(RosterItemPayload::Both, item->getSubscription()); item = roster->getItem(JID("rabbit@teaparty")); CPPUNIT_ASSERT(item); - CPPUNIT_ASSERT_EQUAL(String("Rabbit"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Rabbit"), item->getName()); CPPUNIT_ASSERT_EQUAL(RosterItemPayload::Both, item->getSubscription()); } @@ -145,7 +145,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { addService("alice@wonderland", "Alice", "Alice In", "Wonderland"); boost::optional<RosterItemPayload> item = testling->getRoster()->getItem(JID("alice@wonderland")); - CPPUNIT_ASSERT_EQUAL(String("Alice"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice"), item->getName()); } void testGetRoster_InfoWithFirstName() { @@ -154,7 +154,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { addService("alice@wonderland", "", "Alice In", ""); boost::optional<RosterItemPayload> item = testling->getRoster()->getItem(JID("alice@wonderland")); - CPPUNIT_ASSERT_EQUAL(String("Alice In"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice In"), item->getName()); } void testGetRoster_InfoWithLastName() { @@ -163,7 +163,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { addService("alice@wonderland", "", "", "Wonderland"); boost::optional<RosterItemPayload> item = testling->getRoster()->getItem(JID("alice@wonderland")); - CPPUNIT_ASSERT_EQUAL(String("Wonderland"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Wonderland"), item->getName()); } void testGetRoster_InfoWithFirstAndLastName() { @@ -172,7 +172,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { addService("alice@wonderland", "", "Alice In", "Wonderland"); boost::optional<RosterItemPayload> item = testling->getRoster()->getItem(JID("alice@wonderland")); - CPPUNIT_ASSERT_EQUAL(String("Alice In Wonderland"), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string("Alice In Wonderland"), item->getName()); } void testGetRoster_NoInfo() { @@ -181,7 +181,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { addService("alice@wonderland"); boost::optional<RosterItemPayload> item = testling->getRoster()->getItem(JID("alice@wonderland")); - CPPUNIT_ASSERT_EQUAL(String(""), item->getName()); + CPPUNIT_ASSERT_EQUAL(std::string(""), item->getName()); } void testGetServiceForJID() { @@ -193,7 +193,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { boost::optional<LinkLocalService> service = testling->getServiceForJID(JID("rabbit@teaparty")); CPPUNIT_ASSERT(service); - CPPUNIT_ASSERT_EQUAL(String("rabbit@teaparty"), service->getID().getName()); + CPPUNIT_ASSERT_EQUAL(std::string("rabbit@teaparty"), service->getID().getName()); } void testGetServiceForJID_NoMatch() { @@ -216,7 +216,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { return testling; } - void addService(const String& name, const String& nickName = String(), const String& firstName = String(), const String& lastName = String()) { + void addService(const std::string& name, const std::string& nickName = std::string(), const std::string& firstName = std::string(), const std::string& lastName = std::string()) { DNSSDServiceID service(name, "local."); LinkLocalServiceInfo info; info.setFirstName(firstName); @@ -227,13 +227,13 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture { eventLoop->processEvents(); } - void removeService(const String& name) { + void removeService(const std::string& name) { DNSSDServiceID service(name, "local."); querier->removeService(DNSSDServiceID(name, "local.")); eventLoop->processEvents(); } - void updateServicePresence(const String& name, LinkLocalServiceInfo::Status status, const String& message) { + void updateServicePresence(const std::string& name, LinkLocalServiceInfo::Status status, const std::string& message) { DNSSDServiceID service(name, "local."); LinkLocalServiceInfo info; info.setStatus(status); diff --git a/Slimber/UnitTest/MenuletControllerTest.cpp b/Slimber/UnitTest/MenuletControllerTest.cpp index 9722125..092a886 100644 --- a/Slimber/UnitTest/MenuletControllerTest.cpp +++ b/Slimber/UnitTest/MenuletControllerTest.cpp @@ -10,8 +10,6 @@ #include "Slimber/Menulet.h" #include "Slimber/MenuletController.h" -using namespace Swift; - class MenuletControllerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(MenuletControllerTest); CPPUNIT_TEST(testConstructor); @@ -36,14 +34,14 @@ class MenuletControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(8, static_cast<int>(menulet->items.size())); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("No online users"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("[Offline] "), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*About*"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*Restart*"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*Exit*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("[Offline] "), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*About*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*Restart*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*Exit*"), menulet->items[i++]); } void testUpdate() { @@ -53,14 +51,14 @@ class MenuletControllerTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(8, static_cast<int>(menulet->items.size())); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("No online users"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("[Online] You are connected"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*About*"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*Restart*"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("*Exit*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("[Online] You are connected"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*About*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*Restart*"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("*Exit*"), menulet->items[i++]); } void testSetXMPPStatus_Online() { @@ -69,9 +67,9 @@ class MenuletControllerTest : public CppUnit::TestFixture { testling.setXMPPStatus("You are connected", MenuletController::Online); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("No online users"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("[Online] You are connected"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("[Online] You are connected"), menulet->items[i++]); } @@ -81,35 +79,35 @@ class MenuletControllerTest : public CppUnit::TestFixture { testling.setXMPPStatus("You are not connected", MenuletController::Offline); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("No online users"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("[Offline] You are not connected"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("[Offline] You are not connected"), menulet->items[i++]); } void testSetUserNames() { MenuletController testling(menulet); - std::vector<String> users; + std::vector<std::string> users; users.push_back("Alice In Wonderland"); users.push_back("The Mad Hatter"); testling.setUserNames(users); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("Online users:"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String(" Alice In Wonderland"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String(" The Mad Hatter"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("Online users:"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string(" Alice In Wonderland"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string(" The Mad Hatter"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); } void testSetUserNames_NoUsers() { MenuletController testling(menulet); - std::vector<String> users; + std::vector<std::string> users; testling.setUserNames(users); int i = 0; - CPPUNIT_ASSERT_EQUAL(String("No online users"), menulet->items[i++]); - CPPUNIT_ASSERT_EQUAL(String("-"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("No online users"), menulet->items[i++]); + CPPUNIT_ASSERT_EQUAL(std::string("-"), menulet->items[i++]); } private: @@ -118,9 +116,9 @@ class MenuletControllerTest : public CppUnit::TestFixture { items.clear(); } - virtual void addItem(const String& name, const String& icon = String()) { - String result; - if (!icon.isEmpty()) { + virtual void addItem(const std::string& name, const std::string& icon = std::string()) { + std::string result; + if (!icon.empty()) { result += "[" + icon + "] "; } result += name; @@ -143,12 +141,12 @@ class MenuletControllerTest : public CppUnit::TestFixture { items.push_back("-"); } - virtual void setIcon(const String& i) { + virtual void setIcon(const std::string& i) { icon = i; } - std::vector<String> items; - String icon; + std::vector<std::string> items; + std::string icon; }; FakeMenulet* menulet; |