Merge branch 'master' into zoom_button_drag
authorKaj Wallin <kaj.wallin@ixonos.com>
Wed, 26 May 2010 13:23:52 +0000 (16:23 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Wed, 26 May 2010 13:23:52 +0000 (16:23 +0300)
Conflicts:
src/common.h
tests/ui/zoombuttonpanel/zoombuttonpanel.pro

53 files changed:
doc/test_cases/functionality-tests.doc
images.qrc
res/images/user_info_item_bottom.png [new file with mode: 0755]
res/images/user_info_item_middle.png [new file with mode: 0755]
res/images/user_info_item_top.png [new file with mode: 0755]
scripts/master_test_script.sh [deleted file]
scripts/run_unit_tests.sh [new file with mode: 0755]
situare.pro
src/common.h
src/engine/engine.cpp
src/engine/engine.h
src/map/friendlocationitem.h
src/map/mapengine.cpp
src/map/mapengine.h
src/ui/mainwindow.cpp
src/ui/mainwindow.h
src/ui/userinfo.cpp
src/ui/userinfo.h
src/ui/userinfopanel.cpp
src/ui/userinfopanel.h
tests/map/friendgroupitem/friendgroupitem.pro [new file with mode: 0644]
tests/map/friendgroupitem/testfriendgroupitem.cpp
tests/map/friendgroupitem/testfriendgroupitem.pro [deleted file]
tests/map/friendlocationitem/friendlocationitem.pro
tests/map/friendlocationitem/testfriendlocationitem.cpp
tests/map/gpslocationitem/gpslocationitem.pro [new file with mode: 0644]
tests/map/gpslocationitem/testgpslocationitem.pro [deleted file]
tests/map/mapengine/mapengine.pro [new file with mode: 0644]
tests/map/mapengine/testmapengine.cpp
tests/map/mapengine/testmapengine.pro [deleted file]
tests/map/mapscene/mapscene.pro [new file with mode: 0644]
tests/map/mapscene/testmapscene.pro [deleted file]
tests/map/maptile/maptile.pro [new file with mode: 0644]
tests/map/maptile/testmaptile.pro [deleted file]
tests/map/mapview/mapview.pro [new file with mode: 0644]
tests/map/mapview/testmapview.pro [deleted file]
tests/map/ownlocationitem/ownlocationitem.pro
tests/map/ownlocationitem/testownlocationitem.cpp
tests/map/uselastlocation/testuselastlocation.cpp
tests/map/uselastlocation/uselastlocation.pro
tests/situareservice/networkaccessmanagermock.cpp [deleted file]
tests/situareservice/networkaccessmanagermock.h [deleted file]
tests/situareservice/networkreplymock.cpp [deleted file]
tests/situareservice/networkreplymock.h [deleted file]
tests/situareservice/testfetchlocations/testfetchlocations.cpp [deleted file]
tests/situareservice/testfetchlocations/testfetchlocations.pro [deleted file]
tests/situareservice/testlocationupdate/testlocationupdate.cpp [deleted file]
tests/situareservice/testlocationupdate/testlocationupdate.pro [deleted file]
tests/tests.pro [new file with mode: 0644]
tests/ui/friendlist/friendlist [deleted file]
tests/ui/friendlist/friendlist.pro [new file with mode: 0644]
tests/ui/friendlist/testfriendlist.pro [deleted file]
tests/user/user.pro

index 99b595b..c471008 100644 (file)
Binary files a/doc/test_cases/functionality-tests.doc and b/doc/test_cases/functionality-tests.doc differ
index 5a835e7..5d39858 100644 (file)
@@ -23,6 +23,9 @@
         <file>res/images/list_item_bottom.png</file>
         <file>res/images/list_item_middle.png</file>
         <file>res/images/list_item_top.png</file>
+           <file>res/images/user_info_item_bottom.png</file>
+        <file>res/images/user_info_item_middle.png</file>
+        <file>res/images/user_info_item_top.png</file>
         <file>res/images/sliding_bar_left_test.png</file>
         <file>res/images/userpanel_mask.png</file>
         <file>res/images/sliding_bar_right_test.png</file>
diff --git a/res/images/user_info_item_bottom.png b/res/images/user_info_item_bottom.png
new file mode 100755 (executable)
index 0000000..7a935bc
Binary files /dev/null and b/res/images/user_info_item_bottom.png differ
diff --git a/res/images/user_info_item_middle.png b/res/images/user_info_item_middle.png
new file mode 100755 (executable)
index 0000000..10098a3
Binary files /dev/null and b/res/images/user_info_item_middle.png differ
diff --git a/res/images/user_info_item_top.png b/res/images/user_info_item_top.png
new file mode 100755 (executable)
index 0000000..96e6b70
Binary files /dev/null and b/res/images/user_info_item_top.png differ
diff --git a/scripts/master_test_script.sh b/scripts/master_test_script.sh
deleted file mode 100755 (executable)
index 0f80199..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-
-if [$1 -eq ""]; then
-   echo "Usage of the script: ./master_test_script.sh destination_folder_for_test_reports tests_folder_location"
-else
-##########################################################
-# This script is executed from /scripts directory        #
-# in situare project folder                              #
-##########################################################
-clear
-echo "This is the master script for building and executing all automatic unit test."
-echo "As a final step, it creates summary report from all tests executed."
-##########################################################
-#Environment settings                                   #
-##########################################################
-#Store all directory names to a list
-#Modify these paths to point to correct path
-location=$2
-echo $location
-echo "Tests situate at: $location"
-
-TEST_REPORT=$1
-echo "Directory to store test report: $1"
-#cd $location
-if [ ! -e $1/tests_summary.txt ]; then
-    touch $1/tests_summary.txt
-    echo "##########################################" >> tests_summary.txt
-    echo "# Summary of unit tests executed         #" >> tests_summary.txt
-    echo "# Date: `date`    #" >> tests_summary.txt
-    echo "# User: `whoami`                            #" >> tests_summary.txt
-    echo "##########################################" >> tests_summary.txt
-fi  
-
-FILE=$1/tests_summary.txt
-cd $location
-MODULES=(`ls`)
-echo $MODULES
-
-for component in "${MODULES[@]}"
-do 
-  echo "Found test directory: $component"
-done
-
-##########################################################
-#First part: Execution of all tests                      #
-##########################################################
-for component in "${MODULES[@]}" #Loop through components
-do
-  cd $location/$component
-  CASES=(`ls`) #List all test cases under component directory
-  for unittest in "${CASES[@]}"
-  do
-    cd $location/$component/$unittest
-    echo "Building tests for $component/$unittest"
-    qmake
-    make
-    echo "Running tests for $component/$unittest"
-    ./$unittest -o testreport_$component.txt
-    echo "Cleaning $unittest"
-    make clean
-    rm Makefile
-    rm $unittest
-  done
-done
-
-#########################################################
-# Second part: Extraction of results                   #
-#########################################################
-echo "Summarizing test results....." 
-for component in "${MODULES[@]}" #Loop through components
-do 
-  cd $location/$component
-  CASES=(`ls`) #List all test cases uner component directory
-  for unittests in "${CASES[@]}"
-  do
-    cd $location/$component/$unittests
-    echo "############# $component/$unittests ################" >> $FILE
-    grep Totals *.txt >> $FILE
-  done
-done
-fi
-exit 0
diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh
new file mode 100755 (executable)
index 0000000..7af810e
--- /dev/null
@@ -0,0 +1,126 @@
+#!/bin/bash
+
+clear
+
+# set default values
+UNIT_TESTS_ROOT_DIR="../tests"
+REPORT_PATH="../doc"
+REPORT_FILE="unit_test_results.txt"
+TEMP_FILE_EXEC_NOT_FOUND="temp_exec_not_found.txt"
+TEMP_REPORT_FILE="temp_report.txt"
+
+# check that directories are found
+if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
+    # convert relational paths to absolute ones
+    UNIT_TESTS_ROOT_DIR_ABSOLUTE=`cd $UNIT_TESTS_ROOT_DIR; pwd`
+    REPORT_PATH_ABSOLUTE=`cd $REPORT_PATH; pwd`
+    REPORT="$REPORT_PATH_ABSOLUTE/$REPORT_FILE"
+    echo ""
+    echo "Running recursively all tests under $UNIT_TESTS_ROOT_DIR_ABSOLUTE"
+    echo "Saving results to $REPORT"
+    echo ""
+
+    # overwrite report summary file and write header
+    echo "##########################################" > $REPORT
+    echo "# Summary of unit tests executed" >> $REPORT
+    echo "# Date: `date`" >> $REPORT
+    echo "# User: `whoami`" >> $REPORT
+    echo "##########################################" >> $REPORT
+    echo "" >> $REPORT
+
+    # find all test .pro files pahts, cut .pro extension
+    UNIT_TEST_PROJECTS=(`find $UNIT_TESTS_ROOT_DIR_ABSOLUTE | egrep .pro$ | sed -e s/.pro//g`)
+
+    echo "###################################################"
+    echo "All unit test executables will be deleted"
+    echo "and qmake + make will be run for root tests.pro"
+    echo "###################################################"
+    echo ""
+
+    # remove all unit test binaries
+    for BINARY in "${UNIT_TEST_PROJECTS[@]}"
+    do
+        # remove only if file really exists
+        if [ -a $BINARY ]; then
+            rm $BINARY
+        fi
+    done
+
+    # run qmake
+    cd $UNIT_TESTS_ROOT_DIR_ABSOLUTE
+    qmake -r
+    make
+    cd -
+
+    echo ""
+    echo "###################################################"
+    echo "Executing tests..."
+    echo "###################################################"
+
+    # run tests
+    for PROJECT in "${UNIT_TEST_PROJECTS[@]}"
+    do
+        # do not try to test the root tests.pro project
+        if [ $PROJECT != "$UNIT_TESTS_ROOT_DIR_ABSOLUTE/tests" ]; then
+            # check if unit test file is found and is executable
+            if [ -x $PROJECT ]; then
+                # go to unit test directory
+                cd "`echo $PROJECT | grep --perl-regexp -o .*\(?=/\)`"
+                # run unit test, save to temp file, ignore strerr stream
+                $PROJECT -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2>&1 | grep -v "atk_object_set_name..assertion"
+                cd - > /dev/null
+                # print to screen and append to summary
+                cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE
+                cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
+                echo "" >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
+            else
+                # save path of missing test to temporary file
+                MISSING=(`echo $PROJECT | sed -e s,$UNIT_TESTS_ROOT_DIR_ABSOLUTE,,g`)
+                echo "$MISSING" >> "$REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND"
+            fi
+        fi
+    done
+
+    if [ -f "$REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND" ]; then
+        # print list of missing test executables
+        echo ""
+        echo "###################################################"
+        echo "Executables for following unit tests were not found"
+        echo -e "###################################################\E[31m\E[1m" ## set red color & bold
+        cat $REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND
+        tput sgr0 # restore terminal defaults
+        echo ""
+        echo "Some possible causes:"
+        echo "  - project has set target name explicitly. Target name must be same as directory name"
+        echo "  - don't use shadow build system"
+
+        # and save same list also to test summary file
+        echo "" >> $REPORT
+        echo "###################################################" >> $REPORT
+        echo "Executables for following unit tests were not found" >> $REPORT
+        echo "###################################################"  >> $REPORT
+        cat $REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND  >> $REPORT
+    fi
+
+    # check if unit test output contained any qDebug or qWarning prints
+    DEBUG_COUNT=$(egrep -c "(QDEBUG|QWARN)" $REPORT_PATH_ABSOLUTE/$REPORT_FILE)
+    if [ $DEBUG_COUNT -ge 1 ]; then
+        echo ""
+        # print message in red and bold
+        echo -e "\E[31m\E[1mDisable debug output from unit tests so test output stays readable!!!"
+        tput sgr0 # restore terminal defaults
+    fi
+
+    # remove temporary files
+    rm $REPORT_PATH_ABSOLUTE/temp_*.txt
+
+    # tell that script reached the end
+    echo "" >> $REPORT
+    echo "All done!" >> $REPORT
+    echo ""
+    echo "All done!"
+else
+    echo "Paths for report and/or tests not found!"
+    echo "Script must be run from scripts directory"
+fi
+echo ""
index b6b812f..7a9af68 100644 (file)
@@ -4,4 +4,5 @@ isEmpty( ISQT4 ) {
 error("Use the qmake include with Qt4.6.2 or greater");
 }
 TEMPLATE = subdirs
-SUBDIRS = src
+SUBDIRS = src \
+          tests
index 9c295f1..1a5dd1f 100644 (file)
@@ -34,4 +34,5 @@ const QColor COLOR_GRAY = QColor(152, 152, 152);                           ///<
 const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
 const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);     ///< Small font
 
+const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
 #endif // COMMON_H
index 759a3f0..690a668 100644 (file)
@@ -77,25 +77,13 @@ SituareEngine::SituareEngine(QMainWindow *parent)
     connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
             m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
 
+    initializeGpsAndAutocentering();
+
     // signals connected, now it's time to show the main window
     // but init the MapEngine before so starting location is set
     m_mapEngine->init();
     m_ui->show();
 
-    QSettings settings(DIRECTORY_NAME, FILE_NAME);
-    QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
-    QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
-
-    // set features on / off based on settings
-    changeAutoCenteringSetting(autoCenteringEnabled.toBool());
-    enableGPS(gpsEnabled.toBool());
-
-    // show messages at startup if features are enabled automatically
-    if (gpsEnabled.toBool())
-        m_ui->showMaemoInformationBox(tr("GPS enabled"));
-    if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
-        m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
-
     m_facebookAuthenticator->start();
 }
 
@@ -166,9 +154,40 @@ void SituareEngine::error(const QString &error)
 void SituareEngine::fetchUsernameFromSettings()
 {
     qDebug() << __PRETTY_FUNCTION__;
+
     m_ui->setUsername(m_facebookAuthenticator->loadUsername());
 }
 
+void SituareEngine::initializeGpsAndAutocentering()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QSettings settings(DIRECTORY_NAME, FILE_NAME);
+    QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
+    QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);     
+
+    if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
+
+        connect(m_gps, SIGNAL(position(QPointF,qreal)),
+                this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+
+        changeAutoCenteringSetting(true);
+        enableGPS(true);
+
+        m_ui->showMaemoInformationBox(tr("GPS enabled"));
+        m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
+    } else { // Normal start
+        changeAutoCenteringSetting(autoCenteringEnabled.toBool());
+        enableGPS(gpsEnabled.toBool());
+
+        if (gpsEnabled.toBool())
+            m_ui->showMaemoInformationBox(tr("GPS enabled"));
+
+        if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
+            m_ui->showMaemoInformationBox(tr("Auto centering enabled"));        
+    } 
+}
+
 void SituareEngine::invalidCredentials()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -253,6 +272,20 @@ void SituareEngine::requestUpdateLocation(const QString &status, bool publish)
         m_situareService->updateLocation(m_mapEngine->centerGeoCoordinate(), status, publish);
 }
 
+void SituareEngine::setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    Q_UNUSED(latLonCoordinate);
+    Q_UNUSED(accuracy);
+
+    if (m_autoCenteringEnabled) // autocentering is disabled when map is scrolled        
+        m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
+
+    disconnect(m_gps, SIGNAL(position(QPointF,qreal)),
+               this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+}
+
 void SituareEngine::signalsFromFacebookAuthenticator()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -335,6 +368,9 @@ void SituareEngine::signalsFromMainWindow()
     connect(m_ui, SIGNAL(refreshUserData()),
             this, SLOT(refreshUserData()));
 
+    connect(m_ui, SIGNAL(findUser(QPointF)),
+            m_mapEngine, SLOT(setViewLocation(QPointF)));
+
     // signals from friend list tab
     connect(m_ui, SIGNAL(findFriend(QPointF)),
             m_mapEngine, SLOT(setViewLocation(QPointF)));
index d171810..eb25a68 100644 (file)
@@ -27,6 +27,7 @@
 #define ENGINE_H
 
 #include <QObject>
+#include <QPointF>
 
 class QMainWindow;
 
@@ -139,6 +140,12 @@ public slots:
 
 private:
     /**
+      * @brief Read settings and determine whether to use GPS and autocentering.
+      * When values does not found on the settings, GPS and autocentering are enabled as a default.
+      */
+    void initializeGpsAndAutocentering();
+
+    /**
       * @brief Connect signals coming from Facdebook authenticator
       */
     void signalsFromFacebookAuthenticator();
@@ -196,6 +203,15 @@ private slots:
     void enableGPS(bool enabled);
 
     /**
+     * @brief Sets zoom level to default when first GPS location is received if autocentering
+     * is enabled.
+     *
+     * @param latLonCoordinate own location
+     * @param accuracy accuracy of GPS location
+     */
+    void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
+    
+    /**
     * @brief Slot for intercepting signal when credentials are invalid
     *
     */
index 4fb6d00..4cfbb9b 100644 (file)
@@ -41,7 +41,6 @@ class FriendLocationItem : public BaseLocationItem
     Q_OBJECT
 
 public:
-
     /**
     * @brief Constructor of FriendLocationItem
     *
index d8ad37e..9d82755 100644 (file)
@@ -244,16 +244,13 @@ void MapEngine::init()
     QPointF startLocation;
     QSettings settings(DIRECTORY_NAME, FILE_NAME);
 
-    if (settings.value(MAP_LAST_POSITION, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() ==
-        ERROR_VALUE_NOT_FOUND_ON_SETTINGS ||
-        settings.value(MAP_LAST_ZOOMLEVEL, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() ==
-        ERROR_VALUE_NOT_FOUND_ON_SETTINGS) {
+    if (settings.value(MAP_LAST_POSITION, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString()
+        == ERROR_VALUE_NOT_FOUND_ON_SETTINGS || settings.value(MAP_LAST_ZOOMLEVEL,
+        ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() == ERROR_VALUE_NOT_FOUND_ON_SETTINGS) {
 
         startLocation = QPointF(DEFAULT_LONGITUDE, DEFAULT_LATITUDE);
         m_zoomLevel = DEFAULT_START_ZOOM_LEVEL;
-    }
-
-    else {
+    } else {
         m_zoomLevel = settings.value(MAP_LAST_ZOOMLEVEL, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toInt();
         startLocation = settings.value(MAP_LAST_POSITION,
                                        ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toPointF();
@@ -348,6 +345,14 @@ void MapEngine::setLocation(QPoint sceneCoordinate)
     }
 }
 
+void MapEngine::setZoomLevel(int newZoomLevel)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_zoomLevel = newZoomLevel;
+    emit zoomLevelChanged(m_zoomLevel);
+}
+
 void MapEngine::setViewLocation(QPointF latLonCoordinate)
 {
     qDebug() << __PRETTY_FUNCTION__;
index e80061a..1f2d5ba 100644 (file)
@@ -128,6 +128,13 @@ public:
     QGraphicsScene* scene();
 
     /**
+    * @brief Sets new zoom level
+    *
+    * @return newZoomLevel value that is set to new zoom level
+    */
+    void setZoomLevel(const int newZoomLevel);
+
+    /**
     * @brief Return tile path created from tile values.
     *
     * @param zoomLevel tile's zoom level
@@ -175,7 +182,7 @@ public slots:
     *
     * @param latLonCoordinate Latitude & longitude coordinates for location
     */
-    void setViewLocation(QPointF latLonCoordinate);
+    void setViewLocation(QPointF latLonCoordinate);    
 
     /**
     * @brief Slot for view resizing.
index d5d1134..8b58426 100644 (file)
@@ -197,6 +197,9 @@ void MainWindow::buildUserInfoPanel()
     m_userPanelSidebar->stackUnder(m_friendsListPanel);
     m_userPanel->stackUnder(m_userPanelSidebar);
 
+    connect(m_userPanel, SIGNAL(findUser(QPointF)),
+            this, SIGNAL(findUser(QPointF)));
+
     connect(this, SIGNAL(userLocationReady(User*)),
             m_userPanel, SLOT(userDataReceived(User*)));
 
index d34d0ad..67bb598 100644 (file)
@@ -296,6 +296,13 @@ signals:
     void fetchUsernameFromSettings();
 
     /**
+    * @brief Signal for finding user.
+    *
+    * @param coordinates user geo coordinates
+    */
+    void findUser(const QPointF &coordinates);
+
+    /**
     * @brief GPS setting changed
     *
     * @param enabled True if GPS is enabled, otherwise false
index d457e46..05ea5fb 100644 (file)
 #include "../user/user.h"
 #include "userinfo.h"
 
-const int BACKGROUND_TOP_HEIGHT = 20;
-const int BACKGROUND_BOTTOM_HEIGHT = 15;
-const QColor COLOR_GRAY = QColor(152, 152, 152);    ///< Gray color
-const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal);    ///< Normal font
-const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);     ///< Small font
-const int ICON_HEIGHT = 24;     ///< Icon height
-const int ICON_WIDTH = 24;       ///< Icon width
-const int IMAGE_HEIGHT = 60; ///< Friend image height
-const int IMAGE_WIDTH = 60;  ///< Friend image width
-const int ITEM_MIN_WIDTH = 250;  ///< Minimum width for item
-const int MARGIN = 5;   ///< Icon margin
+const int BACKGROUND_WIDTH = 240; ///< Width for item
+const int BACKGROUND_TOP_HEIGHT = 16; ///< Height for item top
+const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Height for item bottom
+const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
+const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
+const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal);  ///< Small font
+const int ICON_HEIGHT = 24; ///< Icon height
+const int ICON_WIDTH = 24;  ///< Icon width
+const int IMAGE_HEIGHT = 60;    ///< Profile image height
+const int IMAGE_WIDTH = 60;     ///< Profile image width
+const int MARGIN = 5; ///< Icon margin
 const int MOUSE_PRESS_AREA_WIDTH = 20;  ///< Area width for item height toggling
 const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
 
@@ -45,21 +45,16 @@ const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height togglin
 *
 * @brief All label's maximum width
 */
-const int LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - ICON_WIDTH;
-
-/**
-* @brief Name label's maximum width
-*
-* @var NAME_LABEL_MAX_WIDTH
-*/
-const int NAME_LABEL_MAX_WIDTH = LABEL_MAX_WIDTH + 30;
+const int LABEL_MAX_WIDTH = BACKGROUND_WIDTH - 3 * MARGIN - ICON_WIDTH + 130;
 
 UserInfo::UserInfo(QWidget *parent)
-    : QWidget(parent)
-        , m_expanded(false)
+    : QWidget(parent),
+      m_expanded(false)
 {
+    qDebug() << __PRETTY_FUNCTION__;
+
     QVBoxLayout *verticalLayout = new QVBoxLayout(this);
-    verticalLayout->setContentsMargins(MARGIN, 0, MARGIN*2, MARGIN*2);
+    verticalLayout->setContentsMargins(MARGIN * 2, 0, MARGIN * 2, MARGIN * 2);
     verticalLayout->setSpacing(0);
     setLayout(verticalLayout);
 
@@ -71,10 +66,6 @@ UserInfo::UserInfo(QWidget *parent)
     buttonLayout->setMargin(0);
     buttonLayout->setSpacing(0);
 
-    QLabel *clockLabel = new QLabel();
-    clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
-    clockLabel->setContentsMargins(0, 0, MARGIN, 0);
-    clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
     QLabel *envelopeLabel = new QLabel();
     envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
     envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
@@ -83,21 +74,22 @@ UserInfo::UserInfo(QWidget *parent)
     compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
     compassLabel->setContentsMargins(0, 0, MARGIN, 0);
     compassLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
+    QLabel *clockLabel = new QLabel();
+    clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
+    clockLabel->setContentsMargins(0, 0, MARGIN, 0);
+    clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
 
-    m_imageLabel = new QLabel();
-    m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
-    m_imageLabel->setAlignment(Qt::AlignHCenter);
+    m_findButton = new ImageButton();
 
     m_nameLabel = new QLabel();
-    m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
-    m_nameLabel->setAlignment(Qt::AlignHCenter);
+    m_nameLabel->setWordWrap(true);
 
-    m_updatedLabel = new QLabel();
-    m_updatedLabel->setWordWrap(true);
     m_statusTextLabel = new QLabel();
     m_statusTextLabel->setWordWrap(true);
     m_locationLabel = new QLabel();
     m_locationLabel->setWordWrap(true);
+    m_updatedLabel = new QLabel();
+    m_updatedLabel->setWordWrap(true);
 
     ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
                                                              ":/res/images/refresh_s.png");
@@ -107,20 +99,23 @@ UserInfo::UserInfo(QWidget *parent)
     buttonLayout->addWidget(updateFriendsButton);
     buttonLayout->addWidget(updateStatusMessageButton);
 
-    infoLayout->addRow(compassLabel, m_locationLabel);
     infoLayout->addRow(envelopeLabel, m_statusTextLabel);
+    infoLayout->addRow(compassLabel, m_locationLabel);
     infoLayout->addRow(clockLabel, m_updatedLabel);
 
-    verticalLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
-
-    verticalLayout->addWidget(m_nameLabel, 1);
+    verticalLayout->addWidget(m_findButton, 0, Qt::AlignHCenter);
+    verticalLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
     verticalLayout->addLayout(infoLayout);
-    verticalLayout->addLayout(buttonLayout, 2);
+    verticalLayout->addLayout(buttonLayout);
 
     connect(updateStatusMessageButton,SIGNAL(clicked()),
             this,SLOT(messageUpdate()));
     connect(updateFriendsButton,SIGNAL(clicked()),
             this, SIGNAL(refreshUserData()));
+    connect(m_findButton, SIGNAL(clicked()),
+        this, SLOT(findButtonClicked()));
+
+    setFixedWidth(BACKGROUND_WIDTH);
 
     this->setFont(NOKIA_FONT_SMALL);
     m_nameLabel->setFont(NOKIA_FONT_NORMAL);
@@ -131,26 +126,23 @@ UserInfo::UserInfo(QWidget *parent)
     namePalette.setColor(QPalette::Foreground, Qt::white);
     m_nameLabel->setPalette(namePalette);
 
-    m_backgroundTopImage.load(":/res/images/list_item_top.png");
-    m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
-    m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
-
-    this->setMinimumWidth(ITEM_MIN_WIDTH);
+    m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
+    m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
+    m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
 }
 
-void UserInfo::setUserName(const QString &name)
+void UserInfo::setAddress(const QString &address)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_userName = name;
-    setText(false);
+    m_locationLabel->setText(address);
 }
 
-void UserInfo::setAvatar(const QPixmap &image)
+void UserInfo::setCoordinates(const QPointF &coordinates)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_imageLabel->setPixmap(image);
+    m_coordinates = coordinates;
 }
 
 void UserInfo::setMessageText(const QString &text)
@@ -161,18 +153,26 @@ void UserInfo::setMessageText(const QString &text)
     setText(false);
 }
 
-void UserInfo::setAddress(const QString &addr)
+void UserInfo::setProfileImage(const QPixmap &image)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_locationLabel->setText(addr);
+    m_findButton->setIcon(image);
 }
 
-void UserInfo::setTime(const QString &tim)
+void UserInfo::setTime(const QString &time)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
-    m_updatedLabel->setText(tim);
+    m_updatedLabel->setText(time);
+}
+
+void UserInfo::setUserName(const QString &name)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_userName = name;
+    setText(false);
 }
 
 QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
@@ -201,7 +201,7 @@ void UserInfo::setText(bool expanded)
         m_statusTextLabel->setText(m_messageText);
     }
     else {
-        m_nameLabel->setText(shortenText(m_nameLabel, m_userName, NAME_LABEL_MAX_WIDTH));
+        m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
         m_statusTextLabel->setText(shortenText(m_statusTextLabel, m_messageText,
                                                LABEL_MAX_WIDTH));
     }
@@ -229,10 +229,10 @@ void UserInfo::paintEvent(QPaintEvent *aPaintEvent)
 
     QPainter painter(this);
 
-    QRect topRect = QRect(0, 0, ITEM_MIN_WIDTH, BACKGROUND_TOP_HEIGHT);
-    QRect middleRect = QRect(0, topRect.bottom(), ITEM_MIN_WIDTH,
+    QRect topRect = QRect(0, MARGIN, BACKGROUND_WIDTH, BACKGROUND_TOP_HEIGHT);
+    QRect middleRect = QRect(0, topRect.bottom(), BACKGROUND_WIDTH,
                              height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
-    QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), ITEM_MIN_WIDTH,
+    QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), BACKGROUND_WIDTH,
                              BACKGROUND_BOTTOM_HEIGHT);
 
     painter.drawPixmap(topRect, m_backgroundTopImage);
@@ -247,6 +247,13 @@ void UserInfo::mousePressEvent(QMouseEvent *event)
     m_mousePosition = event->pos();
 }
 
+void UserInfo::findButtonClicked()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    emit findUser(m_coordinates);
+}
+
 void UserInfo::messageUpdate()
 {
     qDebug() << __PRETTY_FUNCTION__;
index 06c2494..7e3684f 100644 (file)
 #include <QWidget>
 #include "updatelocation/updatelocationdialog.h"
 
+class ImageButton;
+
+/**
+* @brief UserInfo shows user's data in expandable item.
+*
+* @class UserInfo userinfo.h "ui/userinfo.h"
+*/
 class UserInfo : public QWidget
 {
     Q_OBJECT
@@ -49,6 +56,7 @@ protected:
     * @param event QMouseEvent mouse press event
     */
     void mousePressEvent(QMouseEvent *event);
+
     /**
     * @brief Call toggleHeight if mouse position is unchanged.
     *
@@ -56,6 +64,7 @@ protected:
     * @param event QMouseEvent mouse release event
     */
     void mouseReleaseEvent(QMouseEvent *event);
+
     /**
     * @brief This function is called when the widget is drawn
     *
@@ -70,16 +79,16 @@ public:
     /**
     * @brief Sets the users current address
     *
-    * @param addr Reference to users current address
+    * @param address Reference to users current address
     */
-    void setAddress(const QString &addr);
+    void setAddress(const QString &address);
 
     /**
-    * @brief Sets the user picture
+    * @brief Sets the users current coordinates
     *
-    * @param avat Reference to user picture
+    * @param coordinates Reference to users current coordinates
     */
-    void setAvatar(const QPixmap &image);
+    void setCoordinates(const QPointF &coordinates);
 
     /**
     * @brief Sets the message text
@@ -89,16 +98,23 @@ public:
     void setMessageText(const QString &text);
 
     /**
+    * @brief Sets the user picture
+    *
+    * @param image Reference to user picture
+    */
+    void setProfileImage(const QPixmap &image);
+
+    /**
     * @brief Sets the time of updated message
     *
-    * @param tim Reference to time when message was sent.
+    * @param time Reference to time when message was sent.
     */
-    void setTime(const QString &tim);
+    void setTime(const QString &time);
 
    /**
     * @brief Sets the user name
     *
-    * @param usernam Reference to user name
+    * @param name Reference to user name
     */
     void setUserName(const QString &name);
 
@@ -119,6 +135,11 @@ private:
 
 private slots:
     /**
+    * @brief Slot for find button click
+    */
+    void findButtonClicked();
+
+    /**
     * @brief Slot function to forward messageUpdate launch signal
     *
     */
@@ -129,6 +150,13 @@ private slots:
 ******************************************************************************/
 signals:
     /**
+    * @brief Signal for finding user.
+    *
+    * @param coordinates user geo coordinates
+    */
+    void findUser(const QPointF &coordinates);
+
+    /**
     * @brief Signal for refreshing user data.
     *
     */
@@ -160,7 +188,6 @@ signals:
 ******************************************************************************/
 private:
     bool m_expanded;                    ///< Item expanded state
-    QLabel *m_imageLabel;               ///< Image label
     QLabel *m_locationLabel;            ///< Location label
     QLabel *m_nameLabel;                ///< Name label
     QLabel *m_statusTextLabel;          ///< Status text label
@@ -169,11 +196,12 @@ private:
     QPixmap m_backgroundMiddleImage;    ///< Middle background image
     QPixmap m_backgroundTopImage;       ///< Top background image
     QPoint m_mousePosition;             ///< Current mouse press position
+    QPointF m_coordinates;              ///< User current coordinates
     QString m_address;                  ///< Address from where the new message was sent.
     QString m_messageText;              ///< User's message
     QString m_time;                     ///< Time when the new message was sent
     QString m_userName;                 ///< User's name
-
+    ImageButton *m_findButton;          ///< User find button
 };
 
 #endif // USERINFO_H
index 7d76313..33afd5e 100644 (file)
@@ -26,10 +26,30 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     : SidePanel(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
+
     setType(SidePanel::UserPanel);
 
     m_userInfo = new UserInfo(this);
-    m_panelVBox->addWidget(m_userInfo, 0, Qt::AlignCenter);
+
+    QWidget *userInfoView = new QWidget(this);
+    QVBoxLayout *userViewLayout = new QVBoxLayout(userInfoView);
+    userViewLayout->setMargin(0);
+    userViewLayout->setSpacing(0);
+    userViewLayout->setStretch(0, 0);
+    userViewLayout->setSizeConstraint(QLayout::SetFixedSize);
+    userViewLayout->addWidget(m_userInfo);
+
+    QScrollArea *userInfoScroll = new QScrollArea(this);
+    userInfoScroll->setWidgetResizable(true);
+    userInfoScroll->setWidget(userInfoView);
+    userInfoScroll->setAlignment(Qt::AlignVCenter);
+    userInfoScroll->viewport()->setAutoFillBackground(false);
+    userInfoScroll->widget()->setAutoFillBackground(false);
+
+    m_panelVBox->addWidget(userInfoScroll);
+
+    connect(m_userInfo, SIGNAL(findUser(QPointF)),
+            this, SIGNAL(findUser(QPointF)));
 
     connect(m_userInfo,SIGNAL(requestReverseGeo()),
             this, SIGNAL(requestReverseGeo()));
@@ -50,9 +70,10 @@ void UserInfoPanel::userDataReceived(User *user)
 
     if(user) {
         m_userInfo->setUserName(user->name());
-        m_userInfo->setAvatar(user->profileImage());
+        m_userInfo->setProfileImage(user->profileImage());
         m_userInfo->setMessageText(user->note());
         m_userInfo->setAddress(user->address());
         m_userInfo->setTime(user->timestamp());
+        m_userInfo->setCoordinates(user->coordinates());
     }
 }
index 21d1e2c..7aabce7 100644 (file)
@@ -58,8 +58,18 @@ public slots:
     */
     void userDataReceived(User *user);
 
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
 signals:
     /**
+    * @brief Signal for finding user.
+    *
+    * @param coordinates user geo coordinates
+    */
+    void findUser(const QPointF &coordinates);
+
+    /**
     * @brief Signal for refreshing user data.
     *
     */
@@ -91,5 +101,6 @@ signals:
  ******************************************************************************/
 private:
     UserInfo *m_userInfo; ///< Instance of the user info view
+
 };
 #endif // USERPANEL_H
diff --git a/tests/map/friendgroupitem/friendgroupitem.pro b/tests/map/friendgroupitem/friendgroupitem.pro
new file mode 100644 (file)
index 0000000..f80ac96
--- /dev/null
@@ -0,0 +1,40 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
+# #####################################################################
+CONFIG += qtestlib
+QT += network
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testfriendgroupitem.cpp \
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/friendlocationitem.cpp \
+    ../../../src/map/baselocationitem.cpp \
+    ../../../src/map/mapengine.cpp \
+    ../../../src/map/ownlocationitem.cpp \
+    ../../../src/map/maptilerequest.cpp \
+    ../../../src/map/maptile.cpp \
+    ../../../src/map/mapscene.cpp \
+    ../../../src/map/mapfetcher.cpp \
+    ../../../src/map/frienditemshandler.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/map/gpslocationitem.cpp
+HEADERS += ../../../src/map/friendgroupitem.h \
+    ../../../src/map/friendlocationitem.h \
+    ../../../src/map/baselocationitem.h \
+    ../../../src/map/mapengine.h \
+    ../../../src/map/ownlocationitem.h \
+    ../../../src/map/maptilerequest.h \
+    ../../../src/map/maptile.h \
+    ../../../src/map/mapscene.h \
+    ../../../src/map/mapfetcher.h \
+    ../../../src/map/mapcommon.h \
+    ../../../src/map/frienditemshandler.h \
+    ../../../src/user/user.h \
+    ../../../src/map/gpslocationitem.h
+DEFINES += QT_NO_DEBUG_OUTPUT
+RESOURCES += ../../../images.qrc
index aa7847f..f579ce4 100644 (file)
@@ -48,12 +48,14 @@ private:
     FriendLocationItem *friend4;
     FriendGroupItem *group;
     QPixmap *pixmap;
+    QUrl url;
     MapScene scene;
 };
 
 void TestFriendGroupItem::initTestCase()
 {
     pixmap = new QPixmap("situare_user.gif");
+    url = QUrl("http://www.something.com/pict.png");
 }
 
 void TestFriendGroupItem::cleanupTestCase()
@@ -63,16 +65,24 @@ void TestFriendGroupItem::cleanupTestCase()
 
 void TestFriendGroupItem::init()
 {
+    QString userID("ABC123");
+
     // create test friends
-    friend1 = new FriendLocationItem(*pixmap, QPoint(0, 0), this);
-    friend2 = new FriendLocationItem(*pixmap, QPoint(0, 0), this);
-    friend3 = new FriendLocationItem(*pixmap, QPoint(0, 0), this);
-    friend4 = new FriendLocationItem(*pixmap, QPoint(0, 0), this);
+    friend1 = new FriendLocationItem(userID, this);
+    friend2 = new FriendLocationItem(userID, this);
+    friend3 = new FriendLocationItem(userID, this);
+    friend4 = new FriendLocationItem(userID, this);
     QVERIFY(friend1 != 0);
     QVERIFY(friend2 != 0);
     QVERIFY(friend3 != 0);
     QVERIFY(friend4 != 0);
 
+    // set pixmaps
+    friend1->setProfileImage(*pixmap, url);
+    friend2->setProfileImage(*pixmap, url);
+    friend3->setProfileImage(*pixmap, url);
+    friend4->setProfileImage(*pixmap, url);
+
     // add friends to scene
     scene.addItem(friend1);
     scene.addItem(friend2);
diff --git a/tests/map/friendgroupitem/testfriendgroupitem.pro b/tests/map/friendgroupitem/testfriendgroupitem.pro
deleted file mode 100644 (file)
index 7b4e73e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += network
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testfriendgroupitem.cpp \
-    ../../../src/map/friendgroupitem.cpp \
-    ../../../src/map/friendlocationitem.cpp \
-    ../../../src/map/baselocationitem.cpp \
-    ../../../src/map/mapengine.cpp \
-    ../../../src/map/ownlocationitem.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/maptilerequest.cpp \
-    ../../../src/map/maptile.cpp \
-    ../../../src/map/mapscene.cpp \
-    ../../../src/map/mapfetcher.cpp \
-    ../../../src/map/mapbutton.cpp \
-    ../../../src/map/frienditemshandler.cpp \
-    ../../../src/user/user.cpp
-HEADERS += ../../../src/map/friendgroupitem.h \
-    ../../../src/map/friendlocationitem.h \
-    ../../../src/map/baselocationitem.h \
-    ../../../src/map/mapengine.h \
-    ../../../src/map/ownlocationitem.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/maptilerequest.h \
-    ../../../src/map/maptile.h \
-    ../../../src/map/mapscene.h \
-    ../../../src/map/mapfetcher.h \
-    ../../../src/map/mapcommon.h \
-    ../../../src/map/mapbutton.h \
-    ../../../src/map/frienditemshandler.h \
-    ../../../src/user/user.h
-DEFINES += QT_NO_DEBUG_OUTPUT
-RESOURCES += ../../../images.qrc
index b3e8ee9..e62134f 100644 (file)
@@ -4,7 +4,6 @@
 CONFIG += qtestlib
 QT += network
 TEMPLATE = app
-TARGET = friendlocation
 DEPENDPATH += .
 INCLUDEPATH += . \
     ../../../src/
@@ -18,14 +17,13 @@ SOURCES += testfriendlocationitem.cpp \
     ../../../src/map/mapfetcher.cpp \
     ../../../src/map/ownlocationitem.cpp \
     ../../../src/map/mapview.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/mapbutton.cpp \
     ../../../src/map/baselocationitem.cpp \
     ../../../src/user/user.cpp \
     ../../../src/map/friendlocationitem.cpp \
     ../../../src/map/maptilerequest.cpp \
     ../../../src/map/frienditemshandler.cpp \
-    ../../../src/map/friendgroupitem.cpp
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/gpslocationitem.cpp
 HEADERS += ../../../src/map/ownlocationitem.h \
     ../../../src/map/mapscene.h \
     ../../../src/map/maptile.h \
@@ -33,13 +31,12 @@ HEADERS += ../../../src/map/ownlocationitem.h \
     ../../../src/map/mapfetcher.h \
     ../../../src/map/mapcommon.h \
     ../../../src/map/mapview.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/mapbutton.h \
     ../../../src/map/baselocationitem.h \
     ../../../src/user/user.h \
     ../../../src/map/friendlocationitem.h \
     ../../../src/map/maptilerequest.h \
     ../../../src/map/frienditemshandler.h \
-    ../../../src/map/friendgroupitem.h
+    ../../../src/map/friendgroupitem.h \
+    ../../../src/map/gpslocationitem.h
 
 DEFINES += QT_NO_DEBUG_OUTPUT
index 989d715..c119afe 100644 (file)
@@ -3,6 +3,7 @@
     Copyright (C) 2010  Ixonos Plc. Authors:
 
         Ville Tiensuu - ville.tiensuu@ixonos.com
+        Sami Rämö - sami.ramo@ixonos.com
 
     Situare is free software; you can redistribute it and/or
     modify it under the terms of the GNU General Public License
 
 namespace Testfriendlocation  //  Test data for function is defined in namespace
 {
-    const qreal xCoordinate = 65.525;
-    const qreal yCoordinate = 25.345;
-    const QPointF testLocationPoint(65.525, 25.345);
-    const QPointF defaultLocationPoint(DEFAULT_LONGITUDE,DEFAULT_LATITUDE);
-    const QPointF locationIconOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2);
+    const QPointF defaultPosition(UNDEFINED, UNDEFINED);
+    const QString userID("ABC123");
+    const QUrl url("http://www.test.com/test.png");
     const int itemIgnoresTransformationsFlagValue = 0x20;  
 }
 
 using namespace Testfriendlocation;
 
-
 /**
-* @brief Class that test FriendLocationItem
-*
-* @author Ville Tiensuu
-*/
+  * @brief Class that test FriendLocationItem
+  *
+  * @author Ville Tiensuu - ville.tiensuu@ixonos.com
+  * @author Sami Rämö - sami.ramo@ixonos.com
+  */
 class TestFriendLocationItem: public QObject
- {
-     Q_OBJECT
- private slots:
+{
+    Q_OBJECT
+
+private slots:
+    /**
+      * @brief Test method for constructors.
+      *
+      * Creates instance of FriendLocationItem
+      * Tests that Z-values are set correctly.
+      * Tests that ItemIgnoresTransformations flag is set.
+      * Tests that default position is set.
+      * Tests that user ID is set
+      */
+    void constructor();
+
+    /**
+      * @brief Test grouping functionality
+      */
+    void grouping();
 
     /**
-    * @brief Test method for constructors.
-    *        Creates instance of FriendLocationItem
-    *        Tests that Z-values are set correctly.
-    *        Tests that offses are set correctly.
-    *        Tests that ItemIgnoresTransformations flag is set.
-    */
-     void testConstructor();
-
-     /**
-     * @brief Tests that friend location item is possible to set visible and unvisible
-     */
-     void testHideAndShowPosition();
-
-     /**
-     * @brief  Tests that it is possible to set and get userId for friend location item
-     */
-     void testSetUserId();
- };
-
- void TestFriendLocationItem::testConstructor()
- {    
-     QPixmap friendIcon("situare_user.gif");
-     FriendLocationItem friendLocation(friendIcon);
-
-     // Test Pixmap
-     QPixmap pixmap;
-     QCOMPARE (pixmap.isNull(), true);
-
-     pixmap = friendLocation.pixmap();
-     QCOMPARE (pixmap.isNull(), false);
-
-     // Test Z-value
-     QCOMPARE(static_cast<int>(friendLocation.zValue()), FRIEND_LOCATION_ICON_Z_LEVEL);
-
-     // Test Offset
-     QCOMPARE(friendLocation.offset(),
-              QPointF(-friendLocation.pixmap().width()/2, -friendLocation.pixmap().height()/2));
-
-     // Test ItemIgnoresTransformations Flags
-     QGraphicsItem::GraphicsItemFlags friendLocationItemFlags = friendLocation.flags();
-     QCOMPARE(friendLocationItemFlags, itemIgnoresTransformationsFlagValue);
-
- }
-
- void TestFriendLocationItem::testHideAndShowPosition()
- {
-     QPixmap friendIcon(":/res/images/situare_user.jpg");
-     FriendLocationItem friendLocation(friendIcon);
-     QCOMPARE(friendLocation.isVisible(), true);
-
-     friendLocation.hideLocation();
-     QCOMPARE(friendLocation.isVisible(), false);
-
-     friendLocation.showLocation();
-     QCOMPARE(friendLocation.isVisible(), true);
- } 
-
- void TestFriendLocationItem::testSetUserId()
- {
-     QPixmap friendIcon("situare_user.jpg");
-     FriendLocationItem friendLocation(friendIcon);
-
-     QString userIdentity = "110022";
-     friendLocation.setUserId(userIdentity);
-     QCOMPARE(friendLocation.userId(), userIdentity);
- }
-
- QTEST_MAIN(TestFriendLocationItem)
- #include "testfriendlocationitem.moc"
+      * @brief Tests that friend location item is possible to set visible and unvisible
+      */
+    void setProfileImage();
+};
+
+void TestFriendLocationItem::constructor()
+{
+    FriendLocationItem friendLocation(userID);
+
+    // Test Z-value
+    QCOMPARE(static_cast<int>(friendLocation.zValue()), FRIEND_LOCATION_ICON_Z_LEVEL);
+
+    // Test ItemIgnoresTransformations Flags
+    QGraphicsItem::GraphicsItemFlags friendLocationItemFlags = friendLocation.flags();
+    QCOMPARE(friendLocationItemFlags, itemIgnoresTransformationsFlagValue);
+
+    // test default position
+    QCOMPARE(friendLocation.pos(), defaultPosition);
+
+    // test user ID
+    QCOMPARE(friendLocation.userId(), userID);
+
+    // test isPartOfGroup default value
+    QCOMPARE(friendLocation.isPartOfGroup(), false);
+}
+
+void TestFriendLocationItem::grouping()
+{
+    FriendLocationItem friendLocation(userID);
+
+    // test defaults
+    QCOMPARE(friendLocation.isPartOfGroup(), false);
+    QCOMPARE(friendLocation.isVisible(), true);
+
+    // group item
+    friendLocation.setPartOfGroup(true);
+
+    // flag should be set and item should be hidden
+    QCOMPARE(friendLocation.isPartOfGroup(), true);
+    QCOMPARE(friendLocation.isVisible(), false);
+
+    // back to ungrouped state
+    friendLocation.setPartOfGroup(false);
+
+    // test
+    QCOMPARE(friendLocation.isPartOfGroup(), false);
+    QCOMPARE(friendLocation.isVisible(), true);
+}
+
+void TestFriendLocationItem::setProfileImage()
+{
+    FriendLocationItem friendLocation(userID);
+
+    //default pixmap and URL should be empty
+    QCOMPARE(friendLocation.pixmap().isNull(), true);
+    QCOMPARE(friendLocation.profileImageUrl().isEmpty(), true);
+
+    QPixmap friendIcon("situare_user.gif");
+    friendLocation.setProfileImage(friendIcon, url);
+
+    // picture should be set
+    QCOMPARE(friendLocation.pixmap().isNull(), false);
+
+    // Test Offset
+    QCOMPARE(friendLocation.offset(),
+             QPointF(-friendIcon.width() / 2, -friendIcon.height() / 2));
+
+    // test url
+    QCOMPARE(friendLocation.profileImageUrl(), url);
+}
+
+QTEST_MAIN(TestFriendLocationItem)
+#include "testfriendlocationitem.moc"
diff --git a/tests/map/gpslocationitem/gpslocationitem.pro b/tests/map/gpslocationitem/gpslocationitem.pro
new file mode 100644 (file)
index 0000000..9f0579c
--- /dev/null
@@ -0,0 +1,18 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
+# #####################################################################
+CONFIG += qtestlib
+QT += network
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testgpslocationitem.cpp \ 
+    ../../../src/map/gpslocationitem.cpp
+HEADERS += \ 
+    ../../../src/map/gpslocationitem.h
+DEFINES += QT_NO_DEBUG_OUTPUT
+RESOURCES += ../../../images.qrc
diff --git a/tests/map/gpslocationitem/testgpslocationitem.pro b/tests/map/gpslocationitem/testgpslocationitem.pro
deleted file mode 100644 (file)
index 9f0579c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += network
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testgpslocationitem.cpp \ 
-    ../../../src/map/gpslocationitem.cpp
-HEADERS += \ 
-    ../../../src/map/gpslocationitem.h
-DEFINES += QT_NO_DEBUG_OUTPUT
-RESOURCES += ../../../images.qrc
diff --git a/tests/map/mapengine/mapengine.pro b/tests/map/mapengine/mapengine.pro
new file mode 100644 (file)
index 0000000..db044cf
--- /dev/null
@@ -0,0 +1,40 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
+# #####################################################################
+CONFIG += qtestlib
+QT += network
+TEMPLATE = app
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testmapengine.cpp \
+    ../../../src/map/mapengine.cpp \
+    ../../../src/map/mapscene.cpp \
+    ../../../src/map/maptile.cpp \
+    ../../../src/map/mapview.cpp \
+    ../../../src/map/mapfetcher.cpp \
+    ../../../src/map/ownlocationitem.cpp \
+    ../../../src/map/maptilerequest.cpp \
+    ../../../src/map/frienditemshandler.cpp \
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/baselocationitem.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/map/friendlocationitem.cpp \
+    ../../../src/map/gpslocationitem.cpp
+HEADERS += ../../../src/map/mapengine.h \
+    ../../../src/map/mapscene.h \
+    ../../../src/map/maptile.h \
+    ../../../src/map/mapview.h \
+    ../../../src/map/mapfetcher.h \
+    ../../../src/common.h \
+    ../../../src/map/ownlocationitem.h \
+    ../../../src/map/maptilerequest.h \
+    ../../../src/map/frienditemshandler.h \
+    ../../../src/map/friendgroupitem.h \
+    ../../../src/map/baselocationitem.h \
+    ../../../src/user/user.h \
+    ../../../src/map/friendlocationitem.h \
+    ../../../src/map/gpslocationitem.h
+DEFINES += QT_NO_DEBUG_OUTPUT
index 797ef7d..960ad11 100644 (file)
     USA.
 */
 
+#include <QGraphicsScene>
 #include <QtTest/QtTest>
 
+#include "map/mapcommon.h"
 #include "map/mapengine.h"
 
 class TestMapEngine: public QObject
 {
     Q_OBJECT
+
 private slots:
     void convertTileNumberToSceneCoordinate();
     void convertLatLonToSceneCoordinate_data();
diff --git a/tests/map/mapengine/testmapengine.pro b/tests/map/mapengine/testmapengine.pro
deleted file mode 100644 (file)
index b6f02d6..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Fri Mar 26 15:09:16 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += network
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testmapengine.cpp \
-    ../../../src/map/mapengine.cpp \
-    ../../../src/map/mapscene.cpp \
-    ../../../src/map/maptile.cpp \
-    ../../../src/map/mapview.cpp \
-    ../../../src/map/mapfetcher.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/mapbutton.cpp \
-    ../../../src/map/ownlocationitem.cpp \
-    ../../../src/map/maptilerequest.cpp \
-    ../../../src/map/frienditemshandler.cpp \
-    ../../../src/map/friendgroupitem.cpp \
-    ../../../src/map/baselocationitem.cpp \
-    ../../../src/user/user.cpp \
-    ../../../src/map/friendlocationitem.cpp
-HEADERS += ../../../src/map/mapengine.h \
-    ../../../src/map/mapscene.h \
-    ../../../src/map/maptile.h \
-    ../../../src/map/mapview.h \
-    ../../../src/map/mapfetcher.h \
-    ../../../src/common.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/mapbutton.h \
-    ../../../src/map/ownlocationitem.h \
-    ../../../src/map/maptilerequest.h \
-    ../../../src/map/frienditemshandler.h \
-    ../../../src/map/friendgroupitem.h \
-    ../../../src/map/baselocationitem.h \
-    ../../../src/user/user.h \
-    ../../../src/map/friendlocationitem.h
-DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/mapscene/mapscene.pro b/tests/map/mapscene/mapscene.pro
new file mode 100644 (file)
index 0000000..9cea0ce
--- /dev/null
@@ -0,0 +1,38 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
+# #####################################################################
+CONFIG += qtestlib
+QT += network
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testmapscene.cpp \
+    ../../../src/map/mapscene.cpp \
+    ../../../src/map/maptile.cpp \
+    ../../../src/map/mapengine.cpp \
+    ../../../src/map/mapfetcher.cpp \
+    ../../../src/map/ownlocationitem.cpp \
+    ../../../src/map/maptilerequest.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/map/friendlocationitem.cpp \
+    ../../../src/map/frienditemshandler.cpp \
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/baselocationitem.cpp \
+    ../../../src/map/gpslocationitem.cpp
+HEADERS += ../../../src/map/mapscene.h \
+    ../../../src/map/maptile.h \
+    ../../../src/map/mapengine.h \
+    ../../../src/map/mapfetcher.h \
+    ../../../src/map/ownlocationitem.h \
+    ../../../src/map/maptilerequest.h \
+    ../../../src/user/user.h \
+    ../../../src/map/friendlocationitem.h \
+    ../../../src/map/frienditemshandler.h \
+    ../../../src/map/friendgroupitem.h \
+    ../../../src/map/baselocationitem.h \
+    ../../../src/map/gpslocationitem.h
+DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/mapscene/testmapscene.pro b/tests/map/mapscene/testmapscene.pro
deleted file mode 100644 (file)
index e6c1c46..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += network
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testmapscene.cpp \
-    ../../../src/map/mapscene.cpp \
-    ../../../src/map/maptile.cpp \
-    ../../../src/map/mapengine.cpp \
-    ../../../src/map/mapfetcher.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/mapbutton.cpp \
-    ../../../src/map/ownlocationitem.cpp \
-    ../../../src/map/maptilerequest.cpp \
-    ../../../src/user/user.cpp \
-    ../../../src/map/friendlocationitem.cpp \
-    ../../../src/map/frienditemshandler.cpp \
-    ../../../src/map/friendgroupitem.cpp \
-    ../../../src/map/baselocationitem.cpp
-HEADERS += ../../../src/map/mapscene.h \
-    ../../../src/map/maptile.h \
-    ../../../src/map/mapengine.h \
-    ../../../src/map/mapfetcher.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/mapbutton.h \
-    ../../../src/map/ownlocationitem.h \
-    ../../../src/map/maptilerequest.h \
-    ../../../src/user/user.h \
-    ../../../src/map/friendlocationitem.h \
-    ../../../src/map/frienditemshandler.h \
-    ../../../src/map/friendgroupitem.h \
-    ../../../src/map/baselocationitem.h
-DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/maptile/maptile.pro b/tests/map/maptile/maptile.pro
new file mode 100644 (file)
index 0000000..6baaf4f
--- /dev/null
@@ -0,0 +1,38 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
+# #####################################################################
+CONFIG += qtestlib
+QT += network
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testmaptile.cpp \
+    ../../../src/map/maptile.cpp \
+    ../../../src/map/mapfetcher.cpp \
+    ../../../src/map/mapengine.cpp \
+    ../../../src/map/mapscene.cpp \
+    ../../../src/map/ownlocationitem.cpp \
+    ../../../src/map/maptilerequest.cpp \
+    ../../../src/map/friendlocationitem.cpp \
+    ../../../src/map/frienditemshandler.cpp \
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/baselocationitem.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/map/gpslocationitem.cpp
+HEADERS += ../../../src/map/maptile.h \
+    ../../../src/map/mapfetcher.h \
+    ../../../src/map/mapengine.h \
+    ../../../src/map/mapscene.h \
+    ../../../src/map/ownlocationitem.h \
+    ../../../src/map/maptilerequest.h \
+    ../../../src/map/friendlocationitem.h \
+    ../../../src/map/frienditemshandler.h \
+    ../../../src/map/friendgroupitem.h \
+    ../../../src/map/baselocationitem.h \
+    ../../../src/user/user.h \
+    ../../../src/map/gpslocationitem.h
+DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/maptile/testmaptile.pro b/tests/map/maptile/testmaptile.pro
deleted file mode 100644 (file)
index 24df397..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Mon Mar 29 10:06:28 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += network
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testmaptile.cpp \
-    ../../../src/map/maptile.cpp \
-    ../../../src/map/mapfetcher.cpp \
-    ../../../src/map/mapengine.cpp \
-    ../../../src/map/mapscene.cpp \
-    ../../../src/map/ownlocationitem.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/mapbutton.cpp \
-    ../../../src/map/maptilerequest.cpp \
-    ../../../src/map/friendlocationitem.cpp \
-    ../../../src/map/frienditemshandler.cpp \
-    ../../../src/map/friendgroupitem.cpp \
-    ../../../src/map/baselocationitem.cpp \
-    ../../../src/user/user.cpp
-HEADERS += ../../../src/map/maptile.h \
-    ../../../src/map/mapfetcher.h \
-    ../../../src/map/mapengine.h \
-    ../../../src/map/mapscene.h \
-    ../../../src/map/ownlocationitem.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/mapbutton.h \
-    ../../../src/map/maptilerequest.h \
-    ../../../src/map/friendlocationitem.h \
-    ../../../src/map/frienditemshandler.h \
-    ../../../src/map/friendgroupitem.h \
-    ../../../src/map/baselocationitem.h \
-    ../../../src/user/user.h
-DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/mapview/mapview.pro b/tests/map/mapview/mapview.pro
new file mode 100644 (file)
index 0000000..e8234b4
--- /dev/null
@@ -0,0 +1,17 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Fri Mar 26 15:22:56 2010
+# #####################################################################
+CONFIG += qtestlib
+#QT += opengl
+TEMPLATE = app
+TARGET = 
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testmapview.cpp \
+    ../../../src/map/mapview.cpp
+HEADERS += ../../../src/map/mapview.h
+
+DEFINES += QT_NO_DEBUG_OUTPUT
diff --git a/tests/map/mapview/testmapview.pro b/tests/map/mapview/testmapview.pro
deleted file mode 100644 (file)
index aa145fa..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Fri Mar 26 15:22:56 2010
-# #####################################################################
-CONFIG += qtestlib
-QT += opengl
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testmapview.cpp \
-    ../../../src/map/mapview.cpp
-HEADERS += ../../../src/map/mapview.h
-
-DEFINES += QT_NO_DEBUG_OUTPUT
index 0e47acc..79f2237 100644 (file)
@@ -4,7 +4,6 @@
 CONFIG += qtestlib
 QT += network
 TEMPLATE = app
-TARGET = ownlocation
 DEPENDPATH += .
 INCLUDEPATH += . \
     ../../../src/
@@ -18,14 +17,13 @@ SOURCES += testownlocationitem.cpp \
     ../../../src/map/mapfetcher.cpp \
     ../../../src/map/ownlocationitem.cpp \
     ../../../src/map/mapview.cpp \
-    ../../../src/map/mapzoompanel.cpp \
-    ../../../src/map/mapbutton.cpp \
     ../../../src/map/baselocationitem.cpp \
     ../../../src/user/user.cpp \
     ../../../src/map/friendlocationitem.cpp \
     ../../../src/map/maptilerequest.cpp \
     ../../../src/map/frienditemshandler.cpp \
-    ../../../src/map/friendgroupitem.cpp
+    ../../../src/map/friendgroupitem.cpp \
+    ../../../src/map/gpslocationitem.cpp
 HEADERS += ../../../src/map/ownlocationitem.h \
     ../../../src/map/mapscene.h \
     ../../../src/map/maptile.h \
@@ -33,12 +31,11 @@ HEADERS += ../../../src/map/ownlocationitem.h \
     ../../../src/map/mapfetcher.h \
     ../../../src/map/mapcommon.h \
     ../../../src/map/mapview.h \
-    ../../../src/map/mapzoompanel.h \
-    ../../../src/map/mapbutton.h \
     ../../../src/map/baselocationitem.h \
     ../../../src/user/user.h \
     ../../../src/map/friendlocationitem.h \
     ../../../src/map/maptilerequest.h \
     ../../../src/map/frienditemshandler.h \
-    ../../../src/map/friendgroupitem.h
+    ../../../src/map/friendgroupitem.h \
+    ../../../src/map/gpslocationitem.h
 DEFINES += QT_NO_DEBUG_OUTPUT
index 6b66669..ac309eb 100644 (file)
@@ -38,7 +38,7 @@ namespace TestOwnLocation  //  Test data for function is defined in namespace
     const qreal xCoordinate = 65.525;
     const qreal yCoordinate = 25.345;
     const QPointF testLocationPoint(65.525, 25.345);
-    const QPointF defaultLocationPoint(DEFAULT_LONGITUDE,DEFAULT_LATITUDE);
+    const QPointF defaultLocationPoint(UNDEFINED, UNDEFINED);
     const QPointF locationIconOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2);
     const int itemIgnoresTransformationsFlagValue = 0x20;    
 }
@@ -58,33 +58,20 @@ class TestOwnLocationItem: public QObject
 
     /**
     * @brief Test method for constructors.
-    *        Tests that positions are set correctly.
-    *        Tests that Z-values are set correctly.
-    *        Tests that offses are set correctly.
-    *        Tests that ItemIgnoresTransformations flag is set.
+    *
+    * Tests that default position is set correctly.
+    * Tests that item has pixmap set.
+    * Tests that Z-value is set correctly.
+    * Tests that offset is set correctly.
+    * Tests that ItemIgnoresTransformations flag is set.
     */
      void testConstructors();
-
-     /**
-     * @brief Creates instance of OwnLocationItem.
-     *        Sets test position for location item in geographic coordinates.
-     *        Reads position from location item in scene coordinates and
-     *        verifies that it is correctly formed.
-     */
-     void testSetAndGetPosition();
-
-     /**
-     * @brief Creates instance of OwnLocationItem.
-     *        Verifies that instance is visible.
-     *        Hides instance and verifies that it is not visible.
-     */
-     void testHideAndShowPosition();
  };
 
  void TestOwnLocationItem::testConstructors()
  {
 
-     OwnLocationItem ownLocationItem(defaultLocationPoint);
+     OwnLocationItem ownLocationItem;
 
      // Test Pixmap
      QPixmap pixmap;
@@ -94,8 +81,7 @@ class TestOwnLocationItem: public QObject
      QCOMPARE (pixmap.isNull(), false);
 
      // Test Position
-     QCOMPARE(ownLocationItem.position(),
-              MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));
+     QCOMPARE(ownLocationItem.pos(), defaultLocationPoint);
 
      // Test Z-value
      QCOMPARE(static_cast<int>(ownLocationItem.zValue()), OWN_LOCATION_ICON_Z_LEVEL);
@@ -109,30 +95,5 @@ class TestOwnLocationItem: public QObject
      QCOMPARE(ownLocationItemFlags, itemIgnoresTransformationsFlagValue);
  }
 
- void TestOwnLocationItem::testSetAndGetPosition()
- {
-     OwnLocationItem ownLocation(defaultLocationPoint);
-
-     QCOMPARE(ownLocation.position(),
-              MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));
-
-     ownLocation.setPosition(testLocationPoint);
-
-     QCOMPARE(ownLocation.position(),
-              MapEngine::convertLatLonToSceneCoordinate(testLocationPoint));
- }
-
- void TestOwnLocationItem::testHideAndShowPosition()
- {
-     OwnLocationItem ownLocation(defaultLocationPoint);
-     QCOMPARE(ownLocation.isVisible(), true);     
-
-     ownLocation.hideLocation();
-     QCOMPARE(ownLocation.isVisible(), false);
-
-     ownLocation.showLocation();
-     QCOMPARE(ownLocation.isVisible(), true);
- }
-
  QTEST_MAIN(TestOwnLocationItem)
  #include "testownlocationitem.moc"
index 15f2156..164edd3 100644 (file)
@@ -67,8 +67,7 @@ class TestUseLastPosition: public QObject
      // Check parameters of sended signals
      QList<QVariant> parameters = mapEngineSpy.takeFirst();
      QVERIFY(parameters.at(0).toInt() == DEFAULT_TEST_ZOOMLEVEL);
-//     parameters = mapEngineSpy.takeFirst();
-//     QVERIFY(parameters.at(0).toInt() == 0);
+
      parameters = mapEngineSpy.takeFirst();
      QVERIFY(parameters.at(0).toInt() == DEFAULT_START_ZOOM_LEVEL);
 
index 8d92a32..4dcdbd8 100644 (file)
@@ -26,12 +26,10 @@ SOURCES += testuselastlocation.cpp \
     ../../../src/map/friendlocationitem.cpp \
     ../../../src/map/friendgroupitem.cpp \
     ../../../src/ui/mainwindow.cpp \
-    ../../../src/ui/mapviewscreen.cpp \
     ../../../src/ui/settingsdialog.cpp \
     ../../../src/ui/logindialog.cpp \
     ../../../src/map/mapview.cpp \
     ../../../src/ui/friendlistpanel.cpp \
-    ../../../src/ui/userpanel.cpp \
     ../../../src/ui/panelsidebar.cpp \
     ../../../src/ui/zoombuttonpanel.cpp \
     ../../../src/ui/friendlistview.cpp \
@@ -40,7 +38,10 @@ SOURCES += testuselastlocation.cpp \
     ../../../src/ui/userinfo.cpp \
     ../../../src/ui/imagebutton.cpp \
     ../../../src/ui/updatelocation/updatelocationdialog.cpp \
-    ../../../src/ui/updatelocation/texteditautoresizer.cpp
+    ../../../src/ui/updatelocation/texteditautoresizer.cpp \
+    ../../../src/ui/userinfopanel.cpp \
+    ../../../src/ui/sidepanel.cpp \
+    ../../../src/ui/zoombutton.cpp
 
 HEADERS += ../../../src/map/mapengine.h \
     ../../../src/map/mapscene.h \
@@ -55,12 +56,10 @@ HEADERS += ../../../src/map/mapengine.h \
     ../../../src/map/friendlocationitem.h \
     ../../../src/map/friendgroupitem.h \
     ../../../src/ui/mainwindow.h \
-    ../../../src/ui/mapviewscreen.h \
     ../../../src/ui/settingsdialog.h \
     ../../../src/ui/logindialog.h \
     ../../../src/map/mapview.h \
     ../../../src/ui/friendlistpanel.h \
-    ../../../src/ui/userpanel.h \
     ../../../src/ui/panelsidebar.h \
     ../../../src/ui/zoombuttonpanel.h \
     ../../../src/ui/friendlistview.h \
@@ -69,7 +68,10 @@ HEADERS += ../../../src/map/mapengine.h \
     ../../../src/ui/userinfo.h \
     ../../../src/ui/imagebutton.h \
     ../../../src/ui/updatelocation/updatelocationdialog.h \
-    ../../../src/ui/updatelocation/texteditautoresizer.h
+    ../../../src/ui/updatelocation/texteditautoresizer.h \
+    ../../../src/ui/userinfopanel.h \
+    ../../../src/ui/sidepanel.h \
+    ../../../src/ui/zoombutton.h
 
 
 
diff --git a/tests/situareservice/networkaccessmanagermock.cpp b/tests/situareservice/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/networkaccessmanagermock.h b/tests/situareservice/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/networkreplymock.cpp b/tests/situareservice/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/networkreplymock.h b/tests/situareservice/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
diff --git a/tests/situareservice/testfetchlocations/testfetchlocations.cpp b/tests/situareservice/testfetchlocations/testfetchlocations.cpp
deleted file mode 100644 (file)
index d4d71ca..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
- /*
-    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 "../../../src/situareservice/situareservice.h"
-#include "../../../src/situareservice/situarecommon.h"
-
-class testFetchLocations : public QObject
-{
-    Q_OBJECT
-public:
-    ~testFetchLocations();
-private:
-    SituareService *situare;
-    QList<QNetworkReply *> currentRequests;
-
-private slots:
-    void testFetchLocationsCase();
-};
-
-testFetchLocations::~testFetchLocations()
-{
-    delete situare;
-}
-
-//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()
-{
-    situare = new SituareService(this);
-
-    QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
-
-    situare->fetchLocations();
-    QTest::qWait(1000);
-
-    QCOMPARE(receivedErrorSpy.count(), 0);
-}
-
-QTEST_MAIN(testFetchLocations)
-#include "testfetchlocations.moc"
diff --git a/tests/situareservice/testfetchlocations/testfetchlocations.pro b/tests/situareservice/testfetchlocations/testfetchlocations.pro
deleted file mode 100644 (file)
index 1bea1c8..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 21 10:16:04 2010
-######################################################################
-
-CONFIG += qtestlib
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += "/usr/include/qjson"
-LIBS += "-lqjson"
-
-# Input
-HEADERS += ../../../src/situareservice/situareservice.h \
-           ../../../src/situareservice/imagefetcher.h \
-           ../../../src/facebookservice/facebookauthentication.h \
-           ../../../src/facebookservice/facebookcredentials.h \
-           ../../../src/situareservice/situarecommon.h \
-           ../../../src/cookiehandler/cookiehandler.h \
-           ../../../src/user/user.h
-           #../networkaccessmanagermock.h \
-           #../networkreplymock.h
-SOURCES += testfetchlocations.cpp \
-           ../../../src/situareservice/situareservice.cpp \
-           ../../../src/situareservice/imagefetcher.cpp \
-           ../../../src/facebookservice/facebookauthentication.cpp \
-           ../../../src/facebookservice/facebookcredentials.cpp \
-           ../../../src/cookiehandler/cookiehandler.cpp \
-           ../../../src/user/user.cpp
-           #../networkaccessmanagermock.cpp \
-           #../networkreplymock.cpp
-QT += core \
-    network \
-    webkit
diff --git a/tests/situareservice/testlocationupdate/testlocationupdate.cpp b/tests/situareservice/testlocationupdate/testlocationupdate.cpp
deleted file mode 100644 (file)
index 7e620d6..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
- /*
-    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 <QPointF>
-
-#include "../../../src/situareservice/situareservice.h"
-#include "../../../src/situareservice/situarecommon.h"
-#include "../../../src/facebookservice/facebookauthentication.h"
-
-
-class testLocationUpdate : public QObject
-{
-    Q_OBJECT
-public:
-    ~testLocationUpdate();
-private:
-    SituareService *situare;
-    QList<QNetworkReply *> currentRequests;
-    FacebookAuthentication fbAuthentication;
-    FacebookCredentials credentials;
-
-private slots:
-
-    //void testIncorrectUrl();
-    //void testCorrectUrl();
-    void testLocationUpdateCase();
-};
-
-testLocationUpdate::~testLocationUpdate()
-{
-    delete situare;
-}
-
-
-//void testLocationUpdate::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 testLocationUpdate::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 testLocationUpdate::testLocationUpdateCase()
-{
-    situare = new SituareService(this);
-
-    QSignalSpy receivedErrorSpy(situare, SIGNAL(error(QString)));
-
-    QPointF coordinates(65.3, 25.5);
-    bool publish = true;
-    QString status = "unit-test";
-
-    situare->updateLocation(coordinates, status, publish);
-    QTest::qWait(1000);
-
-    QCOMPARE(receivedErrorSpy.count(), 0);
-}
-
-
-QTEST_MAIN(testLocationUpdate)
-#include "testlocationupdate.moc"
diff --git a/tests/situareservice/testlocationupdate/testlocationupdate.pro b/tests/situareservice/testlocationupdate/testlocationupdate.pro
deleted file mode 100644 (file)
index 5512083..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Wed Apr 7 16:44:14 2010
-# #####################################################################
-CONFIG += qtestlib
-TEMPLATE = app
-TARGET = 
-DEPENDPATH += .
-INCLUDEPATH += "/usr/include/qjson"
-LIBS += "-lqjson"
-
-# Input
-HEADERS += ../../../src/situareservice/situareservice.h \
-    ../../../src/situareservice/imagefetcher.h \
-    ../../../src/facebookservice/facebookauthentication.h \
-    ../../../src/facebookservice/facebookcredentials.h \
-    ../../../src/cookiehandler/cookiehandler.h \
-    ../../../src/user/user.h \
-    testlocationupdate.moc
-SOURCES += testlocationupdate.cpp \
-    ../../../src/situareservice/situareservice.cpp \
-    ../../../src/situareservice/imagefetcher.cpp \
-    ../../../src/facebookservice/facebookauthentication.cpp \
-    ../../../src/facebookservice/facebookcredentials.cpp \
-    ../../../src/cookiehandler/cookiehandler.cpp \
-    ../../../src/user/user.cpp
-QT += core \
-    network \
-    webkit
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644 (file)
index 0000000..f4aeb0c
--- /dev/null
@@ -0,0 +1,13 @@
+TEMPLATE = subdirs
+SUBDIRS = map/mapengine \
+          map/mapview \
+          map/ownlocationitem \
+          map/gpslocationitem \
+          map/maptile \
+          map/friendgroupitem \
+          map/mapscene \
+          map/friendlocationitem \
+          map/uselastlocation \
+          user \
+          ui/friendlist \
+          ui/zoombuttonpanel
diff --git a/tests/ui/friendlist/friendlist b/tests/ui/friendlist/friendlist
deleted file mode 100755 (executable)
index b59abdb..0000000
Binary files a/tests/ui/friendlist/friendlist and /dev/null differ
diff --git a/tests/ui/friendlist/friendlist.pro b/tests/ui/friendlist/friendlist.pro
new file mode 100644 (file)
index 0000000..94de6d8
--- /dev/null
@@ -0,0 +1,15 @@
+CONFIG += qtestlib
+DEFINES += QT_NO_DEBUG_OUTPUT
+INCLUDEPATH += . \
+    ../../../src/
+HEADERS += ../../../src/ui/friendlistview.h \
+    ../../../src/ui/friendlistitem.h \
+    ../../../src/user/user.h \
+    ../../../src/ui/avatarimage.h \
+    ../../../src/ui/imagebutton.h
+SOURCES += ../../../src/ui/friendlistview.cpp \
+    ../../../src/ui/friendlistitem.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/ui/avatarimage.cpp \
+    ../../../src/ui/imagebutton.cpp \
+    testfriendlist.cpp
diff --git a/tests/ui/friendlist/testfriendlist.pro b/tests/ui/friendlist/testfriendlist.pro
deleted file mode 100644 (file)
index 05e76b4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-CONFIG += qtestlib
-HEADERS += ../../../src/ui/friendlistview.h \
-    ../../../src/ui/friendlistitem.h \
-    ../../../src/user/user.h \
-    ../../../src/ui/avatarimage.h \
-    ../../../src/ui/imagebutton.h
-SOURCES += ../../../src/ui/friendlistview.cpp \
-    ../../../src/ui/friendlistitem.cpp \
-    ../../../src/user/user.cpp \
-    ../../../src/ui/avatarimage.cpp \
-    ../../../src/ui/imagebutton.cpp \
-    testfriendlist.cpp
index 0644b33..9f07a0d 100644 (file)
@@ -7,6 +7,7 @@ TEMPLATE = app
 TARGET = 
 DEPENDPATH += .
 INCLUDEPATH += .
+DEFINES += QT_NO_DEBUG_OUTPUT
 
 # Input
 HEADERS += ../../src/user/user.h