+++ /dev/null
-/*
- 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"
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()
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()
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);