Added unit tests.
[situare] / tests / stubs / personlistviewstub.h
1 /*
2    Situare - A location system for Facebook
3    Copyright (C) 2010  Ixonos Plc. Authors:
4
5        Jussi Laitinen - jussi.laitinen@ixonos.com
6
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.
10
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.
15
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,
19    USA.
20 */
21
22 #ifndef PERSONLISTVIEWSTUB_H
23 #define PERSONLISTVIEWSTUB_H
24
25 #include "../../src/ui/personlistview.h"
26 #include "listviewstub.h"
27 #include "stubbase.h"
28
29 class PersonListViewStub : public StubBase
30 {
31 public:
32     virtual void PersonListViewConstructor(QWidget *parent = 0);
33     virtual bool listItemClicked(ListItem *item);
34 };
35
36 void PersonListViewStub::PersonListViewConstructor(QWidget *parent)
37 {
38     Q_UNUSED(parent)
39 }
40
41 bool PersonListViewStub::listItemClicked(ListItem *item)
42 {
43     QList<ParameterBase *> params;
44     params.append(new Parameter<ListItem *>(item));
45     stubMethodEntered("listItemClicked", params);
46
47     return stubReturnValue<bool>("listItemClicked");
48 }
49
50 //Create a stub instance
51 PersonListViewStub defaultPersonListViewStub;
52 PersonListViewStub *personListViewStub = &defaultPersonListViewStub;
53
54 PersonListView::PersonListView(QWidget *parent)
55     : ListView(parent)
56 {
57     personListViewStub->PersonListViewConstructor(parent);
58 }
59
60 bool PersonListView::listItemClicked(ListItem *item)
61 {
62     return personListViewStub->listItemClicked(item);
63 }
64
65 #endif // PERSONLISTVIEWSTUB_H