Merge branch 'master' into friendlist
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Tue, 27 Apr 2010 09:34:58 +0000 (12:34 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Tue, 27 Apr 2010 09:34:58 +0000 (12:34 +0300)
Conflicts:
src/images.qrc
src/src.pro

51 files changed:
debian/control
images.qrc [new file with mode: 0644]
res/icon/48x48/situare.png [new file with mode: 0755]
res/icon/64x64/situare.png [new file with mode: 0755]
res/images/arrow_left.png [new file with mode: 0755]
res/images/arrow_right.png [new file with mode: 0755]
res/images/clock_small.png [new file with mode: 0644]
res/images/compas_small.png [new file with mode: 0644]
res/images/facebook_user_64.png [new file with mode: 0644]
res/images/list_small.png [new file with mode: 0644]
res/images/personal_infotab_background.png [new file with mode: 0644]
res/images/reload_icon.png [new file with mode: 0644]
res/images/sendPosition_icon.png [new file with mode: 0644]
res/images/separe_line.png [new file with mode: 0644]
res/images/situare_icon.png [deleted file]
res/images/top_separtor.png [new file with mode: 0644]
src/resources/arrow_left.png [deleted file]
src/resources/arrow_right.png [deleted file]
src/resources/clock_small.png [deleted file]
src/resources/compas_small.png [deleted file]
src/resources/facebook_user_64.png [deleted file]
src/resources/list_small.png [deleted file]
src/resources/personal_infotab_background.png [deleted file]
src/resources/reload_icon.png [deleted file]
src/resources/sendPosition_icon.png [deleted file]
src/resources/separe_line.png [deleted file]
src/resources/top_separtor.png [deleted file]
src/situare.png [deleted file]
src/situare_40x40.png [deleted file]
src/situare_64x64.png [deleted file]
src/situareservice/situarecommon.h
src/situareservice/situareservice.cpp
src/situareservice/situareservice.h
src/src.pro
src/ui/infotab.cpp
src/ui/listviewscreen.cpp
src/user/user.cpp [new file with mode: 0644]
src/user/user.h [new file with mode: 0644]
tests/situareservice/networkaccessmanagermock.cpp [new file with mode: 0644]
tests/situareservice/networkaccessmanagermock.h [new file with mode: 0644]
tests/situareservice/networkreplymock.cpp [new file with mode: 0644]
tests/situareservice/networkreplymock.h [new file with mode: 0644]
tests/situareservice/testfetchlocations/testfetchlocations.cpp [new file with mode: 0644]
tests/situareservice/testfetchlocations/testfetchlocations.pro [new file with mode: 0644]
tests/situareservice/testlocationupdate/networkaccessmanagermock.cpp [deleted file]
tests/situareservice/testlocationupdate/networkaccessmanagermock.h [deleted file]
tests/situareservice/testlocationupdate/networkreplymock.cpp [deleted file]
tests/situareservice/testlocationupdate/networkreplymock.h [deleted file]
tests/situareservice/testlocationupdate/testlocationupdate.cpp
tests/user/testuser.cpp [new file with mode: 0644]
tests/user/user.pro [new file with mode: 0644]

index d9f3941..ed7b311 100644 (file)
@@ -11,46 +11,126 @@ Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: This is the Situare client for Maemo
  This application is done with Qt, requires Qt4.6.2 libraries
 XB-Maemo-Icon-26:
- iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c
- 6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAHsQAAB7EBBsVhhgAAAAd0
- SU1FB9oEEwQlEtQewisAAAboSURBVEjHhZZbbFxXFYa/tc+ZM56Jx5fJeHxN
- nDrNxSGX4iZNqihpFFBDVCTSi1okHpBACJ6qgkR5AcEDCAmJCkSRihBV6QMv
- KC0SFLVKoSQkJKS514lrx4nj2HHsxPHcPJczZ85ePIztpnWBJW2dh7PP/tda
- //r/s4X/EaoKIIBR1aiINKhqtFgqr/jr0TPNU7dmk4Wy37pxbrrbnZ4cfOo3
- Lx35b2e5IyO35ci/LzidyWij19CwcmDzumRbsqXNcZwe4AFr7RoRWaWqrUCj
- iDSWy37kzp2MO1+uuMmg6sYmxuRqsu3kTw4fOZHI5kvPf/3p5UBHjp/+Yr5U
- +bHReOvje9Y3tSVbmxzHyGJFIgKAiCBAGFpOXxwmkytqYy2QreMjXCuVtLR5
- 9XZvNrf1+W8+c+rTKjKFcrk96jlbD+7f0fNAb1fzIsjS4fWlIqIKDF+bYHD4
- pnq1QB6+e0vnr1zU251rwPUiWq3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K5CYII=
+ ====
diff --git a/images.qrc b/images.qrc
new file mode 100644 (file)
index 0000000..f3a3b46
--- /dev/null
@@ -0,0 +1,12 @@
+<RCC>
+    <qresource prefix="/">
+        <file>res/images/arrow_left.png</file>
+        <file>res/images/arrow_right.png</file>
+        <file>res/images/clock_small.png</file>
+        <file>res/images/compas_small.png</file>
+        <file>res/images/facebook_user_64.png</file>
+        <file>res/images/list_small.png</file>
+        <file>res/images/reload_icon.png</file>
+        <file>res/images/sendPosition_icon.png</file>
+    </qresource>
+</RCC>
diff --git a/res/icon/48x48/situare.png b/res/icon/48x48/situare.png
new file mode 100755 (executable)
index 0000000..9c99f31
Binary files /dev/null and b/res/icon/48x48/situare.png differ
diff --git a/res/icon/64x64/situare.png b/res/icon/64x64/situare.png
new file mode 100755 (executable)
index 0000000..d84ac1f
Binary files /dev/null and b/res/icon/64x64/situare.png differ
diff --git a/res/images/arrow_left.png b/res/images/arrow_left.png
new file mode 100755 (executable)
index 0000000..2232aef
Binary files /dev/null and b/res/images/arrow_left.png differ
diff --git a/res/images/arrow_right.png b/res/images/arrow_right.png
new file mode 100755 (executable)
index 0000000..42fbde4
Binary files /dev/null and b/res/images/arrow_right.png differ
diff --git a/res/images/clock_small.png b/res/images/clock_small.png
new file mode 100644 (file)
index 0000000..50efd6e
Binary files /dev/null and b/res/images/clock_small.png differ
diff --git a/res/images/compas_small.png b/res/images/compas_small.png
new file mode 100644 (file)
index 0000000..a85e802
Binary files /dev/null and b/res/images/compas_small.png differ
diff --git a/res/images/facebook_user_64.png b/res/images/facebook_user_64.png
new file mode 100644 (file)
index 0000000..b828219
Binary files /dev/null and b/res/images/facebook_user_64.png differ
diff --git a/res/images/list_small.png b/res/images/list_small.png
new file mode 100644 (file)
index 0000000..d250a1f
Binary files /dev/null and b/res/images/list_small.png differ
diff --git a/res/images/personal_infotab_background.png b/res/images/personal_infotab_background.png
new file mode 100644 (file)
index 0000000..a9b30ec
Binary files /dev/null and b/res/images/personal_infotab_background.png differ
diff --git a/res/images/reload_icon.png b/res/images/reload_icon.png
new file mode 100644 (file)
index 0000000..7ffa4ec
Binary files /dev/null and b/res/images/reload_icon.png differ
diff --git a/res/images/sendPosition_icon.png b/res/images/sendPosition_icon.png
new file mode 100644 (file)
index 0000000..5c44ea3
Binary files /dev/null and b/res/images/sendPosition_icon.png differ
diff --git a/res/images/separe_line.png b/res/images/separe_line.png
new file mode 100644 (file)
index 0000000..8d9bb0e
Binary files /dev/null and b/res/images/separe_line.png differ
diff --git a/res/images/situare_icon.png b/res/images/situare_icon.png
deleted file mode 100644 (file)
index ab78b15..0000000
Binary files a/res/images/situare_icon.png and /dev/null differ
diff --git a/res/images/top_separtor.png b/res/images/top_separtor.png
new file mode 100644 (file)
index 0000000..d21c24a
Binary files /dev/null and b/res/images/top_separtor.png differ
diff --git a/src/resources/arrow_left.png b/src/resources/arrow_left.png
deleted file mode 100755 (executable)
index 2232aef..0000000
Binary files a/src/resources/arrow_left.png and /dev/null differ
diff --git a/src/resources/arrow_right.png b/src/resources/arrow_right.png
deleted file mode 100755 (executable)
index 42fbde4..0000000
Binary files a/src/resources/arrow_right.png and /dev/null differ
diff --git a/src/resources/clock_small.png b/src/resources/clock_small.png
deleted file mode 100644 (file)
index 50efd6e..0000000
Binary files a/src/resources/clock_small.png and /dev/null differ
diff --git a/src/resources/compas_small.png b/src/resources/compas_small.png
deleted file mode 100644 (file)
index a85e802..0000000
Binary files a/src/resources/compas_small.png and /dev/null differ
diff --git a/src/resources/facebook_user_64.png b/src/resources/facebook_user_64.png
deleted file mode 100644 (file)
index b828219..0000000
Binary files a/src/resources/facebook_user_64.png and /dev/null differ
diff --git a/src/resources/list_small.png b/src/resources/list_small.png
deleted file mode 100644 (file)
index d250a1f..0000000
Binary files a/src/resources/list_small.png and /dev/null differ
diff --git a/src/resources/personal_infotab_background.png b/src/resources/personal_infotab_background.png
deleted file mode 100644 (file)
index a9b30ec..0000000
Binary files a/src/resources/personal_infotab_background.png and /dev/null differ
diff --git a/src/resources/reload_icon.png b/src/resources/reload_icon.png
deleted file mode 100644 (file)
index 7ffa4ec..0000000
Binary files a/src/resources/reload_icon.png and /dev/null differ
diff --git a/src/resources/sendPosition_icon.png b/src/resources/sendPosition_icon.png
deleted file mode 100644 (file)
index 5c44ea3..0000000
Binary files a/src/resources/sendPosition_icon.png and /dev/null differ
diff --git a/src/resources/separe_line.png b/src/resources/separe_line.png
deleted file mode 100644 (file)
index 8d9bb0e..0000000
Binary files a/src/resources/separe_line.png and /dev/null differ
diff --git a/src/resources/top_separtor.png b/src/resources/top_separtor.png
deleted file mode 100644 (file)
index d21c24a..0000000
Binary files a/src/resources/top_separtor.png and /dev/null differ
diff --git a/src/situare.png b/src/situare.png
deleted file mode 100644 (file)
index 3771eb2..0000000
Binary files a/src/situare.png and /dev/null differ
diff --git a/src/situare_40x40.png b/src/situare_40x40.png
deleted file mode 100644 (file)
index 67ae012..0000000
Binary files a/src/situare_40x40.png and /dev/null differ
diff --git a/src/situare_64x64.png b/src/situare_64x64.png
deleted file mode 100644 (file)
index c77f0be..0000000
Binary files a/src/situare_64x64.png and /dev/null differ
index 8440c5f..19824ec 100644 (file)
@@ -35,6 +35,7 @@ const QString TEST_API_KEY = "cf77865a5070f2c2ba3b52cbf3371579";
 // Situare PHP scripts
 const QString UPDATE_LOCATION = "updateLocation.php";
 const QString REVERSE_GEO = "reversegeo.php";
+const QString GET_LOCATIONS = "getLocations.php";
 
 // Cookies
 const QString COOKIE = "Cookie";
@@ -56,6 +57,7 @@ const QString AMBERSAND_MARK = "&";
 const QString EQUAL_MARK = "=";
 const QString UNDERLINE_MARK = "_";
 const QString BREAK_MARK = ";";
+const QString OPENING_BRACE_MARK = "{";
 
 // Coordinates
 const QString LATITUDE = "lat";
index 8cebae4..1f98fc3 100644 (file)
@@ -25,6 +25,7 @@
 #include "situareservice.h"
 #include "situarecommon.h"
 #include "../cookiehandler/cookiehandler.h"
+#include "parser.h"
 
 SituareService::SituareService(QObject *parent, QNetworkAccessManager *manager)
         : QObject(parent), m_networkManager(manager)
@@ -45,8 +46,7 @@ SituareService::~SituareService()
     delete m_networkManager;
 }
 
-void SituareService::updateLocation(const QPointF &coordinates, const QString &status,
-                                    const bool &publish)
+void SituareService::fetchLocations()
 {
     qDebug() << __PRETTY_FUNCTION__;
 
@@ -56,16 +56,7 @@ void SituareService::updateLocation(const QPointF &coordinates, const QString &s
                                               m_credentials.sessionKey(), m_credentials.sessionSecret(),
                                               m_credentials.sig(), EN_LOCALE);
 
-
-    QString publishValue;
-    if(publish) {
-        publishValue = PUBLISH_TRUE;
-    }
-    else {
-        publishValue = PUBLISH_FALSE;
-    }
-    QString urlParameters = formUrlParameters(coordinates, status, publishValue);
-    QUrl url = formUrl(SITUARE_URL, UPDATE_LOCATION, urlParameters);
+    QUrl url = formUrl(SITUARE_URL, GET_LOCATIONS);
 
     sendRequest(url, COOKIE, cookie);
 }
@@ -86,6 +77,31 @@ void SituareService::reverseGeo(const QPointF &coordinates)
     sendRequest(url, COOKIE, cookie);
 }
 
+void SituareService::updateLocation(const QPointF &coordinates, const QString &status,
+                                    const bool &publish)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    CookieHandler cookieHandler;
+
+    QString cookie = cookieHandler.formCookie(API_KEY, m_credentials.expires(), m_credentials.userID(),
+                                              m_credentials.sessionKey(), m_credentials.sessionSecret(),
+                                              m_credentials.sig(), EN_LOCALE);
+
+
+    QString publishValue;
+    if(publish) {
+        publishValue = PUBLISH_TRUE;
+    }
+    else {
+        publishValue = PUBLISH_FALSE;
+    }
+    QString urlParameters = formUrlParameters(coordinates, status, publishValue);
+    QUrl url = formUrl(SITUARE_URL, UPDATE_LOCATION, urlParameters);
+
+    sendRequest(url, COOKIE, cookie);
+}
+
 QUrl SituareService::formUrl(const QString &baseUrl, const QString &phpScript, QString urlParameters)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -186,6 +202,10 @@ void SituareService::requestFinished(QNetworkReply *reply)
             // ToDo: signal UI?
             emit error(replyArray);
         }
+        else if(replyArray.startsWith(OPENING_BRACE_MARK.toAscii())) {
+            qDebug() << "JSON string";
+            parseUserData(replyArray);
+        }
         else {
             // no error -> update was successful
             // ToDo: signal UI?
@@ -202,3 +222,49 @@ void SituareService::credentialsReady()
     qDebug() << __PRETTY_FUNCTION__;
     m_credentials = m_facebookAuthentication.loginCredentials();
 }
+
+void SituareService::parseUserData(const QByteArray &jsonReply)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QJson::Parser parser;
+    bool ok;
+
+    QVariantMap result = parser.parse (jsonReply, &ok).toMap();
+    if (!ok) {
+
+        qFatal("An error occurred during parsing");
+        exit (1);
+    }
+
+    QList<User *> friendsList;
+
+    QVariant userVariant = result.value("user");
+    QMap<QString, QVariant> userMap = userVariant.toMap();
+
+    QPointF coordinates(userMap["longitude"].toReal(), userMap["latitude"].toReal());
+
+    QUrl imageUrl = userMap["profile_pic"].toUrl();
+
+    User user = User(userMap["address"].toString(), coordinates, userMap["name"].toString(),
+                  userMap["note"].toString(), imageUrl, userMap["timestamp"].toString(),
+                  true, userMap["uid"].toString());
+
+    foreach (QVariant friendsVariant, result["friends"].toList()) {
+      QMap<QString, QVariant> friendMap = friendsVariant.toMap();
+      QVariant distance = friendMap["distance"];
+      QMap<QString, QVariant> distanceMap = distance.toMap();
+
+      QPointF coordinates(friendMap["longitude"].toReal(), friendMap["latitude"].toReal());
+
+      QUrl imageUrl = friendMap["profile_pic"].toUrl();
+
+      User *user = new User(friendMap["address"].toString(), coordinates, friendMap["name"].toString(),
+                            friendMap["note"].toString(), imageUrl, friendMap["timestamp"].toString(),
+                            false, friendMap["uid"].toString(), distanceMap["units"].toString(),
+                            distanceMap["value"].toDouble());
+
+      friendsList.append(user);
+    }
+    emit userDataChanged(user, friendsList);
+}
index d87f444..35998ca 100644 (file)
 #define SITUARESERVICE_H
 
 #include <QObject>
-#include <QPointF>
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QNetworkReply>
-#include <QUrl>
 #include "../facebookservice/facebookauthentication.h"
 #include "../facebookservice/facebookcredentials.h"
+#include "../user/user.h"
+
+class QNetworkAccessManager;
+class QNetworkReply;
+class QNetworkRequest;
+class QPointF;
+class QUrl;
 
 /**
 * @brief SituareService class for communicating with Situare server
@@ -58,14 +60,15 @@ public:
     */
     ~SituareService();
 
+    /*******************************************************************************
+     * MEMBER FUNCTIONS AND SLOTS
+     ******************************************************************************/
+
     /**
-    * @brief Updates location to the Situare server
+    * @brief Retrieves location user and friends information from Situare server
     *
-    * @param coordinates current cordinates
-    * @param status message
-    * @param publish publish location on Facebook wall (true/false)
     */
-    void updateLocation(const QPointF &coordinates, const QString &status, const bool &publish);
+    void fetchLocations();
 
     /**
     * @brief Translates coordinates to street address via Situare server
@@ -74,6 +77,15 @@ public:
     */
     void reverseGeo(const QPointF &coordinates);
 
+    /**
+    * @brief Updates location to the Situare server
+    *
+    * @param coordinates current cordinates
+    * @param status message
+    * @param publish publish location on Facebook wall (true/false)
+    */
+    void updateLocation(const QPointF &coordinates, const QString &status, const bool &publish);
+
 public slots:
 
     /**
@@ -83,7 +95,6 @@ public slots:
     */
     void requestFinished(QNetworkReply *reply);
 
-
     /**
     * @brief Public slot, which indicates when facebook credentials are ready
     *
@@ -113,6 +124,13 @@ private:
     QString formUrlParameters(const QPointF &coordinates, QString status = 0, QString publish = 0);
 
     /**
+    * @brief Parses user and friend data from JSON string
+    *
+    * @param jsonReply JSON string
+    */
+    void parseUserData(const QByteArray &jsonReply);
+
+    /**
     * @brief Sends http request
     *
     * @param url destination
@@ -121,6 +139,10 @@ private:
     */
     void sendRequest(const QUrl &url, const QString &cookieType, const QString &cookie);
 
+    /*******************************************************************************
+     * SIGNALS
+     ******************************************************************************/
+
 signals:
 
     /**
@@ -130,6 +152,19 @@ signals:
     */
     void error(const QString &error);
 
+
+    /**
+    * @brief Signals when user data is retrieved
+    *
+    * @param user instance of user
+    * @param friendList list of friends
+    */
+    void userDataChanged(User &user, QList<User *> &friendList);
+
+    /*******************************************************************************
+     * DATA MEMBERS
+     ******************************************************************************/
+
 private:
 
     FacebookCredentials m_credentials; ///< handle for FacebookCredentials
index 3d92a8f..75a4677 100644 (file)
@@ -3,7 +3,9 @@
 # -------------------------------------------------
 TARGET = ../situare
 TEMPLATE = app
-RESOURCES += images.qrc
+INCLUDEPATH += "/usr/include/qjson"
+LIBS += "-lqjson"
+RESOURCES += ../images.qrc
 SOURCES += main.cpp \
     ui/mainwindow.cpp \
     ui/mapviewscreen.cpp \
@@ -24,7 +26,8 @@ SOURCES += main.cpp \
     ui/friendlistview.cpp \
     ui/friendlistitemdelegate.cpp \
     ui/friendlistitem.cpp \
-    ui/friendlistmodel.cpp
+    ui/friendlistmodel.cpp \
+    user/user.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -47,7 +50,9 @@ HEADERS += ui/mainwindow.h \
     ui/friendlistview.h \
     ui/friendlistitemdelegate.h \
     ui/friendlistitem.h \
-    ui/friendlistmodel.h
+    ui/friendlistmodel.h \
+    user/user.h
+
 QT += network \
     webkit
 
@@ -57,6 +62,20 @@ QT += network \
     message(OpenGL built in)
     message(Make sure you have OpenGL development headers installed)
     message(install headers with: sudo apt-get install libgl-dev libglu-dev)
+
+    message(QJson built in)
+    message(Make sure you have QJson development headers installed)
+    message(install headers with: sudo apt-get install libqjson-dev)
+}
+
+maemo5 {
+    message(QJson built in)
+    message(Make sure you have QJson development headers installed)
+    message(add: deb http://repository.maemo.org/extras-devel fremantle free non-free)
+    message(and deb-src http://repository.maemo.org/extras-devel fremantle free non-free)
+    message(to scratchbox's sources.list in /etc/apt)
+    message(run: apt-get update)
+    message(install headers with: apt-get install libqjson-dev)
 }
 
 # -----------------------------------------------------------------
@@ -74,14 +93,11 @@ unix {
     desktop.path = $$DATADIR/applications/hildon
     desktop.files += situare.desktop
     INSTALLS += desktop
-    icon26.path = $$DATADIR/icons/hicolor/26x26/apps
-    icon26.files += situare.png
-    INSTALLS += icon26
-    icon40.path = $$DATADIR/icons/hicolor/40x40/apps
-    icon40.files += situare_40x40.png
-    INSTALLS += icon40
+    icon48.path = $$DATADIR/icons/hicolor/48x48/apps
+    icon48.files += ../res/icon/48x48/situare.png
+    INSTALLS += icon48
     icon64.path = $$DATADIR/icons/hicolor/64x64/apps
-    icon64.files += situare_64x64.png
+    icon64.files += ../res/icon/64x64/situare.png
     INSTALLS += icon64
     target.path = $$BINDIR
     INSTALLS += target
index a592bc1..85607a1 100644 (file)
@@ -36,12 +36,12 @@ InfoTab::InfoTab(QWidget *parent)
     QToolButton *updateFriendsButton = new QToolButton;
     QToolButton *updateStatusMessageButton = new QToolButton;
 
-    updateFriendsButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
-    updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
+    updateFriendsButton->setIcon(QIcon(QPixmap(":/res/images/reload_icon.png")));
+    updateStatusMessageButton->setIcon(QIcon(QPixmap(":/res/images/sendPosition_icon.png")));
 
-    m_clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
-    m_envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
-    m_compassLabel->setPixmap(QPixmap(":/resources/compas_small.png"));
+    m_clockLabel->setPixmap(QPixmap(":/res/images/clock_small.png"));
+    m_envelopeLabel->setPixmap(QPixmap(":/res/images/list_small.png"));
+    m_compassLabel->setPixmap(QPixmap(":/res/images/compas_small.png"));
     m_layout->addWidget(m_userPicture,0,0,4,1);
     m_layout->addWidget(m_userNameLabel,0,2,1,2);
     m_layout->addWidget(m_clockLabel,1,1,1,1);
index cdfa418..07a5d4f 100644 (file)
@@ -115,10 +115,10 @@ ListViewScreen::ListViewScreen(QWidget *parent)
     //DEBUG
 
 
-    m_arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
+    m_arrowbutton = new Pixmap(QPixmap(":/res/images/arrow_right.png"));
 
     m_personalInfo = new InfoTab;
-    m_personalInfo->setAvatar(QPixmap(":/resources/facebook_user_64.png"));
+    m_personalInfo->setAvatar(QPixmap(":/res/images/facebook_user_64.png"));
     m_personalInfo->setUserName("Fred Facebook");
     m_personalInfo->setMessageText("Hello Maemo Situare !");
     m_personalInfo->setTime("1 hour ago");
diff --git a/src/user/user.cpp b/src/user/user.cpp
new file mode 100644 (file)
index 0000000..6bb83f8
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Henri Lampela - henri.lampela@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 "user.h"
+
+User::User(QString address, QPointF coordinates, QString name, QString note, QUrl imageUrl,
+           QString timestamp, bool type, QString userId, QString units, double value)
+               : m_address(address)
+               , m_coordinates(coordinates)
+               , m_name(name)
+               , m_note(note)
+               , m_profileImageUrl(imageUrl)
+               , m_timestamp(timestamp)
+               , m_type(type)
+               , m_units(units)
+               , m_userId(userId)
+               , m_value(value)
+{
+
+}
+
+void User::setAddress(const QString &address)
+{
+    m_address = address;
+}
+
+void User::setCoordinates(const QPointF &coordinates)
+{
+    m_coordinates = coordinates;
+}
+
+void User::setDistance(const double &value, const QString &units)
+{
+    m_value = value;
+    m_units = units;
+}
+
+void User::setNote(const QString &note)
+{
+    m_note = note;
+}
+
+void User::setProfileImageUrl(const QUrl &imageUrl)
+{
+    m_profileImageUrl = imageUrl;
+}
+
+void User::setTimestamp(const QString &timestamp)
+{
+    m_timestamp = timestamp;
+}
+
+QString User::address() const
+{
+    return m_address;
+}
+
+QPointF User::coordinates() const
+{
+    return m_coordinates;
+}
+
+void User::distance(double &value, QString &units) const
+{
+    value = m_value;
+    units = m_units;
+}
+
+QString User::name() const
+{
+    return m_name;
+}
+
+QString User::note() const
+{
+    return m_note;
+}
+
+QUrl User::profileImageUrl() const
+{
+    return m_profileImageUrl;
+}
+
+QString User::timestamp() const
+{
+    return m_timestamp;
+}
+
+bool User::type() const
+{
+    return m_type;
+}
+
+QString User::userId() const
+{
+    return m_userId;
+}
diff --git a/src/user/user.h b/src/user/user.h
new file mode 100644 (file)
index 0000000..968003a
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+       Henri Lampela - henri.lampela@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 USER_H
+#define USER_H
+
+#include <QPointF>
+#include <QString>
+#include <QUrl>
+
+/**
+* @brief Class to store user information (applies to friends also)
+*
+* @author Henri Lampela
+* @class User user.h "user/user.h"
+*/
+class User
+{
+public:
+
+    /**
+    * @brief Default constructor, initializes member data
+    *
+    */
+    User(const QString address, const QPointF coordinates, const QString name, const QString note,
+         const QUrl imageUrl, const QString timestamp, const bool type, const QString userId,
+         const QString units = 0, const double value = 0);
+
+    /*******************************************************************************
+     * MEMBER FUNCTIONS AND SLOTS
+     ******************************************************************************/
+
+    /**
+    * @brief Set address
+    *
+    * @param address street address
+    */
+    void setAddress(const QString &address);
+
+    /**
+    * @brief Set coordinates ( x = lon, y = lat )
+    *
+    * @param coordinates coordinates
+    */
+    void setCoordinates(const QPointF &coordinates);
+
+    /**
+    * @brief Set distance
+    *
+    * @param value distance
+    * @param units unit type
+    */
+    void setDistance(const double &value, const QString &units);
+
+    /**
+    * @brief Set note
+    *
+    * @param note note/status message
+    */
+    void setNote(const QString &note);
+
+    /**
+    * @brief Set download address for profile image
+    *
+    * @param imageUrl image url
+    */
+    void setProfileImageUrl(const QUrl &imageUrl);
+
+    /**
+    * @brief Set timestamp for last status update, timestamp is in literal mode
+    *
+    * @param timestamp timestamp
+    */
+    void setTimestamp(const QString &timestamp);
+
+    /**
+    * @brief Get address
+    *
+    * @return QString address
+    */
+    QString address() const;
+
+    /**
+    * @brief Get coordinates
+    *
+    * @return QPointF coordinates
+    */
+    QPointF coordinates() const;
+
+    /**
+    * @brief Get distance and units
+    *
+    * @param value distance
+    * @param units unit type
+    */
+    void distance(double &value, QString &units) const;
+
+    /**
+    * @brief Get name
+    *
+    * @return QString profile name
+    */
+    QString name() const;
+
+    /**
+    * @brief Get note/status message
+    *
+    * @return QString note
+    */
+    QString note() const;
+
+    /**
+    * @brief Get download address for profile image
+    *
+    * @return QString url
+    */
+    QUrl profileImageUrl() const;
+
+    /**
+    * @brief Get timestamp of last status update
+    *
+    * @return QString timestamp
+    */
+    QString timestamp() const;
+
+    /**
+    * @brief Get user type
+    *
+    * @return bool user type (true = user, false = friend)
+    */
+    bool type() const;
+
+    /**
+    * @brief Get userId
+    *
+    * @return QString userId
+    */
+    QString userId() const;
+
+    /*******************************************************************************
+     * DATA MEMBERS
+     ******************************************************************************/
+
+private:
+    QString m_address; ///< placeholder for address information
+    QPointF m_coordinates; ///< placeholder for coordinates
+    QString m_name; ///< placeholder for name
+    QString m_note; ///< placeholder for note
+    QUrl m_profileImageUrl; ///< placeholder for image url
+    QString m_timestamp; ///< placeholer for timestamp
+    bool m_type; ///< placeholder for user type
+    QString m_units; ///< placeholder for distance unit type
+    QString m_userId; ///< placeholder for userId
+    double m_value; ///< placeholder for distance value
+};
+
+
+#endif // USER_H
diff --git a/tests/situareservice/networkaccessmanagermock.cpp b/tests/situareservice/networkaccessmanagermock.cpp
new file mode 100644 (file)
index 0000000..d18a5b5
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Henri Lampela - henri.lampela@ixonos.com
+      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 <QDebug>
+#include <QBuffer>
+#include "networkaccessmanagermock.h"
+
+NetworkAccessManagerMock::NetworkAccessManagerMock(QNetworkAccessManager *manager, QObject *parent)
+    : QNetworkAccessManager(parent)
+    , mode(0)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
+
+NetworkReplyMock *NetworkAccessManagerMock::createRequest(Operation op, const QNetworkRequest &request,
+                                                        QIODevice *outgoingData)
+{
+     qDebug() << __PRETTY_FUNCTION__;
+
+     reply = new NetworkReplyMock(this);
+     this->request = request;
+
+     switch (this->mode) {
+
+     case NetworkAccessManagerMock::CORRECT:
+         QTimer::singleShot(0, this, SLOT(generateCorrectReply()));
+         break;
+     case NetworkAccessManagerMock::INCORRECT:
+         QTimer::singleShot(0, this, SLOT(generateError()));
+         break;
+     case NetworkAccessManagerMock::DELAYED_CORRECT:
+         QTimer::singleShot(0, this, SLOT(generateDelayedCorrectReply()));
+         break;
+     default:
+         QTimer::singleShot(0, this, SLOT(generateCorrectReply()));
+         break;
+    }
+    return reply;
+}
+
+NetworkAccessManagerMock::~NetworkAccessManagerMock()
+{
+    delete reply;
+}
+
+NetworkReplyMock *NetworkAccessManagerMock::get(const QNetworkRequest &request)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    this->request = request;
+
+    return reply;
+}
+
+void NetworkAccessManagerMock::setMode(int mode)
+{
+    this->mode = mode;
+}
+
+void NetworkAccessManagerMock::generateError()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    reply->setUrl(request.url());
+    reply->setError(QNetworkReply::HostNotFoundError, "Host not found");
+    emit QNetworkAccessManager::finished(reply);
+}
+
+void NetworkAccessManagerMock::generateCorrectReply()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    reply->setUrl(request.url());
+    reply->setError(QNetworkReply::NoError, "No error");
+//    QImage image;
+//    if (!image.load(":testTile.png", 0)) {
+//        qDebug() << "could not load image";
+//        image = QImage();
+//    }
+//    else
+//    qDebug() << "image loaded";
+//
+//    QByteArray array;
+//    QBuffer buffer(&array);
+//    buffer.open(QBuffer::WriteOnly);
+//    if (image.save(&buffer, "PNG"))
+//        qDebug() << "image saved";
+//    buffer.close();
+//    reply->setData(array);
+    emit QNetworkAccessManager::finished(reply);
+}
+
+void NetworkAccessManagerMock::generateDelayedCorrectReply()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    QTimer::singleShot(4000, this, SLOT(generateCorrectReply()));
+}
diff --git a/tests/situareservice/networkaccessmanagermock.h b/tests/situareservice/networkaccessmanagermock.h
new file mode 100644 (file)
index 0000000..6147408
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Henri Lampela - henri.lampela@ixonos.com
+      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 NETWORKACCESSMANAGERMOCK_H
+#define NETWORKACCESSMANAGERMOCK_H
+
+#include <QNetworkAccessManager>
+#include <QNetworkRequest>
+#include <QTimer>
+#include "networkreplymock.h"
+
+
+class NetworkAccessManagerMock : public QNetworkAccessManager
+{
+    Q_OBJECT
+public:
+    NetworkAccessManagerMock(QNetworkAccessManager *manager = 0, QObject *parent = 0);
+
+    ~NetworkAccessManagerMock();
+
+    NetworkReplyMock *get(const QNetworkRequest &request);
+
+    void setMode(int mode);
+
+
+    enum {CORRECT, INCORRECT, DELAYED_CORRECT};
+
+protected:
+    NetworkReplyMock *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
+
+signals:
+     void finished(NetworkReplyMock *reply);
+
+ private slots:
+     void generateError();
+     void generateCorrectReply();
+     void generateDelayedCorrectReply();
+
+private:
+     NetworkReplyMock *reply;
+     QNetworkRequest request;
+     int mode;
+};
+
+#endif // NETWORKACCESSMANAGERMOCK_H
diff --git a/tests/situareservice/networkreplymock.cpp b/tests/situareservice/networkreplymock.cpp
new file mode 100644 (file)
index 0000000..911e896
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Henri Lampela - henri.lampela@ixonos.com
+      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 <QNetworkRequest>
+#include <QDebug>
+#include "networkreplymock.h"
+
+NetworkReplyMock::NetworkReplyMock(QObject *parent)
+    : QNetworkReply(parent)
+    , m_offset(0)
+{
+}
+
+void NetworkReplyMock::setError(NetworkError errorCode, const QString &errorString)
+{
+     qDebug() << __PRETTY_FUNCTION__;
+     QNetworkReply::setError(errorCode, errorString);
+}
+
+
+qint64 NetworkReplyMock::readData(char *data, qint64 maxLen)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    if (m_offset < m_content.size()) {
+        qint64 number = qMin(maxLen, m_content.size() - m_offset);
+        memcpy(data, m_content.constData() + m_offset, number);
+        m_offset += number;
+        return number;
+   }
+   else {
+        return -1;
+   }
+}
+
+QByteArray NetworkReplyMock::readAll()
+{
+    return m_content;
+}
+
+qint64 NetworkReplyMock::bytesAvailable() const
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    return m_content.size() - m_offset;
+}
+
+void NetworkReplyMock::setUrl(const QUrl &url)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    QNetworkReply::setUrl(url);
+}
+
+void NetworkReplyMock::abort()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+}
+
+void NetworkReplyMock::test()
+{
+     qDebug() << __PRETTY_FUNCTION__;
+}
+
+void NetworkReplyMock::setData(const QByteArray &content)
+{
+     qDebug() << __PRETTY_FUNCTION__;
+//     setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/png"));
+//     setHeader(QNetworkRequest::ContentLengthHeader, QVariant(this->m_content.size()));
+     m_content.append(content);
+     qDebug() << "Content size: " << m_content.size();
+}
diff --git a/tests/situareservice/networkreplymock.h b/tests/situareservice/networkreplymock.h
new file mode 100644 (file)
index 0000000..d125aed
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+   Situare - A location system for Facebook
+   Copyright (C) 2010  Ixonos Plc. Authors:
+
+      Henri Lampela - henri.lampela@ixonos.com
+      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 NETWORKREPLYMOCK_H
+#define NETWORKREPLYMOCK_H
+
+#include <QNetworkReply>
+#include <QUrl>
+
+
+class NetworkReplyMock : public QNetworkReply
+{
+    Q_OBJECT
+public:
+    NetworkReplyMock(QObject *parent = 0);
+    void abort();
+    qint64 bytesAvailable() const;
+
+    bool isSequential() const
+    {
+        return true;
+    }
+    void setError(NetworkError errorCode, const QString &errorString);
+    void setData(const QByteArray &content);
+    void setUrl(const QUrl &url);
+    void test();
+    QByteArray readAll();
+
+protected:
+    qint64 readData(char *data, qint64 maxlen);
+
+private:
+    QByteArray m_content;
+    qint64 m_offset;
+};
+
+#endif // NETWORKREPLYMOCK_H
diff --git a/tests/situareservice/testfetchlocations/testfetchlocations.cpp b/tests/situareservice/testfetchlocations/testfetchlocations.cpp
new file mode 100644 (file)
index 0000000..99fc584
--- /dev/null
@@ -0,0 +1,122 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Henri Lampela - henri.lampela@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/QtTest>
+#include <QtCore>
+//#include <QNetworkAccessManager>
+
+
+#include "../../../src/situareservice/situareservice.h"
+#include "../../../src/situareservice/situarecommon.h"
+#include "../networkaccessmanagermock.h"
+#include "../networkreplymock.h"
+
+class QNetworkAccessManager;
+
+
+class testFetchLocations : public QObject
+{
+    Q_OBJECT
+public:
+    ~testFetchLocations();
+private:
+    SituareService *situare;
+    NetworkAccessManagerMock *managerMock;
+    QList<QNetworkReply *> currentRequests;
+
+private slots:
+
+    //void testIncorrectUrl();
+    //void testCorrectUrl();
+    void testFetchLocationsCase();
+};
+
+testFetchLocations::~testFetchLocations()
+{
+    delete situare;
+    delete managerMock;
+}
+
+
+//void testFetchLocations::testIncorrectUrl()
+//{
+//    QNetworkAccessManager *manager = new QNetworkAccessManager();
+//    managerMock = new NetworkAccessManagerMock(manager, this);
+//    situare = new SituareService(this, manager);
+//
+//    managerMock->setMode(NetworkAccessManagerMock::INCORRECT);
+//
+//    QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
+//
+//    QVERIFY(receivedErrorSpy.isValid());
+//
+//    // incorrect url
+//
+//    situare->sendRequest(QUrl("http://client.situare.nett"), COOKIE, QString(""));
+//    QTest::qWait(1000);
+//    QCOMPARE(receivedErrorSpy.count(), 1);
+//
+//    delete manager;
+//}
+
+//void testFetchLocations::testCorrectUrl()
+//{
+//    QNetworkAccessManager *manager = new QNetworkAccessManager();
+//    managerMock = new NetworkAccessManagerMock(manager, this);
+//    situare = new SituareService(this, manager);
+//
+//    managerMock->setMode(NetworkAccessManagerMock::CORRECT);
+//
+//    QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
+//
+//    QVERIFY(receivedErrorSpy.isValid());
+//
+//    QUrl url = QUrl("http://client.situare.net");
+//
+//    situare->sendRequest(url, COOKIE, QString(""));
+//    QTest::qWait(1000);
+//
+//    QCOMPARE(receivedErrorSpy.count(), 0);
+//
+//    delete manager;
+//}
+
+void testFetchLocations::testFetchLocationsCase()
+{
+    QNetworkAccessManager *manager = new QNetworkAccessManager();
+    managerMock = new NetworkAccessManagerMock(manager, this);
+    situare = new SituareService(this, manager);
+
+    managerMock->setMode(NetworkAccessManagerMock::CORRECT);
+
+    QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
+
+    situare->fetchLocations();
+    QTest::qWait(1000);
+
+    QCOMPARE(receivedErrorSpy.count(), 0);
+
+    delete manager;
+}
+
+
+QTEST_MAIN(testFetchLocations)
+#include "testfetchlocations.moc"
diff --git a/tests/situareservice/testfetchlocations/testfetchlocations.pro b/tests/situareservice/testfetchlocations/testfetchlocations.pro
new file mode 100644 (file)
index 0000000..57be8f9
--- /dev/null
@@ -0,0 +1,28 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Apr 21 10:16:04 2010
+######################################################################
+
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../../../src/situareservice/situareservice.h \
+           ../../../src/facebookservice/facebookauthentication.h \
+           ../../../src/facebookservice/facebookcredentials.h \
+           ../../../src/situareservice/situarecommon.h \
+           ../../../src/cookiehandler/cookiehandler.h \
+           ../networkaccessmanagermock.h \
+           ../networkreplymock.h
+SOURCES += testfetchlocations.cpp \
+           ../../../src/situareservice/situareservice.cpp \
+           ../../../src/facebookservice/facebookauthentication.cpp \
+           ../../../src/facebookservice/facebookcredentials.cpp \
+           ../../../src/cookiehandler/cookiehandler.cpp \
+           ../networkaccessmanagermock.cpp \
+           ../networkreplymock.cpp
+QT += core \
+    network \
+    webkit
diff --git a/tests/situareservice/testlocationupdate/networkaccessmanagermock.cpp b/tests/situareservice/testlocationupdate/networkaccessmanagermock.cpp
deleted file mode 100644 (file)
index d18a5b5..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-      Henri Lampela - henri.lampela@ixonos.com
-      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 <QDebug>
-#include <QBuffer>
-#include "networkaccessmanagermock.h"
-
-NetworkAccessManagerMock::NetworkAccessManagerMock(QNetworkAccessManager *manager, QObject *parent)
-    : QNetworkAccessManager(parent)
-    , mode(0)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-}
-
-NetworkReplyMock *NetworkAccessManagerMock::createRequest(Operation op, const QNetworkRequest &request,
-                                                        QIODevice *outgoingData)
-{
-     qDebug() << __PRETTY_FUNCTION__;
-
-     reply = new NetworkReplyMock(this);
-     this->request = request;
-
-     switch (this->mode) {
-
-     case NetworkAccessManagerMock::CORRECT:
-         QTimer::singleShot(0, this, SLOT(generateCorrectReply()));
-         break;
-     case NetworkAccessManagerMock::INCORRECT:
-         QTimer::singleShot(0, this, SLOT(generateError()));
-         break;
-     case NetworkAccessManagerMock::DELAYED_CORRECT:
-         QTimer::singleShot(0, this, SLOT(generateDelayedCorrectReply()));
-         break;
-     default:
-         QTimer::singleShot(0, this, SLOT(generateCorrectReply()));
-         break;
-    }
-    return reply;
-}
-
-NetworkAccessManagerMock::~NetworkAccessManagerMock()
-{
-    delete reply;
-}
-
-NetworkReplyMock *NetworkAccessManagerMock::get(const QNetworkRequest &request)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    this->request = request;
-
-    return reply;
-}
-
-void NetworkAccessManagerMock::setMode(int mode)
-{
-    this->mode = mode;
-}
-
-void NetworkAccessManagerMock::generateError()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    reply->setUrl(request.url());
-    reply->setError(QNetworkReply::HostNotFoundError, "Host not found");
-    emit QNetworkAccessManager::finished(reply);
-}
-
-void NetworkAccessManagerMock::generateCorrectReply()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    reply->setUrl(request.url());
-    reply->setError(QNetworkReply::NoError, "No error");
-//    QImage image;
-//    if (!image.load(":testTile.png", 0)) {
-//        qDebug() << "could not load image";
-//        image = QImage();
-//    }
-//    else
-//    qDebug() << "image loaded";
-//
-//    QByteArray array;
-//    QBuffer buffer(&array);
-//    buffer.open(QBuffer::WriteOnly);
-//    if (image.save(&buffer, "PNG"))
-//        qDebug() << "image saved";
-//    buffer.close();
-//    reply->setData(array);
-    emit QNetworkAccessManager::finished(reply);
-}
-
-void NetworkAccessManagerMock::generateDelayedCorrectReply()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    QTimer::singleShot(4000, this, SLOT(generateCorrectReply()));
-}
diff --git a/tests/situareservice/testlocationupdate/networkaccessmanagermock.h b/tests/situareservice/testlocationupdate/networkaccessmanagermock.h
deleted file mode 100644 (file)
index 6147408..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-      Henri Lampela - henri.lampela@ixonos.com
-      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 NETWORKACCESSMANAGERMOCK_H
-#define NETWORKACCESSMANAGERMOCK_H
-
-#include <QNetworkAccessManager>
-#include <QNetworkRequest>
-#include <QTimer>
-#include "networkreplymock.h"
-
-
-class NetworkAccessManagerMock : public QNetworkAccessManager
-{
-    Q_OBJECT
-public:
-    NetworkAccessManagerMock(QNetworkAccessManager *manager = 0, QObject *parent = 0);
-
-    ~NetworkAccessManagerMock();
-
-    NetworkReplyMock *get(const QNetworkRequest &request);
-
-    void setMode(int mode);
-
-
-    enum {CORRECT, INCORRECT, DELAYED_CORRECT};
-
-protected:
-    NetworkReplyMock *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData);
-
-signals:
-     void finished(NetworkReplyMock *reply);
-
- private slots:
-     void generateError();
-     void generateCorrectReply();
-     void generateDelayedCorrectReply();
-
-private:
-     NetworkReplyMock *reply;
-     QNetworkRequest request;
-     int mode;
-};
-
-#endif // NETWORKACCESSMANAGERMOCK_H
diff --git a/tests/situareservice/testlocationupdate/networkreplymock.cpp b/tests/situareservice/testlocationupdate/networkreplymock.cpp
deleted file mode 100644 (file)
index 911e896..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-      Henri Lampela - henri.lampela@ixonos.com
-      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 <QNetworkRequest>
-#include <QDebug>
-#include "networkreplymock.h"
-
-NetworkReplyMock::NetworkReplyMock(QObject *parent)
-    : QNetworkReply(parent)
-    , m_offset(0)
-{
-}
-
-void NetworkReplyMock::setError(NetworkError errorCode, const QString &errorString)
-{
-     qDebug() << __PRETTY_FUNCTION__;
-     QNetworkReply::setError(errorCode, errorString);
-}
-
-
-qint64 NetworkReplyMock::readData(char *data, qint64 maxLen)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    if (m_offset < m_content.size()) {
-        qint64 number = qMin(maxLen, m_content.size() - m_offset);
-        memcpy(data, m_content.constData() + m_offset, number);
-        m_offset += number;
-        return number;
-   }
-   else {
-        return -1;
-   }
-}
-
-QByteArray NetworkReplyMock::readAll()
-{
-    return m_content;
-}
-
-qint64 NetworkReplyMock::bytesAvailable() const
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    return m_content.size() - m_offset;
-}
-
-void NetworkReplyMock::setUrl(const QUrl &url)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    QNetworkReply::setUrl(url);
-}
-
-void NetworkReplyMock::abort()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-}
-
-void NetworkReplyMock::test()
-{
-     qDebug() << __PRETTY_FUNCTION__;
-}
-
-void NetworkReplyMock::setData(const QByteArray &content)
-{
-     qDebug() << __PRETTY_FUNCTION__;
-//     setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/png"));
-//     setHeader(QNetworkRequest::ContentLengthHeader, QVariant(this->m_content.size()));
-     m_content.append(content);
-     qDebug() << "Content size: " << m_content.size();
-}
diff --git a/tests/situareservice/testlocationupdate/networkreplymock.h b/tests/situareservice/testlocationupdate/networkreplymock.h
deleted file mode 100644 (file)
index d125aed..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-      Henri Lampela - henri.lampela@ixonos.com
-      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 NETWORKREPLYMOCK_H
-#define NETWORKREPLYMOCK_H
-
-#include <QNetworkReply>
-#include <QUrl>
-
-
-class NetworkReplyMock : public QNetworkReply
-{
-    Q_OBJECT
-public:
-    NetworkReplyMock(QObject *parent = 0);
-    void abort();
-    qint64 bytesAvailable() const;
-
-    bool isSequential() const
-    {
-        return true;
-    }
-    void setError(NetworkError errorCode, const QString &errorString);
-    void setData(const QByteArray &content);
-    void setUrl(const QUrl &url);
-    void test();
-    QByteArray readAll();
-
-protected:
-    qint64 readData(char *data, qint64 maxlen);
-
-private:
-    QByteArray m_content;
-    qint64 m_offset;
-};
-
-#endif // NETWORKREPLYMOCK_H
index 5db71d5..0047653 100644 (file)
@@ -27,8 +27,8 @@
 
 #include "../../../src/situareservice/situareservice.h"
 #include "../../../src/situareservice/situarecommon.h"
-#include "networkaccessmanagermock.h"
-#include "networkreplymock.h"
+#include "../networkaccessmanagermock.h"
+#include "../networkreplymock.h"
 
 
 class testLocationUpdate : public QObject
diff --git a/tests/user/testuser.cpp b/tests/user/testuser.cpp
new file mode 100644 (file)
index 0000000..3b19369
--- /dev/null
@@ -0,0 +1,212 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Henri Lampela - henri.lampela@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/QtTest>
+#include <QtCore>
+#include <QPointer>
+#include <QUrl>
+#include <QDebug>
+
+
+#include "../../src/user/user.h"
+
+
+class TestUser : public QObject
+{
+    Q_OBJECT
+public:
+    TestUser();
+    ~TestUser();
+private:
+    User *user;
+
+private slots:
+
+    void testAddress();
+    void testCoordinates();
+    void testName();
+    void testNote();
+    void testImageUrl();
+    void testTimestamp();
+    void testUserType();
+    void testDistance();
+    void testUserId();
+};
+
+TestUser::TestUser()
+{
+    const QString address = "Kuja 3 A, 90560 Oulu, Finland";
+    const QPointF coordinates(65.3, 25.5);
+    const QString name = "Jukka Kukka";
+    const QString note = "Testing";
+    const QUrl imageUrl = QUrl("http://profile.ak.fbcdn.net/v225/874/99/q100000139211584_3252.jpg");
+    const QString timestamp = "1 minute ago";
+    const bool userType = false;
+    const QString units = "km";
+    const QString userId = "111000222";
+    const double value = 12.1;
+
+    user = new User(address, coordinates, name, note, imageUrl, timestamp, userType, userId, units, value);
+}
+
+TestUser::~TestUser()
+{
+    delete user;
+}
+
+void TestUser::testAddress()
+{
+    QString newValue = "Kalmakuja 6 B, 90650 Oulu, Finland";
+    QString oldValue = user->address();
+
+    qDebug() << oldValue;
+
+    user->setAddress(newValue);
+
+    QString currentValue = user->address();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, newValue);
+}
+
+void TestUser::testCoordinates()
+{
+    QPointF oldValue = user->coordinates();
+
+    qDebug() << oldValue;
+
+    QPointF newValue(64.3, 25.8);
+
+    user->setCoordinates(newValue);
+
+    QPointF currentValue = user->coordinates();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, newValue);
+}
+
+void TestUser::testName()
+{
+    QString currentValue = user->name();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, QString("Jukka Kukka"));
+}
+
+void TestUser::testNote()
+{
+    QString oldValue = user->note();
+
+    qDebug() << oldValue;
+
+    QString newValue = "Still testing";
+
+    user->setNote(newValue);
+
+    QString currentValue = user->note();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, newValue);
+}
+
+void TestUser::testImageUrl()
+{
+    QUrl oldValue = user->profileImageUrl();
+
+    qDebug() << oldValue;
+
+    QUrl newValue = QUrl("http://profile.ak.fbcdn.net/v225/874/99/xxxxxxx.jpg");
+
+    user->setProfileImageUrl(newValue);
+
+    QUrl currentValue = user->profileImageUrl();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, newValue);
+}
+
+void TestUser::testTimestamp()
+{
+    QString oldValue = user->timestamp();
+
+    qDebug() << oldValue;
+
+    QString newValue = "2 minutes ago";
+
+    user->setTimestamp(newValue);
+
+    QString currentValue = user->timestamp();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, newValue);
+}
+
+void TestUser::testUserType()
+{
+    bool currentValue = user->type();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, false);
+}
+
+void TestUser::testDistance()
+{
+    QString oldUnitValue;
+    double oldDistanceValue;
+
+    user->distance(oldDistanceValue, oldUnitValue);
+
+    qDebug() << oldDistanceValue  << oldUnitValue;
+
+    QString newUnitValue = "miles";
+    double newDistanceValue = 2.13;
+
+    user->setDistance(newDistanceValue, newUnitValue);
+
+    QString currentUnitValue;
+    double currentDistanceValue;
+
+    user->distance(currentDistanceValue, currentUnitValue);
+
+    qDebug() << currentDistanceValue << currentUnitValue;
+
+    QCOMPARE(currentDistanceValue, newDistanceValue);
+    QCOMPARE(currentUnitValue, newUnitValue);
+}
+
+void TestUser::testUserId()
+{
+    QString currentValue = user->userId();
+
+    qDebug() << currentValue;
+
+    QCOMPARE(currentValue, QString("111000222"));
+}
+
+QTEST_MAIN(TestUser)
+#include "testuser.moc"
diff --git a/tests/user/user.pro b/tests/user/user.pro
new file mode 100644 (file)
index 0000000..0644b33
--- /dev/null
@@ -0,0 +1,13 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Thu Apr 22 12:14:27 2010
+######################################################################
+
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+HEADERS += ../../src/user/user.h
+SOURCES += testuser.cpp ../../src/user/user.cpp