1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 //TESTED_COMPONENT=src/location
30 
31 #include "../utils/qlocationtestutils_p.h"
32 
33 #include <QtPositioning/qgeocoordinate.h>
34 #include <qtest.h>
35 
36 #include <QMetaType>
37 #include <QDebug>
38 
39 #include <float.h>
40 
41 QT_USE_NAMESPACE
42 
43 Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateFormat)
44 Q_DECLARE_METATYPE(QGeoCoordinate::CoordinateType)
45 
46 static const QGeoCoordinate BRISBANE(-27.46758, 153.027892);
47 static const QGeoCoordinate MELBOURNE(-37.814251, 144.963169);
48 static const QGeoCoordinate LONDON(51.500152, -0.126236);
49 static const QGeoCoordinate NEW_YORK(40.71453, -74.00713);
50 static const QGeoCoordinate NORTH_POLE(90, 0);
51 static const QGeoCoordinate SOUTH_POLE(-90, 0);
52 
53 static const QChar DEGREES_SYMB(0x00B0);
54 
55 
56 QByteArray tst_qgeocoordinate_debug;
57 
tst_qgeocoordinate_messageHandler(QtMsgType type,const QMessageLogContext &,const QString & msg)58 void tst_qgeocoordinate_messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
59 {
60     switch (type) {
61         case QtDebugMsg :
62             tst_qgeocoordinate_debug = msg.toLocal8Bit();
63             break;
64         default:
65             break;
66     }
67 }
68 
69 
70 class tst_QGeoCoordinate : public QObject
71 {
72     Q_OBJECT
73 
74 private:
75     enum TestDataType {
76         Latitude,
77         Longitude,
78         Altitude
79     };
80 
81 private slots:
initTestcase()82     void initTestcase()
83     {
84         qRegisterMetaType<QGeoCoordinate>();
85         QMetaType::registerEqualsComparator<QGeoCoordinate>();
86     }
87 
constructor()88     void constructor()
89     {
90         QGeoCoordinate c;
91         QVERIFY(!c.isValid());
92         QCOMPARE(c, QGeoCoordinate());
93     }
94 
constructor_lat_long()95     void constructor_lat_long()
96     {
97         QFETCH(double, latitude);
98         QFETCH(double, longitude);
99         QFETCH(QGeoCoordinate::CoordinateType, type);
100 
101         QGeoCoordinate c(latitude, longitude);
102         QCOMPARE(c.type(), type);
103         if (type != QGeoCoordinate::InvalidCoordinate) {
104             QVERIFY(c.isValid());
105             QCOMPARE(c.latitude(), latitude);
106             QCOMPARE(c.longitude(), longitude);
107         } else {
108             QVERIFY(!c.isValid());
109             QVERIFY(c.latitude() != latitude);
110             QVERIFY(c.longitude() != longitude);
111         }
112     }
113 
constructor_lat_long_data()114     void constructor_lat_long_data()
115     {
116         QTest::addColumn<double>("latitude");
117         QTest::addColumn<double>("longitude");
118         QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
119 
120         QTest::newRow("both zero") << 0.0 << 0.0 << QGeoCoordinate::Coordinate2D;
121         QTest::newRow("both negative") << -1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
122         QTest::newRow("both positive") << 1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
123         QTest::newRow("latitude negative") << -1.0 << 1.0 << QGeoCoordinate::Coordinate2D;
124         QTest::newRow("longitude negative") << 1.0 << -1.0 << QGeoCoordinate::Coordinate2D;
125 
126         QTest::newRow("both too high") << 90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
127         QTest::newRow("latitude too high") << 90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
128         QTest::newRow("longitude too high") << 0.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
129 
130         QTest::newRow("both too low") << -90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
131         QTest::newRow("latitude too low") << -90.1 << 0.1 << QGeoCoordinate::InvalidCoordinate;
132         QTest::newRow("longitude too low") << 0.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
133 
134         QTest::newRow("both not too high") << 90.0 << 180.0 << QGeoCoordinate::Coordinate2D;
135         QTest::newRow("both not too low") << -90.0 << -180.0 << QGeoCoordinate::Coordinate2D;
136 
137         QTest::newRow("latitude too high and longitude too low") << 90.1 << -180.1 << QGeoCoordinate::InvalidCoordinate;
138         QTest::newRow("latitude too low and longitude too high") << -90.1 << 180.1 << QGeoCoordinate::InvalidCoordinate;
139     }
140 
constructor_lat_long_alt()141     void constructor_lat_long_alt()
142     {
143         QFETCH(double, latitude);
144         QFETCH(double, longitude);
145         QFETCH(double, altitude);
146         QFETCH(QGeoCoordinate::CoordinateType, type);
147 
148         QGeoCoordinate c(latitude, longitude, altitude);
149         QCOMPARE(c.type(), type);
150         if (type != QGeoCoordinate::InvalidCoordinate) {
151             QCOMPARE(c.latitude(), latitude);
152             QCOMPARE(c.longitude(), longitude);
153             QCOMPARE(c.altitude(), altitude);
154         } else {
155             QVERIFY(!c.isValid());
156             QVERIFY(c.latitude() != latitude);
157             QVERIFY(c.longitude() != longitude);
158             QVERIFY(c.altitude() != altitude);
159         }
160     }
161 
constructor_lat_long_alt_data()162     void constructor_lat_long_alt_data()
163     {
164         QTest::addColumn<double>("latitude");
165         QTest::addColumn<double>("longitude");
166         QTest::addColumn<double>("altitude");
167         QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
168 
169         QTest::newRow("all zero") << 0.0 << 0.0 << 0.0 << QGeoCoordinate::Coordinate3D;
170         QTest::newRow("all negative") << -1.0 << -1.0 << -2.0 << QGeoCoordinate::Coordinate3D;
171         QTest::newRow("all positive") << 1.0 << 1.0 << 4.0 << QGeoCoordinate::Coordinate3D;
172 
173         QTest::newRow("latitude negative") << -1.0 << 1.0 << 1.0 << QGeoCoordinate::Coordinate3D;
174         QTest::newRow("longitude negative") << 1.0 << -1.0  << 1.0 << QGeoCoordinate::Coordinate3D;
175         QTest::newRow("altitude negative") << 1.0 << 1.0  << -1.0 << QGeoCoordinate::Coordinate3D;
176 
177         QTest::newRow("altitude not too high") << 1.0 << 1.0  << DBL_MAX << QGeoCoordinate::Coordinate3D;
178         QTest::newRow("altitude not too low") << 1.0 << 1.0  << DBL_MIN << QGeoCoordinate::Coordinate3D;
179 
180         QTest::newRow("all not too high") << 90.0 << 180.0  << DBL_MAX << QGeoCoordinate::Coordinate3D;
181         QTest::newRow("all not too low") << -90.0 << -180.0  << DBL_MIN << QGeoCoordinate::Coordinate3D;
182 
183         QTest::newRow("all too high") << 90.1 << 180.1 << DBL_MAX << QGeoCoordinate::InvalidCoordinate;
184         QTest::newRow("all too low") << -90.1 << -180.1 << DBL_MIN << QGeoCoordinate::InvalidCoordinate;
185     }
186 
copy_constructor()187     void copy_constructor()
188     {
189         QFETCH(QGeoCoordinate, c);
190 
191         QGeoCoordinate copy(c);
192         QCOMPARE(copy.type(), c.type());
193         if (c.type() != QGeoCoordinate::InvalidCoordinate) {
194             QCOMPARE(copy.latitude(), c.latitude());
195             QCOMPARE(copy.longitude(), c.longitude());
196             if (c.type() == QGeoCoordinate::Coordinate3D)
197                 QCOMPARE(copy.altitude(), c.altitude());
198         }
199     }
200 
copy_constructor_data()201     void copy_constructor_data()
202     {
203         QTest::addColumn<QGeoCoordinate>("c");
204 
205         QTest::newRow("no argument") << QGeoCoordinate();
206         QTest::newRow("latitude, longitude arguments all zero") << QGeoCoordinate(0.0, 0.0);
207 
208         QTest::newRow("latitude, longitude arguments not too high") << QGeoCoordinate(90.0, 180.0);
209         QTest::newRow("latitude, longitude arguments not too low") << QGeoCoordinate(-90.0, -180.0);
210         QTest::newRow("latitude, longitude arguments too high") << QGeoCoordinate(90.1, 180.1);
211         QTest::newRow("latitude, longitude arguments too low") << QGeoCoordinate(-90.1, -180.1);
212 
213         QTest::newRow("latitude, longitude, altitude arguments all zero") << QGeoCoordinate(0.0, 0.0, 0.0);
214         QTest::newRow("latitude, longitude, altitude arguments not too high values") << QGeoCoordinate(90.0, 180.0, DBL_MAX);
215         QTest::newRow("latitude, longitude, altitude arguments not too low values") << QGeoCoordinate(-90.0, -180.0, DBL_MIN);
216 
217         QTest::newRow("latitude, longitude, altitude arguments too high latitude & longitude") << QGeoCoordinate(90.1, 180.1, DBL_MAX);
218         QTest::newRow("latitude, longitude, altitude arguments too low latitude & longitude") << QGeoCoordinate(-90.1, -180.1, DBL_MAX);
219     }
220 
destructor()221     void destructor()
222     {
223         QGeoCoordinate *coordinate;
224 
225         coordinate = new QGeoCoordinate();
226         delete coordinate;
227 
228         coordinate = new QGeoCoordinate(0.0, 0.0);
229         delete coordinate;
230 
231         coordinate = new QGeoCoordinate(0.0, 0.0, 0.0);
232         delete coordinate;
233 
234         coordinate = new QGeoCoordinate(90.0, 180.0);
235         delete coordinate;
236 
237         coordinate = new QGeoCoordinate(-90.0, -180.0);
238         delete coordinate;
239 
240         coordinate = new QGeoCoordinate(90.1, 180.1);
241         delete coordinate;
242 
243         coordinate = new QGeoCoordinate(-90.1, -180.1);
244         delete coordinate;
245     }
246 
destructor2()247     void destructor2()
248     {
249         QFETCH(QGeoCoordinate, c);
250         QGeoCoordinate *coordinate = new QGeoCoordinate(c);
251         delete coordinate;
252     }
253 
destructor2_data()254     void destructor2_data()
255     {
256         copy_constructor_data();
257     }
258 
assign()259     void assign()
260     {
261         QFETCH(QGeoCoordinate, c);
262 
263         QGeoCoordinate c1 = c;
264         QCOMPARE(c.type(), c1.type());
265         if (c.isValid()) {
266             QCOMPARE(c.latitude(), c.latitude());
267             QCOMPARE(c.longitude(), c.longitude());
268             if (c.type() == QGeoCoordinate::Coordinate3D)
269                 QCOMPARE(c.altitude(), c.altitude());
270         }
271     }
272 
assign_data()273     void assign_data()
274     {
275         copy_constructor_data();
276     }
277 
comparison()278     void comparison()
279     {
280         QFETCH(QGeoCoordinate, c1);
281         QFETCH(QGeoCoordinate, c2);
282         QFETCH(bool, result);
283 
284         QCOMPARE(c1 == c2, result);
285         QVariant v1 = QVariant::fromValue(c1);
286         QVariant v2 = QVariant::fromValue(c2);
287         QCOMPARE(v2 == v1, result);
288     }
289 
comparison_data()290     void comparison_data()
291     {
292         QTest::addColumn<QGeoCoordinate>("c1");
293         QTest::addColumn<QGeoCoordinate>("c2");
294         QTest::addColumn<bool>("result");
295 
296         QTest::newRow("Invalid != BRISBANE")
297                 << QGeoCoordinate(-190,-1000) << BRISBANE << false;
298         QTest::newRow("BRISBANE != MELBOURNE")
299                 << BRISBANE << MELBOURNE << false;
300         QTest::newRow("equal")
301                 << BRISBANE << BRISBANE << true;
302         QTest::newRow("LONDON != uninitialized data")
303                 << LONDON << QGeoCoordinate() << false;
304         QTest::newRow("uninitialized data == uninitialized data")
305                 << QGeoCoordinate() << QGeoCoordinate() << true;
306         QTest::newRow("invalid == same invalid")
307                 << QGeoCoordinate(-190,-1000) << QGeoCoordinate(-190,-1000) << true;
308         QTest::newRow("invalid == different invalid")
309                 << QGeoCoordinate(-190,-1000) << QGeoCoordinate(190,1000) << true;
310         QTest::newRow("valid != another valid")
311                 << QGeoCoordinate(-90,-180) << QGeoCoordinate(-45,+45) << false;
312         QTest::newRow("valid == same valid")
313                 << QGeoCoordinate(-90,-180) << QGeoCoordinate(-90,-180) << true;
314         QTest::newRow("different longitudes at north pole are equal")
315                 << QGeoCoordinate(90, 0) << QGeoCoordinate(90, 45) << true;
316         QTest::newRow("different longitudes at south pole are equal")
317                 << QGeoCoordinate(-90, 0) << QGeoCoordinate(-90, 45) << true;
318     }
319 
type()320     void type()
321     {
322         QFETCH(QGeoCoordinate, c);
323         QFETCH(QGeoCoordinate::CoordinateType, type);
324 
325         QCOMPARE(c.type(), type);
326     }
327 
type_data()328     void type_data()
329     {
330         QTest::addColumn<QGeoCoordinate>("c");
331         QTest::addColumn<QGeoCoordinate::CoordinateType>("type");
332 
333         QGeoCoordinate c;
334 
335         QTest::newRow("no values set")  << c << QGeoCoordinate::InvalidCoordinate;
336 
337         c.setAltitude(1.0);
338         QTest::newRow("only altitude is set")  << c << QGeoCoordinate::InvalidCoordinate;
339 
340         c.setLongitude(1.0);
341         QTest::newRow("only latitude and altitude is set") << c << QGeoCoordinate::InvalidCoordinate;
342 
343         c.setLatitude(-1.0);
344         QTest::newRow("all valid: 3D Coordinate") << c << QGeoCoordinate::Coordinate3D;
345 
346         c.setLatitude(-90.1);
347         QTest::newRow("too low latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
348 
349         c.setLongitude(-180.1);
350         c.setLatitude(90.0);
351         QTest::newRow("valid latitude and too low longitude") << c << QGeoCoordinate::InvalidCoordinate;
352 
353         c.setLatitude(90.1);
354         c.setLongitude(-180.0);
355         QTest::newRow("too high latitude and valid longitude") << c << QGeoCoordinate::InvalidCoordinate;
356 
357         c.setLatitude(-90.0);
358         c.setLongitude(180.1);
359         QTest::newRow("valid latitude and too high longitude") << c << QGeoCoordinate::InvalidCoordinate;
360     }
361 
valid()362     void valid()
363     {
364         QFETCH(QGeoCoordinate, c);
365         QCOMPARE(c.isValid(), c.type() != QGeoCoordinate::InvalidCoordinate);
366     }
367 
valid_data()368     void valid_data()
369     {
370         type_data();
371     }
372 
addDataValues(TestDataType type)373     void addDataValues(TestDataType type)
374     {
375         QTest::addColumn<double>("value");
376         QTest::addColumn<bool>("valid");
377 
378         QTest::newRow("negative") << -1.0 << true;
379         QTest::newRow("zero") << 0.0 << true;
380         QTest::newRow("positive") << 1.0 << true;
381 
382         switch (type) {
383             case Latitude:
384                 QTest::newRow("too low") << -90.1 << false;
385                 QTest::newRow("not too low") << -90.0 << true;
386                 QTest::newRow("not too hight") << 90.0 << true;
387                 QTest::newRow("too high") << 90.1;
388                 break;
389             case Longitude:
390                 QTest::newRow("too low") << -180.1 << false;
391                 QTest::newRow("not too low") << -180.0 << true;
392                 QTest::newRow("not too hight") << 180.0 << true;
393                 QTest::newRow("too high") << 180.1;
394                 break;
395             case Altitude:
396                 break;
397         }
398     }
399 
latitude()400     void latitude()
401     {
402         QFETCH(double, value);
403         QGeoCoordinate c;
404         c.setLatitude(value);
405         QCOMPARE(c.latitude(), value);
406 
407         QGeoCoordinate c2 = c;
408         QCOMPARE(c.latitude(), value);
409         QCOMPARE(c2, c);
410     }
latitude_data()411     void latitude_data() { addDataValues(Latitude); }
412 
longitude()413     void longitude()
414     {
415         QFETCH(double, value);
416         QGeoCoordinate c;
417         c.setLongitude(value);
418         QCOMPARE(c.longitude(), value);
419 
420         QGeoCoordinate c2 = c;
421         QCOMPARE(c.longitude(), value);
422         QCOMPARE(c2, c);
423     }
longitude_data()424     void longitude_data() { addDataValues(Longitude); }
425 
altitude()426     void altitude()
427     {
428         QFETCH(double, value);
429         QGeoCoordinate c;
430         c.setAltitude(value);
431         QCOMPARE(c.altitude(), value);
432 
433         QGeoCoordinate c2 = c;
434         QCOMPARE(c.altitude(), value);
435         QCOMPARE(c2, c);
436     }
altitude_data()437     void altitude_data() { addDataValues(Altitude); }
438 
distanceTo()439     void distanceTo()
440     {
441         QFETCH(QGeoCoordinate, c1);
442         QFETCH(QGeoCoordinate, c2);
443         QFETCH(qreal, distance);
444 
445         QCOMPARE(QString::number(c1.distanceTo(c2)), QString::number(distance));
446     }
447 
distanceTo_data()448     void distanceTo_data()
449     {
450         QTest::addColumn<QGeoCoordinate>("c1");
451         QTest::addColumn<QGeoCoordinate>("c2");
452         QTest::addColumn<qreal>("distance");
453 
454         QTest::newRow("invalid coord 1")
455                 << QGeoCoordinate() << BRISBANE << qreal(0.0);
456         QTest::newRow("invalid coord 2")
457                 << BRISBANE << QGeoCoordinate() << qreal(0.0);
458         QTest::newRow("brisbane -> melbourne")
459                 << BRISBANE << MELBOURNE << qreal(1374820.1618767744);
460         QTest::newRow("london -> new york")
461                 << LONDON << NEW_YORK << qreal(5570538.4987236429);
462         QTest::newRow("north pole -> south pole")
463                 << NORTH_POLE << SOUTH_POLE << qreal(20015109.4154876769);
464     }
465 
azimuthTo()466     void azimuthTo()
467     {
468         QFETCH(QGeoCoordinate, c1);
469         QFETCH(QGeoCoordinate, c2);
470         QFETCH(qreal, azimuth);
471 
472         qreal result = c1.azimuthTo(c2);
473         QVERIFY(result >= 0.0);
474         QVERIFY(result < 360.0);
475         QCOMPARE(QString::number(result), QString::number(azimuth));
476     }
477 
azimuthTo_data()478     void azimuthTo_data()
479     {
480         QTest::addColumn<QGeoCoordinate>("c1");
481         QTest::addColumn<QGeoCoordinate>("c2");
482         QTest::addColumn<qreal>("azimuth");
483 
484         QTest::newRow("invalid coord 1")
485                 << QGeoCoordinate() << BRISBANE << qreal(0.0);
486         QTest::newRow("invalid coord 2")
487                 << BRISBANE << QGeoCoordinate() << qreal(0.0);
488         QTest::newRow("brisbane -> melbourne")
489                 << BRISBANE << MELBOURNE << qreal(211.1717286649);
490         QTest::newRow("london -> new york")
491                 << LONDON << NEW_YORK << qreal(288.3388804508);
492         QTest::newRow("north pole -> south pole")
493                 << NORTH_POLE << SOUTH_POLE << qreal(180.0);
494         QTest::newRow("Almost 360degrees bearing")
495                 << QGeoCoordinate(0.5,45.0,0.0) << QGeoCoordinate(0.5,-134.9999651,0.0)  << qreal(359.998);
496     }
497 
atDistanceAndAzimuth()498     void atDistanceAndAzimuth()
499     {
500         QFETCH(QGeoCoordinate, origin);
501         QFETCH(qreal, distance);
502         QFETCH(qreal, azimuth);
503         QFETCH(QGeoCoordinate, result);
504 
505         QCOMPARE(result, origin.atDistanceAndAzimuth(distance, azimuth));
506     }
507 
atDistanceAndAzimuth_data()508     void atDistanceAndAzimuth_data()
509     {
510         QTest::addColumn<QGeoCoordinate>("origin");
511         QTest::addColumn<qreal>("distance");
512         QTest::addColumn<qreal>("azimuth");
513         QTest::addColumn<QGeoCoordinate>("result");
514 
515         QTest::newRow("invalid coord")
516             << QGeoCoordinate()
517             << qreal(1000.0)
518             << qreal(10.0)
519             << QGeoCoordinate();
520         if (sizeof(qreal) == sizeof(double)) {
521             QTest::newRow("brisbane -> melbourne")
522                 << BRISBANE
523                 << qreal(1374820.1618767744)
524                 << qreal(211.1717286649)
525                 << MELBOURNE;
526             QTest::newRow("london -> new york")
527                 << LONDON
528                 << qreal(5570538.4987236429)
529                 << qreal(288.3388804508)
530                 << NEW_YORK;
531             QTest::newRow("north pole -> south pole")
532                 << NORTH_POLE
533                 << qreal(20015109.4154876769)
534                 << qreal(180.0)
535                 << SOUTH_POLE;
536         } else {
537             QTest::newRow("brisbane -> melbourne")
538                 << BRISBANE
539                 << qreal(1374820.1618767744)
540                 << qreal(211.1717286649)
541                 << QGeoCoordinate(-37.8142515084775, 144.963170622944);
542             QTest::newRow("london -> new york")
543                 << LONDON
544                 << qreal(5570538.4987236429)
545                 << qreal(288.3388804508)
546                 << QGeoCoordinate(40.7145220608416, -74.0071216045375);
547             QTest::newRow("north pole -> south pole")
548                 << NORTH_POLE
549                 << qreal(20015109.4154876769)
550                 << qreal(180.0)
551                 << QGeoCoordinate(-89.9999947369857, -90.0);
552         }
553     }
554 
degreesToString()555     void degreesToString()
556     {
557         QFETCH(QGeoCoordinate, coord);
558         QFETCH(QGeoCoordinate::CoordinateFormat, format);
559         QFETCH(QString, string);
560 
561         QCOMPARE(coord.toString(format), string);
562     }
563 
degreesToString_data()564     void degreesToString_data()
565     {
566         QTest::addColumn<QGeoCoordinate>("coord");
567         QTest::addColumn<QGeoCoordinate::CoordinateFormat>("format");
568         QTest::addColumn<QString>("string");
569 
570         QGeoCoordinate northEast(27.46758, 153.027892);
571         QGeoCoordinate northEastWithAlt(27.46758, 153.027892, 28.23411);
572         QGeoCoordinate southEast(-27.46758, 153.027892);
573         QGeoCoordinate southEastWithAlt(-27.46758, 153.027892, 28.23411);
574         QGeoCoordinate northWest(27.46758, -153.027892);
575         QGeoCoordinate northWestWithAlt(27.46758, -153.027892, 28.23411);
576         QGeoCoordinate southWest(-27.46758, -153.027892);
577         QGeoCoordinate southWestWithAlt(-27.46758, -153.027892, 28.23411);
578 
579         QGeoCoordinate empty;
580         QGeoCoordinate toohigh(90.1, 180.1);
581         QGeoCoordinate toolow(-90.1, -180.1);
582         QGeoCoordinate zeroLatLong(0.0, 0.0);
583         QGeoCoordinate allZero(0.0, 0.0, 0.0);
584 
585         QTest::newRow("empty, dd, no hemisphere")
586                 << empty << QGeoCoordinate::Degrees
587                 << QString();
588         QTest::newRow("empty, dd, hemisphere")
589                 << empty << QGeoCoordinate::DegreesWithHemisphere
590                 << QString();
591         QTest::newRow("empty, dm, no hemisphere")
592                 << empty << QGeoCoordinate::DegreesMinutes
593                 << QString();
594         QTest::newRow("empty, dm, hemisphere")
595                 << empty << QGeoCoordinate::DegreesMinutesWithHemisphere
596                 << QString();
597         QTest::newRow("empty, dms, no hemisphere")
598                 << empty << QGeoCoordinate::DegreesMinutesSeconds
599                 << QString();
600         QTest::newRow("empty, dms, hemisphere")
601                 << empty << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
602                 << QString();
603 
604         QTest::newRow("too low, dd, no hemisphere")
605                 << toolow << QGeoCoordinate::Degrees
606                 << QString();
607         QTest::newRow("too low, dd, hemisphere")
608                 << toolow << QGeoCoordinate::DegreesWithHemisphere
609                 << QString();
610         QTest::newRow("too low, dm, no hemisphere")
611                 << toolow << QGeoCoordinate::DegreesMinutes
612                 << QString();
613         QTest::newRow("too low, dm, hemisphere")
614                 << toolow << QGeoCoordinate::DegreesMinutesWithHemisphere
615                 << QString();
616         QTest::newRow("too low, dms, no hemisphere")
617                 << toolow << QGeoCoordinate::DegreesMinutesSeconds
618                 << QString();
619         QTest::newRow("too low, dms, hemisphere")
620                 << toolow << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
621                 << QString();
622 
623         QTest::newRow("too high, dd, no hemisphere")
624                 << toohigh << QGeoCoordinate::Degrees
625                 << QString();
626         QTest::newRow("too high, dd, hemisphere")
627                 << toohigh << QGeoCoordinate::DegreesWithHemisphere
628                 << QString();
629         QTest::newRow("too high, dm, no hemisphere")
630                 << toohigh << QGeoCoordinate::DegreesMinutes
631                 << QString();
632         QTest::newRow("too high, dm, hemisphere")
633                 << toohigh << QGeoCoordinate::DegreesMinutesWithHemisphere
634                 << QString();
635         QTest::newRow("too high, dms, no hemisphere")
636                 << toohigh << QGeoCoordinate::DegreesMinutesSeconds
637                 << QString();
638         QTest::newRow("too high, dms, hemisphere")
639                 << toohigh << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
640                 << QString();
641 
642         QTest::newRow("zeroLatLong, dd, no hemisphere")
643                 << zeroLatLong << QGeoCoordinate::Degrees
644                 << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
645         QTest::newRow("zeroLatLong, dd, hemisphere")
646                 << zeroLatLong << QGeoCoordinate::DegreesWithHemisphere
647                 << QString("0.00000%1, 0.00000%1").arg(DEGREES_SYMB);
648         QTest::newRow("zeroLatLong, dm, no hemisphere")
649                 << zeroLatLong << QGeoCoordinate::DegreesMinutes
650                 << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
651         QTest::newRow("zeroLatLong, dm, hemisphere")
652                 << zeroLatLong << QGeoCoordinate::DegreesMinutesWithHemisphere
653                 << QString("0%1 0.000', 0%1 0.000'").arg(DEGREES_SYMB);
654         QTest::newRow("zeroLatLong, dms, no hemisphere")
655                 << zeroLatLong << QGeoCoordinate::DegreesMinutesSeconds
656                 << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
657         QTest::newRow("zeroLatLong, dms, hemisphere")
658                 << zeroLatLong << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
659                 << QString("0%1 0' 0.0\", 0%1 0' 0.0\"").arg(DEGREES_SYMB);
660 
661         QTest::newRow("allZero, dd, no hemisphere")
662                 << allZero << QGeoCoordinate::Degrees
663                 << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
664         QTest::newRow("allZero, dd, hemisphere")
665                 << allZero << QGeoCoordinate::DegreesWithHemisphere
666                 << QString("0.00000%1, 0.00000%1, 0m").arg(DEGREES_SYMB);
667         QTest::newRow("allZero, dm, no hemisphere")
668                 << allZero << QGeoCoordinate::DegreesMinutes
669                 << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
670         QTest::newRow("allZero, dm, hemisphere")
671                 << allZero << QGeoCoordinate::DegreesMinutesWithHemisphere
672                 << QString("0%1 0.000', 0%1 0.000', 0m").arg(DEGREES_SYMB);
673         QTest::newRow("allZero, dms, no hemisphere")
674                 << allZero << QGeoCoordinate::DegreesMinutesSeconds
675                 << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
676         QTest::newRow("allZero, dms, hemisphere")
677                 << allZero << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
678                 << QString("0%1 0' 0.0\", 0%1 0' 0.0\", 0m").arg(DEGREES_SYMB);
679 
680         QTest::newRow("NE, dd, no hemisphere")
681                 << northEast << QGeoCoordinate::Degrees
682                 << QString("27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
683         QTest::newRow("NE, dd, hemisphere")
684                 << northEast << QGeoCoordinate::DegreesWithHemisphere
685                 << QString("27.46758%1 N, 153.02789%1 E").arg(DEGREES_SYMB);
686         QTest::newRow("NE, dm, no hemisphere")
687                 << northEast << QGeoCoordinate::DegreesMinutes
688                 << QString("27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
689         QTest::newRow("NE, dm, hemisphere")
690                 << northEast << QGeoCoordinate::DegreesMinutesWithHemisphere
691                 << QString("27%1 28.055' N, 153%1 1.674' E").arg(DEGREES_SYMB);
692         QTest::newRow("NE, dms, no hemisphere")
693                 << northEast << QGeoCoordinate::DegreesMinutesSeconds
694                 << QString("27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
695         QTest::newRow("NE, dms, hemisphere")
696                 << northEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
697                 << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
698 
699         QTest::newRow("NE with alt, dd, no hemisphere")
700                 << northEastWithAlt << QGeoCoordinate::Degrees
701                 << QString("27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
702         QTest::newRow("NE with alt, dd, hemisphere")
703                 << northEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
704                 << QString("27.46758%1 N, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
705         QTest::newRow("NE with alt, dm, no hemisphere")
706                 << northEastWithAlt << QGeoCoordinate::DegreesMinutes
707                 << QString("27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
708         QTest::newRow("NE with alt, dm, hemisphere")
709                 << northEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
710                 << QString("27%1 28.055' N, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
711         QTest::newRow("NE with alt, dms, no hemisphere")
712                 << northEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
713                 << QString("27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
714         QTest::newRow("NE with alt, dms, hemisphere")
715                 << northEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
716                 << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);
717 
718         QTest::newRow("SE, dd, no hemisphere")
719                 << southEast << QGeoCoordinate::Degrees
720                 << QString("-27.46758%1, 153.02789%1").arg(DEGREES_SYMB);
721         QTest::newRow("SE, dd, hemisphere")
722                 << southEast << QGeoCoordinate::DegreesWithHemisphere
723                 << QString("27.46758%1 S, 153.02789%1 E").arg(DEGREES_SYMB);
724         QTest::newRow("SE, dm, no hemisphere")
725                 << southEast << QGeoCoordinate::DegreesMinutes
726                 << QString("-27%1 28.055', 153%1 1.674'").arg(DEGREES_SYMB);
727         QTest::newRow("SE, dm, hemisphere")
728                 << southEast << QGeoCoordinate::DegreesMinutesWithHemisphere
729                 << QString("27%1 28.055' S, 153%1 1.674' E").arg(DEGREES_SYMB);
730         QTest::newRow("SE, dms, no hemisphere")
731                 << southEast << QGeoCoordinate::DegreesMinutesSeconds
732                 << QString("-27%1 28' 3.3\", 153%1 1' 40.4\"").arg(DEGREES_SYMB);
733         QTest::newRow("SE, dms, hemisphere")
734                 << southEast << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
735                 << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E").arg(DEGREES_SYMB);
736 
737         QTest::newRow("SE with alt, dd, no hemisphere, 28.2341m")
738                 << southEastWithAlt << QGeoCoordinate::Degrees
739                 << QString("-27.46758%1, 153.02789%1, 28.2341m").arg(DEGREES_SYMB);
740         QTest::newRow("SE with alt, dd, hemisphere, 28.2341m")
741                 << southEastWithAlt << QGeoCoordinate::DegreesWithHemisphere
742                 << QString("27.46758%1 S, 153.02789%1 E, 28.2341m").arg(DEGREES_SYMB);
743         QTest::newRow("SE with alt, dm, no hemisphere, 28.2341m")
744                 << southEastWithAlt << QGeoCoordinate::DegreesMinutes
745                 << QString("-27%1 28.055', 153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
746         QTest::newRow("SE with alt, dm, hemisphere, 28.2341m")
747                 << southEastWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
748                 << QString("27%1 28.055' S, 153%1 1.674' E, 28.2341m").arg(DEGREES_SYMB);
749         QTest::newRow("SE with alt, dms, no hemisphere, 28.2341m")
750                 << southEastWithAlt << QGeoCoordinate::DegreesMinutesSeconds
751                 << QString("-27%1 28' 3.3\", 153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
752         QTest::newRow("SE with alt, dms, hemisphere, 28.2341m")
753                 << southEastWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
754                 << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" E, 28.2341m").arg(DEGREES_SYMB);;
755 
756         QTest::newRow("NW, dd, no hemisphere")
757                 << northWest << QGeoCoordinate::Degrees
758                 << QString("27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
759         QTest::newRow("NW, dd, hemisphere")
760                 << northWest << QGeoCoordinate::DegreesWithHemisphere
761                 << QString("27.46758%1 N, 153.02789%1 W").arg(DEGREES_SYMB);
762         QTest::newRow("NW, dm, no hemisphere")
763                 << northWest << QGeoCoordinate::DegreesMinutes
764                 << QString("27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
765         QTest::newRow("NW, dm, hemisphere")
766                 << northWest << QGeoCoordinate::DegreesMinutesWithHemisphere
767                 << QString("27%1 28.055' N, 153%1 1.674' W").arg(DEGREES_SYMB);
768         QTest::newRow("NW, dms, no hemisphere")
769                 << northWest << QGeoCoordinate::DegreesMinutesSeconds
770                 << QString("27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
771         QTest::newRow("NW, dms, hemisphere")
772                 << northWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
773                 << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
774 
775         QTest::newRow("NW with alt, dd, no hemisphere, 28.2341m")
776                 << northWestWithAlt << QGeoCoordinate::Degrees
777                 << QString("27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
778         QTest::newRow("NW with alt, dd, hemisphere, 28.2341m")
779                 << northWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
780                 << QString("27.46758%1 N, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
781         QTest::newRow("NW with alt, dm, no hemisphere, 28.2341m")
782                 << northWestWithAlt << QGeoCoordinate::DegreesMinutes
783                 << QString("27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
784         QTest::newRow("NW with alt, dm, hemisphere, 28.2341m")
785                 << northWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
786                 << QString("27%1 28.055' N, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
787         QTest::newRow("NW with alt, dms, no hemisphere, 28.2341m")
788                 << northWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
789                 << QString("27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
790         QTest::newRow("NW with alt, dms, hemisphere, 28.2341m")
791                 << northWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
792                 << QString("27%1 28' 3.3\" N, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
793 
794         QTest::newRow("SW, dd, no hemisphere")
795                 << southWest << QGeoCoordinate::Degrees
796                 << QString("-27.46758%1, -153.02789%1").arg(DEGREES_SYMB);
797         QTest::newRow("SW, dd, hemisphere")
798                 << southWest << QGeoCoordinate::DegreesWithHemisphere
799                 << QString("27.46758%1 S, 153.02789%1 W").arg(DEGREES_SYMB);
800         QTest::newRow("SW, dm, no hemisphere")
801                 << southWest << QGeoCoordinate::DegreesMinutes
802                 << QString("-27%1 28.055', -153%1 1.674'").arg(DEGREES_SYMB);
803         QTest::newRow("SW, dm, hemisphere")
804                 << southWest << QGeoCoordinate::DegreesMinutesWithHemisphere
805                 << QString("27%1 28.055' S, 153%1 1.674' W").arg(DEGREES_SYMB);
806         QTest::newRow("SW, dms, no hemisphere")
807                 << southWest << QGeoCoordinate::DegreesMinutesSeconds
808                 << QString("-27%1 28' 3.3\", -153%1 1' 40.4\"").arg(DEGREES_SYMB);
809         QTest::newRow("SW, dms, hemisphere")
810                 << southWest << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
811                 << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W").arg(DEGREES_SYMB);
812 
813         QTest::newRow("SW with alt, dd, no hemisphere, 28.2341m")
814                 << southWestWithAlt << QGeoCoordinate::Degrees
815                 << QString("-27.46758%1, -153.02789%1, 28.2341m").arg(DEGREES_SYMB);
816         QTest::newRow("SW with alt, dd, hemisphere, 28.2341m")
817                 << southWestWithAlt << QGeoCoordinate::DegreesWithHemisphere
818                 << QString("27.46758%1 S, 153.02789%1 W, 28.2341m").arg(DEGREES_SYMB);
819         QTest::newRow("SW with alt, dm, no hemisphere, 28.2341m")
820                 << southWestWithAlt << QGeoCoordinate::DegreesMinutes
821                 << QString("-27%1 28.055', -153%1 1.674', 28.2341m").arg(DEGREES_SYMB);
822         QTest::newRow("SW with alt, dm, hemisphere, 28.2341m")
823                 << southWestWithAlt << QGeoCoordinate::DegreesMinutesWithHemisphere
824                 << QString("27%1 28.055' S, 153%1 1.674' W, 28.2341m").arg(DEGREES_SYMB);
825         QTest::newRow("SW with alt, dms, no hemisphere, 28.2341m")
826                 << southWestWithAlt << QGeoCoordinate::DegreesMinutesSeconds
827                 << QString("-27%1 28' 3.3\", -153%1 1' 40.4\", 28.2341m").arg(DEGREES_SYMB);
828         QTest::newRow("SW with alt, dms, hemisphere, 28.2341m")
829                 << southWestWithAlt << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
830                 << QString("27%1 28' 3.3\" S, 153%1 1' 40.4\" W, 28.2341m").arg(DEGREES_SYMB);
831 
832         QTest::newRow("Wrap seconds to Minutes DMSH")
833                 << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSecondsWithHemisphere
834                 << QString( "1%1 8' 0.0\" N, 1%1 8' 0.0\" E").arg(DEGREES_SYMB);
835         QTest::newRow("Wrap seconds to Minutes DMS")
836                 << QGeoCoordinate(1.1333333, 1.1333333) << QGeoCoordinate::DegreesMinutesSeconds
837                 << QString( "1%1 8' 0.0\", 1%1 8' 0.0\"").arg(DEGREES_SYMB);
838         QTest::newRow("Wrap minutes to Degrees DMH")
839                 << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutesWithHemisphere
840                 << QString( "2%1 0.000' N, 2%1 0.000' E").arg(DEGREES_SYMB);
841         QTest::newRow("Wrap minutes to Degrees DM")
842                 << QGeoCoordinate(1.999999, 1.999999) << QGeoCoordinate::DegreesMinutes
843                 << QString( "2%1 0.000', 2%1 0.000'").arg(DEGREES_SYMB);
844 
845         QTest::newRow("Wrap seconds to minutes to Degrees DM -> above valid long/lat values")
846                 << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutesSeconds
847                 << QString( "90%1 0' 0.0\", 180%1 0' 0.0\"").arg(DEGREES_SYMB);
848 
849         QTest::newRow("Wrap minutes to Degrees DM ->above valid long/lat values")
850                 << QGeoCoordinate(89.9999, 179.9999) << QGeoCoordinate::DegreesMinutes
851                 << QString( "90%1 0.000', 180%1 0.000'").arg(DEGREES_SYMB);
852 
853     }
854 
datastream()855     void datastream()
856     {
857         QFETCH(QGeoCoordinate, c);
858 
859         QByteArray ba;
860         QDataStream out(&ba, QIODevice::WriteOnly);
861         out << c;
862 
863         QDataStream in(&ba, QIODevice::ReadOnly);
864         QGeoCoordinate inCoord;
865         in >> inCoord;
866         QCOMPARE(inCoord, c);
867     }
868 
datastream_data()869     void datastream_data()
870     {
871         QTest::addColumn<QGeoCoordinate>("c");
872 
873         QTest::newRow("invalid") << QGeoCoordinate();
874         QTest::newRow("valid lat, long") << BRISBANE;
875         QTest::newRow("valid lat, long, alt") << QGeoCoordinate(-1, -1, -1);
876         QTest::newRow("valid lat, long, alt again") << QGeoCoordinate(1, 1, 1);
877     }
878 
debug()879     void debug()
880     {
881         QFETCH(QGeoCoordinate, c);
882         QFETCH(int, nextValue);
883         QFETCH(QByteArray, debugString);
884 
885         qInstallMessageHandler(tst_qgeocoordinate_messageHandler);
886         qDebug() << c << nextValue;
887         qInstallMessageHandler(0);
888         QCOMPARE(tst_qgeocoordinate_debug, debugString);
889     }
890 
debug_data()891     void debug_data()
892     {
893         QTest::addColumn<QGeoCoordinate>("c");
894         QTest::addColumn<int>("nextValue");
895         QTest::addColumn<QByteArray>("debugString");
896 
897         QTest::newRow("uninitialized") << QGeoCoordinate() << 45
898                 << QByteArray("QGeoCoordinate(?, ?) 45");
899         QTest::newRow("initialized without altitude") << BRISBANE << 45
900                 << (QString("QGeoCoordinate(%1, %2) 45").arg(BRISBANE.latitude(), 0, 'g', 9)
901                         .arg(BRISBANE.longitude(), 0, 'g', 9)).toLatin1();
902         QTest::newRow("invalid initialization") << QGeoCoordinate(-100,-200) << 45
903                 << QByteArray("QGeoCoordinate(?, ?) 45");
904         QTest::newRow("initialized with altitude") << QGeoCoordinate(1,2,3) << 45
905                 << QByteArray("QGeoCoordinate(1, 2, 3) 45");
906         QTest::newRow("extra long coordinates") << QGeoCoordinate(89.123412341, 179.123412341)
907                 << 45 << QByteArray("QGeoCoordinate(89.123412341, 179.12341234) 45");
908     }
909 
hash()910     void hash()
911     {
912         uint s1 = qHash(QGeoCoordinate(1, 1, 2));
913         uint s2 = qHash(QGeoCoordinate(2, 1, 1));
914         uint s3 = qHash(QGeoCoordinate(1, 2, 1));
915         uint s10 = qHash(QGeoCoordinate(0, 0, 2));
916         uint s20 = qHash(QGeoCoordinate(2, 0, 0));
917         uint s30 = qHash(QGeoCoordinate(0, 2, 0));
918         uint s30NoAlt = qHash(QGeoCoordinate(0, 2));
919         uint s30WithSeed = qHash(QGeoCoordinate(0, 2, 0), 1);
920         uint nullCoordinate = qHash(QGeoCoordinate());
921 
922         uint north1 = qHash(QGeoCoordinate(90.0, 34.7, 0));
923         uint north2 = qHash(QGeoCoordinate(90.0, 180, 0));
924 
925         uint south1 = qHash(QGeoCoordinate(90.0, 67.7, 34.0));
926         uint south2 = qHash(QGeoCoordinate(90.0, 111, 34.0));
927 
928         QVERIFY(s1 != s2);
929         QVERIFY(s2 != s3);
930         QVERIFY(s1 != s3);
931         QVERIFY(s10 != s20);
932         QVERIFY(s20 != s30);
933         QVERIFY(s10 != s30);
934         QVERIFY(s30NoAlt != s30);
935         QVERIFY(s30WithSeed != s30);
936 
937         QVERIFY(nullCoordinate != s1);
938         QVERIFY(nullCoordinate != s2);
939         QVERIFY(nullCoordinate != s3);
940         QVERIFY(nullCoordinate != s10);
941         QVERIFY(nullCoordinate != s20);
942         QVERIFY(nullCoordinate != s30);
943         QVERIFY(nullCoordinate != s30NoAlt);
944         QVERIFY(nullCoordinate != s30WithSeed);
945 
946         QVERIFY(north1 == north2);
947         QVERIFY(south1 == south2);
948     }
949 };
950 
951 QTEST_GUILESS_MAIN(tst_QGeoCoordinate)
952 #include "tst_qgeocoordinate.moc"
953