# 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
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
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
Q_OBJECT
public:
-
/**
* @brief Constructor of FriendLocationItem
*
--- /dev/null
+# #####################################################################
+# 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
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()
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);
+++ /dev/null
-# #####################################################################
-# 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
CONFIG += qtestlib
QT += network
TEMPLATE = app
-TARGET = friendlocation
DEPENDPATH += .
INCLUDEPATH += . \
../../../src/
../../../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 \
../../../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
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"
--- /dev/null
+# #####################################################################
+# 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
+++ /dev/null
-# #####################################################################
-# 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
--- /dev/null
+# #####################################################################
+# 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
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();
+++ /dev/null
-# #####################################################################
-# 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
--- /dev/null
+# #####################################################################
+# 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
+++ /dev/null
-# #####################################################################
-# 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
--- /dev/null
+# #####################################################################
+# 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
+++ /dev/null
-# #####################################################################
-# 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
--- /dev/null
+# #####################################################################
+# 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
+++ /dev/null
-# #####################################################################
-# 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
../../../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 \
../../../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
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;
}
/**
* @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;
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);
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"
+++ /dev/null
-/*
- 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()));
-}
+++ /dev/null
-/*
- 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
+++ /dev/null
-/*
- 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();
-}
+++ /dev/null
-/*
- 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
+++ /dev/null
- /*
- 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"
+++ /dev/null
-######################################################################
-# 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
+++ /dev/null
- /*
- 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"
+++ /dev/null
-# #####################################################################
-# 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
map/friendgroupitem \
map/mapscene \
map/friendlocationitem \
- map/mapfetcher \
user \
- situareservice/testlocationupdate \
- situareservice/testfetchlocations \
ui/friendlist \
- ui/zoombuttonpanel \
- ui/pixmap
+ ui/zoombuttonpanel
--- /dev/null
+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
+++ /dev/null
-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
+++ /dev/null
-# #####################################################################
-# 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
--- /dev/null
+# #####################################################################
+# 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