4 #include <QGeoPositionInfo>
6 #include "location_p.h"
7 #include "ut_location.h"
11 QByteArray sampleInput(
13 <?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?><MTRXML version=\"1.0\">\
14 <GEOCODE key=\"taivaanvuohentie 7,helsinki\">\
15 <LOC name1=\"Taivaanvuohentie\" number=\"7\" city=\"Helsinki\" code=\"\" address=\"\" type=\"900\" category=\"street\" x=\"2549182\" y=\"6672569\" lon=\"24.88256\" lat=\"60.16183\" />\
22 void Ut_Location::init()
26 void Ut_Location::cleanup()
30 void Ut_Location::initTestCase()
34 void Ut_Location::cleanupTestCase()
38 void Ut_Location::testParseReply()
40 QString label("home");
41 LocationPrivate m_subject(label);
43 m_subject.parseReply( sampleInput );
45 QCOMPARE( m_subject.label(), label );
46 QCOMPARE( m_subject.x(), QString( "2549182" ) );
47 QCOMPARE( m_subject.y(), QString( "6672569" ) );
50 void Ut_Location::testSet()
52 QString label( "home" );
53 LocationPrivate m_subject(label);
56 QString x( "2549182" );
57 QString y( "6672569" );
58 m_subject.setLabel( label );
61 QCOMPARE( m_subject.label(), label );
62 QCOMPARE( m_subject.x(), x );
63 QCOMPARE( m_subject.y(), y );
66 void Ut_Location::testConstructorQGeoPositionInfo()
68 QGeoPositionInfo thisPositionInfo( QGeoCoordinate( 60.16183, 24.88256 ), QDateTime( QDate( 1965, 11, 11 ) ) );
69 Location subject( thisPositionInfo );
71 QString x( "2549182" );
72 QString y( "6672569" );
73 QCOMPARE( subject.x(), x );
74 QCOMPARE( subject.y(), y );
77 QTEST_APPLESS_MAIN(Ut_Location)