From: Max Waterman Date: Tue, 13 Apr 2010 05:37:32 +0000 (+0300) Subject: Changes: tweaks to unit tests X-Git-Url: http://vcs.maemo.org/git/?p=ptas;a=commitdiff_plain;h=effa33c0d462b151f3027c22570539bafbc2a3c0 Changes: tweaks to unit tests --- diff --git a/zouba/src/location_p.h b/zouba/src/location_p.h index c0778bc..e32b267 100644 --- a/zouba/src/location_p.h +++ b/zouba/src/location_p.h @@ -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 diff --git a/zouba/src/route_p.cpp b/zouba/src/route_p.cpp index 1acb276..8cb2c7f 100644 --- a/zouba/src/route_p.cpp +++ b/zouba/src/route_p.cpp @@ -112,7 +112,7 @@ QString RoutePrivate::parseJORECode( const QString &joreCode ) const lineCode.setNum( lineCode.toInt() ); retVal = lineCode; - + if ( letterVariant != " " ) { retVal += letterVariant; } diff --git a/zouba/tests/ut_location/ut_location.cpp b/zouba/tests/ut_location/ut_location.cpp index 88295c8..e7e4ca6 100644 --- a/zouba/tests/ut_location/ut_location.cpp +++ b/zouba/tests/ut_location/ut_location.cpp @@ -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 ); diff --git a/zouba/tests/ut_route/ut_route.cpp b/zouba/tests/ut_route/ut_route.cpp index 138b8c0..bb34092 100644 --- a/zouba/tests/ut_route/ut_route.cpp +++ b/zouba/tests/ut_route/ut_route.cpp @@ -336,7 +336,6 @@ QByteArray sampleInput( \ \ " - ); 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)