Removed tests/ui/listitem.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 19 Jul 2010 08:05:50 +0000 (11:05 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Mon, 19 Jul 2010 08:05:50 +0000 (11:05 +0300)
tests/ui/listitem/listitem.pro [deleted file]
tests/ui/listitem/testlistitem.cpp [deleted file]
tests/ui/listview/testlistview.cpp

diff --git a/tests/ui/listitem/listitem.pro b/tests/ui/listitem/listitem.pro
deleted file mode 100644 (file)
index fded4d8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-CONFIG += qtestlib
-DEFINES += QT_NO_DEBUG_OUTPUT
-INCLUDEPATH += . \
-    ../../../src/
-HEADERS += ../../../src/ui/listitem.h
-SOURCES += ../../../src/ui/listitem.cpp \
-    testlistitem.cpp
-RESOURCES += ../../../images.qrc
diff --git a/tests/ui/listitem/testlistitem.cpp b/tests/ui/listitem/testlistitem.cpp
deleted file mode 100644 (file)
index 4e3dafe..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-       Jussi Laitinen - jussi.laitinen@ixonos.com
-
-   Situare is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License
-   version 2 as published by the Free Software Foundation.
-
-   Situare is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with Situare; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
-   USA.
-*/
-
-#include <QtTest>
-#include <QtGui>
-
-#include "../../../src/ui/listitem.h"
-
-class TestListItem: public QObject
-{
-    Q_OBJECT
-
-private slots:
-    void cleanupTestCase();
-    void initTestCase();
-
-private:
-    ListItem *listItem;
-};
-
-void TestListItem::cleanupTestCase()
-{
-    delete listItem;
-}
-
-void TestListItem::initTestCase()
-{
-    listItem = new ListItem();
-
-    QVERIFY(listItem != 0);
-}
-
-QTEST_MAIN(TestListItem)
-#include "testlistitem.moc"
index 5aa68be..72354ed 100644 (file)
@@ -40,18 +40,55 @@ private slots:
 
 private:
     ListView *listView;
+    User *user1;
+    User *user2;
+    User *user3;
+    User *user4;
 };
 
 void TestListView::cleanupTestCase()
 {
     delete listView;
+    delete user1;
+    delete user2;
+    delete user3;
+    delete user4;
 }
 
 void TestListView::initTestCase()
 {
     listView = new ListView();
-
     QVERIFY(listView != 0);
+
+    user1 = new User(QString("Address address address address address"),
+                           QPointF(12.22, 23.33), QString("Name na msfdsa dsfadsaf sdaf"),
+                           QString("Note note note note note note note note"),
+                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
+                           true, QString("key1"), QString("km"), 44.12);
+    user1->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
+    user2 = new User(QString("Address address"),
+                           QPointF(12.1, 44.33), QString("Name na msfdsa dsfadsaf sdaf"),
+                           QString("Note note note note note note note note"),
+                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
+                           true, QString("key2"), QString("km"), 144.12);
+    user2->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
+    user3 = new User(QString("Address address address address address"),
+                           QPointF(12.22, 23.33), QString("Name na msfdsa dsfadsaf sdaf"),
+                           QString("Note note note note note note note note"),
+                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
+                           true, QString("key3"), QString("km"), 44.12);
+    user3->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
+    user4 = new User(QString("Address address"),
+                           QPointF(12.1, 44.33), QString("Name na msfdsa dsfadsaf sdaf"),
+                           QString("Note note note note note note note note"),
+                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
+                           true, QString("key4"), QString("km"), 144.12);
+    user4->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
+
+    QVERIFY(user1 != 0);
+    QVERIFY(user2 != 0);
+    QVERIFY(user3 != 0);
+    QVERIFY(user4 != 0);
 }
 
 void TestListView::addListItem()
@@ -80,21 +117,21 @@ void TestListView::addItemToView()
 
 void TestListView::clearUnused()
 {
-//    listView->addListItem("key1", new FriendListItem());
-//    listView->addListItem("key2", new FriendListItem());
-//    listView->addListItem("key3", new FriendListItem());
-//    listView->addListItem("key4", new FriendListItem());
-//    QCOMPARE(listView->count(), 4);
-
-//    QStringList newUserIDs;
-//    newUserIDs.append("key2");
-//    newUserIDs.append("key3");
-//    listView->clearUnused(newUserIDs);
-//    QCOMPARE(listView->count(), 2);
-//    QVERIFY(listView->listItem("key1") == 0);
-//    QVERIFY(listView->listItem("key2") != 0);
-//    QVERIFY(listView->listItem("key3") != 0);
-//    QVERIFY(listView->listItem("key4") == 0);
+    listView->addListItem("key1", new FriendListItem());
+    listView->addListItem("key2", new FriendListItem());
+    listView->addListItem("key3", new FriendListItem());
+    listView->addListItem("key4", new FriendListItem());
+    QCOMPARE(listView->count(), 4);
+
+    QStringList newUserIDs;
+    newUserIDs.append("key2");
+    newUserIDs.append("key3");
+    listView->clearUnused(newUserIDs);
+    QCOMPARE(listView->count(), 2);
+    QVERIFY(listView->listItem("key1") == 0);
+    QVERIFY(listView->listItem("key2") != 0);
+    QVERIFY(listView->listItem("key3") != 0);
+    QVERIFY(listView->listItem("key4") == 0);
 }
 
 void TestListView::filterList()
@@ -106,32 +143,7 @@ void TestListView::filterList()
     FriendListItem *item2 = new FriendListItem();
     FriendListItem *item3 = new FriendListItem();;
     FriendListItem *item4 = new FriendListItem();
-    User *user1 = new User(QString("Address address address address address"),
-                           QPointF(12.22, 23.33), QString("Name na msfdsa dsfadsaf sdaf"),
-                           QString("Note note note note note note note note"),
-                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
-                           true, QString("key1"), QString("km"), 44.12);
-    user1->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
 
-    User *user2 = new User(QString("Address address"),
-                           QPointF(12.1, 44.33), QString("Name na msfdsa dsfadsaf sdaf"),
-                           QString("Note note note note note note note note"),
-                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
-                           true, QString("key2"), QString("km"), 144.12);
-    user2->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
-    User *user3 = new User(QString("Address address address address address"),
-                           QPointF(12.22, 23.33), QString("Name na msfdsa dsfadsaf sdaf"),
-                           QString("Note note note note note note note note"),
-                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
-                           true, QString("key3"), QString("km"), 44.12);
-    user1->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
-
-    User *user4 = new User(QString("Address address"),
-                           QPointF(12.1, 44.33), QString("Name na msfdsa dsfadsaf sdaf"),
-                           QString("Note note note note note note note note"),
-                           QUrl("http://image.url"), QString("Timestamp timestamp timestamp tim"),
-                           true, QString("key4"), QString("km"), 144.12);
-    user2->setProfileImage(QPixmap(":/res/images/profile_pic_border.png"));
     item1->setUserData(user1);
     item2->setUserData(user2);
     item3->setUserData(user3);