+++ /dev/null
-#include "httpclient_p.h"
-#include "httpclient.h"
-
-#include "routedata.h"
-#include "location.h"
-
-#include "ui_zouba.h"
-
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QUrl>
-#include <QObject>
-#include <QDebug>
-#include <QStringList>
-#include <QString>
-#include <QXmlStreamReader>
-
-namespace {
- QUrl ytv( "http://api.reittiopas.fi/public-ytv/fi/api/" );
- QString username( "zouba" );
- QString password( "caf9r3ee" );
-
- QString homeKey( "taivaanvuohentie%207%2Chelsinki" );
- QString workKey( "it%E4merenkatu%2011%2Chelsinki" );
-
-}
-
-HttpClient::HttpClient( Ui::MainWindow *ui ) :
- q( new HttpClientPrivate( this ) ),
- manager( new QNetworkAccessManager(this) ),
- ui( ui )
-{
- connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
-}
-
-HttpClient::~HttpClient()
-{
- delete manager;
- manager = 0;
-}
-
-void HttpClient::get()
-{
- QUrl fullUrl( ytv );
-
- QStringList a;
- a << q->fromLocation().x << q->fromLocation().y;
- QStringList b;
- b << q->toLocation().x << q->toLocation().y;
-
- fullUrl.addQueryItem( "a", a.join(",") );
- fullUrl.addQueryItem( "b", b.join(",") );
- fullUrl.addQueryItem( "user", username );
- fullUrl.addQueryItem( "pass", password );
-
- manager->get( QNetworkRequest( fullUrl ) );
-}
-
-void HttpClient::replyFinished( QNetworkReply * reply )
-{
- RouteData routeData = q->parseReply( reply->readAll() );
-
- ui->BusNoDisplay->setText( routeData.lineCode );
- ui->TimeDisplay->setText( routeData.arrivalTime );
-}
-
-void HttpClient::setFromLocation( Location fromLocation )
-{
- q->setFromLocation( fromLocation );
-}
-
-Location HttpClient::fromLocation()
-{
- return q->fromLocation();
-}
-
-void HttpClient::setToLocation( Location toLocation )
-{
- q->setToLocation( toLocation );
-}
-
-Location HttpClient::toLocation()
-{
- return q->toLocation();
-}
-
+++ /dev/null
-#ifndef HTTPCLIENT_H
-#define HTTPCLIENT_H
-
-#include "ui_zouba.h"
-
-#include "location.h"
-
-#include <QObject>
-#include <QNetworkReply>
-#include <QNetworkAccessManager>
-
-class HttpClientPrivate;
-
-class HttpClient: public QObject
-{
- Q_OBJECT
-
-public:
- HttpClient( Ui::MainWindow *ui );
- ~HttpClient();
-
- Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
- Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
-
- /*!
- * \brief Gets the route data from the server
- */
- void get();
-
- /*!
- * \brief Sets the from location
- * \param fromLocation The from location
- */
- void setFromLocation( Location fromLocation );
-
- /*!
- \brief Get the from location
- \return The from location
- */
- Location fromLocation();
-
- /*!
- * \brief Sets the to location
- * \param toLocation The to location
- */
- void setToLocation( Location toLocation );
-
- /*!
- \brief Get the to location
- \return The to location
- */
- Location toLocation();
-
-public Q_SLOTS:
- void replyFinished(QNetworkReply*);
-
-private:
- HttpClientPrivate *q;
- QNetworkAccessManager *manager;
- Ui::MainWindow *ui;
-};
-#endif // HTTPCLIENT_H
+++ /dev/null
-#include "httpclient_p.h"
-#include "location.h"
-
-#include <QXmlStreamReader>
-#include <QDebug>
-
-HttpClientPrivate::HttpClientPrivate( QObject *parent ) :
- m_fromLocation(0,0),
- m_toLocation(0,0)
-{
-}
-
-HttpClientPrivate::~HttpClientPrivate()
-{
-}
-
-RouteData HttpClientPrivate::parseReply( const QByteArray &reply )
-{
- RouteData retVal;
-
- QXmlStreamReader xml( reply );
-
- bool inLine = false;
- bool inStop = false;
- while ( !xml.atEnd() ) {
- xml.readNext();
- if ( xml.isStartElement() && xml.name() == "LINE" ) {
- QString lineCode( xml.attributes().value("code").toString() );
-
- retVal.lineCode = lineCode;
-
- inLine = true;
- } else
- if ( inLine && xml.name() == "STOP" ) {
- inStop = true;
- } else
- if ( inLine && inStop && xml.name() == "ARRIVAL" ) {
- QString arrivalTime( xml.attributes().value("time").toString() );
-
- retVal.arrivalTime = arrivalTime;
-
- inLine = false;
- } else
- if ( xml.isEndElement() && xml.name() == "STOP" ) {
- inStop = false;
- } else
- if ( xml.isEndElement() && xml.name() == "LINE" ) {
- inLine = false;
- }
- }
-
- if ( xml.hasError() ) {
- qDebug() << "xml error";
- }
-
- return retVal;
-}
-
-void HttpClientPrivate::setFromLocation( Location fromLocation )
-{
- m_fromLocation = fromLocation;
-}
-
-Location HttpClientPrivate::fromLocation()
-{
- return m_fromLocation;
-}
-
-void HttpClientPrivate::setToLocation( Location toLocation )
-{
- m_toLocation = toLocation;
-}
-
-Location HttpClientPrivate::toLocation()
-
-{
- return m_toLocation;
-}
+++ /dev/null
-#ifndef HTTPCLIENT_P_H
-#define HTTPCLIENT_P_H
-
-#include "routedata.h"
-
-#include "location.h"
-
-#include <QObject>
-
-class HttpClientPrivate: public QObject
-{
- Q_OBJECT
-
-public:
- HttpClientPrivate( QObject *parent=0 );
- ~HttpClientPrivate();
-
- Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
- Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
-
- RouteData parseReply( const QByteArray &reply );
-
- /*!
- * \brief Sets the from location
- * \param fromLocation The from location
- */
- void setFromLocation( Location fromLocation );
-
- /*!
- \brief Get the from location
- \return The from location
- */
- Location fromLocation();
-
- /*!
- * \brief Sets the to location
- * \param toLocation The to location
- */
- void setToLocation( Location toLocation );
-
- /*!
- \brief Get the to location
- \return The to location
- */
- Location toLocation();
-
-private:
- Location m_fromLocation;
- Location m_toLocation;
-};
-#endif // HTTPCLIENT_P_H
-#include "httpclient.h"
+#include "route.h"
#include "ui_zouba.h"
#include "location.h"
Ui::MainWindow ui;
ui.setupUi(widget);
- HttpClient httpClient( &ui );
+ Route route( &ui );
- httpClient.setFromLocation( work );
- httpClient.setToLocation( home );
+ route.setFromLocation( work );
+ route.setToLocation( home );
- httpClient.get();
+ route.get();
ui.TimeDisplay->setText( "HELLO" );
SOURCES = \
main.cpp \
- httpclient.cpp \
- httpclient_p.cpp \
+ route.cpp \
+ route_p.cpp \
HEADERS += \
- httpclient.h \
- httpclient_p.h \
+ route.h \
+ route_p.h \
--- /dev/null
+#include "route_p.h"
+#include "route.h"
+
+#include "routedata.h"
+#include "location.h"
+
+#include "ui_zouba.h"
+
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+#include <QUrl>
+#include <QObject>
+#include <QDebug>
+#include <QStringList>
+#include <QString>
+#include <QXmlStreamReader>
+
+namespace {
+ QUrl ytv( "http://api.reittiopas.fi/public-ytv/fi/api/" );
+ QString username( "zouba" );
+ QString password( "caf9r3ee" );
+
+ QString homeKey( "taivaanvuohentie%207%2Chelsinki" );
+ QString workKey( "it%E4merenkatu%2011%2Chelsinki" );
+
+}
+
+Route::Route( Ui::MainWindow *ui ) :
+ q( new RoutePrivate( this ) ),
+ manager( new QNetworkAccessManager(this) ),
+ ui( ui )
+{
+ connect( manager, SIGNAL( finished(QNetworkReply*) ), this, SLOT( replyFinished(QNetworkReply*) ) );
+}
+
+Route::~Route()
+{
+ delete manager;
+ manager = 0;
+}
+
+void Route::get()
+{
+ QUrl fullUrl( ytv );
+
+ QStringList a;
+ a << q->fromLocation().x << q->fromLocation().y;
+ QStringList b;
+ b << q->toLocation().x << q->toLocation().y;
+
+ fullUrl.addQueryItem( "a", a.join(",") );
+ fullUrl.addQueryItem( "b", b.join(",") );
+ fullUrl.addQueryItem( "user", username );
+ fullUrl.addQueryItem( "pass", password );
+
+ manager->get( QNetworkRequest( fullUrl ) );
+}
+
+void Route::replyFinished( QNetworkReply * reply )
+{
+ RouteData routeData = q->parseReply( reply->readAll() );
+
+ ui->BusNoDisplay->setText( routeData.lineCode );
+ ui->TimeDisplay->setText( routeData.arrivalTime );
+}
+
+void Route::setFromLocation( Location fromLocation )
+{
+ q->setFromLocation( fromLocation );
+}
+
+Location Route::fromLocation()
+{
+ return q->fromLocation();
+}
+
+void Route::setToLocation( Location toLocation )
+{
+ q->setToLocation( toLocation );
+}
+
+Location Route::toLocation()
+{
+ return q->toLocation();
+}
+
--- /dev/null
+#ifndef ROUTE_H
+#define ROUTE_H
+
+#include "ui_zouba.h"
+
+#include "location.h"
+
+#include <QObject>
+#include <QNetworkReply>
+#include <QNetworkAccessManager>
+
+class RoutePrivate;
+
+class Route: public QObject
+{
+ Q_OBJECT
+
+public:
+ Route( Ui::MainWindow *ui );
+ ~Route();
+
+ Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
+ Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
+
+ /*!
+ * \brief Gets the route data from the server
+ */
+ void get();
+
+ /*!
+ * \brief Sets the from location
+ * \param fromLocation The from location
+ */
+ void setFromLocation( Location fromLocation );
+
+ /*!
+ \brief Get the from location
+ \return The from location
+ */
+ Location fromLocation();
+
+ /*!
+ * \brief Sets the to location
+ * \param toLocation The to location
+ */
+ void setToLocation( Location toLocation );
+
+ /*!
+ \brief Get the to location
+ \return The to location
+ */
+ Location toLocation();
+
+public Q_SLOTS:
+ void replyFinished(QNetworkReply*);
+
+private:
+ RoutePrivate *q;
+ QNetworkAccessManager *manager;
+ Ui::MainWindow *ui;
+};
+#endif // ROUTE_H
--- /dev/null
+#include "route_p.h"
+#include "location.h"
+
+#include <QXmlStreamReader>
+#include <QDebug>
+
+RoutePrivate::RoutePrivate( QObject *parent ) :
+ m_fromLocation(0,0),
+ m_toLocation(0,0)
+{
+ Q_UNUSED( parent )
+}
+
+RoutePrivate::~RoutePrivate()
+{
+}
+
+RouteData RoutePrivate::parseReply( const QByteArray &reply )
+{
+ RouteData retVal;
+
+ QXmlStreamReader xml( reply );
+
+ bool inLine = false;
+ bool inStop = false;
+ while ( !xml.atEnd() ) {
+ xml.readNext();
+ if ( xml.isStartElement() && xml.name() == "LINE" ) {
+ QString lineCode( xml.attributes().value("code").toString() );
+
+ retVal.lineCode = lineCode;
+
+ inLine = true;
+ } else
+ if ( inLine && xml.name() == "STOP" ) {
+ inStop = true;
+ } else
+ if ( inLine && inStop && xml.name() == "ARRIVAL" ) {
+ QString arrivalTime( xml.attributes().value("time").toString() );
+
+ retVal.arrivalTime = arrivalTime;
+
+ inLine = false;
+ } else
+ if ( xml.isEndElement() && xml.name() == "STOP" ) {
+ inStop = false;
+ } else
+ if ( xml.isEndElement() && xml.name() == "LINE" ) {
+ inLine = false;
+ }
+ }
+
+ if ( xml.hasError() ) {
+ qDebug() << "xml error";
+ }
+
+ return retVal;
+}
+
+void RoutePrivate::setFromLocation( Location fromLocation )
+{
+ m_fromLocation = fromLocation;
+}
+
+Location RoutePrivate::fromLocation()
+{
+ return m_fromLocation;
+}
+
+void RoutePrivate::setToLocation( Location toLocation )
+{
+ m_toLocation = toLocation;
+}
+
+Location RoutePrivate::toLocation()
+
+{
+ return m_toLocation;
+}
--- /dev/null
+#ifndef ROUTE_P_H
+#define ROUTE_P_H
+
+#include "routedata.h"
+
+#include "location.h"
+
+#include <QObject>
+
+class RoutePrivate: public QObject
+{
+ Q_OBJECT
+
+public:
+ RoutePrivate( QObject *parent=0 );
+ ~RoutePrivate();
+
+ Q_PROPERTY(Location fromLocation READ fromLocation WRITE setFromLocation);
+ Q_PROPERTY(Location toLocation READ toLocation WRITE setFromLocation);
+
+ RouteData parseReply( const QByteArray &reply );
+
+ /*!
+ * \brief Sets the from location
+ * \param fromLocation The from location
+ */
+ void setFromLocation( Location fromLocation );
+
+ /*!
+ \brief Get the from location
+ \return The from location
+ */
+ Location fromLocation();
+
+ /*!
+ * \brief Sets the to location
+ * \param toLocation The to location
+ */
+ void setToLocation( Location toLocation );
+
+ /*!
+ \brief Get the to location
+ \return The to location
+ */
+ Location toLocation();
+
+private:
+ Location m_fromLocation;
+ Location m_toLocation;
+};
+#endif // ROUTE_P_H
+++ /dev/null
-#include <QObject>
-#include <QtDebug>
-#include <QByteArray>
-#include "ut_httpclient.h"
-
-QByteArray sampleInput(
-"\
-<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\
-<MTRXML version=\"1.0\">\
- <ROUTE from=\"start\" to=\"dest\">\
- <LENGTH time=\"14.411\" dist=\"2510.063\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1815\"/>\
- <DEPARTURE date=\"20100207\" time=\"1815\"/>\
- </POINT>\
- <WALK>\
- <LENGTH time=\"4.475\" dist=\"357.069\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1815\"/>\
- <DEPARTURE date=\"20100207\" time=\"1815\"/>\
- </POINT>\
- <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1816\"/>\
- <DEPARTURE date=\"20100207\" time=\"1816\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
- <ARRIVAL date=\"20100207\" time=\"1817\"/>\
- <DEPARTURE date=\"20100207\" time=\"1817\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1817\"/>\
- <DEPARTURE date=\"20100207\" time=\"1817\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1819\"/>\
- <DEPARTURE date=\"20100207\" time=\"1819\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
- <ARRIVAL date=\"20100207\" time=\"1820\"/>\
- <DEPARTURE date=\"20100207\" time=\"1820\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\">\
- <ARRIVAL date=\"20100207\" time=\"1820\"/>\
- <DEPARTURE date=\"20100207\" time=\"1820\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- </WALK>\
- <LINE id=\"200\" code=\"1065A 2\" type=\"1\" mobility=\"3\">\
- <LENGTH time=\"5.000\" dist=\"1760.931\"/>\
- <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\" ord=\"30\">\
- <ARRIVAL date=\"20100207\" time=\"1820\"/>\
- <DEPARTURE date=\"20100207\" time=\"1820\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- <STOP code=\"6:1201131\" x=\"2550385.0\" y=\"6672760.0\" id=\"747\">\
- <ARRIVAL date=\"20100207\" time=\"1821\"/>\
- <DEPARTURE date=\"20100207\" time=\"1821\"/>\
- <NAME lang=\"1\" val=\"Salmisaari\"/>\
- <NAME lang=\"2\" val=\"Sundholmen\"/>\
- </STOP>\
- <STOP code=\"6:1310101\" x=\"2549608.0\" y=\"6672522.0\" id=\"1356\">\
- <ARRIVAL date=\"20100207\" time=\"1824\"/>\
- <DEPARTURE date=\"20100207\" time=\"1824\"/>\
- <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
- <NAME lang=\"2\" val=\"Drumsö bro\"/>\
- </STOP>\
- <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\" ord=\"33\">\
- <ARRIVAL date=\"20100207\" time=\"1825\"/>\
- <DEPARTURE date=\"20100207\" time=\"1825\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- </LINE>\
- <WALK>\
- <LENGTH time=\"4.936\" dist=\"392.062\"/>\
- <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\">\
- <ARRIVAL date=\"20100207\" time=\"1825\"/>\
- <DEPARTURE date=\"20100207\" time=\"1825\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1825\"/>\
- <DEPARTURE date=\"20100207\" time=\"1825\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1827\"/>\
- <DEPARTURE date=\"20100207\" time=\"1827\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1828\"/>\
- <DEPARTURE date=\"20100207\" time=\"1828\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1828\"/>\
- <DEPARTURE date=\"20100207\" time=\"1828\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- </MAPLOC>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- </POINT>\
- </WALK>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- </POINT>\
- </ROUTE>\
- <ROUTE from=\"start\" to=\"dest\">\
- <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1821\"/>\
- <DEPARTURE date=\"20100207\" time=\"1821\"/>\
- </POINT>\
- <WALK>\
- <LENGTH time=\"4.475\" dist=\"357.069\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1821\"/>\
- <DEPARTURE date=\"20100207\" time=\"1821\"/>\
- </POINT>\
- <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1822\"/>\
- <DEPARTURE date=\"20100207\" time=\"1822\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
- <ARRIVAL date=\"20100207\" time=\"1823\"/>\
- <DEPARTURE date=\"20100207\" time=\"1823\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1823\"/>\
- <DEPARTURE date=\"20100207\" time=\"1823\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1825\"/>\
- <DEPARTURE date=\"20100207\" time=\"1825\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
- <ARRIVAL date=\"20100207\" time=\"1826\"/>\
- <DEPARTURE date=\"20100207\" time=\"1826\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
- <ARRIVAL date=\"20100207\" time=\"1826\"/>\
- <DEPARTURE date=\"20100207\" time=\"1826\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- </WALK>\
- <LINE id=\"579\" code=\"2102T 1\" type=\"5\" mobility=\"3\">\
- <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
- <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
- <ARRIVAL date=\"20100207\" time=\"1826\"/>\
- <DEPARTURE date=\"20100207\" time=\"1826\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
- <ARRIVAL date=\"20100207\" time=\"1827\"/>\
- <DEPARTURE date=\"20100207\" time=\"1827\"/>\
- <NAME lang=\"1\" val=\"Salmisaari\"/>\
- <NAME lang=\"2\" val=\"Sundholmen\"/>\
- </STOP>\
- <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
- <NAME lang=\"2\" val=\"Drumsö bro\"/>\
- </STOP>\
- <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
- <ARRIVAL date=\"20100207\" time=\"1830\"/>\
- <DEPARTURE date=\"20100207\" time=\"1830\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- </LINE>\
- <WALK>\
- <LENGTH time=\"4.936\" dist=\"392.846\"/>\
- <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
- <ARRIVAL date=\"20100207\" time=\"1830\"/>\
- <DEPARTURE date=\"20100207\" time=\"1830\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1830\"/>\
- <DEPARTURE date=\"20100207\" time=\"1830\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1832\"/>\
- <DEPARTURE date=\"20100207\" time=\"1832\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1833\"/>\
- <DEPARTURE date=\"20100207\" time=\"1833\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1833\"/>\
- <DEPARTURE date=\"20100207\" time=\"1833\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- </MAPLOC>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- </POINT>\
- </WALK>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- </POINT>\
- </ROUTE>\
- <ROUTE from=\"start\" to=\"dest\">\
- <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- </POINT>\
- <WALK>\
- <LENGTH time=\"4.475\" dist=\"357.069\"/>\
- <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
- <ARRIVAL date=\"20100207\" time=\"1829\"/>\
- <DEPARTURE date=\"20100207\" time=\"1829\"/>\
- </POINT>\
- <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1830\"/>\
- <DEPARTURE date=\"20100207\" time=\"1830\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
- <ARRIVAL date=\"20100207\" time=\"1831\"/>\
- <DEPARTURE date=\"20100207\" time=\"1831\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1831\"/>\
- <DEPARTURE date=\"20100207\" time=\"1831\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
- <ARRIVAL date=\"20100207\" time=\"1833\"/>\
- <DEPARTURE date=\"20100207\" time=\"1833\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
- </MAPLOC>\
- <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- </WALK>\
- <LINE id=\"603\" code=\"2110T 1\" type=\"5\" mobility=\"3\">\
- <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
- <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
- <ARRIVAL date=\"20100207\" time=\"1834\"/>\
- <DEPARTURE date=\"20100207\" time=\"1834\"/>\
- <NAME lang=\"1\" val=\"Länsiväylä\"/>\
- <NAME lang=\"2\" val=\"Västerleden\"/>\
- </STOP>\
- <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
- <ARRIVAL date=\"20100207\" time=\"1835\"/>\
- <DEPARTURE date=\"20100207\" time=\"1835\"/>\
- <NAME lang=\"1\" val=\"Salmisaari\"/>\
- <NAME lang=\"2\" val=\"Sundholmen\"/>\
- </STOP>\
- <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
- <ARRIVAL date=\"20100207\" time=\"1837\"/>\
- <DEPARTURE date=\"20100207\" time=\"1837\"/>\
- <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
- <NAME lang=\"2\" val=\"Drumsö bro\"/>\
- </STOP>\
- <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
- <ARRIVAL date=\"20100207\" time=\"1838\"/>\
- <DEPARTURE date=\"20100207\" time=\"1838\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- </LINE>\
- <WALK>\
- <LENGTH time=\"4.936\" dist=\"392.846\"/>\
- <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
- <ARRIVAL date=\"20100207\" time=\"1838\"/>\
- <DEPARTURE date=\"20100207\" time=\"1838\"/>\
- <NAME lang=\"1\" val=\"Koillisväylä\"/>\
- <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
- </STOP>\
- <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1838\"/>\
- <DEPARTURE date=\"20100207\" time=\"1838\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1840\"/>\
- <DEPARTURE date=\"20100207\" time=\"1840\"/>\
- <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1841\"/>\
- <DEPARTURE date=\"20100207\" time=\"1841\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1841\"/>\
- <DEPARTURE date=\"20100207\" time=\"1841\"/>\
- </MAPLOC>\
- <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
- <ARRIVAL date=\"20100207\" time=\"1842\"/>\
- <DEPARTURE date=\"20100207\" time=\"1842\"/>\
- </MAPLOC>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1842\"/>\
- <DEPARTURE date=\"20100207\" time=\"1842\"/>\
- </POINT>\
- </WALK>\
- <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
- <ARRIVAL date=\"20100207\" time=\"1842\"/>\
- <DEPARTURE date=\"20100207\" time=\"1842\"/>\
- </POINT>\
- </ROUTE>\
-</MTRXML>\
-"
-
-);
-
-void Ut_HttpClient::init()
-{
- m_subject = new HttpClientPrivate();
-}
-
-void Ut_HttpClient::cleanup()
-{
- delete m_subject;
- m_subject = 0;
-}
-
-void Ut_HttpClient::initTestCase()
-{
-}
-
-void Ut_HttpClient::cleanupTestCase()
-{
-}
-
-void Ut_HttpClient::testParseReply()
-{
- RouteData routeData = m_subject->parseReply( sampleInput );
-
- QCOMPARE( routeData.lineCode, QString( "2110T 1" ) );
- QCOMPARE( routeData.arrivalTime, QString( "1834" ) );
-}
-
-void Ut_HttpClient::testSetFromLocation()
-{
- Location work( "2551042", "6672829" );
- m_subject->setFromLocation( work );
- QCOMPARE( work.x, m_subject->fromLocation().x );
- QCOMPARE( work.y, m_subject->fromLocation().y );
-}
-
-void Ut_HttpClient::testSetToLocation()
-{
- Location work( "2551042", "6672829" );
- m_subject->setToLocation( work );
- QCOMPARE( work.x, m_subject->toLocation().x );
- QCOMPARE( work.y, m_subject->toLocation().y );
-}
-
-QTEST_MAIN(Ut_HttpClient)
+++ /dev/null
-#ifndef UT_HTTPCLIENT_H
-#define UT_HTTPCLIENT_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-#include <httpclient_p.h>
-
-Q_DECLARE_METATYPE(HttpClientPrivate*);
-
-class Ut_HttpClient : public QObject
-{
- Q_OBJECT
-
-public:
-
-private slots:
- void init();
- void cleanup();
- void initTestCase();
- void cleanupTestCase();
- void testParseReply();
- void testSetFromLocation();
- void testSetToLocation();
-
-private:
- HttpClientPrivate *m_subject;
-};
-#endif // UT_HTTPCLIENT_H
+++ /dev/null
-CONFIG += \
- qt \
- debug \
-
-QT += \
- testlib \
-
-INCLUDEPATH += \
- ../.. \
-
-TEMPLATE = app
-
-SOURCES = \
- ut_httpclient.cpp \
- ../../httpclient_p.cpp \
-
-HEADERS += \
- ut_httpclient.h \
- ../../httpclient_p.h \
-
--- /dev/null
+#include <QObject>
+#include <QtDebug>
+#include <QByteArray>
+#include "ut_route.h"
+
+QByteArray sampleInput(
+"\
+<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\
+<MTRXML version=\"1.0\">\
+ <ROUTE from=\"start\" to=\"dest\">\
+ <LENGTH time=\"14.411\" dist=\"2510.063\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1815\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1815\"/>\
+ </POINT>\
+ <WALK>\
+ <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1815\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1815\"/>\
+ </POINT>\
+ <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1816\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1816\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+ <ARRIVAL date=\"20100207\" time=\"1817\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1817\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1817\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1817\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1819\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1819\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+ <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\">\
+ <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ </WALK>\
+ <LINE id=\"200\" code=\"1065A 2\" type=\"1\" mobility=\"3\">\
+ <LENGTH time=\"5.000\" dist=\"1760.931\"/>\
+ <STOP code=\"6:1201129\" x=\"2550765.0\" y=\"6672886.0\" id=\"745\" ord=\"30\">\
+ <ARRIVAL date=\"20100207\" time=\"1820\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1820\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ <STOP code=\"6:1201131\" x=\"2550385.0\" y=\"6672760.0\" id=\"747\">\
+ <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+ <NAME lang=\"1\" val=\"Salmisaari\"/>\
+ <NAME lang=\"2\" val=\"Sundholmen\"/>\
+ </STOP>\
+ <STOP code=\"6:1310101\" x=\"2549608.0\" y=\"6672522.0\" id=\"1356\">\
+ <ARRIVAL date=\"20100207\" time=\"1824\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1824\"/>\
+ <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+ <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+ </STOP>\
+ <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\" ord=\"33\">\
+ <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ </LINE>\
+ <WALK>\
+ <LENGTH time=\"4.936\" dist=\"392.062\"/>\
+ <STOP code=\"6:1310103\" x=\"2549247.0\" y=\"6672446.0\" id=\"1358\">\
+ <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1827\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1827\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1828\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1828\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1828\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1828\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ </MAPLOC>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ </POINT>\
+ </WALK>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ </POINT>\
+ </ROUTE>\
+ <ROUTE from=\"start\" to=\"dest\">\
+ <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+ </POINT>\
+ <WALK>\
+ <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1821\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1821\"/>\
+ </POINT>\
+ <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1822\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1822\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+ <ARRIVAL date=\"20100207\" time=\"1823\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1823\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1823\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1823\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1825\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1825\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+ <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
+ <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ </WALK>\
+ <LINE id=\"579\" code=\"2102T 1\" type=\"5\" mobility=\"3\">\
+ <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
+ <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
+ <ARRIVAL date=\"20100207\" time=\"1826\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1826\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
+ <ARRIVAL date=\"20100207\" time=\"1827\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1827\"/>\
+ <NAME lang=\"1\" val=\"Salmisaari\"/>\
+ <NAME lang=\"2\" val=\"Sundholmen\"/>\
+ </STOP>\
+ <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+ <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+ </STOP>\
+ <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
+ <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ </LINE>\
+ <WALK>\
+ <LENGTH time=\"4.936\" dist=\"392.846\"/>\
+ <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
+ <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1832\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1832\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ </MAPLOC>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ </POINT>\
+ </WALK>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ </POINT>\
+ </ROUTE>\
+ <ROUTE from=\"start\" to=\"dest\">\
+ <LENGTH time=\"13.411\" dist=\"2501.497\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ </POINT>\
+ <WALK>\
+ <LENGTH time=\"4.475\" dist=\"357.069\"/>\
+ <POINT uid=\"start\" x=\"2551042.0\" y=\"6672829.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1829\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1829\"/>\
+ </POINT>\
+ <MAPLOC x=\"2551034.9\" y=\"6672875.6\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1830\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1830\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550977.7\" y=\"6672869.1\" type=\"15\">\
+ <ARRIVAL date=\"20100207\" time=\"1831\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1831\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550949.3\" y=\"6672867.5\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1831\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1831\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550817.2\" y=\"6672859.3\" type=\"7\">\
+ <ARRIVAL date=\"20100207\" time=\"1833\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1833\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2550808.5\" y=\"6672889.3\" type=\"11\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ <NAME lang=\"1\" val=\"Porkkalankatu\"/>\
+ </MAPLOC>\
+ <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ </WALK>\
+ <LINE id=\"603\" code=\"2110T 1\" type=\"5\" mobility=\"3\">\
+ <LENGTH time=\"4.000\" dist=\"1751.582\"/>\
+ <STOP code=\"6:1201227\" x=\"2550765.0\" y=\"6672886.0\" id=\"755\" ord=\"3\">\
+ <ARRIVAL date=\"20100207\" time=\"1834\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1834\"/>\
+ <NAME lang=\"1\" val=\"Länsiväylä\"/>\
+ <NAME lang=\"2\" val=\"Västerleden\"/>\
+ </STOP>\
+ <STOP code=\"6:1201231\" x=\"2550387.0\" y=\"6672761.0\" id=\"759\">\
+ <ARRIVAL date=\"20100207\" time=\"1835\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1835\"/>\
+ <NAME lang=\"1\" val=\"Salmisaari\"/>\
+ <NAME lang=\"2\" val=\"Sundholmen\"/>\
+ </STOP>\
+ <STOP code=\"6:1310201\" x=\"2549630.0\" y=\"6672524.0\" id=\"1402\">\
+ <ARRIVAL date=\"20100207\" time=\"1837\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1837\"/>\
+ <NAME lang=\"1\" val=\"Lauttasaaren silta\"/>\
+ <NAME lang=\"2\" val=\"Drumsö bro\"/>\
+ </STOP>\
+ <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\" ord=\"6\">\
+ <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ </LINE>\
+ <WALK>\
+ <LENGTH time=\"4.936\" dist=\"392.846\"/>\
+ <STOP code=\"6:1310203\" x=\"2549248.0\" y=\"6672446.0\" id=\"1404\">\
+ <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+ <NAME lang=\"1\" val=\"Koillisväylä\"/>\
+ <NAME lang=\"2\" val=\"Nordostpassagen\"/>\
+ </STOP>\
+ <MAPLOC x=\"2549200.4\" y=\"6672433.4\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1838\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1838\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohenkuja\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549151.2\" y=\"6672527.3\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1840\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1840\"/>\
+ <NAME lang=\"1\" val=\"Taivaanvuohentie\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549105.4\" y=\"6672573.6\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1841\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1841\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549115.4\" y=\"6672595.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1841\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1841\"/>\
+ </MAPLOC>\
+ <MAPLOC x=\"2549162.6\" y=\"6672633.1\" type=\"0\">\
+ <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+ </MAPLOC>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+ </POINT>\
+ </WALK>\
+ <POINT uid=\"dest\" x=\"2549183.0\" y=\"6672570.0\">\
+ <ARRIVAL date=\"20100207\" time=\"1842\"/>\
+ <DEPARTURE date=\"20100207\" time=\"1842\"/>\
+ </POINT>\
+ </ROUTE>\
+</MTRXML>\
+"
+
+);
+
+void Ut_Route::init()
+{
+ m_subject = new RoutePrivate();
+}
+
+void Ut_Route::cleanup()
+{
+ delete m_subject;
+ m_subject = 0;
+}
+
+void Ut_Route::initTestCase()
+{
+}
+
+void Ut_Route::cleanupTestCase()
+{
+}
+
+void Ut_Route::testParseReply()
+{
+ RouteData routeData = m_subject->parseReply( sampleInput );
+
+ QCOMPARE( routeData.lineCode, QString( "2110T 1" ) );
+ QCOMPARE( routeData.arrivalTime, QString( "1834" ) );
+}
+
+void Ut_Route::testSetFromLocation()
+{
+ Location work( "2551042", "6672829" );
+ m_subject->setFromLocation( work );
+ QCOMPARE( work.x, m_subject->fromLocation().x );
+ QCOMPARE( work.y, m_subject->fromLocation().y );
+}
+
+void Ut_Route::testSetToLocation()
+{
+ Location work( "2551042", "6672829" );
+ m_subject->setToLocation( work );
+ QCOMPARE( work.x, m_subject->toLocation().x );
+ QCOMPARE( work.y, m_subject->toLocation().y );
+}
+
+QTEST_MAIN(Ut_Route)
--- /dev/null
+#ifndef UT_HTTPCLIENT_H
+#define UT_HTTPCLIENT_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include <route_p.h>
+
+Q_DECLARE_METATYPE(RoutePrivate*);
+
+class Ut_Route : public QObject
+{
+ Q_OBJECT
+
+public:
+
+private slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void cleanupTestCase();
+ void testParseReply();
+ void testSetFromLocation();
+ void testSetToLocation();
+
+private:
+ RoutePrivate *m_subject;
+};
+#endif // UT_HTTPCLIENT_H
--- /dev/null
+CONFIG += \
+ qt \
+ debug \
+
+QT += \
+ testlib \
+
+INCLUDEPATH += \
+ ../.. \
+
+TEMPLATE = app
+
+SOURCES = \
+ ut_route.cpp \
+ ../../route_p.cpp \
+
+HEADERS += \
+ ut_route.h \
+ ../../route_p.h \
+