2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include "../../../src/ui/friendlistitem.h"
26 #include "../../../src/ui/friendlistview.h"
27 #include "../../../src/user/user.h"
28 #include "../../../src/ui/avatarimage.h"
31 class TestFriendList: public QObject
36 * @brief Add widgets to the view.
38 void friendListViewAddWidget();
42 * @brief Clear widgets from the view.
44 void friendListViewClear();
47 void TestFriendList::friendListViewAddWidget()
49 FriendListView *view = new FriendListView();
51 User *user1 = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
52 QString("Note"), QUrl("http://image.url"), QString("Timestamp"), true,
53 QString("UserID"), QString("Units"), 44.12);
54 User *user2 = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
55 QString("Note"), QUrl("http://image.url"), QString("Timestamp"), true,
56 QString("UserID"), QString("Units"), 44.12);
58 FriendListItem *item1 = new FriendListItem(view);
59 item1->setData(user1);
60 FriendListItem *item2 = new FriendListItem(view);
61 item2->setData(user2);
63 view->addWidget(item1);
64 view->addWidget(item2);
66 QCOMPARE(view->layout()->count(), 2);
68 User *user3 = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
69 QString("Note"), QUrl("http://image.url"), QString("Timestamp"), true,
70 QString("UserID"), QString("Units"), 44.12);
72 FriendListItem *item3 = new FriendListItem(view);
73 item3->setData(user3);
74 view->addWidget(item3);
76 QCOMPARE(view->layout()->count(), 3);
78 view->addWidget(item3);
80 QCOMPARE(view->layout()->count(), 3);
83 void TestFriendList::friendListViewClear()
85 FriendListView *view = new FriendListView();
87 User *user1 = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
88 QString("Note"), QUrl("http://image.url"), QString("Timestamp"), true,
89 QString("UserID"), QString("Units"), 44.12);
90 User *user2 = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
91 QString("Note"), QUrl("http://image.url"), QString("Timestamp"), true,
92 QString("UserID"), QString("Units"), 44.12);
94 FriendListItem *item1 = new FriendListItem(view);
95 item1->setData(user1);
96 FriendListItem *item2 = new FriendListItem(view);
97 item2->setData(user2);
99 view->addWidget(item1);
100 view->addWidget(item2);
102 QCOMPARE(view->layout()->count(), 2);
106 QCOMPARE(view->layout()->count(), 0);
110 QTEST_MAIN(TestFriendList)
111 #include "testfriendlist.moc"