Changes: tweaks to unit tests
authorMax Waterman <david.waterman@nokia.com>
Tue, 13 Apr 2010 05:37:32 +0000 (08:37 +0300)
committerMax Waterman <david.waterman@nokia.com>
Tue, 13 Apr 2010 05:37:32 +0000 (08:37 +0300)
zouba/src/location_p.h
zouba/src/route_p.cpp
zouba/tests/ut_location/ut_location.cpp
zouba/tests/ut_route/ut_route.cpp

index c0778bc..e32b267 100644 (file)
@@ -10,13 +10,7 @@ class LocationPrivate : public QObject
     Q_OBJECT
 
 public:
-  QString m_label;
-  QString m_address;
-  QString m_x;
-  QString m_y;
-  bool    m_valid;
   LocationPrivate( const QString &x, const QString &y, const QString &label );
-
   LocationPrivate( const QString &label );
   virtual ~LocationPrivate();
 
@@ -39,6 +33,11 @@ public:
 
   void parseReply( const QByteArray &reply );
 
+  QString m_label;
+  QString m_address;
+  QString m_x;
+  QString m_y;
+  bool    m_valid;
 };
 
 #endif // LOCATION_P_H
index 1acb276..8cb2c7f 100644 (file)
@@ -112,7 +112,7 @@ QString RoutePrivate::parseJORECode( const QString &joreCode ) const
   lineCode.setNum( lineCode.toInt() );
 
   retVal = lineCode;
-  
+
   if ( letterVariant != " " ) {
     retVal += letterVariant;
   }
index 88295c8..e7e4ca6 100644 (file)
@@ -53,11 +53,14 @@ void Ut_Location::testSet()
   LocationPrivate m_subject(label);
 
   label = "work";
+  QString address( "Taivaanvuohentie 7 B 27, Helsinki" );
   QString x( "2549182" );
   QString y( "6672569" );
+  m_subject.setAddress( address );
   m_subject.setLabel( label );
   m_subject.setX( x );
   m_subject.setY( y );
+  QCOMPARE( m_subject.address(), address );
   QCOMPARE( m_subject.label(), label );
   QCOMPARE( m_subject.x(), x );
   QCOMPARE( m_subject.y(), y );
index 138b8c0..bb34092 100644 (file)
@@ -336,7 +336,6 @@ QByteArray sampleInput(
        </ROUTE>\
 </MTRXML>\
 "
-
 );
 
 void Ut_Route::init()
@@ -374,17 +373,21 @@ void Ut_Route::testParseReply()
 void Ut_Route::testSetFromLocation()
 {
   Location work( "2551042", "6672829" );
+  QCOMPARE( m_subject->fromValid(), false );
   m_subject->setFromLocation( &work );
-  QCOMPARE( work.x(), m_subject->fromLocation()->x() );
-  QCOMPARE( work.y(), m_subject->fromLocation()->y() );
+  QCOMPARE( m_subject->fromLocation()->x(), work.x() );
+  QCOMPARE( m_subject->fromLocation()->y(), work.y() );
+  QCOMPARE( m_subject->fromValid(), true );
 }
 
 void Ut_Route::testSetToLocation()
 {
   Location work( "2551042", "6672829" );
+  QCOMPARE( m_subject->toValid(), false );
   m_subject->setToLocation( &work );
-  QCOMPARE( work.x(), m_subject->toLocation()->x() );
-  QCOMPARE( work.y(), m_subject->toLocation()->y() );
+  QCOMPARE( m_subject->toLocation()->x(), work.x() );
+  QCOMPARE( m_subject->toLocation()->y(), work.y() );
+  QCOMPARE( m_subject->toValid(), true );
 }
 
 QTEST_APPLESS_MAIN(Ut_Route)