Renamed the httpclient class.
authorMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sat, 27 Feb 2010 10:21:47 +0000 (12:21 +0200)
committerMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sat, 27 Feb 2010 10:25:39 +0000 (12:25 +0200)
16 files changed:
zouba/qt/httpclient.cpp [deleted file]
zouba/qt/httpclient.h [deleted file]
zouba/qt/httpclient_p.cpp [deleted file]
zouba/qt/httpclient_p.h [deleted file]
zouba/qt/main.cpp
zouba/qt/qt.pro
zouba/qt/route.cpp [new file with mode: 0644]
zouba/qt/route.h [new file with mode: 0644]
zouba/qt/route_p.cpp [new file with mode: 0644]
zouba/qt/route_p.h [new file with mode: 0644]
zouba/qt/tests/ut_httpclient/ut_httpclient.cpp [deleted file]
zouba/qt/tests/ut_httpclient/ut_httpclient.h [deleted file]
zouba/qt/tests/ut_httpclient/ut_httpclient.pro [deleted file]
zouba/qt/tests/ut_route/ut_route.cpp [new file with mode: 0644]
zouba/qt/tests/ut_route/ut_route.h [new file with mode: 0644]
zouba/qt/tests/ut_route/ut_route.pro [new file with mode: 0644]

diff --git a/zouba/qt/httpclient.cpp b/zouba/qt/httpclient.cpp
deleted file mode 100644 (file)
index 8c4ff59..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#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();
-}
-
diff --git a/zouba/qt/httpclient.h b/zouba/qt/httpclient.h
deleted file mode 100644 (file)
index 9d12c2c..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#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
diff --git a/zouba/qt/httpclient_p.cpp b/zouba/qt/httpclient_p.cpp
deleted file mode 100644 (file)
index d9f7e3f..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#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;
-}
diff --git a/zouba/qt/httpclient_p.h b/zouba/qt/httpclient_p.h
deleted file mode 100644 (file)
index e0ee685..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#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
index 3b93dda..ab38693 100644 (file)
@@ -1,4 +1,4 @@
-#include "httpclient.h"
+#include "route.h"
 #include "ui_zouba.h"
 
 #include "location.h"
@@ -17,12 +17,12 @@ int main(int argc, char *argv[] )
   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" );
 
index 23f9158..66a76ac 100644 (file)
@@ -9,10 +9,10 @@ FORMS    = zouba.ui
 
 SOURCES  = \
   main.cpp \
-  httpclient.cpp \
-  httpclient_p.cpp \
+  route.cpp \
+  route_p.cpp \
 
 HEADERS += \
-  httpclient.h \
-  httpclient_p.h \
+  route.h \
+  route_p.h \
 
diff --git a/zouba/qt/route.cpp b/zouba/qt/route.cpp
new file mode 100644 (file)
index 0000000..2b150f0
--- /dev/null
@@ -0,0 +1,86 @@
+#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();
+}
+
diff --git a/zouba/qt/route.h b/zouba/qt/route.h
new file mode 100644 (file)
index 0000000..4e8bbf6
--- /dev/null
@@ -0,0 +1,62 @@
+#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
diff --git a/zouba/qt/route_p.cpp b/zouba/qt/route_p.cpp
new file mode 100644 (file)
index 0000000..92c8c3c
--- /dev/null
@@ -0,0 +1,79 @@
+#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;
+}
diff --git a/zouba/qt/route_p.h b/zouba/qt/route_p.h
new file mode 100644 (file)
index 0000000..57d3767
--- /dev/null
@@ -0,0 +1,51 @@
+#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
diff --git a/zouba/qt/tests/ut_httpclient/ut_httpclient.cpp b/zouba/qt/tests/ut_httpclient/ut_httpclient.cpp
deleted file mode 100644 (file)
index da8b80f..0000000
+++ /dev/null
@@ -1,385 +0,0 @@
-#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)
diff --git a/zouba/qt/tests/ut_httpclient/ut_httpclient.h b/zouba/qt/tests/ut_httpclient/ut_httpclient.h
deleted file mode 100644 (file)
index 9602ce9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#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
diff --git a/zouba/qt/tests/ut_httpclient/ut_httpclient.pro b/zouba/qt/tests/ut_httpclient/ut_httpclient.pro
deleted file mode 100644 (file)
index a8d816d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-CONFIG += \
-  qt \
-  debug \
-
-QT += \
-  testlib \
-
-INCLUDEPATH += \
-  ../.. \
-
-TEMPLATE = app
-
-SOURCES  = \
-  ut_httpclient.cpp \
-  ../../httpclient_p.cpp \
-
-HEADERS += \
-  ut_httpclient.h \
-  ../../httpclient_p.h \
-
diff --git a/zouba/qt/tests/ut_route/ut_route.cpp b/zouba/qt/tests/ut_route/ut_route.cpp
new file mode 100644 (file)
index 0000000..e1ad672
--- /dev/null
@@ -0,0 +1,385 @@
+#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)
diff --git a/zouba/qt/tests/ut_route/ut_route.h b/zouba/qt/tests/ut_route/ut_route.h
new file mode 100644 (file)
index 0000000..54f3c3f
--- /dev/null
@@ -0,0 +1,29 @@
+#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
diff --git a/zouba/qt/tests/ut_route/ut_route.pro b/zouba/qt/tests/ut_route/ut_route.pro
new file mode 100644 (file)
index 0000000..820f8fb
--- /dev/null
@@ -0,0 +1,20 @@
+CONFIG += \
+  qt \
+  debug \
+
+QT += \
+  testlib \
+
+INCLUDEPATH += \
+  ../.. \
+
+TEMPLATE = app
+
+SOURCES  = \
+  ut_route.cpp \
+  ../../route_p.cpp \
+
+HEADERS += \
+  ut_route.h \
+  ../../route_p.h \
+