Added new List stubs, modified MeetPeoplePanel unit test.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 3 Nov 2010 13:02:47 +0000 (15:02 +0200)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Wed, 3 Nov 2010 13:02:47 +0000 (15:02 +0200)
17 files changed:
src/coordinates/geocoordinate.cpp
src/coordinates/scenecoordinate.cpp
src/ui/meetpeoplepanel.cpp
src/ui/messagepanel.cpp
src/ui/panelcommon.h
src/ui/personlistitem.h
src/user/user.h
tests/stubs/extendedlistitem.h [new file with mode: 0644]
tests/stubs/imagefetcherstub.h
tests/stubs/listitem.h [new file with mode: 0644]
tests/stubs/listview.h [new file with mode: 0644]
tests/stubs/personlistitem.h [new file with mode: 0644]
tests/stubs/personlistview.h [new file with mode: 0644]
tests/stubs/stubs.pro
tests/ui/meetpeoplepanel/meetpeoplepanel.pro
tests/ui/meetpeoplepanel/testmeetpeoplepanel.cpp
tests/ui/messagedialog/testmessagedialog.cpp

index bbac688..65ebc13 100644 (file)
@@ -24,7 +24,7 @@
 
 #include <QDebug>
 
-#include "map/osm.h"
+#include "../map/osm.h"
 #include "scenecoordinate.h"
 
 #include "geocoordinate.h"
index 9b423cb..22d4483 100644 (file)
@@ -27,7 +27,7 @@
 #include <QVariant>
 
 #include "geocoordinate.h"
-#include "map/osm.h"
+#include "../map/osm.h"
 
 #include "scenecoordinate.h"
 
index b30e767..5c0ada4 100644 (file)
@@ -7,7 +7,7 @@
 #include "personlistview.h"
 #include "imagebutton.h"
 #include "panelcommon.h"
-#include "user/user.h"
+#include "../user/user.h"
 
 #include "meetpeoplepanel.h"
 
index d05cba8..0f77666 100644 (file)
@@ -83,9 +83,8 @@ void MessagePanel::removeMessage()
 
     MessageListItem *item = dynamic_cast<MessageListItem *>(m_messageListView->selectedItem());
 
-    if (item) {
+    if (item)
         emit requestRemoveMessage(item->id());
-    }
 }
 
 void MessagePanel::hideEvent(QHideEvent *event)
index c3fcd64..c6b138a 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <QString>
 
-#include "common.h"
+#include "../common.h"
 
 // Dragging settings
 const int DRAG_INIT_TIME = 1000;        ///< How long buttons must be pressed to start drag mode
index b5e4ae0..95213b8 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef PERSONLISTITEM_H
 #define PERSONLISTITEM_H
 
-#include "coordinates/geocoordinate.h"
+#include "../coordinates/geocoordinate.h"
 #include "extendedlistitem.h"
 
 class User;
index cfb45f1..3b2773c 100644 (file)
@@ -26,7 +26,7 @@
 #include <QString>
 #include <QUrl>
 
-#include "coordinates/geocoordinate.h"
+#include "../coordinates/geocoordinate.h"
 
 /**
 * @brief Class to store user information (applies to friends also)
diff --git a/tests/stubs/extendedlistitem.h b/tests/stubs/extendedlistitem.h
new file mode 100644 (file)
index 0000000..88c6044
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+   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.
+*/
+
+#ifndef EXTENDEDLISTITEMSTUB_H
+#define EXTENDEDLISTITEMSTUB_H
+
+#include "../../src/ui/personlistitem.h"
+#include "listitem.h"
+#include "../../src/coordinates/geocoordinate.h"
+#include "stubbase.h"
+
+class ExtendedListItemStub : public StubBase
+{
+public:
+    virtual void ExtendedListItemConstructor(QListWidget *parent, int type);
+    virtual void addSubItem(const QString &text, const QPixmap &icon = QPixmap());
+    virtual void clearSubItems();
+    virtual void setSelected(bool selected);
+    virtual void setSubitemTextWidth(int width);
+    virtual bool toggleSelection();
+
+};
+
+void ExtendedListItemStub::ExtendedListItemConstructor(QListWidget *parent, int type)
+{
+    Q_UNUSED(parent)
+    Q_UNUSED(type)
+}
+
+void ExtendedListItemStub::addSubItem(const QString &text, const QPixmap &icon)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(text));
+    params.append(new Parameter<const QPixmap &>(icon));
+    stubMethodEntered("addSubItem", params);
+}
+
+void ExtendedListItemStub::clearSubItems()
+{
+    stubMethodEntered("clearSubItems");
+}
+
+void ExtendedListItemStub::setSelected(bool selected)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<bool>(selected));
+    stubMethodEntered("setSelected", params);
+}
+
+void ExtendedListItemStub::setSubitemTextWidth(int width)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(width));
+    stubMethodEntered("setSubitemTextWidth", params);
+}
+
+QString ExtendedListItemStub::toggleSelection()
+{
+    stubMethodEntered("toggleSelection");
+}
+
+//Create a stub instance
+ExtendedListItemStub defaultExtendedListItemStub;
+ExtendedListItemStub *extendedListItemStub = &defaultExtendedListItemStub;
+
+ExtendedListItem::ExtendedListItem(QListWidget *parent, int type)
+    : ListItem(parent, type)
+{
+    extendedListItemStub->ExtendedListItemConstructor(parent, type);
+}
+
+void ExtendedListItemStub::addSubItem(const QString &text, const QPixmap &icon)
+{
+    extendedListItemStub->addSubItem(text, icon);
+}
+
+void ExtendedListItemStub::clearSubItems()
+{
+    extendedListItemStub->clearSubItems();
+}
+
+void ExtendedListItemStub::setSelected(bool selected)
+{
+    extendedListItemStub->setSelected(selected);
+}
+
+void ExtendedListItemStub::setSubitemTextWidth(int width)
+{
+    extendedListItemStub->setSubitemTextWidth(width);
+}
+
+void ExtendedListItemStub::toggleSelection()
+{
+    extendedListItemStub->toggleSelection();
+}
+
+#endif // EXTENDEDLISTITEMSTUB_H
+
index fdef03a..2c09c62 100644 (file)
@@ -18,6 +18,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
    USA.
 */
+
 #ifndef IMAGEFETCHERSTUB_H
 #define IMAGEFETCHERSTUB_H
 
diff --git a/tests/stubs/listitem.h b/tests/stubs/listitem.h
new file mode 100644 (file)
index 0000000..08fd6e9
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+   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.
+*/
+
+#ifndef LISTITEMSTUB_H
+#define LISTITEMSTUB_H
+
+#include "../../src/ui/personlistitem.h"
+#include "../../src/coordinates/geocoordinate.h"
+#include "stubbase.h"
+
+class ListViewStub : public StubBase
+{
+public:
+    virtual void ListItemConstructor(QListWidget *parent = 0, int type = Type);
+    enum TextSize{TEXT_SIZE_NORMAL, TEXT_SIZE_SMALL};
+    virtual void setImage(const QPixmap &image);
+    virtual void setTitle(const QString &name);
+    virtual void setSelected(bool selected) = 0;
+    virtual void setSize(const QSize &size);
+    virtual QString shortenText(const QString &text, int textWidth, TextSize textSize);
+    virtual QString title() const;
+    virtual bool toggleSelection() = 0;
+};
+
+void ListViewStub::ListItemConstructor(QListWidget *parent, int type)
+{
+    Q_UNUSED(parent)
+    Q_UNUSED(type)
+}
+
+void ListViewStub::setImage(const QPixmap &image)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QPixmap *>(image));
+    stubMethodEntered("setImage", params);
+}
+
+void ListViewStub::setTitle(const QString &name)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(name));
+    stubMethodEntered("setTitle", params);
+}
+
+void ListViewStub::setSize(const QSize &size)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QSize &>(size));
+    stubMethodEntered("setSize", params);
+}
+
+QString ListViewStub::shortenText(const QString &text, int textWidth, TextSize textSize)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(text));
+    params.append(new Parameter<int>(textWidth));
+    params.append(new Parameter<TextSize>(textSize));
+    stubMethodEntered("shortenText", params);
+
+    return stubReturnValue<QString>("shortenText");
+}
+
+QString ListViewStub::title() const
+{
+    return stubReturnValue<QString>("title");
+}
+
+//Create a stub instance
+ListViewStub defaultListItemStub;
+ListViewStub *listItemStub = &defaultListItemStub;
+
+ListItem::ListItem(QListWidget *parent, int type)
+    : QListWidgetItem(parent, type)
+{
+    listItemStub->ListItemConstructor(parent, type);
+}
+
+void ListViewStub::setImage(const QPixmap &image)
+{
+    listItemStub->setImage(image);
+}
+
+void ListViewStub::setTitle(const QString &name)
+{
+    listItemStub->setTitle(name);
+}
+
+void ListViewStub::setSize(const QSize &size)
+{
+    listItemStub->setSize(size);
+}
+
+QString ListViewStub::shortenText(const QString &text, int textWidth, TextSize textSize)
+{
+    return listItemStub->shortenText(text, textWidth, textSize);
+}
+
+QString ListViewStub::title()
+{
+    return listItemStub->title();
+}
+
+#endif // LISTITEMSTUB_H
+
diff --git a/tests/stubs/listview.h b/tests/stubs/listview.h
new file mode 100644 (file)
index 0000000..cf44964
--- /dev/null
@@ -0,0 +1,274 @@
+/*
+   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.
+*/
+
+#ifndef LISTVIEWSTUB_H
+#define LISTVIEWSTUB_H
+
+#include "../../src/ui/personlistview.h"
+#include "listitem.h"
+#include "stubbase.h"
+
+class ListViewStub : public StubBase
+{
+public:
+    virtual void ListViewConstructor(QWidget *parent = 0);
+    virtual void addListItem(const QString &key, ListItem *item);
+    virtual void addListItemToView(ListItem *item);
+    virtual void clearUnused(const QStringList &itemIDs);
+    virtual void clearFilter();
+    virtual void clearItemSelection();
+    virtual void clearList();
+    virtual bool contains(const QString &userID);
+    virtual void filter(const QList<QString> &itemIDs);
+    virtual void filter(const QString &pattern);
+    virtual ListItem *takeListItemFromView(const QString &itemID);
+    virtual ListItem *listItem(const QString &itemID);
+    virtual ListItem *listItemAt(int index);
+    virtual void prependListItem(const QString &key, ListItem *item);
+    virtual void removeLastItem();
+    virtual ListItem *selectedItem();
+    virtual void setSelectedItem(ListItem *item);
+
+protected:
+    virtual bool listItemClicked(ListItem *clickedItem);
+};
+
+ListViewStub::ListViewConstructor(QWidget *parent)
+{
+    Q_UNUSED(parent)
+}
+
+void ListViewStub::addListItem(const QString &key, ListItem *item)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(key));
+    params.append(new Parameter<ListItem *>(item));
+    stubMethodEntered("addListItem", params);
+}
+
+void ListViewStub::addListItemToView(ListItem *item)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<ListItem *>(item));
+    stubMethodEntered("addListItemToView", params);
+}
+
+void ListViewStub::clearUnused(const QStringList &itemIDs)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QStringList &>(itemIDs));
+    stubMethodEntered("clearUnused", params);
+}
+
+void ListViewStub::clearFilter()
+{
+    stubMethodEntered("clearFilter");
+}
+
+void ListViewStub::clearItemSelection()
+{
+    stubMethodEntered("clearItemSelection");
+}
+
+void ListViewStub::clearList()
+{
+    stubMethodEntered("clearList");
+}
+
+bool ListViewStub::contains(const QString &userID)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(userID));
+    stubMethodEntered("contains", params);
+
+    return stubReturnValue<bool>("contains");
+}
+
+void ListViewStub::filter(const QList<QString> &itemIDs)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QList<QString> &>(itemIDs));
+    stubMethodEntered("filter", params);
+}
+
+void ListViewStub::filter(const QString &pattern)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(pattern));
+    stubMethodEntered("filter", params);
+}
+
+ListItem *ListViewStub::takeListItemFromView(const QString &itemID)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(itemID));
+    stubMethodEntered("takeListItemFromView", params);
+
+    return stubReturnValue<ListItem *>("takeListItemFromView");
+}
+
+ListItem *ListViewStub::listItem(const QString &itemID)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(itemID));
+    stubMethodEntered("listItem", params);
+
+    return stubReturnValue<ListItem *>("listItem");
+}
+
+ListItem *ListViewStub::listItemAt(int index)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<int>(index));
+    stubMethodEntered("listItemAt", params);
+
+    return stubReturnValue<ListItem *>("listItemAt");
+}
+
+void ListViewStub::prependListItem(const QString &key, ListItem *item)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QString &>(key));
+    params.append(new Parameter<ListItem *>(item));
+    stubMethodEntered("prependListItem", params);
+}
+
+void ListViewStub::removeLastItem()
+{
+    stubMethodEntered("removeLastItem");
+}
+
+ListItem *ListViewStub::selectedItem()
+{
+    return stubReturnValue<ListItem *>("selectedItem");
+}
+
+void ListViewStub::setSelectedItem(ListItem *item)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<ListItem *>(item));
+    stubMethodEntered("setSelectedItem", params);
+}
+
+bool ListViewStub::listItemClicked(ListItem *clickedItem)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<ListItem *>(clickedItem));
+    stubMethodEntered("listItemClicked", params);
+
+    return stubReturnValue<bool>("listItemClicked");
+}
+
+ListViewStub defaultListViewStub;
+ListViewStub *listViewStub = &defaultListViewStub;
+
+ListView::ListView(QWidget *parent)
+    : QListWidget(parent)
+{
+    listViewStub->ListViewConstructor(parent);
+}
+
+void ListView::addListItem(const QString &key, ListItem *item)
+{
+    listViewStub->addListItem(key, item);
+}
+
+void ListView::addListItemToView(ListItem *item)
+{
+    listViewStub->addListItemToView(item);
+}
+
+void ListView::clearUnused(const QStringList &itemIDs)
+{
+    listViewStub->clearUnused(itemIDs);
+}
+
+void ListView::clearFilter()
+{
+    listViewStub->clearFilter();
+}
+
+void ListView::clearItemSelection()
+{
+    listViewStub->clearItemSelection();
+}
+
+void ListView::clearList()
+{
+    listViewStub->clearList();
+}
+
+void ListView::contains(const QString &userID)
+{
+    listViewStub->contains(userID);
+}
+
+void ListView::filter(const QList<QString> &itemIDs)
+{
+    listViewStub->filter(itemIDs);
+}
+
+void ListView::filter(const QString &pattern)
+{
+    listViewStub->filter(pattern);
+}
+
+ListItem *ListView::takeListItemFromView(const QString &itemID)
+{
+    return listViewStub->takeListItemFromView(itemID);
+}
+
+ListItem *ListView::listItem(const QString &itemID)
+{
+    return listViewStub->listItem(itemID);
+}
+
+ListItem *ListView::listItemAt(int index)
+{
+    return listViewStub->listItemAt(index);
+}
+
+void ListView::prependListItem(const QString &key, ListItem *item)
+{
+    listViewStub->prependListItem(key, item);
+}
+
+void ListView::removeLastItem()
+{
+    listViewStub->removeLastItem();
+}
+
+ListItem *ListView::selectedItem()
+{
+    return listViewStub->selectedItem();
+}
+
+void ListView::setSelectedItem(ListItem *item)
+{
+    listViewStub->setSelectedItem(item);
+}
+
+bool ListView::listItemClicked(ListItem *clickedItem)
+{
+    listViewStub->listItemClicked(clickedItem);
+}
+
+#endif // LISTVIEWSTUB_H
diff --git a/tests/stubs/personlistitem.h b/tests/stubs/personlistitem.h
new file mode 100644 (file)
index 0000000..1070b1f
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+   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.
+*/
+
+#ifndef PERSONLISTITEMSTUB_H
+#define PERSONLISTITEMSTUB_H
+
+#include "../../src/ui/personlistitem.h"
+#include "../../src/coordinates/geocoordinate.h"
+#include "stubbase.h"
+
+class PersonListItemStub : public StubBase
+{
+public:
+    virtual void PersonListItemConstructor();
+    virtual GeoCoordinate coordinates() const;
+    virtual QString facebookId() const;
+    virtual void setAvatarImage(const QPixmap &image);
+    virtual void setCoordinates(const GeoCoordinate &coordinates);
+    virtual void setPersonData(const User &user);
+};
+
+void PersonListItemStub::PersonListItemConstructor()
+{
+
+}
+
+GeoCoordinate PersonListItemStub::coordinates() const
+{
+    return stubReturnValue<GeoCoordinate>("coordinates");
+}
+
+QString PersonListItemStub::facebookId() const
+{
+    return stubReturnValue<QString>("facebookId");
+}
+
+void PersonListItemStub::setAvatarImage(const QPixmap &image)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const QPixmap *>(image));
+    stubMethodEntered("setAvatarImage", params);
+}
+
+void PersonListItemStub::setCoordinates(const GeoCoordinate &coordinates)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const GeoCoordinate &>(coordinates));
+    stubMethodEntered("setCoordinates", params);
+}
+
+void PersonListItemStub::setPersonData(const User &user)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<const User &>(user));
+    stubMethodEntered("setUserData", params);
+}
+
+//Create a stub instance
+PersonListItemStub defaultPersonListItemStub;
+PersonListItemStub *personListItemStub = &defaultPersonListItemStub;
+
+PersonListItem::PersonListItem()
+    : ExtendedListItem()
+{
+    personListItemStub->PersonListItemConstructor();
+}
+
+GeoCoordinate PersonListItem::coordinates() const
+{
+    return personListItemStub->coordinates();
+}
+
+GeoCoordinate PersonListItem::facebookId() const
+{
+    return personListItemStub->facebookId();
+}
+
+void PersonListItem::setAvatarImage(const QPixmap &image)
+{
+    personListItemStub->setAvatarImage(image);
+}
+
+void PersonListItem::setCoordinates(const GeoCoordinate &coordinates)
+{
+    personListItemStub->setCoordinates(coordinates);
+}
+
+void PersonListItem::setPersonData(const User &user)
+{
+    personListItemStub->setPersonData(user);
+}
+
+#endif // PERSONLISTITEMSTUB_H
diff --git a/tests/stubs/personlistview.h b/tests/stubs/personlistview.h
new file mode 100644 (file)
index 0000000..627d47e
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+   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.
+*/
+
+#ifndef PERSONLISTVIEWSTUB_H
+#define PERSONLISTVIEWSTUB_H
+
+#include "../../src/ui/personlistview.h"
+#include "listview.h"
+#include "stubbase.h"
+
+class PersonListViewStub : public StubBase
+{
+public:
+    virtual void PersonListViewConstructor(QWidget *parent = 0);
+    virtual bool listItemClicked(ListItem *item);
+};
+
+void PersonListViewStub::PersonListViewConstructor(QWidget *parent)
+{
+    Q_UNUSED(parent)
+}
+
+bool PersonListViewStub::listItemClicked(ListItem *item)
+{
+    QList<ParameterBase *> params;
+    params.append(new Parameter<ListItem *>(item));
+    stubMethodEntered("listItemClicked", params);
+
+    return stubReturnValue<bool>("listItemClicked");
+}
+
+//Create a stub instance
+PersonListViewStub defaultPersonListViewStub;
+PersonListViewStub *personListViewStub = &defaultPersonListViewStub;
+
+PersonListView::PersonListView(QWidget *parent)
+    : ListView(parent)
+{
+    personListViewStub->PersonListViewConstructor(parent);
+}
+
+bool PersonListView::listItemClicked(ListItem *item)
+{
+    personListViewStub->listItemClicked(item);
+}
+
+#endif // PERSONLISTVIEWSTUB_H
index 9095d1f..f88357c 100644 (file)
@@ -3,7 +3,12 @@ HEADERS += \
     methodcall.h \
     parameter.h \
     networkaccessmanagerstub.h \
-    imagefetcherstub.h
+    imagefetcherstub.h \
+    personlistitem.h \
+    personlistview.h \
+    listview.h \
+    listitem.h \
+    extendedlistitem.h
 
 SOURCES += \
     stubbase.cpp
index b195c37..9cb7d4c 100644 (file)
@@ -1,10 +1,36 @@
 CONFIG += qtestlib
 DEFINES += QT_NO_DEBUG_OUTPUT
-INCLUDEPATH += . \
-    ../../../src/
-HEADERS += ../../../src/ui/meetpeoplepanel.h \
-           ../../../src/ui/panelbase.h
-SOURCES += ../../../src/ui/meetpeoplepanel.cpp \
-           ../../../src/ui/panelbase.cpp \
-           testmeetpeoplepanel.cpp
-RESOURCES += ../../../images.qrc
+
+INCLUDEPATH += ../../stubs/
+
+HEADERS += \
+    ../../stubs/personlistview.h \
+    ../../stubs/personlistitem.h \
+    ../../stubs/listview.h \
+    ../../stubs/listitem.h \
+    ../../stubs/extendedlistitem.h \
+    ../../../src/ui/extendedlistitemdelegate.h \
+    ../../../src/ui/listitemdelegate.h \
+    ../../../src/ui/meetpeoplepanel.h \
+    ../../../src/coordinates/geocoordinate.h \
+    ../../../src/coordinates/scenecoordinate.h \
+    ../../../src/ui/imagebutton.h \
+    ../../../src/ui/panelbase.h \
+    ../../../src/ui/panelcommon.h \
+    ../../../src/ui/listcommon.h \
+    ../../../src/ui/extendedlistitemstore.h \
+    ../../../src/common.h \
+    ../../../src/map/osm.h \
+    ../../../src/user/user.h
+
+SOURCES += \
+    ../../../src/ui/meetpeoplepanel.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/ui/extendedlistitemdelegate.cpp \
+    ../../../src/ui/listitemdelegate.cpp \
+    ../../../src/ui/imagebutton.cpp \
+    ../../../src/ui/panelbase.cpp \
+    ../../../src/coordinates/geocoordinate.cpp \
+    ../../../src/coordinates/scenecoordinate.cpp \
+    ../../../src/ui/extendedlistitemstore.cpp \
+    testmeetpeoplepanel.cpp
index 58203dd..3f8cf08 100644 (file)
 #include <QtTest>
 #include <QtGui>
 
-#include "ui/meetpeoplepanel.h"
+#include "../../../src/ui/meetpeoplepanel.h"
 
 class TestMeetPeoplePanel: public QObject
 {
     Q_OBJECT
 
 private slots:
-    void cleanupTestCase();
-    void initTestCase();
+    void cleanup();
+    void init();
 
 private:
     MeetPeoplePanel *m_meetPeoplePanel;
 };
 
-void TestMeetPeoplePanel::cleanupTestCase()
+void TestMeetPeoplePanel::cleanup()
 {
     delete m_meetPeoplePanel;
 }
 
-void TestMeetPeoplePanel::initTestCase()
+void TestMeetPeoplePanel::init()
 {
     m_meetPeoplePanel = new MeetPeoplePanel();
-    QVERIFY(m_meetPeoplePanel != 0);
+    QVERIFY(m_meetPeoplePanel);
 }
 
 QTEST_MAIN(TestMeetPeoplePanel)
index 25d51a0..a3afcef 100644 (file)
@@ -32,7 +32,6 @@ private slots:
     void cleanup();
     void init();
     void input();
-    void sendButtonPressed();
 
 private:
     QHash<QString, QString> m_tags;