88c6044f7872a4c27ed7eca302f7ee2022df9054
[situare] / tests / stubs / extendedlistitem.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 EXTENDEDLISTITEMSTUB_H
23 #define EXTENDEDLISTITEMSTUB_H
24
25 #include "../../src/ui/personlistitem.h"
26 #include "listitem.h"
27 #include "../../src/coordinates/geocoordinate.h"
28 #include "stubbase.h"
29
30 class ExtendedListItemStub : public StubBase
31 {
32 public:
33     virtual void ExtendedListItemConstructor(QListWidget *parent, int type);
34     virtual void addSubItem(const QString &text, const QPixmap &icon = QPixmap());
35     virtual void clearSubItems();
36     virtual void setSelected(bool selected);
37     virtual void setSubitemTextWidth(int width);
38     virtual bool toggleSelection();
39
40 };
41
42 void ExtendedListItemStub::ExtendedListItemConstructor(QListWidget *parent, int type)
43 {
44     Q_UNUSED(parent)
45     Q_UNUSED(type)
46 }
47
48 void ExtendedListItemStub::addSubItem(const QString &text, const QPixmap &icon)
49 {
50     QList<ParameterBase *> params;
51     params.append(new Parameter<const QString &>(text));
52     params.append(new Parameter<const QPixmap &>(icon));
53     stubMethodEntered("addSubItem", params);
54 }
55
56 void ExtendedListItemStub::clearSubItems()
57 {
58     stubMethodEntered("clearSubItems");
59 }
60
61 void ExtendedListItemStub::setSelected(bool selected)
62 {
63     QList<ParameterBase *> params;
64     params.append(new Parameter<bool>(selected));
65     stubMethodEntered("setSelected", params);
66 }
67
68 void ExtendedListItemStub::setSubitemTextWidth(int width)
69 {
70     QList<ParameterBase *> params;
71     params.append(new Parameter<int>(width));
72     stubMethodEntered("setSubitemTextWidth", params);
73 }
74
75 QString ExtendedListItemStub::toggleSelection()
76 {
77     stubMethodEntered("toggleSelection");
78 }
79
80 //Create a stub instance
81 ExtendedListItemStub defaultExtendedListItemStub;
82 ExtendedListItemStub *extendedListItemStub = &defaultExtendedListItemStub;
83
84 ExtendedListItem::ExtendedListItem(QListWidget *parent, int type)
85     : ListItem(parent, type)
86 {
87     extendedListItemStub->ExtendedListItemConstructor(parent, type);
88 }
89
90 void ExtendedListItemStub::addSubItem(const QString &text, const QPixmap &icon)
91 {
92     extendedListItemStub->addSubItem(text, icon);
93 }
94
95 void ExtendedListItemStub::clearSubItems()
96 {
97     extendedListItemStub->clearSubItems();
98 }
99
100 void ExtendedListItemStub::setSelected(bool selected)
101 {
102     extendedListItemStub->setSelected(selected);
103 }
104
105 void ExtendedListItemStub::setSubitemTextWidth(int width)
106 {
107     extendedListItemStub->setSubitemTextWidth(width);
108 }
109
110 void ExtendedListItemStub::toggleSelection()
111 {
112     extendedListItemStub->toggleSelection();
113 }
114
115 #endif // EXTENDEDLISTITEMSTUB_H
116