Fixed unit tests
authorSami Rämö <sami.ramo@ixonos.com>
Tue, 25 May 2010 10:58:50 +0000 (13:58 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Tue, 25 May 2010 10:58:50 +0000 (13:58 +0300)
 - removed some garbage unit tests

 - fixed some broken unit tests

 - added some new tests for FriendLocationItem

 - test script modifications

      * check if unit test file is executable

      * doesn't try to test master tests.pro project

      * added some instructional prints if executables
        for all unit tests are not found

      * check if test report contains any qDebug or
        qWarning prints and instruct to disable them

34 files changed:
scripts/run_unit_tests.sh
src/map/friendlocationitem.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/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
tests/ui/friendlist/friendlist
tests/ui/friendlist/friendlist.pro [new file with mode: 0644]
tests/ui/friendlist/testfriendlist.pro [deleted file]
tests/ui/zoombuttonpanel/testzoombuttonpanel.pro [deleted file]
tests/ui/zoombuttonpanel/zoombuttonpanel.pro [new file with mode: 0644]

index 2aa0cce..4462ce5 100755 (executable)
@@ -33,19 +33,23 @@ if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
 
     # run tests
     for project in "${UNIT_TEST_PROJECTS[@]}"
-    do 
-        if [ -f $project ]; then
-            echo ""
-            # run unit test, save to temp file, ignore strerr stream
-            $project -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2> /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"
+    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
+                echo ""
+                # run unit test, save to temp file, ignore strerr stream
+                $project -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2> /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
 
@@ -57,6 +61,10 @@ if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
         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
@@ -66,6 +74,15 @@ if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
         cat $REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND  >> $REPORT
     fi
 
+    # check if unit test output contained any qDebug or qWarning prints
+    debugs=$(egrep -c "(QDEBUG|QWARN)" $REPORT_PATH_ABSOLUTE/$REPORT_FILE)
+    if [ $debugs -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
 
index 67081c9..ee2730e 100644 (file)
@@ -41,7 +41,6 @@ class FriendLocationItem : public BaseLocationItem
     Q_OBJECT
 
 public:
-
     /**
     * @brief Constructor of FriendLocationItem
     *
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..aa145fa
--- /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..55efc20 100644 (file)
@@ -18,14 +18,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 +32,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"
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
index f4f8497..990fbc4 100644 (file)
@@ -7,10 +7,6 @@ SUBDIRS = map/mapengine \
           map/friendgroupitem \
           map/mapscene \
           map/friendlocationitem \
-          map/mapfetcher \
           user \
-          situareservice/testlocationupdate \
-          situareservice/testfetchlocations \
           ui/friendlist \
-          ui/zoombuttonpanel \
-          ui/pixmap
+          ui/zoombuttonpanel
index b59abdb..9af5ca8 100755 (executable)
Binary files a/tests/ui/friendlist/friendlist and b/tests/ui/friendlist/friendlist differ
diff --git a/tests/ui/friendlist/friendlist.pro b/tests/ui/friendlist/friendlist.pro
new file mode 100644 (file)
index 0000000..0ffd36d
--- /dev/null
@@ -0,0 +1,15 @@
+CONFIG += qtestlib
+INCLUDEPATH += . \
+    ../../../src/
+HEADERS += ../../../src/ui/friendlistview.h \
+    ../../../src/ui/friendlistitem.h \
+    ../../../src/user/user.h \
+    ../../../src/ui/avatarimage.h \
+    ../../../src/common.h \
+    ../../../src/ui/imagebutton.h
+SOURCES += ../../../src/ui/friendlistview.cpp \
+    ../../../src/ui/friendlistitem.cpp \
+    ../../../src/user/user.cpp \
+    ../../../src/ui/avatarimage.cpp \
+    testfriendlist.cpp \
+    ../../../src/ui/imagebutton.cpp
diff --git a/tests/ui/friendlist/testfriendlist.pro b/tests/ui/friendlist/testfriendlist.pro
deleted file mode 100644 (file)
index 959e157..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG += qtestlib
-HEADERS += ../../../src/ui/friendlistview.h \
-    ../../../src/ui/friendlistitem.h \
-    ../../../src/user/user.h \
-    ../../../src/ui/avatarimage.h
-SOURCES += ../../../src/ui/friendlistview.cpp \
-    ../../../src/ui/friendlistitem.cpp \
-    ../../../src/user/user.cpp \
-    ../../../src/ui/avatarimage.cpp \
-    testfriendlist.cpp
diff --git a/tests/ui/zoombuttonpanel/testzoombuttonpanel.pro b/tests/ui/zoombuttonpanel/testzoombuttonpanel.pro
deleted file mode 100644 (file)
index 9b46a68..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Mon May 18 15:38:16 2010
-# #####################################################################
-CONFIG += qtestlib
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += . \
-    ../../../src/
-
-# Input
-SOURCES += testzoombuttonpanel.cpp \
-    ../../../src/ui/zoombuttonpanel.cpp \
-    ../../../src/ui/imagebutton.cpp
-HEADERS += ../../../src/ui/zoombuttonpanel.h \
-    ../../../src/ui/imagebutton.h
-
-DEFINES += QT_NO_DEBUG_OUTPUT
-RESOURCES += ../../../images.qrc
diff --git a/tests/ui/zoombuttonpanel/zoombuttonpanel.pro b/tests/ui/zoombuttonpanel/zoombuttonpanel.pro
new file mode 100644 (file)
index 0000000..9b46a68
--- /dev/null
@@ -0,0 +1,19 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Mon May 18 15:38:16 2010
+# #####################################################################
+CONFIG += qtestlib
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += . \
+    ../../../src/
+
+# Input
+SOURCES += testzoombuttonpanel.cpp \
+    ../../../src/ui/zoombuttonpanel.cpp \
+    ../../../src/ui/imagebutton.cpp
+HEADERS += ../../../src/ui/zoombuttonpanel.h \
+    ../../../src/ui/imagebutton.h
+
+DEFINES += QT_NO_DEBUG_OUTPUT
+RESOURCES += ../../../images.qrc