Deleted files under tests/testMap and testMap.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 1 Apr 2010 08:28:08 +0000 (11:28 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Thu, 1 Apr 2010 08:28:08 +0000 (11:28 +0300)
Situare.pro
src/map/mapfetcher.cpp
tests/testMap/networkaccessmanagermock.cpp [deleted file]
tests/testMap/networkreplymock.cpp [deleted file]
tests/testMap/testmapengine.cpp [deleted file]
tests/testMap/testmapfetcher.cpp [deleted file]
tests/testmap/testmapfetcher.cpp

index 2b09e4c..c134f5d 100644 (file)
@@ -8,10 +8,9 @@ QT += network \
 INCLUDEPATH += . \
     src/tests/testmap/ \
     src/map/
-SOURCES +=  src/main.cpp \
-src/map/mapfetcher.cpp \
+SOURCES += src/map/mapfetcher.cpp \
     src/map/mapengine.cpp \
-#    tests/testmap/testmapfetcher.cpp \
+    tests/testmap/testmapfetcher.cpp \
 #    tests/testmap/testmapengine.cpp \
     src/ui/mainwindow.cpp \
     tests/testmap/networkaccessmanagermock.cpp \
index 2c730b8..807b2fa 100644 (file)
@@ -42,7 +42,7 @@ MapFetcher::MapFetcher(QObject *parent, QNetworkAccessManager *manager)
 
     m_manager->setCache(diskCache);
 
-    connect(m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*)));    //Change to QNetworkReply
+    connect(m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(downloadFinished(QNetworkReply*)));
 }
 
 void MapFetcher::fetchMapImage(const QUrl &url)
diff --git a/tests/testMap/networkaccessmanagermock.cpp b/tests/testMap/networkaccessmanagermock.cpp
deleted file mode 100644 (file)
index e36d895..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-       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 <QNetworkAccessManager>
-
-class NetworkAccessManagerMock : public QNetworkAccessManager
-{
-    Q_OBJECT
-
-public:
-    NetworkAccessManagerMock();
-
-    void get(const QNetworkRequest &request);
-};
-
-NetworkAccessManagerMock::NetworkAccessManagerMock()
-    : QNetworkAccessManager()
-{
-
-}
-
-void NetworkAccessManagerMock::get(const QNetworkRequest &request)
-{
-    QNetworkReply *reply = new QNetworkReply();
-}
-
-
diff --git a/tests/testMap/networkreplymock.cpp b/tests/testMap/networkreplymock.cpp
deleted file mode 100644 (file)
index ca55c4d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-   Situare - A location system for Facebook
-   Copyright (C) 2010  Ixonos Plc. Authors:
-
-       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 <QNetworkReply>
-
-class NetworkReplyMock : public QNetworkReply
-{
-    Q_OBJECT
-
-public:
-    NetworkReplyMock();
-};
-
-NetworkReplyMock::NetworkReplyMock()
-    : QNetworkReply()
-{
-
-}
diff --git a/tests/testMap/testmapengine.cpp b/tests/testMap/testmapengine.cpp
deleted file mode 100644 (file)
index 9a5a690..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <QtTest/QtTest>
-#include <QPointF>
-#include <QDebug>
-
-#include "mapengine.h"
-
-/**
-* @brief Test class for MapEngine.
-*
-* @class TestMapEngine testmapengine.cpp "tests/testmapengine.cpp"
-*/
-class TestMapEngine : public QObject
-{
-    Q_OBJECT
-public:
-    TestMapEngine();
-
-private slots:
-    void coordinatesToTiles();
-    void longitudeFromTiles();
-    void latitudeFromTiles();
-
-private:
-    MapEngine *mapEngine;
-};
-
-TestMapEngine::TestMapEngine()
-{
-    mapEngine = new MapEngine();
-}
-
-
-void TestMapEngine::coordinatesToTiles()
-{
-    //QPoint point1 = mapEngine->coordinateToTile(47.629, 7.262, 1);
-    QPoint point1 = MapEngine::latLonToTile(47.629, 7.262, 1);
-    QCOMPARE(point1, QPoint(1, 0));
-    /*QPoint point2 = mapEngine->coordinateToTile(65.013379, 25.472059, 13);
-    QCOMPARE(point2, QPoint(4675, 2131));
-    QPoint point3 = mapEngine->coordinateToTile(65.013379, 25.472059, 10);
-    QCOMPARE(point3, QPoint(584, 266));*/
-}
-
-void TestMapEngine::longitudeFromTiles()
-{
-    qreal longitude = mapEngine->tileXToLongitude(4675, 13);
-    QCOMPARE(longitude, 25.47059);
-}
-
-void TestMapEngine::latitudeFromTiles()
-{
-
-}
-
-QTEST_MAIN(TestMapEngine)
-#include "testmapengine.moc"
diff --git a/tests/testMap/testmapfetcher.cpp b/tests/testMap/testmapfetcher.cpp
deleted file mode 100644 (file)
index 7dbb366..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <QtTest/QtTest>
-#include <QUrl>
-#include <QImage>
-#include <QNetworkAccessManager>
-
-#include "mapfetcher.h"
-
-class TestMapFetcher : public QObject
-{
-    Q_OBJECT
-public:
-    TestMapFetcher();
-
-
-private slots:
-    void testFetchImage();
-    //void testDownloadFinished();
-    void testSignals();
-
-
-private:
-    MapFetcher *mapFetcher;
-};
-
-TestMapFetcher::TestMapFetcher()
-{
-    mapFetcher = new MapFetcher();
-}
-
-void TestMapFetcher::testFetchImage()
-{
-    QUrl url("");
-    mapFetcher->fetchMapImage(url);
-}
-
-/*void TestMapFetcher::testDownloadFinished()
-{
-    NetworkReplyDummy *reply = new NetworkReplyDummy();
-    reply->setError(QNetworkReply::ConnectionRefusedError, QString("Connection refused"));
-
-    QSignalSpy errorSpy(mapFetcher, SIGNAL(error(QString)));
-    mapFetcher->downloadFinished(reply);
-    QTest::qWait(500);
-
-    QCOMPARE(errorSpy.count(), 1);
-
-    QSignalSpy imageReceivedSpy(mapFetcher, SIGNAL(mapImageReceived(QUrl,QPixmap)));
-    //QList<QVariant> signalArgs1 = imageReceivedErrorSpy.takeFirst();
-}*/
-
-void TestMapFetcher::testSignals()
-{
-    QSignalSpy imageReceivedSpy(mapFetcher, SIGNAL(mapImageReceived(QUrl,QPixmap)));
-    QSignalSpy imageReceivedErrorSpy(mapFetcher, SIGNAL(error(QString)));
-
-    QVERIFY(imageReceivedSpy.isValid());
-
-    //Incorrect URL
-    QUrl url1("http://tile.openstreetmap.org/7/63/22.gi");
-    mapFetcher->fetchMapImage(url1);
-    QTest::qWait(1000);
-    QCOMPARE(imageReceivedErrorSpy.count(), 1);
-    QList<QVariant> signalArgs1 = imageReceivedErrorSpy.takeFirst();
-    qDebug() << signalArgs1.at(0).toString();
-
-    /*//Correct URL
-    QUrl url2("http://tile.openstreetmap.org/7/63/42.png");
-    mapFetcher->fetchMapImage(url2);
-    QTest::qWait(1000);
-    QCOMPARE(imageReceivedSpy.count(), 1);
-    QList<QVariant> signalArgs2 = imageReceivedSpy.takeLast();
-    QCOMPARE(url2, signalArgs2.at(0).toUrl());
-
-    //20 requests immediately
-    for (int i = 1; i < 3; ++i) {
-        for (int j = 0; j < 10; ++j) {
-            QUrl url(QString("http://tile.openstreetmap.org/7/53/%1%2.png").arg(i).arg(j));
-            mapFetcher->fetchMapImage(url);
-        }
-    }
-    QTest::qWait(400);
-
-    //50 requests immediately
-    for (int i = 1; i < 6; ++i) {
-        for (int j = 0; j < 10; ++j) {
-            QUrl url(QString("http://tile.openstreetmap.org/7/63/%1%2.png").arg(i).arg(j));
-            mapFetcher->fetchMapImage(url);
-        }
-    }
-
-    QTest::qWait(2000);*/
-
-}
-
-QTEST_MAIN(TestMapFetcher)
-#include "testmapfetcher.moc"
index a18142d..205b2eb 100644 (file)
@@ -115,17 +115,17 @@ void TestMapFetcher::testFetchImageIncorrectURL()
 
 void TestMapFetcher::testFetchImageCorrectURL()
 {
-//    QSignalSpy imageReceivedSpy(mapFetcher, SIGNAL(mapImageReceived(QUrl,QPixmap)));
-//
-//    QVERIFY(imageReceivedSpy.isValid());
-//
-//    //Correct URL
-//    QUrl url2("http://tile.openstreetmap.org/7/63/42.png");
-//    mapFetcher->fetchMapImage(url2);
-//    QTest::qWait(2000);
-//    QCOMPARE(imageReceivedSpy.count(), 1);
-//    QList<QVariant> signalArgs2 = imageReceivedSpy.takeLast();
-//    QCOMPARE(url2, signalArgs2.at(0).toUrl());
+    QSignalSpy imageReceivedSpy(mapFetcher, SIGNAL(mapImageReceived(QUrl,QPixmap)));
+
+    QVERIFY(imageReceivedSpy.isValid());
+
+    //Correct URL
+    QUrl url2("http://tile.openstreetmap.org/7/63/42.png");
+    mapFetcher->fetchMapImage(url2);
+    QTest::qWait(2000);
+    QCOMPARE(imageReceivedSpy.count(), 1);
+    QList<QVariant> signalArgs2 = imageReceivedSpy.takeLast();
+    QCOMPARE(url2, signalArgs2.at(0).toUrl());
 }
 
 void TestMapFetcher::testFetchCorruptedImage()