summaryrefslogtreecommitdiffstats
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/Controllers/UnitTest
parentc632dffabdd3387547bd07cd96754deab47703bc (diff)
downloadswift-739e16ab8fa21f22b8ddf827b0979e71bf613e78.zip
swift-739e16ab8fa21f22b8ddf827b0979e71bf613e78.tar.bz2
Code cleanup.
Diffstat (limited to 'Swift/Controllers/UnitTest')
-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
4 files changed, 12 insertions, 10 deletions
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());