summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-01-21 18:36:11 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-01-21 18:36:11 (GMT)
commit739e16ab8fa21f22b8ddf827b0979e71bf613e78 (patch)
tree91bf9bad8e8ade3aa9484fc01dff0221addb4cbe /Swift
parentc632dffabdd3387547bd07cd96754deab47703bc (diff)
downloadswift-contrib-739e16ab8fa21f22b8ddf827b0979e71bf613e78.zip
swift-contrib-739e16ab8fa21f22b8ddf827b0979e71bf613e78.tar.bz2
Code cleanup.
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/Chat/MUCSearchController.cpp1
-rw-r--r--Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp5
-rw-r--r--Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp5
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindow.h2
-rw-r--r--Swift/Controllers/UnitTest/MockMainWindowFactory.h4
-rw-r--r--Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp5
-rw-r--r--Swift/Controllers/UnitTest/RosterControllerTest.cpp11
7 files changed, 15 insertions, 18 deletions
diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp
index c85f793..0f66163 100644
--- a/Swift/Controllers/Chat/MUCSearchController.cpp
+++ b/Swift/Controllers/Chat/MUCSearchController.cpp
@@ -64,6 +64,7 @@ void MUCSearchController::addToSavedServices(const JID& jid) {
collapsed += "\n";
}
collapsed += jidItem.toString();
+ ++i;
}
settings_->storeString(SEARCHED_SERVICES, collapsed);
window_->addSavedServices(savedServices_);
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index be262bc..4d6ca08 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -46,8 +46,7 @@ class DummyCapsProvider : public CapsProvider {
DiscoInfo::ref getCaps(const String&) const {return DiscoInfo::ref(new DiscoInfo());}
};
-class ChatsManagerTest : public CppUnit::TestFixture
-{
+class ChatsManagerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(ChatsManagerTest);
CPPUNIT_TEST(testFirstOpenWindowIncoming);
CPPUNIT_TEST(testSecondOpenWindowIncoming);
@@ -60,8 +59,6 @@ class ChatsManagerTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- ChatsManagerTest() {};
-
void setUp() {
mocks_ = new MockRepository();
jid_ = JID("test@test.com/resource");
diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
index 21871cb..62f0ccd 100644
--- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp
@@ -27,8 +27,7 @@
using namespace Swift;
-class MUCControllerTest : public CppUnit::TestFixture
-{
+class MUCControllerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MUCControllerTest);
CPPUNIT_TEST(testJoinPartStringContructionSimple);
CPPUNIT_TEST(testJoinPartStringContructionMixed);
@@ -39,8 +38,6 @@ class MUCControllerTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- MUCControllerTest() {};
-
void setUp() {
self_ = JID("girl@wonderland.lit/rabbithole");
nick_ = "aLiCe";
diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h
index 79c148a..9da5490 100644
--- a/Swift/Controllers/UnitTest/MockMainWindow.h
+++ b/Swift/Controllers/UnitTest/MockMainWindow.h
@@ -12,7 +12,7 @@ namespace Swift {
class Roster;
class MockMainWindow : public MainWindow {
public:
- MockMainWindow() {};
+ MockMainWindow() : roster(NULL) {};
virtual ~MockMainWindow() {};
virtual void setRosterModel(Roster* roster) {this->roster = roster;};
virtual void setMyNick(const String& /*name*/) {};;
diff --git a/Swift/Controllers/UnitTest/MockMainWindowFactory.h b/Swift/Controllers/UnitTest/MockMainWindowFactory.h
index 8a35d1a..d130b39 100644
--- a/Swift/Controllers/UnitTest/MockMainWindowFactory.h
+++ b/Swift/Controllers/UnitTest/MockMainWindowFactory.h
@@ -13,8 +13,10 @@ namespace Swift {
class MockMainWindowFactory : public MainWindowFactory {
public:
- MockMainWindowFactory() {};
+ MockMainWindowFactory() : last(NULL) {};
+
virtual ~MockMainWindowFactory() {};
+
/**
* Transfers ownership of result.
*/
diff --git a/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp b/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp
index 8b62afe..10fb2fa 100644
--- a/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp
+++ b/Swift/Controllers/UnitTest/PreviousStatusStoreTest.cpp
@@ -11,8 +11,7 @@
using namespace Swift;
-class PreviousStatusStoreTest : public CppUnit::TestFixture
-{
+class PreviousStatusStoreTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(PreviousStatusStoreTest);
CPPUNIT_TEST(testGetAll);
//CPPUNIT_TEST(testGetAllLimited);
@@ -21,8 +20,6 @@ class PreviousStatusStoreTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- PreviousStatusStoreTest() {};
-
void setUp() {
store_ = new PreviousStatusStore();
store_->addStatus(StatusShow::Online, "At home in the study");
diff --git a/Swift/Controllers/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
index fb61820..80134b7 100644
--- a/Swift/Controllers/UnitTest/RosterControllerTest.cpp
+++ b/Swift/Controllers/UnitTest/RosterControllerTest.cpp
@@ -36,8 +36,7 @@ using namespace Swift;
#define CHILDREN mainWindow_->roster->getRoot()->getChildren()
-class RosterControllerTest : public CppUnit::TestFixture
-{
+class RosterControllerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(RosterControllerTest);
CPPUNIT_TEST(testAdd);
CPPUNIT_TEST(testAddSubscription);
@@ -51,8 +50,6 @@ class RosterControllerTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- RosterControllerTest() {};
-
void setUp() {
jid_ = JID("testjid@swift.im/swift");
xmppRoster_ = new XMPPRosterImpl();
@@ -111,8 +108,10 @@ class RosterControllerTest : public CppUnit::TestFixture
presence->setStatus("So totally here");
stanzaChannel_->onPresenceReceived(presence);
ContactRosterItem* item = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[0])->getChildren()[0]);
+ CPPUNIT_ASSERT(item);
CPPUNIT_ASSERT_EQUAL(presence->getStatus(), item->getStatusText());
ContactRosterItem* item2 = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[1])->getChildren()[0]);
+ CPPUNIT_ASSERT(item2);
CPPUNIT_ASSERT_EQUAL(presence->getStatus(), item2->getStatusText());
};
@@ -133,6 +132,7 @@ class RosterControllerTest : public CppUnit::TestFixture
stanzaChannel_->onPresenceReceived(lowPresence);
stanzaChannel_->onPresenceReceived(highPresence);
ContactRosterItem* item = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[0])->getChildren()[0]);
+ CPPUNIT_ASSERT(item);
CPPUNIT_ASSERT_EQUAL(highPresence->getStatus(), item->getStatusText());
};
@@ -152,6 +152,7 @@ class RosterControllerTest : public CppUnit::TestFixture
stanzaChannel_->onPresenceReceived(highPresence);
stanzaChannel_->onPresenceReceived(lowPresence);
ContactRosterItem* item = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[0])->getChildren()[0]);
+ CPPUNIT_ASSERT(item);
CPPUNIT_ASSERT_EQUAL(highPresence->getStatus(), item->getStatusText());
};
@@ -179,6 +180,7 @@ class RosterControllerTest : public CppUnit::TestFixture
stanzaChannel_->onPresenceReceived(highPresence);
stanzaChannel_->onPresenceReceived(highPresenceOffline);
ContactRosterItem* item = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[0])->getChildren()[0]);
+ CPPUNIT_ASSERT(item);
/* A verification that if the test fails, it's the RosterController, not the PresenceOracle. */
Presence::ref high = presenceOracle_->getHighestPriorityPresence(from);
CPPUNIT_ASSERT_EQUAL(Presence::Available, high->getType());
@@ -187,6 +189,7 @@ class RosterControllerTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(lowPresence->getStatus(), item->getStatusText());
stanzaChannel_->onPresenceReceived(lowPresenceOffline);
item = dynamic_cast<ContactRosterItem*>(dynamic_cast<GroupRosterItem*>(CHILDREN[0])->getChildren()[0]);
+ CPPUNIT_ASSERT(item);
/* A verification that if the test fails, it's the RosterController, not the PresenceOracle. */
high = presenceOracle_->getHighestPriorityPresence(from);
CPPUNIT_ASSERT_EQUAL(Presence::Unavailable, high->getType());