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 address( "Taivaanvuohentie 7 B 27, Helsinki" );
57 QString x( "2549182" );
58 QString y( "6672569" );
59 m_subject.setAddress( address );
60 m_subject.setLabel( label );
63 QCOMPARE( m_subject.address(), address );
64 QCOMPARE( m_subject.label(), label );
65 QCOMPARE( m_subject.x(), x );
66 QCOMPARE( m_subject.y(), y );
69 void Ut_Location::testConstructorQGeoPositionInfo()
71 QGeoPositionInfo thisPositionInfo( QGeoCoordinate( 60.16183, 24.88256 ), QDateTime( QDate( 1965, 11, 11 ) ) );
72 Location subject( thisPositionInfo );
74 QString x( "2549182" );
75 QString y( "6672569" );
76 QCOMPARE( subject.x(), x );
77 QCOMPARE( subject.y(), y );
80 QTEST_APPLESS_MAIN(Ut_Location)