<file>res/images/list_item_bottom.png</file>
<file>res/images/list_item_middle.png</file>
<file>res/images/list_item_top.png</file>
+ <file>res/images/user_info_item_bottom.png</file>
+ <file>res/images/user_info_item_middle.png</file>
+ <file>res/images/user_info_item_top.png</file>
<file>res/images/sliding_bar_left_test.png</file>
<file>res/images/userpanel_mask.png</file>
<file>res/images/sliding_bar_right_test.png</file>
+++ /dev/null
-#!/bin/bash
-
-if [$1 -eq ""]; then
- echo "Usage of the script: ./master_test_script.sh destination_folder_for_test_reports tests_folder_location"
-else
-##########################################################
-# This script is executed from /scripts directory #
-# in situare project folder #
-##########################################################
-clear
-echo "This is the master script for building and executing all automatic unit test."
-echo "As a final step, it creates summary report from all tests executed."
-##########################################################
-#Environment settings #
-##########################################################
-#Store all directory names to a list
-#Modify these paths to point to correct path
-location=$2
-echo $location
-echo "Tests situate at: $location"
-
-TEST_REPORT=$1
-echo "Directory to store test report: $1"
-#cd $location
-if [ ! -e $1/tests_summary.txt ]; then
- touch $1/tests_summary.txt
- echo "##########################################" >> tests_summary.txt
- echo "# Summary of unit tests executed #" >> tests_summary.txt
- echo "# Date: `date` #" >> tests_summary.txt
- echo "# User: `whoami` #" >> tests_summary.txt
- echo "##########################################" >> tests_summary.txt
-fi
-
-FILE=$1/tests_summary.txt
-cd $location
-MODULES=(`ls`)
-echo $MODULES
-
-for component in "${MODULES[@]}"
-do
- echo "Found test directory: $component"
-done
-
-##########################################################
-#First part: Execution of all tests #
-##########################################################
-for component in "${MODULES[@]}" #Loop through components
-do
- cd $location/$component
- CASES=(`ls`) #List all test cases under component directory
- for unittest in "${CASES[@]}"
- do
- cd $location/$component/$unittest
- echo "Building tests for $component/$unittest"
- qmake
- make
- echo "Running tests for $component/$unittest"
- ./$unittest -o testreport_$component.txt
- echo "Cleaning $unittest"
- make clean
- rm Makefile
- rm $unittest
- done
-done
-
-#########################################################
-# Second part: Extraction of results #
-#########################################################
-echo "Summarizing test results....."
-for component in "${MODULES[@]}" #Loop through components
-do
- cd $location/$component
- CASES=(`ls`) #List all test cases uner component directory
- for unittests in "${CASES[@]}"
- do
- cd $location/$component/$unittests
- echo "############# $component/$unittests ################" >> $FILE
- grep Totals *.txt >> $FILE
- done
-done
-fi
-exit 0
--- /dev/null
+#!/bin/bash
+
+clear
+
+# set default values
+UNIT_TESTS_ROOT_DIR="../tests"
+REPORT_PATH="../doc"
+REPORT_FILE="unit_test_results.txt"
+TEMP_FILE_EXEC_NOT_FOUND="temp_exec_not_found.txt"
+TEMP_REPORT_FILE="temp_report.txt"
+
+# check that directories are found
+if [[ -d $REPORT_PATH && -d $UNIT_TESTS_ROOT_DIR ]]; then
+ # convert relational paths to absolute ones
+ UNIT_TESTS_ROOT_DIR_ABSOLUTE=`cd $UNIT_TESTS_ROOT_DIR; pwd`
+ REPORT_PATH_ABSOLUTE=`cd $REPORT_PATH; pwd`
+ REPORT="$REPORT_PATH_ABSOLUTE/$REPORT_FILE"
+ echo ""
+ echo "Running recursively all tests under $UNIT_TESTS_ROOT_DIR_ABSOLUTE"
+ echo "Saving results to $REPORT"
+ echo ""
+
+ # overwrite report summary file and write header
+ echo "##########################################" > $REPORT
+ echo "# Summary of unit tests executed" >> $REPORT
+ echo "# Date: `date`" >> $REPORT
+ echo "# User: `whoami`" >> $REPORT
+ echo "##########################################" >> $REPORT
+ echo "" >> $REPORT
+
+ # find all test .pro files pahts, cut .pro extension
+ UNIT_TEST_PROJECTS=(`find $UNIT_TESTS_ROOT_DIR_ABSOLUTE | egrep .pro$ | sed -e s/.pro//g`)
+
+ echo "###################################################"
+ echo "All unit test executables will be deleted"
+ echo "and qmake + make will be run for root tests.pro"
+ echo "###################################################"
+ echo ""
+
+ # remove all unit test binaries
+ for BINARY in "${UNIT_TEST_PROJECTS[@]}"
+ do
+ # remove only if file really exists
+ if [ -a $BINARY ]; then
+ rm $BINARY
+ fi
+ done
+
+ # run qmake
+ cd $UNIT_TESTS_ROOT_DIR_ABSOLUTE
+ qmake -r
+ make
+ cd -
+
+ echo ""
+ echo "###################################################"
+ echo "Executing tests..."
+ echo "###################################################"
+
+ # run tests
+ for PROJECT in "${UNIT_TEST_PROJECTS[@]}"
+ do
+ # do not try to test the root tests.pro project
+ if [ $PROJECT != "$UNIT_TESTS_ROOT_DIR_ABSOLUTE/tests" ]; then
+ # check if unit test file is found and is executable
+ if [ -x $PROJECT ]; then
+ # go to unit test directory
+ cd "`echo $PROJECT | grep --perl-regexp -o .*\(?=/\)`"
+ # run unit test, save to temp file, ignore strerr stream
+ $PROJECT -silent -o $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE 2>&1 | grep -v "atk_object_set_name..assertion"
+ cd - > /dev/null
+ # print to screen and append to summary
+ cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE
+ cat $REPORT_PATH_ABSOLUTE/$TEMP_REPORT_FILE >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
+ echo "" >> $REPORT_PATH_ABSOLUTE/$REPORT_FILE
+ else
+ # save path of missing test to temporary file
+ MISSING=(`echo $PROJECT | sed -e s,$UNIT_TESTS_ROOT_DIR_ABSOLUTE,,g`)
+ echo "$MISSING" >> "$REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND"
+ fi
+ fi
+ done
+
+ if [ -f "$REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND" ]; then
+ # print list of missing test executables
+ echo ""
+ echo "###################################################"
+ echo "Executables for following unit tests were not found"
+ echo -e "###################################################\E[31m\E[1m" ## set red color & bold
+ cat $REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND
+ tput sgr0 # restore terminal defaults
+ echo ""
+ echo "Some possible causes:"
+ echo " - project has set target name explicitly. Target name must be same as directory name"
+ echo " - don't use shadow build system"
+
+ # and save same list also to test summary file
+ echo "" >> $REPORT
+ echo "###################################################" >> $REPORT
+ echo "Executables for following unit tests were not found" >> $REPORT
+ echo "###################################################" >> $REPORT
+ cat $REPORT_PATH_ABSOLUTE/$TEMP_FILE_EXEC_NOT_FOUND >> $REPORT
+ fi
+
+ # check if unit test output contained any qDebug or qWarning prints
+ DEBUG_COUNT=$(egrep -c "(QDEBUG|QWARN)" $REPORT_PATH_ABSOLUTE/$REPORT_FILE)
+ if [ $DEBUG_COUNT -ge 1 ]; then
+ echo ""
+ # print message in red and bold
+ echo -e "\E[31m\E[1mDisable debug output from unit tests so test output stays readable!!!"
+ tput sgr0 # restore terminal defaults
+ fi
+
+ # remove temporary files
+ rm $REPORT_PATH_ABSOLUTE/temp_*.txt
+
+ # tell that script reached the end
+ echo "" >> $REPORT
+ echo "All done!" >> $REPORT
+ echo ""
+ echo "All done!"
+else
+ echo "Paths for report and/or tests not found!"
+ echo "Script must be run from scripts directory"
+fi
+echo ""
error("Use the qmake include with Qt4.6.2 or greater");
}
TEMPLATE = subdirs
-SUBDIRS = src
+SUBDIRS = src \
+ tests
const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
+const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
#endif // COMMON_H
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_mapEngine, SIGNAL(friendsLocationsReady(QList<User*>&)));
+ initializeGpsAndAutocentering();
+
// signals connected, now it's time to show the main window
// but init the MapEngine before so starting location is set
m_mapEngine->init();
m_ui->show();
- QSettings settings(DIRECTORY_NAME, FILE_NAME);
- QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
- QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
-
- // set features on / off based on settings
- changeAutoCenteringSetting(autoCenteringEnabled.toBool());
- enableGPS(gpsEnabled.toBool());
-
- // show messages at startup if features are enabled automatically
- if (gpsEnabled.toBool())
- m_ui->showMaemoInformationBox(tr("GPS enabled"));
- if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
- m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
-
m_facebookAuthenticator->start();
}
void SituareEngine::fetchUsernameFromSettings()
{
qDebug() << __PRETTY_FUNCTION__;
+
m_ui->setUsername(m_facebookAuthenticator->loadUsername());
}
+void SituareEngine::initializeGpsAndAutocentering()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ QVariant gpsEnabled = settings.value(SETTINGS_GPS_ENABLED);
+ QVariant autoCenteringEnabled = settings.value(SETTINGS_AUTO_CENTERING_ENABLED);
+
+ if (gpsEnabled.toString().isEmpty()) { // First start. Situare.conf file does not exists
+
+ connect(m_gps, SIGNAL(position(QPointF,qreal)),
+ this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+
+ changeAutoCenteringSetting(true);
+ enableGPS(true);
+
+ m_ui->showMaemoInformationBox(tr("GPS enabled"));
+ m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
+ } else { // Normal start
+ changeAutoCenteringSetting(autoCenteringEnabled.toBool());
+ enableGPS(gpsEnabled.toBool());
+
+ if (gpsEnabled.toBool())
+ m_ui->showMaemoInformationBox(tr("GPS enabled"));
+
+ if (gpsEnabled.toBool() && autoCenteringEnabled.toBool())
+ m_ui->showMaemoInformationBox(tr("Auto centering enabled"));
+ }
+}
+
void SituareEngine::invalidCredentials()
{
qDebug() << __PRETTY_FUNCTION__;
m_situareService->updateLocation(m_mapEngine->centerGeoCoordinate(), status, publish);
}
+void SituareEngine::setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(latLonCoordinate);
+ Q_UNUSED(accuracy);
+
+ if (m_autoCenteringEnabled) // autocentering is disabled when map is scrolled
+ m_mapEngine->setZoomLevel(DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE);
+
+ disconnect(m_gps, SIGNAL(position(QPointF,qreal)),
+ this, SLOT(setFirstStartZoomLevel(QPointF,qreal)));
+}
+
void SituareEngine::signalsFromFacebookAuthenticator()
{
qDebug() << __PRETTY_FUNCTION__;
connect(m_ui, SIGNAL(refreshUserData()),
this, SLOT(refreshUserData()));
+ connect(m_ui, SIGNAL(findUser(QPointF)),
+ m_mapEngine, SLOT(setViewLocation(QPointF)));
+
// signals from friend list tab
connect(m_ui, SIGNAL(findFriend(QPointF)),
m_mapEngine, SLOT(setViewLocation(QPointF)));
#define ENGINE_H
#include <QObject>
+#include <QPointF>
class QMainWindow;
private:
/**
+ * @brief Read settings and determine whether to use GPS and autocentering.
+ * When values does not found on the settings, GPS and autocentering are enabled as a default.
+ */
+ void initializeGpsAndAutocentering();
+
+ /**
* @brief Connect signals coming from Facdebook authenticator
*/
void signalsFromFacebookAuthenticator();
void enableGPS(bool enabled);
/**
+ * @brief Sets zoom level to default when first GPS location is received if autocentering
+ * is enabled.
+ *
+ * @param latLonCoordinate own location
+ * @param accuracy accuracy of GPS location
+ */
+ void setFirstStartZoomLevel(QPointF latLonCoordinate, qreal accuracy);
+
+ /**
* @brief Slot for intercepting signal when credentials are invalid
*
*/
Q_OBJECT
public:
-
/**
* @brief Constructor of FriendLocationItem
*
QPointF startLocation;
QSettings settings(DIRECTORY_NAME, FILE_NAME);
- if (settings.value(MAP_LAST_POSITION, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() ==
- ERROR_VALUE_NOT_FOUND_ON_SETTINGS ||
- settings.value(MAP_LAST_ZOOMLEVEL, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() ==
- ERROR_VALUE_NOT_FOUND_ON_SETTINGS) {
+ if (settings.value(MAP_LAST_POSITION, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString()
+ == ERROR_VALUE_NOT_FOUND_ON_SETTINGS || settings.value(MAP_LAST_ZOOMLEVEL,
+ ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toString() == ERROR_VALUE_NOT_FOUND_ON_SETTINGS) {
startLocation = QPointF(DEFAULT_LONGITUDE, DEFAULT_LATITUDE);
m_zoomLevel = DEFAULT_START_ZOOM_LEVEL;
- }
-
- else {
+ } else {
m_zoomLevel = settings.value(MAP_LAST_ZOOMLEVEL, ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toInt();
startLocation = settings.value(MAP_LAST_POSITION,
ERROR_VALUE_NOT_FOUND_ON_SETTINGS).toPointF();
}
}
+void MapEngine::setZoomLevel(int newZoomLevel)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_zoomLevel = newZoomLevel;
+ emit zoomLevelChanged(m_zoomLevel);
+}
+
void MapEngine::setViewLocation(QPointF latLonCoordinate)
{
qDebug() << __PRETTY_FUNCTION__;
QGraphicsScene* scene();
/**
+ * @brief Sets new zoom level
+ *
+ * @return newZoomLevel value that is set to new zoom level
+ */
+ void setZoomLevel(const int newZoomLevel);
+
+ /**
* @brief Return tile path created from tile values.
*
* @param zoomLevel tile's zoom level
*
* @param latLonCoordinate Latitude & longitude coordinates for location
*/
- void setViewLocation(QPointF latLonCoordinate);
+ void setViewLocation(QPointF latLonCoordinate);
/**
* @brief Slot for view resizing.
m_userPanelSidebar->stackUnder(m_friendsListPanel);
m_userPanel->stackUnder(m_userPanelSidebar);
+ connect(m_userPanel, SIGNAL(findUser(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
+
connect(this, SIGNAL(userLocationReady(User*)),
m_userPanel, SLOT(userDataReceived(User*)));
void fetchUsernameFromSettings();
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief GPS setting changed
*
* @param enabled True if GPS is enabled, otherwise false
#include "../user/user.h"
#include "userinfo.h"
-const int BACKGROUND_TOP_HEIGHT = 20;
-const int BACKGROUND_BOTTOM_HEIGHT = 15;
-const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
-const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
-const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
-const int ICON_HEIGHT = 24; ///< Icon height
-const int ICON_WIDTH = 24; ///< Icon width
-const int IMAGE_HEIGHT = 60; ///< Friend image height
-const int IMAGE_WIDTH = 60; ///< Friend image width
-const int ITEM_MIN_WIDTH = 250; ///< Minimum width for item
-const int MARGIN = 5; ///< Icon margin
+const int BACKGROUND_WIDTH = 240; ///< Width for item
+const int BACKGROUND_TOP_HEIGHT = 16; ///< Height for item top
+const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Height for item bottom
+const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
+const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
+const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
+const int ICON_HEIGHT = 24; ///< Icon height
+const int ICON_WIDTH = 24; ///< Icon width
+const int IMAGE_HEIGHT = 60; ///< Profile image height
+const int IMAGE_WIDTH = 60; ///< Profile image width
+const int MARGIN = 5; ///< Icon margin
const int MOUSE_PRESS_AREA_WIDTH = 20; ///< Area width for item height toggling
const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
*
* @brief All label's maximum width
*/
-const int LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - ICON_WIDTH;
-
-/**
-* @brief Name label's maximum width
-*
-* @var NAME_LABEL_MAX_WIDTH
-*/
-const int NAME_LABEL_MAX_WIDTH = LABEL_MAX_WIDTH + 30;
+const int LABEL_MAX_WIDTH = BACKGROUND_WIDTH - 3 * MARGIN - ICON_WIDTH + 130;
UserInfo::UserInfo(QWidget *parent)
- : QWidget(parent)
- , m_expanded(false)
+ : QWidget(parent),
+ m_expanded(false)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
- verticalLayout->setContentsMargins(MARGIN, 0, MARGIN*2, MARGIN*2);
+ verticalLayout->setContentsMargins(MARGIN * 2, 0, MARGIN * 2, MARGIN * 2);
verticalLayout->setSpacing(0);
setLayout(verticalLayout);
buttonLayout->setMargin(0);
buttonLayout->setSpacing(0);
- QLabel *clockLabel = new QLabel();
- clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
- clockLabel->setContentsMargins(0, 0, MARGIN, 0);
- clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
QLabel *envelopeLabel = new QLabel();
envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
compassLabel->setContentsMargins(0, 0, MARGIN, 0);
compassLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
+ QLabel *clockLabel = new QLabel();
+ clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
+ clockLabel->setContentsMargins(0, 0, MARGIN, 0);
+ clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- m_imageLabel = new QLabel();
- m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
- m_imageLabel->setAlignment(Qt::AlignHCenter);
+ m_findButton = new ImageButton();
m_nameLabel = new QLabel();
- m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
- m_nameLabel->setAlignment(Qt::AlignHCenter);
+ m_nameLabel->setWordWrap(true);
- m_updatedLabel = new QLabel();
- m_updatedLabel->setWordWrap(true);
m_statusTextLabel = new QLabel();
m_statusTextLabel->setWordWrap(true);
m_locationLabel = new QLabel();
m_locationLabel->setWordWrap(true);
+ m_updatedLabel = new QLabel();
+ m_updatedLabel->setWordWrap(true);
ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
":/res/images/refresh_s.png");
buttonLayout->addWidget(updateFriendsButton);
buttonLayout->addWidget(updateStatusMessageButton);
- infoLayout->addRow(compassLabel, m_locationLabel);
infoLayout->addRow(envelopeLabel, m_statusTextLabel);
+ infoLayout->addRow(compassLabel, m_locationLabel);
infoLayout->addRow(clockLabel, m_updatedLabel);
- verticalLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
-
- verticalLayout->addWidget(m_nameLabel, 1);
+ verticalLayout->addWidget(m_findButton, 0, Qt::AlignHCenter);
+ verticalLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
verticalLayout->addLayout(infoLayout);
- verticalLayout->addLayout(buttonLayout, 2);
+ verticalLayout->addLayout(buttonLayout);
connect(updateStatusMessageButton,SIGNAL(clicked()),
this,SLOT(messageUpdate()));
connect(updateFriendsButton,SIGNAL(clicked()),
this, SIGNAL(refreshUserData()));
+ connect(m_findButton, SIGNAL(clicked()),
+ this, SLOT(findButtonClicked()));
+
+ setFixedWidth(BACKGROUND_WIDTH);
this->setFont(NOKIA_FONT_SMALL);
m_nameLabel->setFont(NOKIA_FONT_NORMAL);
namePalette.setColor(QPalette::Foreground, Qt::white);
m_nameLabel->setPalette(namePalette);
- m_backgroundTopImage.load(":/res/images/list_item_top.png");
- m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
- m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
-
- this->setMinimumWidth(ITEM_MIN_WIDTH);
+ m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
+ m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
+ m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
}
-void UserInfo::setUserName(const QString &name)
+void UserInfo::setAddress(const QString &address)
{
qDebug() << __PRETTY_FUNCTION__;
- m_userName = name;
- setText(false);
+ m_locationLabel->setText(address);
}
-void UserInfo::setAvatar(const QPixmap &image)
+void UserInfo::setCoordinates(const QPointF &coordinates)
{
qDebug() << __PRETTY_FUNCTION__;
- m_imageLabel->setPixmap(image);
+ m_coordinates = coordinates;
}
void UserInfo::setMessageText(const QString &text)
setText(false);
}
-void UserInfo::setAddress(const QString &addr)
+void UserInfo::setProfileImage(const QPixmap &image)
{
qDebug() << __PRETTY_FUNCTION__;
- m_locationLabel->setText(addr);
+ m_findButton->setIcon(image);
}
-void UserInfo::setTime(const QString &tim)
+void UserInfo::setTime(const QString &time)
{
qDebug() << __PRETTY_FUNCTION__;
- m_updatedLabel->setText(tim);
+ m_updatedLabel->setText(time);
+}
+
+void UserInfo::setUserName(const QString &name)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_userName = name;
+ setText(false);
}
QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
m_statusTextLabel->setText(m_messageText);
}
else {
- m_nameLabel->setText(shortenText(m_nameLabel, m_userName, NAME_LABEL_MAX_WIDTH));
+ m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
m_statusTextLabel->setText(shortenText(m_statusTextLabel, m_messageText,
LABEL_MAX_WIDTH));
}
QPainter painter(this);
- QRect topRect = QRect(0, 0, ITEM_MIN_WIDTH, BACKGROUND_TOP_HEIGHT);
- QRect middleRect = QRect(0, topRect.bottom(), ITEM_MIN_WIDTH,
+ QRect topRect = QRect(0, MARGIN, BACKGROUND_WIDTH, BACKGROUND_TOP_HEIGHT);
+ QRect middleRect = QRect(0, topRect.bottom(), BACKGROUND_WIDTH,
height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
- QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), ITEM_MIN_WIDTH,
+ QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), BACKGROUND_WIDTH,
BACKGROUND_BOTTOM_HEIGHT);
painter.drawPixmap(topRect, m_backgroundTopImage);
m_mousePosition = event->pos();
}
+void UserInfo::findButtonClicked()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ emit findUser(m_coordinates);
+}
+
void UserInfo::messageUpdate()
{
qDebug() << __PRETTY_FUNCTION__;
#include <QWidget>
#include "updatelocation/updatelocationdialog.h"
+class ImageButton;
+
+/**
+* @brief UserInfo shows user's data in expandable item.
+*
+* @class UserInfo userinfo.h "ui/userinfo.h"
+*/
class UserInfo : public QWidget
{
Q_OBJECT
* @param event QMouseEvent mouse press event
*/
void mousePressEvent(QMouseEvent *event);
+
/**
* @brief Call toggleHeight if mouse position is unchanged.
*
* @param event QMouseEvent mouse release event
*/
void mouseReleaseEvent(QMouseEvent *event);
+
/**
* @brief This function is called when the widget is drawn
*
/**
* @brief Sets the users current address
*
- * @param addr Reference to users current address
+ * @param address Reference to users current address
*/
- void setAddress(const QString &addr);
+ void setAddress(const QString &address);
/**
- * @brief Sets the user picture
+ * @brief Sets the users current coordinates
*
- * @param avat Reference to user picture
+ * @param coordinates Reference to users current coordinates
*/
- void setAvatar(const QPixmap &image);
+ void setCoordinates(const QPointF &coordinates);
/**
* @brief Sets the message text
void setMessageText(const QString &text);
/**
+ * @brief Sets the user picture
+ *
+ * @param image Reference to user picture
+ */
+ void setProfileImage(const QPixmap &image);
+
+ /**
* @brief Sets the time of updated message
*
- * @param tim Reference to time when message was sent.
+ * @param time Reference to time when message was sent.
*/
- void setTime(const QString &tim);
+ void setTime(const QString &time);
/**
* @brief Sets the user name
*
- * @param usernam Reference to user name
+ * @param name Reference to user name
*/
void setUserName(const QString &name);
private slots:
/**
+ * @brief Slot for find button click
+ */
+ void findButtonClicked();
+
+ /**
* @brief Slot function to forward messageUpdate launch signal
*
*/
******************************************************************************/
signals:
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief Signal for refreshing user data.
*
*/
******************************************************************************/
private:
bool m_expanded; ///< Item expanded state
- QLabel *m_imageLabel; ///< Image label
QLabel *m_locationLabel; ///< Location label
QLabel *m_nameLabel; ///< Name label
QLabel *m_statusTextLabel; ///< Status text label
QPixmap m_backgroundMiddleImage; ///< Middle background image
QPixmap m_backgroundTopImage; ///< Top background image
QPoint m_mousePosition; ///< Current mouse press position
+ QPointF m_coordinates; ///< User current coordinates
QString m_address; ///< Address from where the new message was sent.
QString m_messageText; ///< User's message
QString m_time; ///< Time when the new message was sent
QString m_userName; ///< User's name
-
+ ImageButton *m_findButton; ///< User find button
};
#endif // USERINFO_H
: SidePanel(parent)
{
qDebug() << __PRETTY_FUNCTION__;
+
setType(SidePanel::UserPanel);
m_userInfo = new UserInfo(this);
- m_panelVBox->addWidget(m_userInfo, 0, Qt::AlignCenter);
+
+ QWidget *userInfoView = new QWidget(this);
+ QVBoxLayout *userViewLayout = new QVBoxLayout(userInfoView);
+ userViewLayout->setMargin(0);
+ userViewLayout->setSpacing(0);
+ userViewLayout->setStretch(0, 0);
+ userViewLayout->setSizeConstraint(QLayout::SetFixedSize);
+ userViewLayout->addWidget(m_userInfo);
+
+ QScrollArea *userInfoScroll = new QScrollArea(this);
+ userInfoScroll->setWidgetResizable(true);
+ userInfoScroll->setWidget(userInfoView);
+ userInfoScroll->setAlignment(Qt::AlignVCenter);
+ userInfoScroll->viewport()->setAutoFillBackground(false);
+ userInfoScroll->widget()->setAutoFillBackground(false);
+
+ m_panelVBox->addWidget(userInfoScroll);
+
+ connect(m_userInfo, SIGNAL(findUser(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
connect(m_userInfo,SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
if(user) {
m_userInfo->setUserName(user->name());
- m_userInfo->setAvatar(user->profileImage());
+ m_userInfo->setProfileImage(user->profileImage());
m_userInfo->setMessageText(user->note());
m_userInfo->setAddress(user->address());
m_userInfo->setTime(user->timestamp());
+ m_userInfo->setCoordinates(user->coordinates());
}
}
*/
void userDataReceived(User *user);
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
/**
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
+ void findUser(const QPointF &coordinates);
+
+ /**
* @brief Signal for refreshing user data.
*
*/
******************************************************************************/
private:
UserInfo *m_userInfo; ///< Instance of the user info view
+
};
#endif // USERPANEL_H
--- /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
CONFIG += qtestlib
QT += network
TEMPLATE = app
-TARGET = ownlocation
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
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"
// Check parameters of sended signals
QList<QVariant> parameters = mapEngineSpy.takeFirst();
QVERIFY(parameters.at(0).toInt() == DEFAULT_TEST_ZOOMLEVEL);
-// parameters = mapEngineSpy.takeFirst();
-// QVERIFY(parameters.at(0).toInt() == 0);
+
parameters = mapEngineSpy.takeFirst();
QVERIFY(parameters.at(0).toInt() == DEFAULT_START_ZOOM_LEVEL);
../../../src/map/friendlocationitem.cpp \
../../../src/map/friendgroupitem.cpp \
../../../src/ui/mainwindow.cpp \
- ../../../src/ui/mapviewscreen.cpp \
../../../src/ui/settingsdialog.cpp \
../../../src/ui/logindialog.cpp \
../../../src/map/mapview.cpp \
../../../src/ui/friendlistpanel.cpp \
- ../../../src/ui/userpanel.cpp \
../../../src/ui/panelsidebar.cpp \
../../../src/ui/zoombuttonpanel.cpp \
../../../src/ui/friendlistview.cpp \
../../../src/ui/userinfo.cpp \
../../../src/ui/imagebutton.cpp \
../../../src/ui/updatelocation/updatelocationdialog.cpp \
- ../../../src/ui/updatelocation/texteditautoresizer.cpp
+ ../../../src/ui/updatelocation/texteditautoresizer.cpp \
+ ../../../src/ui/userinfopanel.cpp \
+ ../../../src/ui/sidepanel.cpp \
+ ../../../src/ui/zoombutton.cpp
HEADERS += ../../../src/map/mapengine.h \
../../../src/map/mapscene.h \
../../../src/map/friendlocationitem.h \
../../../src/map/friendgroupitem.h \
../../../src/ui/mainwindow.h \
- ../../../src/ui/mapviewscreen.h \
../../../src/ui/settingsdialog.h \
../../../src/ui/logindialog.h \
../../../src/map/mapview.h \
../../../src/ui/friendlistpanel.h \
- ../../../src/ui/userpanel.h \
../../../src/ui/panelsidebar.h \
../../../src/ui/zoombuttonpanel.h \
../../../src/ui/friendlistview.h \
../../../src/ui/userinfo.h \
../../../src/ui/imagebutton.h \
../../../src/ui/updatelocation/updatelocationdialog.h \
- ../../../src/ui/updatelocation/texteditautoresizer.h
+ ../../../src/ui/updatelocation/texteditautoresizer.h \
+ ../../../src/ui/userinfopanel.h \
+ ../../../src/ui/sidepanel.h \
+ ../../../src/ui/zoombutton.h
+++ /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
--- /dev/null
+TEMPLATE = subdirs
+SUBDIRS = map/mapengine \
+ map/mapview \
+ map/ownlocationitem \
+ map/gpslocationitem \
+ map/maptile \
+ map/friendgroupitem \
+ map/mapscene \
+ map/friendlocationitem \
+ map/uselastlocation \
+ user \
+ ui/friendlist \
+ ui/zoombuttonpanel
--- /dev/null
+CONFIG += qtestlib
+DEFINES += QT_NO_DEBUG_OUTPUT
+INCLUDEPATH += . \
+ ../../../src/
+HEADERS += ../../../src/ui/friendlistview.h \
+ ../../../src/ui/friendlistitem.h \
+ ../../../src/user/user.h \
+ ../../../src/ui/avatarimage.h \
+ ../../../src/ui/imagebutton.h
+SOURCES += ../../../src/ui/friendlistview.cpp \
+ ../../../src/ui/friendlistitem.cpp \
+ ../../../src/user/user.cpp \
+ ../../../src/ui/avatarimage.cpp \
+ ../../../src/ui/imagebutton.cpp \
+ testfriendlist.cpp
+++ /dev/null
-CONFIG += qtestlib
-HEADERS += ../../../src/ui/friendlistview.h \
- ../../../src/ui/friendlistitem.h \
- ../../../src/user/user.h \
- ../../../src/ui/avatarimage.h \
- ../../../src/ui/imagebutton.h
-SOURCES += ../../../src/ui/friendlistview.cpp \
- ../../../src/ui/friendlistitem.cpp \
- ../../../src/user/user.cpp \
- ../../../src/ui/avatarimage.cpp \
- ../../../src/ui/imagebutton.cpp \
- testfriendlist.cpp
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
+DEFINES += QT_NO_DEBUG_OUTPUT
# Input
HEADERS += ../../src/user/user.h