diff options
Diffstat (limited to 'tests')
38 files changed, 753 insertions, 750 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index fdfd39bd..e9a19a6c 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -32,9 +32,9 @@ SUBDIRS += geotestplugin \ qgeocodingmanagerplugins \ qgeoaddress \ qgeoareamonitor \ - qgeoboundingarea \ - qgeoboundingbox \ - qgeoboundingcircle \ + qgeoshape \ + qgeorectangle \ + qgeocircle \ qgeocameradata \ qgeocameracapabilities \ qgeocameratiles \ diff --git a/tests/auto/declarative_core/tst_bounding_area.qml b/tests/auto/declarative_core/tst_geoshape.qml index 2c1a55af..e7701fe4 100644 --- a/tests/auto/declarative_core/tst_bounding_area.qml +++ b/tests/auto/declarative_core/tst_geoshape.qml @@ -48,8 +48,8 @@ Item { Coordinate{ id: coordinate2; latitude: 2; longitude: 2} Coordinate{ id: coordinate3; latitude: 80; longitude: 80} - BoundingCircle{ id: emptyCircle} - BoundingCircle{ id: circle1; center: coordinate1; radius: 200000} + GeoCircle { id: emptyCircle } + GeoCircle { id: circle1; center: coordinate1; radius: 200000 } SignalSpy {id: radiusSpy; target: emptyCircle; signalName: "radiusChanged"} SignalSpy {id: centerSpy; target: emptyCircle; signalName: "centerChanged"} @@ -91,7 +91,7 @@ Item { Coordinate{ id: inside; latitude: 0.5; longitude: 0.5} Coordinate{ id: outside; latitude: 2; longitude: 2} - BoundingBox { + GeoRectangle { id: box; bottomLeft: bottomLeft; topLeft: topLeft; diff --git a/tests/auto/declarative_core/tst_map_routing.qml b/tests/auto/declarative_core/tst_map_routing.qml index 3f1a3998..56ed6149 100644 --- a/tests/auto/declarative_core/tst_map_routing.qml +++ b/tests/auto/declarative_core/tst_map_routing.qml @@ -48,15 +48,15 @@ Item { Plugin { id: invalidPlugin; name: "invalid"} Coordinate{ id: coordinate1; latitude: 51; longitude: 0} Coordinate{ id: coordinate2; latitude: 52; longitude: 0} - BoundingBox{ id: boundingBox1; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000} - BoundingBox{ id: boundingBox2; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000} + GeoRectangle { id: boundingBox1; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000 } + GeoRectangle { id: boundingBox2; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000 } Coordinate{ id: bottomLeft; latitude: 0; longitude: 0} Coordinate{ id: topLeft; latitude: 1; longitude: 0} Coordinate{ id: topRight; latitude: 1; longitude: 1} Coordinate{ id: bottomRight; latitude: 0; longitude: 1} Coordinate{ id: newTopRight; latitude: 3; longitude: 3} - BoundingBox { + GeoRectangle { id: unitBox; bottomLeft: bottomLeft; topLeft: topLeft; @@ -72,7 +72,7 @@ Item { // TODO enable when we have map route //MapRoute {id: emptyMapRoute} - BoundingBox {id: emptyBox} + GeoRectangle {id: emptyBox} Coordinate {id: emptyCoordinate} // TODO enable when we have map route diff --git a/tests/auto/declarative_core/tst_place.qml b/tests/auto/declarative_core/tst_place.qml index fb2423bf..60c84eaf 100644 --- a/tests/auto/declarative_core/tst_place.qml +++ b/tests/auto/declarative_core/tst_place.qml @@ -85,7 +85,7 @@ TestCase { altitude: 100 } - boundingBox: BoundingBox { + boundingBox: GeoRectangle { center: Coordinate { latitude: 10 longitude: 10 diff --git a/tests/auto/declarative_core/tst_placerecommendationmodel.qml b/tests/auto/declarative_core/tst_placerecommendationmodel.qml index 5e87bc29..5a7a200a 100644 --- a/tests/auto/declarative_core/tst_placerecommendationmodel.qml +++ b/tests/auto/declarative_core/tst_placerecommendationmodel.qml @@ -57,7 +57,7 @@ TestCase { name: "qmlgeo.test.plugin" } - BoundingCircle { + GeoCircle { id: testSearchArea center: Coordinate { latitude: 10 diff --git a/tests/auto/declarative_core/tst_placesearchmodel.qml b/tests/auto/declarative_core/tst_placesearchmodel.qml index ddc9d912..b626307b 100644 --- a/tests/auto/declarative_core/tst_placesearchmodel.qml +++ b/tests/auto/declarative_core/tst_placesearchmodel.qml @@ -57,7 +57,7 @@ TestCase { name: "qmlgeo.test.plugin" } - BoundingCircle { + GeoCircle { id: testSearchArea center: Coordinate { latitude: 10 diff --git a/tests/auto/declarative_core/tst_placesearchsuggestionmodel.qml b/tests/auto/declarative_core/tst_placesearchsuggestionmodel.qml index 20c6cb75..d984b480 100644 --- a/tests/auto/declarative_core/tst_placesearchsuggestionmodel.qml +++ b/tests/auto/declarative_core/tst_placesearchsuggestionmodel.qml @@ -57,7 +57,7 @@ TestCase { name: "qmlgeo.test.plugin" } - BoundingCircle { + GeoCircle { id: testSearchArea center: Coordinate { latitude: 10 diff --git a/tests/auto/declarative_ui/tst_map_geocoding.qml b/tests/auto/declarative_ui/tst_map_geocoding.qml index a58680f5..c150421e 100644 --- a/tests/auto/declarative_ui/tst_map_geocoding.qml +++ b/tests/auto/declarative_ui/tst_map_geocoding.qml @@ -49,12 +49,12 @@ Item { Coordinate{ id: coordinate1; latitude: 51; longitude: 41} Coordinate{ id: coordinate2; latitude: 52; longitude: 42} - BoundingBox{ id: boundingBox1; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000} - BoundingBox{ id: boundingBox2; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000} - BoundingCircle { id: boundingCircle1; center: coordinate1; radius: 100} - BoundingCircle { id: boundingCircle2; center: coordinate2; radius: 100} + GeoRectangle { id: boundingBox1; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000 } + GeoRectangle { id: boundingBox2; topLeft: coordinate2; bottomLeft: coordinate1; width: 1000 } + GeoCircle { id: boundingCircle1; center: coordinate1; radius: 100 } + GeoCircle { id: boundingCircle2; center: coordinate2; radius: 100 } - BoundingBox {id: emptyBox} + GeoRectangle {id: emptyBox} Coordinate {id: emptyCoordinate} GeocodeModel {id: emptyModel} @@ -121,7 +121,7 @@ Item { compare(boundsSpy.count, 2) compare(emptyModel.bounds.topLeft.latitude, boundingBox2.topLeft.latitude) compare(emptyModel.bounds.bottomRight.longitude, boundingBox2.bottomRight.longitude) - var dynamicBox = Qt.createQmlObject("import QtQuick 2.0; import QtLocation 5.0; BoundingBox { id: dynBox}", testCase1) + var dynamicBox = Qt.createQmlObject("import QtQuick 2.0; import QtLocation 5.0; GeoRectangle { id: dynBox }", testCase1) emptyModel.bounds = dynamicBox compare(boundsSpy.count, 3) @@ -137,7 +137,7 @@ Item { emptyModel.bounds = boundingCircle2 compare(boundsSpy.count, 2) compare(emptyModel.bounds.center.latitude, coordinate2.latitude) - var dynamicCircle = Qt.createQmlObject("import QtQuick 2.0; import QtLocation 5.0; BoundingCircle { id: dynCircle; center: Coordinate {id: dynCoord; latitude: 8; longitude: 9}}", testCase1) + var dynamicCircle = Qt.createQmlObject("import QtQuick 2.0; import QtLocation 5.0; GeoCircle { id: dynCircle; center: Coordinate { id: dynCoord; latitude: 8; longitude: 9 } }", testCase1) emptyModel.bounds = dynamicCircle compare(boundsSpy.count, 3) compare(emptyModel.bounds.center.latitude, dynamicCircle.center.latitude) diff --git a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml index 504b3f9b..5560a832 100644 --- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml +++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml @@ -110,7 +110,7 @@ Item { Coordinate{ id: mapRouteTopLeft; latitude: 0; longitude: 0} Coordinate{ id: mapRouteBottomRight; latitude: 0; longitude: 0} - BoundingBox { + GeoRectangle { id: boundingBox topLeft: Coordinate { latitude: 0 diff --git a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h index 78914c61..61778385 100644 --- a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h +++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h @@ -48,6 +48,7 @@ #include <qgeoaddress.h> #include <qgeolocation.h> #include <qgeocodereply.h> +#include <QtLocation/QGeoShape> #include <QTimer> #include <QDebug> @@ -68,7 +69,7 @@ public: void callSetLimit ( int limit ) {setLimit(limit);} void callSetOffset ( int offset ) {setOffset(offset);} void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);} - void callSetViewport ( const QGeoBoundingArea &viewport ) {setViewport(viewport);} + void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);} void abort() { emit aborted(); } @@ -106,7 +107,7 @@ public: QGeocodeReply* geocode(const QString &searchString, int limit = -1, int offset = 0, - const QGeoBoundingArea &bounds = QGeoBoundingArea()) + const QGeoShape &bounds = QGeoShape()) { geocodeReply_ = new GeocodeReplyTest(); connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); @@ -138,7 +139,7 @@ public: return static_cast<QGeocodeReply*>(geocodeReply_); } - QGeocodeReply* geocode ( const QGeoAddress & address, const QGeoBoundingArea &bounds ) + QGeocodeReply* geocode ( const QGeoAddress & address, const QGeoShape &bounds ) { geocodeReply_ = new GeocodeReplyTest(); connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); @@ -225,7 +226,7 @@ public: } } - QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, const QGeoBoundingArea &bounds ) + QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, const QGeoShape &bounds ) { geocodeReply_ = new GeocodeReplyTest(); connect(geocodeReply_, SIGNAL(aborted()), this, SLOT(requestAborted())); diff --git a/tests/auto/nokia_services/routing/tst_routing.cpp b/tests/auto/nokia_services/routing/tst_routing.cpp index 87ef7847..b95b0b60 100644 --- a/tests/auto/nokia_services/routing/tst_routing.cpp +++ b/tests/auto/nokia_services/routing/tst_routing.cpp @@ -48,7 +48,7 @@ #include <QtLocation/QGeoRouteReply> #include <QtLocation/QGeoServiceProvider> #include <QtLocation/QGeoRoutingManager> -#include <QtLocation/QGeoBoundingBox> +#include <QtLocation/QGeoRectangle> #include <QtLocation/QGeoManeuver> #include <QtLocation/QGeoRouteSegment> @@ -266,7 +266,7 @@ void tst_nokia_routing::verifySaneRoute(const QGeoRoute& route) QVERIFY(route.travelTime() > 0); QVERIFY(route.travelMode() != 0); - const QGeoBoundingBox bounds = route.bounds(); + const QGeoRectangle bounds = route.bounds(); QVERIFY(bounds.width() > 0); QVERIFY(bounds.height() > 0); diff --git a/tests/auto/qgeoboundingarea/qgeoboundingarea.pro b/tests/auto/qgeoboundingarea/qgeoboundingarea.pro deleted file mode 100644 index ea2f18df..00000000 --- a/tests/auto/qgeoboundingarea/qgeoboundingarea.pro +++ /dev/null @@ -1,4 +0,0 @@ -load(testcase) -TARGET = tst_qgeoboundingarea -QT += testlib location -SOURCES = tst_qgeoboundingarea.cpp diff --git a/tests/auto/qgeoboundingbox/qgeoboundingbox.pro b/tests/auto/qgeoboundingbox/qgeoboundingbox.pro deleted file mode 100644 index 3427c37b..00000000 --- a/tests/auto/qgeoboundingbox/qgeoboundingbox.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -CONFIG += testcase -TARGET = tst_qgeoboundingbox - -SOURCES += tst_qgeoboundingbox.cpp - -QT += location testlib diff --git a/tests/auto/qgeoboundingcircle/qgeoboundingcircle.pro b/tests/auto/qgeoboundingcircle/qgeoboundingcircle.pro deleted file mode 100644 index 3b29b30a..00000000 --- a/tests/auto/qgeoboundingcircle/qgeoboundingcircle.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE = app -CONFIG += testcase -TARGET = tst_qgeoboundingcircle - -SOURCES += tst_qgeoboundingcircle.cpp - -QT += location testlib diff --git a/tests/auto/qgeocircle/qgeocircle.pro b/tests/auto/qgeocircle/qgeocircle.pro new file mode 100644 index 00000000..6e2fd88b --- /dev/null +++ b/tests/auto/qgeocircle/qgeocircle.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +CONFIG += testcase +TARGET = tst_qgeocircle + +SOURCES += \ + tst_qgeocircle.cpp + +QT += location testlib diff --git a/tests/auto/qgeoboundingcircle/tst_qgeoboundingcircle.cpp b/tests/auto/qgeocircle/tst_qgeocircle.cpp index ff3a61d8..4caf3bb1 100644 --- a/tests/auto/qgeoboundingcircle/tst_qgeoboundingcircle.cpp +++ b/tests/auto/qgeocircle/tst_qgeocircle.cpp @@ -40,13 +40,13 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <qgeoboundingcircle.h> -#include <qgeoboundingbox.h> -#include <qgeocoordinate.h> +#include <QtLocation/QGeoCoordinate> +#include <QtLocation/QGeoCircle> +#include <QtLocation/QGeoRectangle> QT_USE_NAMESPACE -class tst_QGeoBoundingCircle : public QObject +class tst_QGeoCircle : public QObject { Q_OBJECT @@ -80,24 +80,24 @@ private slots: void boxComparison_data(); }; -void tst_QGeoBoundingCircle::defaultConstructor() +void tst_QGeoCircle::defaultConstructor() { - QGeoBoundingCircle c; + QGeoCircle c; QVERIFY(!c.center().isValid()); QCOMPARE(c.radius(), qreal(-1.0)); } -void tst_QGeoBoundingCircle::centerRadiusConstructor() +void tst_QGeoCircle::centerRadiusConstructor() { - QGeoBoundingCircle c(QGeoCoordinate(1,1), qreal(50.0)); + QGeoCircle c(QGeoCoordinate(1,1), qreal(50.0)); QCOMPARE(c.center(), QGeoCoordinate(1,1)); QCOMPARE(c.radius(), qreal(50.0)); } -void tst_QGeoBoundingCircle::assignment() +void tst_QGeoCircle::assignment() { - QGeoBoundingCircle c1 = QGeoBoundingCircle(QGeoCoordinate(10.0, 0.0), 20.0); - QGeoBoundingCircle c2 = QGeoBoundingCircle(QGeoCoordinate(20.0, 0.0), 30.0); + QGeoCircle c1 = QGeoCircle(QGeoCoordinate(10.0, 0.0), 20.0); + QGeoCircle c2 = QGeoCircle(QGeoCoordinate(20.0, 0.0), 30.0); QVERIFY(c1 != c2); @@ -112,12 +112,12 @@ void tst_QGeoBoundingCircle::assignment() QCOMPARE(c1.radius(), 20.0); // Assign c1 to an area - QGeoBoundingArea area = c1; + QGeoShape area = c1; QCOMPARE(area.type(), c1.type()); QVERIFY(area == c1); // Assign the area back to a bounding circle - QGeoBoundingCircle ca = area; + QGeoCircle ca = area; QCOMPARE(ca.center(), c1.center()); QCOMPARE(ca.radius(), c1.radius()); @@ -127,12 +127,12 @@ void tst_QGeoBoundingCircle::assignment() QVERIFY(ca != c1); } -void tst_QGeoBoundingCircle::comparison() +void tst_QGeoCircle::comparison() { - QGeoBoundingCircle c1(QGeoCoordinate(1,1), qreal(50.0)); - QGeoBoundingCircle c2(QGeoCoordinate(1,1), qreal(50.0)); - QGeoBoundingCircle c3(QGeoCoordinate(1,1), qreal(35.0)); - QGeoBoundingCircle c4(QGeoCoordinate(1,2), qreal(50.0)); + QGeoCircle c1(QGeoCoordinate(1,1), qreal(50.0)); + QGeoCircle c2(QGeoCoordinate(1,1), qreal(50.0)); + QGeoCircle c3(QGeoCoordinate(1,1), qreal(35.0)); + QGeoCircle c4(QGeoCoordinate(1,2), qreal(50.0)); QVERIFY(c1 == c2); QVERIFY(!(c1 != c2)); @@ -146,44 +146,44 @@ void tst_QGeoBoundingCircle::comparison() QVERIFY(!(c2 == c3)); QVERIFY(c2 != c3); - QGeoBoundingBox b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30)); + QGeoRectangle b1(QGeoCoordinate(20,20),QGeoCoordinate(10,30)); QVERIFY(!(c1 == b1)); QVERIFY(c1 != b1); - QGeoBoundingArea *c2Ptr = &c2; + QGeoShape *c2Ptr = &c2; QVERIFY(c1 == *c2Ptr); QVERIFY(!(c1 != *c2Ptr)); - QGeoBoundingArea *c3Ptr = &c3; + QGeoShape *c3Ptr = &c3; QVERIFY(!(c1 == *c3Ptr)); QVERIFY(c1 != *c3Ptr); } -void tst_QGeoBoundingCircle::type() +void tst_QGeoCircle::type() { - QGeoBoundingCircle c; - QCOMPARE(c.type(), QGeoBoundingArea::CircleType); + QGeoCircle c; + QCOMPARE(c.type(), QGeoShape::CircleType); } -void tst_QGeoBoundingCircle::radius() +void tst_QGeoCircle::radius() { - QGeoBoundingCircle c; + QGeoCircle c; c.setRadius(1.0); QCOMPARE(c.radius(), qreal(1.0)); c.setRadius(5.0); QCOMPARE(c.radius(), qreal(5.0)); } -void tst_QGeoBoundingCircle::center() +void tst_QGeoCircle::center() { - QGeoBoundingCircle c; + QGeoCircle c; c.setCenter(QGeoCoordinate(1,1)); QCOMPARE(c.center(), QGeoCoordinate(1,1)); c.setCenter(QGeoCoordinate(5,10)); QCOMPARE(c.center(), QGeoCoordinate(5,10)); } -void tst_QGeoBoundingCircle::translate_data() +void tst_QGeoCircle::translate_data() { QTest::addColumn<QGeoCoordinate>("center"); QTest::addColumn<qreal>("radius"); @@ -200,7 +200,7 @@ void tst_QGeoBoundingCircle::translate_data() << QGeoCoordinate(-8.0, 10.0); } -void tst_QGeoBoundingCircle::translate() +void tst_QGeoCircle::translate() { QFETCH(QGeoCoordinate, center); QFETCH(qreal, radius); @@ -208,8 +208,8 @@ void tst_QGeoBoundingCircle::translate() QFETCH(double, lon); QFETCH(QGeoCoordinate, newCenter); - QGeoBoundingCircle c(center, radius); - QGeoBoundingCircle d = c; + QGeoCircle c(center, radius); + QGeoCircle d = c; c.translate(lat, lon); @@ -224,7 +224,7 @@ void tst_QGeoBoundingCircle::translate() QCOMPARE(c.center(), newCenter); } -void tst_QGeoBoundingCircle::valid_data() +void tst_QGeoCircle::valid_data() { QTest::addColumn<QGeoCoordinate>("center"); QTest::addColumn<qreal>("radius"); @@ -239,20 +239,20 @@ void tst_QGeoBoundingCircle::valid_data() QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << true; } -void tst_QGeoBoundingCircle::valid() +void tst_QGeoCircle::valid() { QFETCH(QGeoCoordinate, center); QFETCH(qreal, radius); QFETCH(bool, valid); - QGeoBoundingCircle c(center, radius); + QGeoCircle c(center, radius); QCOMPARE(c.isValid(), valid); - QGeoBoundingArea area = c; + QGeoShape area = c; QCOMPARE(c.isValid(), valid); } -void tst_QGeoBoundingCircle::empty_data() +void tst_QGeoCircle::empty_data() { QTest::addColumn<QGeoCoordinate>("center"); QTest::addColumn<qreal>("radius"); @@ -267,20 +267,20 @@ void tst_QGeoBoundingCircle::empty_data() QTest::newRow("good") << QGeoCoordinate(10, 10) << qreal(5.0) << false; } -void tst_QGeoBoundingCircle::empty() +void tst_QGeoCircle::empty() { QFETCH(QGeoCoordinate, center); QFETCH(qreal, radius); QFETCH(bool, empty); - QGeoBoundingCircle c(center, radius); + QGeoCircle c(center, radius); QCOMPARE(c.isEmpty(), empty); - QGeoBoundingArea area = c; + QGeoShape area = c; QCOMPARE(area.isEmpty(), empty); } -void tst_QGeoBoundingCircle::contains_data() +void tst_QGeoCircle::contains_data() { QTest::addColumn<QGeoCoordinate>("center"); QTest::addColumn<qreal>("radius"); @@ -299,42 +299,42 @@ void tst_QGeoBoundingCircle::contains_data() QGeoCoordinate(1.00071413, 0.99943423) << false; } -void tst_QGeoBoundingCircle::contains() +void tst_QGeoCircle::contains() { QFETCH(QGeoCoordinate, center); QFETCH(qreal, radius); QFETCH(QGeoCoordinate, probe); QFETCH(bool, result); - QGeoBoundingCircle c(center, radius); + QGeoCircle c(center, radius); QCOMPARE(c.contains(probe), result); - QGeoBoundingArea area = c; + QGeoShape area = c; QCOMPARE(area.contains(probe), result); } -void tst_QGeoBoundingCircle::areaComparison_data() +void tst_QGeoCircle::areaComparison_data() { - QTest::addColumn<QGeoBoundingArea>("area"); - QTest::addColumn<QGeoBoundingCircle>("circle"); + QTest::addColumn<QGeoShape>("area"); + QTest::addColumn<QGeoCircle>("circle"); QTest::addColumn<bool>("equal"); - QGeoBoundingCircle c1(QGeoCoordinate(10.0, 0.0), 10.0); - QGeoBoundingCircle c2(QGeoCoordinate(20.0, 10.0), 20.0); - QGeoBoundingBox b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); + QGeoCircle c1(QGeoCoordinate(10.0, 0.0), 10.0); + QGeoCircle c2(QGeoCoordinate(20.0, 10.0), 20.0); + QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QTest::newRow("default constructed") << QGeoBoundingArea() << QGeoBoundingCircle() << false; - QTest::newRow("c1 c1") << QGeoBoundingArea(c1) << c1 << true; - QTest::newRow("c1 c2") << QGeoBoundingArea(c1) << c2 << false; - QTest::newRow("c2 c1") << QGeoBoundingArea(c2) << c1 << false; - QTest::newRow("c2 c2") << QGeoBoundingArea(c2) << c2 << true; - QTest::newRow("b c1") << QGeoBoundingArea(b) << c1 << false; + QTest::newRow("default constructed") << QGeoShape() << QGeoCircle() << false; + QTest::newRow("c1 c1") << QGeoShape(c1) << c1 << true; + QTest::newRow("c1 c2") << QGeoShape(c1) << c2 << false; + QTest::newRow("c2 c1") << QGeoShape(c2) << c1 << false; + QTest::newRow("c2 c2") << QGeoShape(c2) << c2 << true; + QTest::newRow("b c1") << QGeoShape(b) << c1 << false; } -void tst_QGeoBoundingCircle::areaComparison() +void tst_QGeoCircle::areaComparison() { - QFETCH(QGeoBoundingArea, area); - QFETCH(QGeoBoundingCircle, circle); + QFETCH(QGeoShape, area); + QFETCH(QGeoCircle, circle); QFETCH(bool, equal); QCOMPARE((area == circle), equal); @@ -344,23 +344,23 @@ void tst_QGeoBoundingCircle::areaComparison() QCOMPARE((circle != area), !equal); } -void tst_QGeoBoundingCircle::boxComparison_data() +void tst_QGeoCircle::boxComparison_data() { - QTest::addColumn<QGeoBoundingBox>("box"); - QTest::addColumn<QGeoBoundingCircle>("circle"); + QTest::addColumn<QGeoRectangle>("box"); + QTest::addColumn<QGeoCircle>("circle"); QTest::addColumn<bool>("equal"); - QGeoBoundingCircle c(QGeoCoordinate(10.0, 0.0), 10.0); - QGeoBoundingBox b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); + QGeoCircle c(QGeoCoordinate(10.0, 0.0), 10.0); + QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QTest::newRow("default constructed") << QGeoBoundingBox() << QGeoBoundingCircle() << false; + QTest::newRow("default constructed") << QGeoRectangle() << QGeoCircle() << false; QTest::newRow("b c") << b << c << false; } -void tst_QGeoBoundingCircle::boxComparison() +void tst_QGeoCircle::boxComparison() { - QFETCH(QGeoBoundingBox, box); - QFETCH(QGeoBoundingCircle, circle); + QFETCH(QGeoRectangle, box); + QFETCH(QGeoCircle, circle); QFETCH(bool, equal); QCOMPARE((box == circle), equal); @@ -370,5 +370,5 @@ void tst_QGeoBoundingCircle::boxComparison() QCOMPARE((circle != box), !equal); } -QTEST_MAIN(tst_QGeoBoundingCircle) -#include "tst_qgeoboundingcircle.moc" +QTEST_MAIN(tst_QGeoCircle) +#include "tst_qgeocircle.moc" diff --git a/tests/auto/qgeocodereply/tst_qgeocodereply.cpp b/tests/auto/qgeocodereply/tst_qgeocodereply.cpp index e030b090..93edee0a 100644 --- a/tests/auto/qgeocodereply/tst_qgeocodereply.cpp +++ b/tests/auto/qgeocodereply/tst_qgeocodereply.cpp @@ -275,11 +275,11 @@ void tst_QGeocodeReply::viewport() { QGeoCoordinate *qgeocoordinate = new QGeoCoordinate (12.12 , 54.43); - qgeoboundingbox = new QGeoBoundingBox (*qgeocoordinate, 0.5 , 0.5); + qgeoboundingbox = new QGeoRectangle (*qgeocoordinate, 0.5 , 0.5); reply->callSetViewport(*qgeoboundingbox); - QCOMPARE (reply->viewport(), static_cast<const QGeoBoundingArea &>(*qgeoboundingbox)); + QCOMPARE (reply->viewport(), static_cast<const QGeoShape &>(*qgeoboundingbox)); delete qgeocoordinate; delete qgeoboundingbox; diff --git a/tests/auto/qgeocodereply/tst_qgeocodereply.h b/tests/auto/qgeocodereply/tst_qgeocodereply.h index f6971da0..d239362d 100644 --- a/tests/auto/qgeocodereply/tst_qgeocodereply.h +++ b/tests/auto/qgeocodereply/tst_qgeocodereply.h @@ -54,7 +54,7 @@ #include <qgeolocation.h> #include <qgeoaddress.h> #include <qgeocoordinate.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QGeoRectangle> QT_USE_NAMESPACE class SubGeocodeReply : public QGeocodeReply @@ -69,7 +69,7 @@ public: void callSetLimit ( int limit ) {setLimit(limit);} void callSetOffset ( int offset ) {setOffset(offset);} void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);} - void callSetViewport ( const QGeoBoundingArea &viewport ) {setViewport(viewport);} + void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);} }; @@ -108,7 +108,7 @@ private: QSignalSpy *signalfinished; SubGeocodeReply* reply; QGeoLocation *qgeolocation; - QGeoBoundingBox *qgeoboundingbox; + QGeoRectangle *qgeoboundingbox; }; Q_DECLARE_METATYPE( QList<double>); diff --git a/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h index e006d7c9..84f96235 100644 --- a/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h +++ b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.h @@ -51,7 +51,7 @@ #include <qgeoserviceprovider.h> #include <qgeocodingmanager.h> #include <qgeocodereply.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QGeoRectangle> #include <qgeoaddress.h> #include <qgeocoordinate.h> diff --git a/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h index c502010f..d8c8945b 100644 --- a/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h +++ b/tests/auto/qgeocodingmanagerplugins/qgeocodingmanagerengine_test.h @@ -48,11 +48,10 @@ #include <qgeoaddress.h> #include <qgeolocation.h> #include <qgeocodereply.h> - +#include <QtLocation/QGeoCoordinate> QT_USE_NAMESPACE - class GeocodeReplyTest :public QGeocodeReply { Q_OBJECT @@ -65,7 +64,7 @@ public: void callSetLimit ( int limit ) {setLimit(limit);} void callSetOffset ( int offset ) {setOffset(offset);} void callSetLocations ( const QList<QGeoLocation> & locations ) {setLocations(locations);} - void callSetViewport ( const QGeoBoundingArea &viewport ) {setViewport(viewport);} + void callSetViewport ( const QGeoShape &viewport ) {setViewport(viewport);} }; @@ -83,7 +82,7 @@ public: setLocale(QLocale(QLocale::German, QLocale::Germany)); } - QGeocodeReply* geocode ( const QString & searchString, int limit, int offset, const QGeoBoundingArea &bounds ) + QGeocodeReply* geocode ( const QString & searchString, int limit, int offset, const QGeoShape &bounds ) { GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); geocodereply->callSetLimit(limit); @@ -96,7 +95,7 @@ public: return static_cast<QGeocodeReply*>(geocodereply); } - QGeocodeReply* geocode ( const QGeoAddress & address, const QGeoBoundingArea &bounds ) + QGeocodeReply* geocode ( const QGeoAddress & address, const QGeoShape &bounds ) { GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); geocodereply->callSetViewport(bounds); @@ -107,7 +106,7 @@ public: return static_cast<QGeocodeReply*>(geocodereply); } - QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, const QGeoBoundingArea &bounds ) + QGeocodeReply* reverseGeocode ( const QGeoCoordinate & coordinate, const QGeoShape &bounds ) { GeocodeReplyTest *geocodereply = new GeocodeReplyTest(); geocodereply->callSetViewport(bounds); diff --git a/tests/auto/qgeolocation/tst_qgeolocation.cpp b/tests/auto/qgeolocation/tst_qgeolocation.cpp index 0936412e..a8b0844b 100644 --- a/tests/auto/qgeolocation/tst_qgeolocation.cpp +++ b/tests/auto/qgeolocation/tst_qgeolocation.cpp @@ -126,7 +126,7 @@ void tst_QGeoLocation::viewport() m_coordinate.setLatitude(13.3851); m_coordinate.setLongitude(52.5312); - QGeoBoundingBox qgeoboundingboxcopy(m_coordinate, 0.4, 0.4); + QGeoRectangle qgeoboundingboxcopy(m_coordinate, 0.4, 0.4); m_location.setBoundingBox(qgeoboundingboxcopy); QCOMPARE(m_location.boundingBox(),qgeoboundingboxcopy); @@ -192,7 +192,7 @@ void tst_QGeoLocation::comparison() location.setCoordinate(QGeoCoordinate(5,10)); //set viewport - location.setBoundingBox(QGeoBoundingBox(QGeoCoordinate(5,5),0.4,0.4)); + location.setBoundingBox(QGeoRectangle(QGeoCoordinate(5,5),0.4,0.4)); QGeoLocation otherLocation(location); @@ -207,7 +207,7 @@ void tst_QGeoLocation::comparison() } else if (dataField == "coordinate") { otherLocation.setCoordinate(QGeoCoordinate(12,13)); } else if (dataField == "viewport"){ - otherLocation.setBoundingBox(QGeoBoundingBox(QGeoCoordinate(1,2), 0.5,0.5)); + otherLocation.setBoundingBox(QGeoRectangle(QGeoCoordinate(1,2), 0.5,0.5)); } else { qFatal("Unknown data field to test"); } @@ -230,7 +230,7 @@ void tst_QGeoLocation::isEmpty() address.setCity(QLatin1String("Braunschweig")); QVERIFY(!address.isEmpty()); - QGeoBoundingBox boundingBox; + QGeoRectangle boundingBox; boundingBox.setTopLeft(QGeoCoordinate(1, -1)); boundingBox.setBottomRight(QGeoCoordinate(-1, 1)); QVERIFY(!boundingBox.isEmpty()); @@ -254,7 +254,7 @@ void tst_QGeoLocation::isEmpty() // bounding box location.setBoundingBox(boundingBox); QVERIFY(!location.isEmpty()); - location.setBoundingBox(QGeoBoundingBox()); + location.setBoundingBox(QGeoRectangle()); QVERIFY(location.isEmpty()); } diff --git a/tests/auto/qgeolocation/tst_qgeolocation.h b/tests/auto/qgeolocation/tst_qgeolocation.h index 49bde170..7f413842 100644 --- a/tests/auto/qgeolocation/tst_qgeolocation.h +++ b/tests/auto/qgeolocation/tst_qgeolocation.h @@ -51,7 +51,7 @@ #include <qgeoaddress.h> #include <qgeocoordinate.h> #include <qgeolocation.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QGeoRectangle> QT_USE_NAMESPACE @@ -86,7 +86,7 @@ private: QGeoAddress m_address; QGeoCoordinate m_coordinate; - QGeoBoundingBox m_viewport; + QGeoRectangle m_viewport; }; Q_DECLARE_METATYPE( QGeoCoordinate::CoordinateFormat); diff --git a/tests/auto/qgeorectangle/qgeorectangle.pro b/tests/auto/qgeorectangle/qgeorectangle.pro new file mode 100644 index 00000000..2b118bee --- /dev/null +++ b/tests/auto/qgeorectangle/qgeorectangle.pro @@ -0,0 +1,8 @@ +TEMPLATE = app +CONFIG += testcase +TARGET = tst_qgeorectangle + +SOURCES += \ + tst_qgeorectangle.cpp + +QT += location testlib diff --git a/tests/auto/qgeoboundingbox/tst_qgeoboundingbox.cpp b/tests/auto/qgeorectangle/tst_qgeorectangle.cpp index b270f4a4..c3827004 100644 --- a/tests/auto/qgeoboundingbox/tst_qgeoboundingbox.cpp +++ b/tests/auto/qgeorectangle/tst_qgeorectangle.cpp @@ -42,13 +42,13 @@ //TESTED_COMPONENT=src/location #include <QtTest/QtTest> -#include <qgeoboundingbox.h> -#include <qgeoboundingcircle.h> -#include <qgeocoordinate.h> +#include <QtLocation/QGeoCoordinate> +#include <QtLocation/QGeoCircle> +#include <QtLocation/QGeoRectangle> QT_USE_NAMESPACE -class tst_QGeoBoundingBox : public QObject +class tst_QGeoRectangle : public QObject { Q_OBJECT @@ -102,35 +102,35 @@ private slots: void circleComparison_data(); }; -void tst_QGeoBoundingBox::default_constructor() +void tst_QGeoRectangle::default_constructor() { - QGeoBoundingBox box; + QGeoRectangle box; QCOMPARE(box.topLeft().isValid(), false); QCOMPARE(box.bottomRight().isValid(), false); } -void tst_QGeoBoundingBox::center_constructor() +void tst_QGeoRectangle::center_constructor() { - QGeoBoundingBox b1 = QGeoBoundingBox(QGeoCoordinate(5.0, 5.0), 10.0, 10.0); + QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(5.0, 5.0), 10.0, 10.0); QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0)); QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0)); } -void tst_QGeoBoundingBox::corner_constructor() +void tst_QGeoRectangle::corner_constructor() { - QGeoBoundingBox b1 = QGeoBoundingBox(QGeoCoordinate(10.0, 0.0), + QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0)); QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0)); } -void tst_QGeoBoundingBox::copy_constructor() +void tst_QGeoRectangle::copy_constructor() { - QGeoBoundingBox b1 = QGeoBoundingBox(QGeoCoordinate(10.0, 0.0), + QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QGeoBoundingBox b2 = QGeoBoundingBox(b1); + QGeoRectangle b2 = QGeoRectangle(b1); QCOMPARE(b2.topLeft(), QGeoCoordinate(10.0, 0.0)); QCOMPARE(b2.bottomRight(), QGeoCoordinate(0.0, 10.0)); @@ -140,29 +140,29 @@ void tst_QGeoBoundingBox::copy_constructor() QCOMPARE(b1.topLeft(), QGeoCoordinate(10.0, 0.0)); QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0)); - QGeoBoundingArea area; - QGeoBoundingBox areaBox(area); + QGeoShape area; + QGeoRectangle areaBox(area); QVERIFY(!areaBox.isValid()); QVERIFY(areaBox.isEmpty()); - QGeoBoundingCircle circle; - QGeoBoundingBox circleBox(circle); + QGeoCircle circle; + QGeoRectangle circleBox(circle); QVERIFY(!circleBox.isValid()); QVERIFY(circleBox.isEmpty()); } -void tst_QGeoBoundingBox::destructor() +void tst_QGeoRectangle::destructor() { - QGeoBoundingBox *box = new QGeoBoundingBox(); + QGeoRectangle *box = new QGeoRectangle(); delete box; // checking for a crash } -void tst_QGeoBoundingBox::assignment() +void tst_QGeoRectangle::assignment() { - QGeoBoundingBox b1 = QGeoBoundingBox(QGeoCoordinate(10.0, 0.0), + QGeoRectangle b1 = QGeoRectangle(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QGeoBoundingBox b2 = QGeoBoundingBox(QGeoCoordinate(20.0, 0.0), + QGeoRectangle b2 = QGeoRectangle(QGeoCoordinate(20.0, 0.0), QGeoCoordinate(0.0, 20.0)); QVERIFY(b1 != b2); @@ -178,12 +178,12 @@ void tst_QGeoBoundingBox::assignment() QCOMPARE(b1.bottomRight(), QGeoCoordinate(0.0, 10.0)); // Assign b1 to an area - QGeoBoundingArea area = b1; + QGeoShape area = b1; QCOMPARE(area.type(), b1.type()); QVERIFY(area == b1); // Assign the area back to a bounding box - QGeoBoundingBox ba = area; + QGeoRectangle ba = area; QCOMPARE(ba.topLeft(), b1.topLeft()); QCOMPARE(ba.bottomRight(), b1.bottomRight()); @@ -193,12 +193,12 @@ void tst_QGeoBoundingBox::assignment() QVERIFY(ba != b1); } -void tst_QGeoBoundingBox::equality() +void tst_QGeoRectangle::equality() { - QFETCH(QGeoBoundingBox, box1); - QFETCH(QGeoBoundingBox, box2); - QFETCH(QGeoBoundingArea, area1); - QFETCH(QGeoBoundingArea, area2); + QFETCH(QGeoRectangle, box1); + QFETCH(QGeoRectangle, box2); + QFETCH(QGeoShape, area1); + QFETCH(QGeoShape, area2); QFETCH(bool, equal); // compare boxes @@ -218,12 +218,12 @@ void tst_QGeoBoundingBox::equality() QCOMPARE((box1 != area2), !equal); } -void tst_QGeoBoundingBox::equality_data() +void tst_QGeoRectangle::equality_data() { - QTest::addColumn<QGeoBoundingBox>("box1"); - QTest::addColumn<QGeoBoundingBox>("box2"); - QTest::addColumn<QGeoBoundingArea>("area1"); - QTest::addColumn<QGeoBoundingArea>("area2"); + QTest::addColumn<QGeoRectangle>("box1"); + QTest::addColumn<QGeoRectangle>("box2"); + QTest::addColumn<QGeoShape>("area1"); + QTest::addColumn<QGeoShape>("area2"); QTest::addColumn<bool>("equal"); QGeoCoordinate c1(10, 5); @@ -231,17 +231,17 @@ void tst_QGeoBoundingBox::equality_data() QGeoCoordinate c3(20, 15); QGeoCoordinate c4(15, 20); - QGeoBoundingBox b1(c1, c2); - QGeoBoundingBox b2(c3, c4); - QGeoBoundingBox b3(c3, c2); - QGeoBoundingBox b4(c1, c3); - QGeoBoundingBox b5(c1, c2); + QGeoRectangle b1(c1, c2); + QGeoRectangle b2(c3, c4); + QGeoRectangle b3(c3, c2); + QGeoRectangle b4(c1, c3); + QGeoRectangle b5(c1, c2); - QGeoBoundingArea a1(b1); - QGeoBoundingArea a2(b2); - QGeoBoundingArea a3(b3); - QGeoBoundingArea a4(b4); - QGeoBoundingArea a5(b5); + QGeoShape a1(b1); + QGeoShape a2(b2); + QGeoShape a3(b3); + QGeoShape a4(b4); + QGeoShape a5(b5); QTest::newRow("all unequal") << b1 << b2 << a1 << a2 << false; @@ -253,20 +253,20 @@ void tst_QGeoBoundingBox::equality_data() << b1 << b5 << a1 << a5 << true; } -void tst_QGeoBoundingBox::isValid() +void tst_QGeoRectangle::isValid() { - QFETCH(QGeoBoundingBox, input); + QFETCH(QGeoRectangle, input); QFETCH(bool, valid); QCOMPARE(input.isValid(), valid); - QGeoBoundingArea area = input; + QGeoShape area = input; QCOMPARE(area.isValid(), valid); } -void tst_QGeoBoundingBox::isValid_data() +void tst_QGeoRectangle::isValid_data() { - QTest::addColumn<QGeoBoundingBox>("input"); + QTest::addColumn<QGeoRectangle>("input"); QTest::addColumn<bool>("valid"); QGeoCoordinate c0; @@ -274,31 +274,31 @@ void tst_QGeoBoundingBox::isValid_data() QGeoCoordinate c2(5, 10); QTest::newRow("both corners invalid") - << QGeoBoundingBox(c0, c0) << false; + << QGeoRectangle(c0, c0) << false; QTest::newRow("top left corner invalid") - << QGeoBoundingBox(c0, c2) << false; + << QGeoRectangle(c0, c2) << false; QTest::newRow("bottom right corner invalid") - << QGeoBoundingBox(c1, c0) << false; + << QGeoRectangle(c1, c0) << false; QTest::newRow("height in wrong order") - << QGeoBoundingBox(c2, c1) << false; + << QGeoRectangle(c2, c1) << false; QTest::newRow("both corners valid") - << QGeoBoundingBox(c1, c2) << true; + << QGeoRectangle(c1, c2) << true; } -void tst_QGeoBoundingBox::isEmpty() +void tst_QGeoRectangle::isEmpty() { - QFETCH(QGeoBoundingBox, input); + QFETCH(QGeoRectangle, input); QFETCH(bool, empty); QCOMPARE(input.isEmpty(), empty); - QGeoBoundingArea area = input; + QGeoShape area = input; QCOMPARE(area.isEmpty(), empty); } -void tst_QGeoBoundingBox::isEmpty_data() +void tst_QGeoRectangle::isEmpty_data() { - QTest::addColumn<QGeoBoundingBox>("input"); + QTest::addColumn<QGeoRectangle>("input"); QTest::addColumn<bool>("empty"); QGeoCoordinate c0; @@ -307,24 +307,24 @@ void tst_QGeoBoundingBox::isEmpty_data() QGeoCoordinate c3(10, 10); QTest::newRow("both corners invalid") - << QGeoBoundingBox(c0, c0) << true; + << QGeoRectangle(c0, c0) << true; QTest::newRow("top left corner invalid") - << QGeoBoundingBox(c0, c2) << true; + << QGeoRectangle(c0, c2) << true; QTest::newRow("bottom right corner invalid") - << QGeoBoundingBox(c1, c0) << true; + << QGeoRectangle(c1, c0) << true; QTest::newRow("zero width") - << QGeoBoundingBox(c1, c3) << true; + << QGeoRectangle(c1, c3) << true; QTest::newRow("zero height") - << QGeoBoundingBox(c3, c2) << true; + << QGeoRectangle(c3, c2) << true; QTest::newRow("zero width and height") - << QGeoBoundingBox(c1, c1) << true; + << QGeoRectangle(c1, c1) << true; QTest::newRow("non-zero width and height") - << QGeoBoundingBox(c1, c2) << false; + << QGeoRectangle(c1, c2) << false; } -void tst_QGeoBoundingBox::corners() +void tst_QGeoRectangle::corners() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(QGeoCoordinate, topLeft); QFETCH(QGeoCoordinate, topRight); QFETCH(QGeoCoordinate, bottomLeft); @@ -336,9 +336,9 @@ void tst_QGeoBoundingBox::corners() QCOMPARE(box.bottomRight(), bottomRight); } -void tst_QGeoBoundingBox::corners_data() +void tst_QGeoRectangle::corners_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<QGeoCoordinate>("topLeft"); QTest::addColumn<QGeoCoordinate>("topRight"); QTest::addColumn<QGeoCoordinate>("bottomLeft"); @@ -351,34 +351,34 @@ void tst_QGeoBoundingBox::corners_data() QGeoCoordinate bl(5, 5); QTest::newRow("both invalid") - << QGeoBoundingBox(c0, c0) + << QGeoRectangle(c0, c0) << c0 << c0 << c0 << c0; QTest::newRow("top left invalid") - << QGeoBoundingBox(c0, br) + << QGeoRectangle(c0, br) << c0 << c0 << c0 << br; QTest::newRow("bottom right invalid") - << QGeoBoundingBox(tl, c0) + << QGeoRectangle(tl, c0) << tl << c0 << c0 << c0; QTest::newRow("both valid") - << QGeoBoundingBox(tl, br) + << QGeoRectangle(tl, br) << tl << tr << bl << br; } -void tst_QGeoBoundingBox::setCorners() +void tst_QGeoRectangle::setCorners() { - QGeoBoundingBox box(QGeoCoordinate(10.0, 0.0), + QGeoRectangle box(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); box.setTopLeft(QGeoCoordinate(20.0, -10.0)); @@ -412,12 +412,12 @@ void tst_QGeoBoundingBox::setCorners() } -void tst_QGeoBoundingBox::width() +void tst_QGeoRectangle::width() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(double, oldWidth); QFETCH(double, newWidth); - QFETCH(QGeoBoundingBox, newBox); + QFETCH(QGeoRectangle, newBox); if (qIsNaN(oldWidth)) QVERIFY(qIsNaN(box.width())); @@ -429,186 +429,186 @@ void tst_QGeoBoundingBox::width() QCOMPARE(box, newBox); } -void tst_QGeoBoundingBox::width_data() +void tst_QGeoRectangle::width_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<double>("oldWidth"); QTest::addColumn<double>("newWidth"); - QTest::addColumn<QGeoBoundingBox>("newBox"); + QTest::addColumn<QGeoRectangle>("newBox"); QTest::newRow("invalid box") - << QGeoBoundingBox() + << QGeoRectangle() << qQNaN() << 100.0 - << QGeoBoundingBox(); + << QGeoRectangle(); QTest::newRow("0 width -> negative width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << -1.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)); QTest::newRow("0 width -> 0 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << 0.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)); QTest::newRow("0 width -> non wrapping width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << 10.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)); QTest::newRow("0 width -> wrapping width positive") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -5.0), + << QGeoRectangle(QGeoCoordinate(10.0, -5.0), QGeoCoordinate(5.0, -175.0)); QTest::newRow("0 width -> wrapping width negative") - << QGeoBoundingBox(QGeoCoordinate(10.0, -90.0), + << QGeoRectangle(QGeoCoordinate(10.0, -90.0), QGeoCoordinate(5.0, -90.0)) << 0.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, 5.0)); QTest::newRow("0 width -> 360 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << 360.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); QTest::newRow("0 width -> 360+ width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)) << 0.0 << 370.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); QTest::newRow("non wrapping width -> negative width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << -1.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)); QTest::newRow("non wrapping width -> 0 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << 0.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 90.0), + << QGeoRectangle(QGeoCoordinate(10.0, 90.0), QGeoCoordinate(5.0, 90.0)); QTest::newRow("non wrapping width -> non wrapping width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 80.0), + << QGeoRectangle(QGeoCoordinate(10.0, 80.0), QGeoCoordinate(5.0, 100.0)); QTest::newRow("non wrapping width -> wrapping width positive") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -5.0), + << QGeoRectangle(QGeoCoordinate(10.0, -5.0), QGeoCoordinate(5.0, -175.0)); QTest::newRow("non wrapping width -> wrapping width negative") - << QGeoBoundingBox(QGeoCoordinate(10.0, -95.0), + << QGeoRectangle(QGeoCoordinate(10.0, -95.0), QGeoCoordinate(5.0, -85.0)) << 10.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, 5.0)); QTest::newRow("non wrapping width -> 360 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << 360.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); QTest::newRow("non wrapping width width -> 360+ width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 85.0), + << QGeoRectangle(QGeoCoordinate(10.0, 85.0), QGeoCoordinate(5.0, 95.0)) << 10.0 << 370.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); QTest::newRow("wrapping width -> negative width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << -1.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)); QTest::newRow("wrapping width -> 0 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << 0.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -135.0), + << QGeoRectangle(QGeoCoordinate(10.0, -135.0), QGeoCoordinate(5.0, -135.0)); QTest::newRow("wrapping width -> non wrapping width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << 80.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -175.0), + << QGeoRectangle(QGeoCoordinate(10.0, -175.0), QGeoCoordinate(5.0, -95.0)); QTest::newRow("wrapping width -> wrapping width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << 120.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 165.0), + << QGeoRectangle(QGeoCoordinate(10.0, 165.0), QGeoCoordinate(5.0, -75.0)); QTest::newRow("wrapping width -> 360 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << 360.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); QTest::newRow("wrapping width width -> 360+ width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 175.0), + << QGeoRectangle(QGeoCoordinate(10.0, 175.0), QGeoCoordinate(5.0, -85.0)) << 100.0 << 370.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)); } -void tst_QGeoBoundingBox::height() +void tst_QGeoRectangle::height() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(double, oldHeight); QFETCH(double, newHeight); - QFETCH(QGeoBoundingBox, newBox); + QFETCH(QGeoRectangle, newBox); if (qIsNaN(oldHeight)) QVERIFY(qIsNaN(box.height())); @@ -619,354 +619,354 @@ void tst_QGeoBoundingBox::height() QCOMPARE(box, newBox); } -void tst_QGeoBoundingBox::height_data() +void tst_QGeoRectangle::height_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<double>("oldHeight"); QTest::addColumn<double>("newHeight"); - QTest::addColumn<QGeoBoundingBox>("newBox"); + QTest::addColumn<QGeoRectangle>("newBox"); QTest::newRow("invalid box") - << QGeoBoundingBox() + << QGeoRectangle() << qQNaN() << 100.0 - << QGeoBoundingBox(); + << QGeoRectangle(); QTest::newRow("0 height -> negative height") - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(10.0, 10.0)) << 0.0 << -1.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(10.0, 10.0)); QTest::newRow("0 height -> 0 height") - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(10.0, 10.0)) << 0.0 << 0.0 - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(10.0, 10.0)); QTest::newRow("0 height -> non zero height") - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(10.0, 10.0)) << 0.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(20.0, 5.0), + << QGeoRectangle(QGeoCoordinate(20.0, 5.0), QGeoCoordinate(0.0, 10.0)); QTest::newRow("0 height -> squash top") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(70.0, 70.0)) << 0.0 << 60.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(50.0, 70.0)); QTest::newRow("0 height -> squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-70.0, 30.0), QGeoCoordinate(-70.0, 70.0)) << 0.0 << 60.0 - << QGeoBoundingBox(QGeoCoordinate(-50.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-50.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("0 height -> 180") - << QGeoBoundingBox(QGeoCoordinate(0.0, 5.0), + << QGeoRectangle(QGeoCoordinate(0.0, 5.0), QGeoCoordinate(0.0, 10.0)) << 0.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-90.0, 10.0)); QTest::newRow("0 height -> 180 squash top") - << QGeoBoundingBox(QGeoCoordinate(20.0, 5.0), + << QGeoRectangle(QGeoCoordinate(20.0, 5.0), QGeoCoordinate(20.0, 10.0)) << 0.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-50.0, 10.0)); QTest::newRow("0 height -> 180 squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-20.0, 5.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 5.0), QGeoCoordinate(-20.0, 10.0)) << 0.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 5.0), + << QGeoRectangle(QGeoCoordinate(50.0, 5.0), QGeoCoordinate(-90.0, 10.0)); QTest::newRow("0 height -> 180+") - << QGeoBoundingBox(QGeoCoordinate(0.0, 5.0), + << QGeoRectangle(QGeoCoordinate(0.0, 5.0), QGeoCoordinate(0.0, 10.0)) << 0.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-90.0, 10.0)); QTest::newRow("0 height -> 180+ squash top") - << QGeoBoundingBox(QGeoCoordinate(20.0, 5.0), + << QGeoRectangle(QGeoCoordinate(20.0, 5.0), QGeoCoordinate(20.0, 10.0)) << 0.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-50.0, 10.0)); QTest::newRow("0 height -> 180+ squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-20.0, 5.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 5.0), QGeoCoordinate(-20.0, 10.0)) << 0.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 5.0), + << QGeoRectangle(QGeoCoordinate(50.0, 5.0), QGeoCoordinate(-90.0, 10.0)); QTest::newRow("non zero height -> negative height") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << -1.0 - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)); QTest::newRow("non zero height -> 0 height") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << 0.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 30.0), + << QGeoRectangle(QGeoCoordinate(50.0, 30.0), QGeoCoordinate(50.0, 70.0)); QTest::newRow("non zero height -> non zero height") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(60.0, 30.0), + << QGeoRectangle(QGeoCoordinate(60.0, 30.0), QGeoCoordinate(40.0, 70.0)); QTest::newRow("non zero height -> squash top") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << 100.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(10.0, 70.0)); QTest::newRow("non zero height -> squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 30.0), QGeoCoordinate(-70.0, 70.0)) << 40.0 << 100.0 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("non zero height -> 180") - << QGeoBoundingBox(QGeoCoordinate(20.0, 30.0), + << QGeoRectangle(QGeoCoordinate(20.0, 30.0), QGeoCoordinate(-20.0, 70.0)) << 40.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("non zero height -> 180 squash top") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(10.0, 70.0)); QTest::newRow("non zero height -> 180 squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 30.0), QGeoCoordinate(-70.0, 70.0)) << 40.0 << 180.0 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("non zero height -> 180+") - << QGeoBoundingBox(QGeoCoordinate(20.0, 30.0), + << QGeoRectangle(QGeoCoordinate(20.0, 30.0), QGeoCoordinate(-20.0, 70.0)) << 40.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("non zero height -> 180+ squash top") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << 40.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(10.0, 70.0)); QTest::newRow("non zero height -> 180+ squash bottom") - << QGeoBoundingBox(QGeoCoordinate(-30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 30.0), QGeoCoordinate(-70.0, 70.0)) << 40.0 << 190.0 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 30.0), QGeoCoordinate(-90.0, 70.0)); } -void tst_QGeoBoundingBox::center() +void tst_QGeoRectangle::center() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(QGeoCoordinate, oldCenter); QFETCH(QGeoCoordinate, newCenter); - QFETCH(QGeoBoundingBox, newBox); + QFETCH(QGeoRectangle, newBox); QCOMPARE(box.center(), oldCenter); box.setCenter(newCenter); QCOMPARE(box, newBox); } -void tst_QGeoBoundingBox::center_data() +void tst_QGeoRectangle::center_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<QGeoCoordinate>("oldCenter"); QTest::addColumn<QGeoCoordinate>("newCenter"); - QTest::addColumn<QGeoBoundingBox>("newBox"); + QTest::addColumn<QGeoRectangle>("newBox"); QTest::newRow("invalid") - << QGeoBoundingBox() + << QGeoRectangle() << QGeoCoordinate() << QGeoCoordinate(0.0, 0.0) - << QGeoBoundingBox(QGeoCoordinate(0.0, 0.0), 0.0, 0.0); + << QGeoRectangle(QGeoCoordinate(0.0, 0.0), 0.0, 0.0); QTest::newRow("zero width") - << QGeoBoundingBox(QGeoCoordinate(10.0, 5.0), + << QGeoRectangle(QGeoCoordinate(10.0, 5.0), QGeoCoordinate(5.0, 5.0)) << QGeoCoordinate(7.5, 5.0) << QGeoCoordinate(20.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(22.5, 20.0), + << QGeoRectangle(QGeoCoordinate(22.5, 20.0), QGeoCoordinate(17.5, 20.0)); QTest::newRow("360 width") - << QGeoBoundingBox(QGeoCoordinate(10.0, -180.0), + << QGeoRectangle(QGeoCoordinate(10.0, -180.0), QGeoCoordinate(5.0, 180.0)) << QGeoCoordinate(7.5, 0.0) << QGeoCoordinate(20.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(22.5, -180.0), + << QGeoRectangle(QGeoCoordinate(22.5, -180.0), QGeoCoordinate(17.5, 180.0)); QTest::newRow("zero height") - << QGeoBoundingBox(QGeoCoordinate(5.0, 5.0), + << QGeoRectangle(QGeoCoordinate(5.0, 5.0), QGeoCoordinate(5.0, 10.0)) << QGeoCoordinate(5.0, 7.5) << QGeoCoordinate(20.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(20.0, 17.5), + << QGeoRectangle(QGeoCoordinate(20.0, 17.5), QGeoCoordinate(20.0, 22.5)); QTest::newRow("180 height -> move") - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-90.0, 10.0)) << QGeoCoordinate(0.0, 7.5) << QGeoCoordinate(0.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(90.0, 17.5), + << QGeoRectangle(QGeoCoordinate(90.0, 17.5), QGeoCoordinate(-90.0, 22.5)); QTest::newRow("180 height -> squash top") - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-90.0, 10.0)) << QGeoCoordinate(0.0, 7.5) << QGeoCoordinate(-20.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(50.0, 17.5), + << QGeoRectangle(QGeoCoordinate(50.0, 17.5), QGeoCoordinate(-90.0, 22.5)); QTest::newRow("180 height -> squash bottom") - << QGeoBoundingBox(QGeoCoordinate(90.0, 5.0), + << QGeoRectangle(QGeoCoordinate(90.0, 5.0), QGeoCoordinate(-90.0, 10.0)) << QGeoCoordinate(0.0, 7.5) << QGeoCoordinate(20.0, 20.0) - << QGeoBoundingBox(QGeoCoordinate(90.0, 17.5), + << QGeoRectangle(QGeoCoordinate(90.0, 17.5), QGeoCoordinate(-50.0, 22.5)); QTest::newRow("non wrapping -> non wrapping") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << QGeoCoordinate(50.0, 50.0) << QGeoCoordinate(10.0, 10.0) - << QGeoBoundingBox(QGeoCoordinate(30.0, -10.0), + << QGeoRectangle(QGeoCoordinate(30.0, -10.0), QGeoCoordinate(-10.0, 30.0)); QTest::newRow("non wrapping -> wrapping") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << QGeoCoordinate(50.0, 50.0) << QGeoCoordinate(10.0, 170.0) - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-10.0, -170.0)); QTest::newRow("non wrapping -> squash top") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << QGeoCoordinate(50.0, 50.0) << QGeoCoordinate(80.0, 50.0) - << QGeoBoundingBox(QGeoCoordinate(90.0, 30.0), + << QGeoRectangle(QGeoCoordinate(90.0, 30.0), QGeoCoordinate(70.0, 70.0)); QTest::newRow("non wrapping -> squash bottom") - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)) << QGeoCoordinate(50.0, 50.0) << QGeoCoordinate(-80.0, 50.0) - << QGeoBoundingBox(QGeoCoordinate(-70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-70.0, 30.0), QGeoCoordinate(-90.0, 70.0)); QTest::newRow("wrapping -> non wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-10.0, -170.0)) << QGeoCoordinate(10.0, 170.0) << QGeoCoordinate(50.0, 50.0) - << QGeoBoundingBox(QGeoCoordinate(70.0, 30.0), + << QGeoRectangle(QGeoCoordinate(70.0, 30.0), QGeoCoordinate(30.0, 70.0)); QTest::newRow("wrapping -> wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-10.0, -170.0)) << QGeoCoordinate(10.0, 170.0) << QGeoCoordinate(10.0, -170.0) - << QGeoBoundingBox(QGeoCoordinate(30.0, 170.0), + << QGeoRectangle(QGeoCoordinate(30.0, 170.0), QGeoCoordinate(-10.0, -150.0)); QTest::newRow("wrapping -> squash top") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-10.0, -170.0)) << QGeoCoordinate(10.0, 170.0) << QGeoCoordinate(80.0, 170.0) - << QGeoBoundingBox(QGeoCoordinate(90.0, 150.0), + << QGeoRectangle(QGeoCoordinate(90.0, 150.0), QGeoCoordinate(70.0, -170.0)); QTest::newRow("wrapping -> squash bottom") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-10.0, -170.0)) << QGeoCoordinate(10.0, 170.0) << QGeoCoordinate(-80.0, 170.0) - << QGeoBoundingBox(QGeoCoordinate(-70.0, 150.0), + << QGeoRectangle(QGeoCoordinate(-70.0, 150.0), QGeoCoordinate(-90.0, -170.0)); } -void tst_QGeoBoundingBox::containsCoord() +void tst_QGeoRectangle::containsCoord() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(QGeoCoordinate, coord); QFETCH(bool, contains); QCOMPARE(box.contains(coord), contains); - QGeoBoundingArea area = box; + QGeoShape area = box; QCOMPARE(area.contains(coord), contains); } -void tst_QGeoBoundingBox::containsCoord_data() +void tst_QGeoRectangle::containsCoord_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<QGeoCoordinate>("coord"); QTest::addColumn<bool>("contains"); - QGeoBoundingBox b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70)); + QGeoRectangle b1(QGeoCoordinate(70, 30), QGeoCoordinate(30, 70)); double lonLO1 = 20.0; double lonL1 = 30.0; @@ -1035,7 +1035,7 @@ void tst_QGeoBoundingBox::containsCoord_data() QTest::newRow("non wrapped - bottom right - outside") << b1 << QGeoCoordinate(latBO1, lonRO1) << false; - QGeoBoundingBox b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170)); + QGeoRectangle b2(QGeoCoordinate(70, 150), QGeoCoordinate(30, -170)); double lonLO2 = 140.0; double lonL2 = 150.0; @@ -1104,7 +1104,7 @@ void tst_QGeoBoundingBox::containsCoord_data() QTest::newRow("wrapped - bottom right - outside") << b2 << QGeoCoordinate(latBO2, lonRO2) << false; - QGeoBoundingBox b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70)); + QGeoRectangle b3(QGeoCoordinate(90, 30), QGeoCoordinate(50, 70)); double lonLO3 = 20.0; double lonL3 = 30.0; @@ -1154,7 +1154,7 @@ void tst_QGeoBoundingBox::containsCoord_data() QTest::newRow("north pole - top right - outside") << b3 << QGeoCoordinate(latT3, lonRO3) << true; - QGeoBoundingBox b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70)); + QGeoRectangle b4(QGeoCoordinate(-50, 30), QGeoCoordinate(-90, 70)); double lonLO4 = 20.0; double lonL4 = 30.0; @@ -1205,10 +1205,10 @@ void tst_QGeoBoundingBox::containsCoord_data() << b4 << QGeoCoordinate(latB4, lonRO4) << true; } -void tst_QGeoBoundingBox::containsBoxAndIntersects() +void tst_QGeoRectangle::containsBoxAndIntersects() { - QFETCH(QGeoBoundingBox, box1); - QFETCH(QGeoBoundingBox, box2); + QFETCH(QGeoRectangle, box1); + QFETCH(QGeoRectangle, box2); QFETCH(bool, contains); QFETCH(bool, intersects); @@ -1216,597 +1216,597 @@ void tst_QGeoBoundingBox::containsBoxAndIntersects() QCOMPARE(box1.intersects(box2), intersects); } -void tst_QGeoBoundingBox::containsBoxAndIntersects_data() +void tst_QGeoRectangle::containsBoxAndIntersects_data() { - QTest::addColumn<QGeoBoundingBox>("box1"); - QTest::addColumn<QGeoBoundingBox>("box2"); + QTest::addColumn<QGeoRectangle>("box1"); + QTest::addColumn<QGeoRectangle>("box2"); QTest::addColumn<bool>("contains"); QTest::addColumn<bool>("intersects"); - QGeoBoundingBox b1(QGeoCoordinate(30.0, -30.0), + QGeoRectangle b1(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("non wrapped same") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) << true << true; QTest::newRow("non wrapped smaller") << b1 - << QGeoBoundingBox(QGeoCoordinate(20.0, -20.0), + << QGeoRectangle(QGeoCoordinate(20.0, -20.0), QGeoCoordinate(-20.0, 20.0)) << true << true; QTest::newRow("non wrapped larger") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -40.0), + << QGeoRectangle(QGeoCoordinate(40.0, -40.0), QGeoCoordinate(-40.0, 40.0)) << false << true; QTest::newRow("non wrapped outside top") << b1 - << QGeoBoundingBox(QGeoCoordinate(80.0, -30.0), + << QGeoRectangle(QGeoCoordinate(80.0, -30.0), QGeoCoordinate(50.0, 30.0)) << false << false; QTest::newRow("non wrapped outside bottom") << b1 - << QGeoBoundingBox(QGeoCoordinate(-50.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-50.0, -30.0), QGeoCoordinate(-80.0, 30.0)) << false << false; QTest::newRow("non wrapped outside left") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, -80.0), + << QGeoRectangle(QGeoCoordinate(30.0, -80.0), QGeoCoordinate(-30.0, -50.0)) << false << false; QTest::newRow("non wrapped outside wrapped") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) << false << false; QTest::newRow("non wrapped outside right") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, 50.0), + << QGeoRectangle(QGeoCoordinate(30.0, 50.0), QGeoCoordinate(-30.0, 80.0)) << false << false; QTest::newRow("non wrapped top left cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -40.0), + << QGeoRectangle(QGeoCoordinate(40.0, -40.0), QGeoCoordinate(20.0, -20.0)) << false << true; QTest::newRow("non wrapped top cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -10.0), + << QGeoRectangle(QGeoCoordinate(40.0, -10.0), QGeoCoordinate(20.0, 10.0)) << false << true; QTest::newRow("non wrapped top right cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, 20.0), + << QGeoRectangle(QGeoCoordinate(40.0, 20.0), QGeoCoordinate(20.0, 40.0)) << false << true; QTest::newRow("non wrapped left cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, -40.0), + << QGeoRectangle(QGeoCoordinate(10.0, -40.0), QGeoCoordinate(-10.0, -20.0)) << false << true; QTest::newRow("non wrapped right cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, 20.0), + << QGeoRectangle(QGeoCoordinate(10.0, 20.0), QGeoCoordinate(-10.0, 40.0)) << false << true; QTest::newRow("non wrapped bottom left cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(-20.0, -40.0), + << QGeoRectangle(QGeoCoordinate(-20.0, -40.0), QGeoCoordinate(-40.0, -20.0)) << false << true; QTest::newRow("non wrapped bottom cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(-20.0, -10.0), + << QGeoRectangle(QGeoCoordinate(-20.0, -10.0), QGeoCoordinate(-40.0, 10.0)) << false << true; QTest::newRow("non wrapped bottom right cross") << b1 - << QGeoBoundingBox(QGeoCoordinate(-20.0, 20.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 20.0), QGeoCoordinate(-40.0, 40.0)) << false << true; QTest::newRow("non wrapped top left touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(50.0, -50.0), + << QGeoRectangle(QGeoCoordinate(50.0, -50.0), QGeoCoordinate(30.0, -30.0)) << false << true; QTest::newRow("non wrapped top touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(50.0, -10.0), + << QGeoRectangle(QGeoCoordinate(50.0, -10.0), QGeoCoordinate(30.0, 10.0)) << false << true; QTest::newRow("non wrapped top right touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(50.0, 30.0), + << QGeoRectangle(QGeoCoordinate(50.0, 30.0), QGeoCoordinate(30.0, 50.0)) << false << true; QTest::newRow("non wrapped left touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, -50.0), + << QGeoRectangle(QGeoCoordinate(10.0, -50.0), QGeoCoordinate(-10.0, -30.0)) << false << true; QTest::newRow("non wrapped right touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, 30.0), + << QGeoRectangle(QGeoCoordinate(10.0, 30.0), QGeoCoordinate(-10.0, 50.0)) << false << true; QTest::newRow("non wrapped bottom left touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, -30.0), QGeoCoordinate(-50.0, -50.0)) << false << true; QTest::newRow("non wrapped bottom touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-30.0, -10.0), + << QGeoRectangle(QGeoCoordinate(-30.0, -10.0), QGeoCoordinate(-50.0, 10.0)) << false << true; QTest::newRow("non wrapped bottom right touch outside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 30.0), QGeoCoordinate(-50.0, 50.0)) << false << true; QTest::newRow("non wrapped top left touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(10.0, -10.0)) << true << true; QTest::newRow("non wrapped top touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, -10.0), + << QGeoRectangle(QGeoCoordinate(30.0, -10.0), QGeoCoordinate(10.0, 10.0)) << true << true; QTest::newRow("non wrapped top right touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(10.0, 30.0)) << true << true; QTest::newRow("non wrapped left touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, -30.0), + << QGeoRectangle(QGeoCoordinate(10.0, -30.0), QGeoCoordinate(-10.0, -10.0)) << true << true; QTest::newRow("non wrapped right touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, 10.0), + << QGeoRectangle(QGeoCoordinate(10.0, 10.0), QGeoCoordinate(-10.0, 30.0)) << true << true; QTest::newRow("non wrapped bottom left touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-10.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-10.0, -30.0), QGeoCoordinate(-30.0, -10.0)) << true << true; QTest::newRow("non wrapped bottom touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-10.0, -10.0), + << QGeoRectangle(QGeoCoordinate(-10.0, -10.0), QGeoCoordinate(-30.0, 10.0)) << true << true; QTest::newRow("non wrapped bottom right touch inside") << b1 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 10.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 10.0), QGeoCoordinate(-30.0, 30.0)) << true << true; QTest::newRow("non wrapped top lon strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -40.0), + << QGeoRectangle(QGeoCoordinate(40.0, -40.0), QGeoCoordinate(20.0, 40.0)) << false << true; QTest::newRow("non wrapped center lon strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(10.0, -40.0), + << QGeoRectangle(QGeoCoordinate(10.0, -40.0), QGeoCoordinate(-10.0, 40.0)) << false << true; QTest::newRow("non wrapped bottom lon strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(-20.0, -40.0), + << QGeoRectangle(QGeoCoordinate(-20.0, -40.0), QGeoCoordinate(-40.0, 40.0)) << false << true; QTest::newRow("non wrapped left lat strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -40.0), + << QGeoRectangle(QGeoCoordinate(40.0, -40.0), QGeoCoordinate(-40.0, -20.0)) << false << true; QTest::newRow("non wrapped center lat strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, -10.0), + << QGeoRectangle(QGeoCoordinate(40.0, -10.0), QGeoCoordinate(-40.0, 10.0)) << false << true; QTest::newRow("non wrapped right lat strip") << b1 - << QGeoBoundingBox(QGeoCoordinate(40.0, 20.0), + << QGeoRectangle(QGeoCoordinate(40.0, 20.0), QGeoCoordinate(-40.0, 40.0)) << false << true; - QGeoBoundingBox b2(QGeoCoordinate(30.0, 150.0), + QGeoRectangle b2(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)); QTest::newRow("wrapped same") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) << true << true; QTest::newRow("wrapped smaller") << b2 - << QGeoBoundingBox(QGeoCoordinate(20.0, 160.0), + << QGeoRectangle(QGeoCoordinate(20.0, 160.0), QGeoCoordinate(-20.0, -160.0)) << true << true; QTest::newRow("wrapped larger") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 140.0), + << QGeoRectangle(QGeoCoordinate(40.0, 140.0), QGeoCoordinate(-40.0, -140.0)) << false << true; QTest::newRow("wrapped outside top") << b2 - << QGeoBoundingBox(QGeoCoordinate(80.0, 150.0), + << QGeoRectangle(QGeoCoordinate(80.0, 150.0), QGeoCoordinate(50.0, -150.0)) << false << false; QTest::newRow("wrapped outside bottom") << b2 - << QGeoBoundingBox(QGeoCoordinate(-50.0, 150.0), + << QGeoRectangle(QGeoCoordinate(-50.0, 150.0), QGeoCoordinate(-80.0, -150.0)) << false << false; QTest::newRow("wrapped outside left") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, 70.0), + << QGeoRectangle(QGeoCoordinate(30.0, 70.0), QGeoCoordinate(-30.0, 130.0)) << false << false; QTest::newRow("wrapped outside right") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, -130.0), + << QGeoRectangle(QGeoCoordinate(30.0, -130.0), QGeoCoordinate(-30.0, -70.0)) << false << false; QTest::newRow("wrapped top left cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 140.0), + << QGeoRectangle(QGeoCoordinate(40.0, 140.0), QGeoCoordinate(20.0, 160.0)) << false << true; QTest::newRow("wrapped top cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 170.0), + << QGeoRectangle(QGeoCoordinate(40.0, 170.0), QGeoCoordinate(20.0, -170.0)) << false << true; QTest::newRow("wrapped top right cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, -160.0), + << QGeoRectangle(QGeoCoordinate(40.0, -160.0), QGeoCoordinate(20.0, -140.0)) << false << true; QTest::newRow("wrapped left cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, 140.0), + << QGeoRectangle(QGeoCoordinate(10.0, 140.0), QGeoCoordinate(-10.0, 160.0)) << false << true; QTest::newRow("wrapped right cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, -160.0), + << QGeoRectangle(QGeoCoordinate(10.0, -160.0), QGeoCoordinate(-10.0, -140.0)) << false << true; QTest::newRow("wrapped bottom left cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(-20.0, 140.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 140.0), QGeoCoordinate(-40.0, 160.0)) << false << true; QTest::newRow("wrapped bottom cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(-20.0, 170.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 170.0), QGeoCoordinate(-40.0, -170.0)) << false << true; QTest::newRow("wrapped bottom right cross") << b2 - << QGeoBoundingBox(QGeoCoordinate(-20.0, -160.0), + << QGeoRectangle(QGeoCoordinate(-20.0, -160.0), QGeoCoordinate(-40.0, -140.0)) << false << true; QTest::newRow("wrapped top left touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(50.0, 130.0), + << QGeoRectangle(QGeoCoordinate(50.0, 130.0), QGeoCoordinate(30.0, 150.0)) << false << true; QTest::newRow("wrapped top touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(50.0, 170.0), + << QGeoRectangle(QGeoCoordinate(50.0, 170.0), QGeoCoordinate(30.0, -170.0)) << false << true; QTest::newRow("wrapped top right touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(50.0, -150.0), + << QGeoRectangle(QGeoCoordinate(50.0, -150.0), QGeoCoordinate(30.0, -130.0)) << false << true; QTest::newRow("wrapped left touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, 130.0), + << QGeoRectangle(QGeoCoordinate(10.0, 130.0), QGeoCoordinate(-10.0, 150.0)) << false << true; QTest::newRow("wrapped right touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, -150.0), + << QGeoRectangle(QGeoCoordinate(10.0, -150.0), QGeoCoordinate(-10.0, -130.0)) << false << true; QTest::newRow("wrapped bottom left touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 150.0), QGeoCoordinate(-50.0, 130.0)) << false << true; QTest::newRow("wrapped bottom touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-30.0, 170.0), + << QGeoRectangle(QGeoCoordinate(-30.0, 170.0), QGeoCoordinate(-50.0, -170.0)) << false << true; QTest::newRow("wrapped bottom right touch outside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-30.0, -150.0), + << QGeoRectangle(QGeoCoordinate(-30.0, -150.0), QGeoCoordinate(-50.0, -130.0)) << false << true; QTest::newRow("wrapped top left touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(10.0, 170.0)) << true << true; QTest::newRow("wrapped top touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, 170.0), + << QGeoRectangle(QGeoCoordinate(30.0, 170.0), QGeoCoordinate(10.0, -170.0)) << true << true; QTest::newRow("wrapped top right touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(10.0, -150.0)) << true << true; QTest::newRow("wrapped left touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, 150.0), + << QGeoRectangle(QGeoCoordinate(10.0, 150.0), QGeoCoordinate(-10.0, 170.0)) << true << true; QTest::newRow("wrapped right touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, -170.0), + << QGeoRectangle(QGeoCoordinate(10.0, -170.0), QGeoCoordinate(-10.0, -150.0)) << true << true; QTest::newRow("wrapped bottom left touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 150.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 150.0), QGeoCoordinate(-30.0, 170.0)) << true << true; QTest::newRow("wrapped bottom touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-10.0, 170.0), + << QGeoRectangle(QGeoCoordinate(-10.0, 170.0), QGeoCoordinate(-30.0, -170.0)) << true << true; QTest::newRow("wrapped bottom right touch inside") << b2 - << QGeoBoundingBox(QGeoCoordinate(-10.0, -170.0), + << QGeoRectangle(QGeoCoordinate(-10.0, -170.0), QGeoCoordinate(-30.0, -150.0)) << true << true; QTest::newRow("wrapped top lon strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 140.0), + << QGeoRectangle(QGeoCoordinate(40.0, 140.0), QGeoCoordinate(20.0, -140.0)) << false << true; QTest::newRow("wrapped center lon strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(10.0, 140.0), + << QGeoRectangle(QGeoCoordinate(10.0, 140.0), QGeoCoordinate(-10.0, -140.0)) << false << true; QTest::newRow("wrapped bottom lon strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(-20.0, 140.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 140.0), QGeoCoordinate(-40.0, -140.0)) << false << true; QTest::newRow("wrapped left lat strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 140.0), + << QGeoRectangle(QGeoCoordinate(40.0, 140.0), QGeoCoordinate(-40.0, 160.0)) << false << true; QTest::newRow("wrapped center lat strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, 170.0), + << QGeoRectangle(QGeoCoordinate(40.0, 170.0), QGeoCoordinate(-40.0, -170.0)) << false << true; QTest::newRow("wrapped right lat strip") << b2 - << QGeoBoundingBox(QGeoCoordinate(40.0, -160.0), + << QGeoRectangle(QGeoCoordinate(40.0, -160.0), QGeoCoordinate(-40.0, -140.0)) << false << true; QTest::newRow("north pole touching") - << QGeoBoundingBox(QGeoCoordinate(90.0, 20.0), + << QGeoRectangle(QGeoCoordinate(90.0, 20.0), QGeoCoordinate(40.0, 40.0)) - << QGeoBoundingBox(QGeoCoordinate(90.0, 60.0), + << QGeoRectangle(QGeoCoordinate(90.0, 60.0), QGeoCoordinate(30.0, 80.0)) << false << true; QTest::newRow("south pole touching") - << QGeoBoundingBox(QGeoCoordinate(40.0, 20.0), + << QGeoRectangle(QGeoCoordinate(40.0, 20.0), QGeoCoordinate(-90.0, 40.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 60.0), + << QGeoRectangle(QGeoCoordinate(30.0, 60.0), QGeoCoordinate(-90.0, 80.0)) << false << true; } -void tst_QGeoBoundingBox::translate() +void tst_QGeoRectangle::translate() { - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoRectangle, box); QFETCH(double, degreesLatitude); QFETCH(double, degreesLongitude); - QFETCH(QGeoBoundingBox, newBox); + QFETCH(QGeoRectangle, newBox); - QGeoBoundingBox test = box.translated(degreesLatitude, degreesLongitude); + QGeoRectangle test = box.translated(degreesLatitude, degreesLongitude); QCOMPARE(test, newBox); box.translate(degreesLatitude, degreesLongitude); QCOMPARE(box, newBox); } -void tst_QGeoBoundingBox::translate_data() +void tst_QGeoRectangle::translate_data() { - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<double>("degreesLatitude"); QTest::addColumn<double>("degreesLongitude"); - QTest::addColumn<QGeoBoundingBox>("newBox"); + QTest::addColumn<QGeoRectangle>("newBox"); QTest::newRow("invalid") - << QGeoBoundingBox() + << QGeoRectangle() << 20.0 << 20.0 - << QGeoBoundingBox(); + << QGeoRectangle(); QTest::newRow("360 width") - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, -180.0), + << QGeoRectangle(QGeoCoordinate(50.0, -180.0), QGeoCoordinate(-10.0, 180.0)); QTest::newRow("180 height") - << QGeoBoundingBox(QGeoCoordinate(90.0, -30.0), + << QGeoRectangle(QGeoCoordinate(90.0, -30.0), QGeoCoordinate(-90.0, 30.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, -10.0), + << QGeoRectangle(QGeoCoordinate(90.0, -10.0), QGeoCoordinate(-90.0, 50.0)); QTest::newRow("non wrapping -> non wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, -10.0), + << QGeoRectangle(QGeoCoordinate(50.0, -10.0), QGeoCoordinate(-10.0, 50.0)); QTest::newRow("non wrapping -> wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, 110.0), + << QGeoRectangle(QGeoCoordinate(30.0, 110.0), QGeoCoordinate(-30.0, 170.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 130.0), + << QGeoRectangle(QGeoCoordinate(50.0, 130.0), QGeoCoordinate(-10.0, -170.0)); QTest::newRow("non wrapping -> north clip") - << QGeoBoundingBox(QGeoCoordinate(80.0, -30.0), + << QGeoRectangle(QGeoCoordinate(80.0, -30.0), QGeoCoordinate(20.0, 30.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, -10.0), + << QGeoRectangle(QGeoCoordinate(90.0, -10.0), QGeoCoordinate(40.0, 50.0)); QTest::newRow("non wrapping -> south clip") - << QGeoBoundingBox(QGeoCoordinate(-20.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-20.0, -30.0), QGeoCoordinate(-80.0, 30.0)) << -20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(-40.0, -10.0), + << QGeoRectangle(QGeoCoordinate(-40.0, -10.0), QGeoCoordinate(-90.0, 50.0)); QTest::newRow("wrapping -> non wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, 130.0), + << QGeoRectangle(QGeoCoordinate(30.0, 130.0), QGeoCoordinate(-30.0, -170.0)) << 20.0 << -20.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 110.0), + << QGeoRectangle(QGeoCoordinate(50.0, 110.0), QGeoCoordinate(-10.0, 170.0)); QTest::newRow("wrapping -> wrapping") - << QGeoBoundingBox(QGeoCoordinate(30.0, 130.0), + << QGeoRectangle(QGeoCoordinate(30.0, 130.0), QGeoCoordinate(-30.0, -170.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(50.0, 150.0), + << QGeoRectangle(QGeoCoordinate(50.0, 150.0), QGeoCoordinate(-10.0, -150.0)); QTest::newRow("wrapping -> north clip") - << QGeoBoundingBox(QGeoCoordinate(80.0, 130.0), + << QGeoRectangle(QGeoCoordinate(80.0, 130.0), QGeoCoordinate(20.0, -170.0)) << 20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(90.0, 150.0), + << QGeoRectangle(QGeoCoordinate(90.0, 150.0), QGeoCoordinate(40.0, -150.0)); QTest::newRow("wrapping -> south clip") - << QGeoBoundingBox(QGeoCoordinate(-20.0, 130.0), + << QGeoRectangle(QGeoCoordinate(-20.0, 130.0), QGeoCoordinate(-80.0, -170.0)) << -20.0 << 20.0 - << QGeoBoundingBox(QGeoCoordinate(-40.0, 150.0), + << QGeoRectangle(QGeoCoordinate(-40.0, 150.0), QGeoCoordinate(-90.0, -150.0)); } -void tst_QGeoBoundingBox::unite() +void tst_QGeoRectangle::unite() { - QFETCH(QGeoBoundingBox, in1); - QFETCH(QGeoBoundingBox, in2); - QFETCH(QGeoBoundingBox, out); + QFETCH(QGeoRectangle, in1); + QFETCH(QGeoRectangle, in2); + QFETCH(QGeoRectangle, out); QCOMPARE(in1.united(in2), out); QCOMPARE(in2.united(in1), out); @@ -1814,404 +1814,404 @@ void tst_QGeoBoundingBox::unite() QCOMPARE(in1 | in2, out); QCOMPARE(in2 | in1, out); - QGeoBoundingBox united1 = QGeoBoundingBox(in1); + QGeoRectangle united1 = QGeoRectangle(in1); united1 |= in2; QCOMPARE(united1, out); - QGeoBoundingBox united2 = QGeoBoundingBox(in2); + QGeoRectangle united2 = QGeoRectangle(in2); united2 |= in1; QCOMPARE(united2, out); } -void tst_QGeoBoundingBox::unite_data() +void tst_QGeoRectangle::unite_data() { - QTest::addColumn<QGeoBoundingBox>("in1"); - QTest::addColumn<QGeoBoundingBox>("in2"); - QTest::addColumn<QGeoBoundingBox>("out"); + QTest::addColumn<QGeoRectangle>("in1"); + QTest::addColumn<QGeoRectangle>("in2"); + QTest::addColumn<QGeoRectangle>("out"); QTest::newRow("central and taller") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(50.0, -30.0), + << QGeoRectangle(QGeoCoordinate(50.0, -30.0), QGeoCoordinate(-50.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(50.0, -30.0), + << QGeoRectangle(QGeoCoordinate(50.0, -30.0), QGeoCoordinate(-50.0, 30.0)); QTest::newRow("central and 180 high") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(90.0, -30.0), + << QGeoRectangle(QGeoCoordinate(90.0, -30.0), QGeoCoordinate(-90.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(90.0, -30.0), + << QGeoRectangle(QGeoCoordinate(90.0, -30.0), QGeoCoordinate(-90.0, 30.0)); QTest::newRow("central and non overlapping higher") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(50.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("central and overlapping higher") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(0.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("central and touching higher") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(60.0, -30.0), + << QGeoRectangle(QGeoCoordinate(60.0, -30.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("central and non overlapping lower") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(-50.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-50.0, -30.0), QGeoCoordinate(-60.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-60.0, 30.0)); QTest::newRow("central and overlapping lower") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(0.0, -30.0), + << QGeoRectangle(QGeoCoordinate(0.0, -30.0), QGeoCoordinate(-60.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-60.0, 30.0)); QTest::newRow("central and touching lower") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(-30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(-30.0, -30.0), QGeoCoordinate(-60.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-60.0, 30.0)); QTest::newRow("non wrapping central and wider") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -50.0), + << QGeoRectangle(QGeoCoordinate(30.0, -50.0), QGeoCoordinate(-30.0, 50.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -50.0), + << QGeoRectangle(QGeoCoordinate(30.0, -50.0), QGeoCoordinate(-30.0, 50.0)); QTest::newRow("non wrapping central and 360 width") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("non wrapping central and non overlapping non wrapping left") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -110.0), + << QGeoRectangle(QGeoCoordinate(30.0, -110.0), QGeoCoordinate(-30.0, -50.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -110.0), + << QGeoRectangle(QGeoCoordinate(30.0, -110.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("non wrapping central and overlapping non wrapping left") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -80.0), + << QGeoRectangle(QGeoCoordinate(30.0, -80.0), QGeoCoordinate(-30.0, -20.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -80.0), + << QGeoRectangle(QGeoCoordinate(30.0, -80.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("non wrapping central and touching non wrapping left") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, -30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, 30.0)); QTest::newRow("non wrapping central and non overlapping non wrapping right") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 50.0), + << QGeoRectangle(QGeoCoordinate(30.0, 50.0), QGeoCoordinate(-30.0, 110.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 110.0)); QTest::newRow("non wrapping central and overlapping non wrapping right") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 20.0), + << QGeoRectangle(QGeoCoordinate(30.0, 20.0), QGeoCoordinate(-30.0, 80.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 80.0)); QTest::newRow("non wrapping central and touching non wrapping right") - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(30.0, 30.0), QGeoCoordinate(-30.0, 90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 90.0)); QTest::newRow("wrapping and wider") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 130.0), + << QGeoRectangle(QGeoCoordinate(30.0, 130.0), QGeoCoordinate(-30.0, -130.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 130.0), + << QGeoRectangle(QGeoCoordinate(30.0, 130.0), QGeoCoordinate(-30.0, -130.0)); QTest::newRow("wrapping and 360 width") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("wrapping and non overlapping right") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -130.0), + << QGeoRectangle(QGeoCoordinate(30.0, -130.0), QGeoCoordinate(-30.0, -70.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -70.0)); QTest::newRow("wrapping and overlapping right") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -160.0), + << QGeoRectangle(QGeoCoordinate(30.0, -160.0), QGeoCoordinate(-30.0, -70.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -70.0)); QTest::newRow("wrapping and touching right") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -150.0), + << QGeoRectangle(QGeoCoordinate(30.0, -150.0), QGeoCoordinate(-30.0, -90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -90.0)); QTest::newRow("wrapping and non overlapping left") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 70.0), + << QGeoRectangle(QGeoCoordinate(30.0, 70.0), QGeoCoordinate(-30.0, 130.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 70.0), + << QGeoRectangle(QGeoCoordinate(30.0, 70.0), QGeoCoordinate(-30.0, -150.0)); QTest::newRow("wrapping and overlapping left") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 100.0), + << QGeoRectangle(QGeoCoordinate(30.0, 100.0), QGeoCoordinate(-30.0, 160.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 100.0), + << QGeoRectangle(QGeoCoordinate(30.0, 100.0), QGeoCoordinate(-30.0, -150.0)); QTest::newRow("wrapping and touching left") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, 150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, -150.0)); QTest::newRow("wrapping and non overlapping center") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -30.0), + << QGeoRectangle(QGeoCoordinate(30.0, -30.0), QGeoCoordinate(-30.0, 30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("wrapping and overlapping center") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -160.0), + << QGeoRectangle(QGeoCoordinate(30.0, -160.0), QGeoCoordinate(-30.0, 160.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("wrapping and touching center") - << QGeoBoundingBox(QGeoCoordinate(30.0, 150.0), + << QGeoRectangle(QGeoCoordinate(30.0, 150.0), QGeoCoordinate(-30.0, -150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -150.0), + << QGeoRectangle(QGeoCoordinate(30.0, -150.0), QGeoCoordinate(-30.0, 150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("small gap over zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -20.0), + << QGeoRectangle(QGeoCoordinate(30.0, -20.0), QGeoCoordinate(-30.0, -10.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(-30.0, 20.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -20.0), + << QGeoRectangle(QGeoCoordinate(30.0, -20.0), QGeoCoordinate(-30.0, 20.0)); QTest::newRow("small gap before zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -40.0), + << QGeoRectangle(QGeoCoordinate(30.0, -40.0), QGeoCoordinate(-30.0, -30.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -20.0), + << QGeoRectangle(QGeoCoordinate(30.0, -20.0), QGeoCoordinate(-30.0, -10.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -40.0), + << QGeoRectangle(QGeoCoordinate(30.0, -40.0), QGeoCoordinate(-30.0, -10.0)); QTest::newRow("small gap after zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(-30.0, 20.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 30.0), + << QGeoRectangle(QGeoCoordinate(30.0, 30.0), QGeoCoordinate(-30.0, 40.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(-30.0, 40.0)); QTest::newRow("small gap over dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 160.0), + << QGeoRectangle(QGeoCoordinate(30.0, 160.0), QGeoCoordinate(-30.0, 170.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(-30.0, -160.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 160.0), + << QGeoRectangle(QGeoCoordinate(30.0, 160.0), QGeoCoordinate(-30.0, -160.0)); QTest::newRow("small gap before dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 140.0), + << QGeoRectangle(QGeoCoordinate(30.0, 140.0), QGeoCoordinate(-30.0, 150.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 160.0), + << QGeoRectangle(QGeoCoordinate(30.0, 160.0), QGeoCoordinate(-30.0, 170.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 140.0), + << QGeoRectangle(QGeoCoordinate(30.0, 140.0), QGeoCoordinate(-30.0, 170.0)); QTest::newRow("small gap after dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(-30.0, -160.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -150.0), + << QGeoRectangle(QGeoCoordinate(30.0, -150.0), QGeoCoordinate(-30.0, -140.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(-30.0, -140.0)); QTest::newRow("90-degree inner gap over zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -55.0), + << QGeoRectangle(QGeoCoordinate(30.0, -55.0), QGeoCoordinate(-30.0, -45.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 45.0), + << QGeoRectangle(QGeoCoordinate(30.0, 45.0), QGeoCoordinate(-30.0, 55.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -55.0), + << QGeoRectangle(QGeoCoordinate(30.0, -55.0), QGeoCoordinate(-30.0, 55.0)); QTest::newRow("90-degree inner gap before zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -20.0), + << QGeoRectangle(QGeoCoordinate(30.0, -20.0), QGeoCoordinate(-30.0, -10.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -65.0), + << QGeoRectangle(QGeoCoordinate(30.0, -65.0), QGeoCoordinate(-30.0, -55.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -65.0), + << QGeoRectangle(QGeoCoordinate(30.0, -65.0), QGeoCoordinate(-30.0, -10.0)); QTest::newRow("90-degree inner gap after zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, 65.0), + << QGeoRectangle(QGeoCoordinate(30.0, 65.0), QGeoCoordinate(-30.0, 75.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(-30.0, 20.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 10.0), + << QGeoRectangle(QGeoCoordinate(30.0, 10.0), QGeoCoordinate(-30.0, 75.0)); QTest::newRow("90-degree inner gap over dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 125.0), + << QGeoRectangle(QGeoCoordinate(30.0, 125.0), QGeoCoordinate(-30.0, 135.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -135.0), + << QGeoRectangle(QGeoCoordinate(30.0, -135.0), QGeoCoordinate(-30.0, -125.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 125.0), + << QGeoRectangle(QGeoCoordinate(30.0, 125.0), QGeoCoordinate(-30.0, -125.0)); QTest::newRow("90-degree inner gap before dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 160.0), + << QGeoRectangle(QGeoCoordinate(30.0, 160.0), QGeoCoordinate(-30.0, 170.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 50.0), + << QGeoRectangle(QGeoCoordinate(30.0, 50.0), QGeoCoordinate(-30.0, 60.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 50.0), + << QGeoRectangle(QGeoCoordinate(30.0, 50.0), QGeoCoordinate(-30.0, 170.0)); QTest::newRow("90-degree inner gap after dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(-30.0, -160.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -60.0), + << QGeoRectangle(QGeoCoordinate(30.0, -60.0), QGeoCoordinate(-30.0, -50.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -170.0), + << QGeoRectangle(QGeoCoordinate(30.0, -170.0), QGeoCoordinate(-30.0, -50.0)); QTest::newRow("180-degree inner gap centered on zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -100.0), + << QGeoRectangle(QGeoCoordinate(30.0, -100.0), QGeoCoordinate(-30.0, -90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, 100.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, -90.0)); QTest::newRow("180-degree outer gap cenetered on zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, -80.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 80.0), + << QGeoRectangle(QGeoCoordinate(30.0, 80.0), QGeoCoordinate(-30.0, 90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, 90.0)); QTest::newRow("180-degree shift centered on zero line") - << QGeoBoundingBox(QGeoCoordinate(30.0, -100.0), + << QGeoRectangle(QGeoCoordinate(30.0, -100.0), QGeoCoordinate(-30.0, -80.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 80.0), + << QGeoRectangle(QGeoCoordinate(30.0, 80.0), QGeoCoordinate(-30.0, 100.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); QTest::newRow("180-degree inner gap centered on dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 80.0), + << QGeoRectangle(QGeoCoordinate(30.0, 80.0), QGeoCoordinate(-30.0, 90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, -80.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -90.0), + << QGeoRectangle(QGeoCoordinate(30.0, -90.0), QGeoCoordinate(-30.0, 90.0)); QTest::newRow("180-degree outer gap centered on dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, 100.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -100.0), + << QGeoRectangle(QGeoCoordinate(30.0, -100.0), QGeoCoordinate(-30.0, -90.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, 90.0), + << QGeoRectangle(QGeoCoordinate(30.0, 90.0), QGeoCoordinate(-30.0, -90.0)); QTest::newRow("180-degree shift centered on dateline") - << QGeoBoundingBox(QGeoCoordinate(30.0, 80.0), + << QGeoRectangle(QGeoCoordinate(30.0, 80.0), QGeoCoordinate(-30.0, 100.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -100.0), + << QGeoRectangle(QGeoCoordinate(30.0, -100.0), QGeoCoordinate(-30.0, -80.0)) - << QGeoBoundingBox(QGeoCoordinate(30.0, -180.0), + << QGeoRectangle(QGeoCoordinate(30.0, -180.0), QGeoCoordinate(-30.0, 180.0)); } -void tst_QGeoBoundingBox::areaComparison_data() +void tst_QGeoRectangle::areaComparison_data() { - QTest::addColumn<QGeoBoundingArea>("area"); - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoShape>("area"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<bool>("equal"); - QGeoBoundingBox b1(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QGeoBoundingBox b2(QGeoCoordinate(20.0, 0.0), QGeoCoordinate(0.0, 20.0)); - QGeoBoundingCircle c(QGeoCoordinate(0.0, 0.0), 10); + QGeoRectangle b1(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); + QGeoRectangle b2(QGeoCoordinate(20.0, 0.0), QGeoCoordinate(0.0, 20.0)); + QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10); - QTest::newRow("default constructed") << QGeoBoundingArea() << QGeoBoundingBox() << false; - QTest::newRow("b1 b1") << QGeoBoundingArea(b1) << b1 << true; - QTest::newRow("b1 b2") << QGeoBoundingArea(b1) << b2 << false; - QTest::newRow("b2 b1") << QGeoBoundingArea(b2) << b1 << false; - QTest::newRow("b2 b2") << QGeoBoundingArea(b2) << b2 << true; - QTest::newRow("c b1") << QGeoBoundingArea(c) << b1 << false; + QTest::newRow("default constructed") << QGeoShape() << QGeoRectangle() << false; + QTest::newRow("b1 b1") << QGeoShape(b1) << b1 << true; + QTest::newRow("b1 b2") << QGeoShape(b1) << b2 << false; + QTest::newRow("b2 b1") << QGeoShape(b2) << b1 << false; + QTest::newRow("b2 b2") << QGeoShape(b2) << b2 << true; + QTest::newRow("c b1") << QGeoShape(c) << b1 << false; } -void tst_QGeoBoundingBox::areaComparison() +void tst_QGeoRectangle::areaComparison() { - QFETCH(QGeoBoundingArea, area); - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoShape, area); + QFETCH(QGeoRectangle, box); QFETCH(bool, equal); QCOMPARE((area == box), equal); @@ -2221,23 +2221,23 @@ void tst_QGeoBoundingBox::areaComparison() QCOMPARE((box != area), !equal); } -void tst_QGeoBoundingBox::circleComparison_data() +void tst_QGeoRectangle::circleComparison_data() { - QTest::addColumn<QGeoBoundingCircle>("circle"); - QTest::addColumn<QGeoBoundingBox>("box"); + QTest::addColumn<QGeoCircle>("circle"); + QTest::addColumn<QGeoRectangle>("box"); QTest::addColumn<bool>("equal"); - QGeoBoundingBox b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); - QGeoBoundingCircle c(QGeoCoordinate(0.0, 0.0), 10); + QGeoRectangle b(QGeoCoordinate(10.0, 0.0), QGeoCoordinate(0.0, 10.0)); + QGeoCircle c(QGeoCoordinate(0.0, 0.0), 10); - QTest::newRow("default constructed") << QGeoBoundingCircle() << QGeoBoundingBox() << false; + QTest::newRow("default constructed") << QGeoCircle() << QGeoRectangle() << false; QTest::newRow("c b") << c << b << false; } -void tst_QGeoBoundingBox::circleComparison() +void tst_QGeoRectangle::circleComparison() { - QFETCH(QGeoBoundingCircle, circle); - QFETCH(QGeoBoundingBox, box); + QFETCH(QGeoCircle, circle); + QFETCH(QGeoRectangle, box); QFETCH(bool, equal); QCOMPARE((circle == box), equal); @@ -2247,6 +2247,6 @@ void tst_QGeoBoundingBox::circleComparison() QCOMPARE((box != circle), !equal); } -QTEST_MAIN(tst_QGeoBoundingBox) -#include "tst_qgeoboundingbox.moc" +QTEST_MAIN(tst_QGeoRectangle) +#include "tst_qgeorectangle.moc" diff --git a/tests/auto/qgeoroute/tst_qgeoroute.cpp b/tests/auto/qgeoroute/tst_qgeoroute.cpp index 0d094850..ebc96c71 100644 --- a/tests/auto/qgeoroute/tst_qgeoroute.cpp +++ b/tests/auto/qgeoroute/tst_qgeoroute.cpp @@ -69,7 +69,7 @@ void tst_QGeoRoute::cleanup() void tst_QGeoRoute::constructor() { QString empty = ""; - QGeoBoundingBox *boundingbox = new QGeoBoundingBox(); + QGeoRectangle *boundingbox = new QGeoRectangle(); QCOMPARE(qgeoroute->bounds(), *boundingbox); QCOMPARE(qgeoroute->distance(), qreal(0.0)); @@ -103,7 +103,7 @@ void tst_QGeoRoute::bounds() qgeocoordinate->setLatitude(13.3851); qgeocoordinate->setLongitude(52.5312); - QGeoBoundingBox *qgeoboundingbox = new QGeoBoundingBox(*qgeocoordinate,0.4,0.4); + QGeoRectangle *qgeoboundingbox = new QGeoRectangle(*qgeocoordinate,0.4,0.4); qgeoroute->setBounds(*qgeoboundingbox); diff --git a/tests/auto/qgeoroute/tst_qgeoroute.h b/tests/auto/qgeoroute/tst_qgeoroute.h index 27779894..6183406a 100644 --- a/tests/auto/qgeoroute/tst_qgeoroute.h +++ b/tests/auto/qgeoroute/tst_qgeoroute.h @@ -47,7 +47,7 @@ #include <QMetaType> #include <qgeoroute.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QGeoRectangle> #include <qgeocoordinate.h> #include <qgeorouterequest.h> #include <qgeoroutesegment.h> @@ -87,7 +87,7 @@ private Q_SLOTS: private: QGeoRoute *qgeoroute; - QGeoBoundingBox *qgeoboundingbox; + QGeoRectangle *qgeoboundingbox; QGeoCoordinate *qgeocoordinate; QGeoRouteRequest *qgeorouterequest; QGeoRouteSegment *qgeoroutesegment; diff --git a/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp b/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp index 049cbd9f..31a96faa 100644 --- a/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp +++ b/tests/auto/qgeorouterequest/tst_qgeorouterequest.cpp @@ -41,6 +41,8 @@ #include "tst_qgeorouterequest.h" +#include <QtLocation/QGeoRectangle> + QT_USE_NAMESPACE tst_QGeoRouteRequest::tst_QGeoRouteRequest() @@ -58,7 +60,7 @@ void tst_QGeoRouteRequest::cleanupTestCase() void tst_QGeoRouteRequest::init() { qgeocoordinate = new QGeoCoordinate(); - qgeoboundingbox = new QGeoBoundingBox(); + qgeoboundingbox = new QGeoRectangle(); qgeorouterequest = new QGeoRouteRequest(); } @@ -143,9 +145,9 @@ void tst_QGeoRouteRequest::excludeAreas() QGeoCoordinate *qgeocoordinatecopy = new QGeoCoordinate(34.324 , -110.32); - QGeoBoundingBox *qgeoboundingboxcopy = new QGeoBoundingBox(*qgeocoordinate, 0.4, 0.4); - QGeoBoundingBox *qgeoboundingboxcopy2 = new QGeoBoundingBox(*qgeocoordinatecopy, 1.2, 0.9); - QList<QGeoBoundingBox> areas; + QGeoRectangle *qgeoboundingboxcopy = new QGeoRectangle(*qgeocoordinate, 0.4, 0.4); + QGeoRectangle *qgeoboundingboxcopy2 = new QGeoRectangle(*qgeocoordinatecopy, 1.2, 0.9); + QList<QGeoRectangle> areas; areas.append(*qgeoboundingboxcopy); areas.append(*qgeoboundingboxcopy2); diff --git a/tests/auto/qgeorouterequest/tst_qgeorouterequest.h b/tests/auto/qgeorouterequest/tst_qgeorouterequest.h index ef96c1e7..024f3a0b 100644 --- a/tests/auto/qgeorouterequest/tst_qgeorouterequest.h +++ b/tests/auto/qgeorouterequest/tst_qgeorouterequest.h @@ -47,7 +47,7 @@ #include <QMetaType> #include <qgeocoordinate.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QGeoRectangle> #include <qgeorouterequest.h> @@ -89,7 +89,7 @@ private Q_SLOTS: private: QGeoCoordinate *qgeocoordinate; - QGeoBoundingBox *qgeoboundingbox; + QGeoRectangle *qgeoboundingbox; QGeoRouteRequest *qgeorouterequest; }; diff --git a/tests/auto/qgeoshape/qgeoshape.pro b/tests/auto/qgeoshape/qgeoshape.pro new file mode 100644 index 00000000..729e2244 --- /dev/null +++ b/tests/auto/qgeoshape/qgeoshape.pro @@ -0,0 +1,5 @@ +load(testcase) +TARGET = tst_qgeoshape +QT += testlib location +SOURCES = \ + tst_qgeoshape.cpp diff --git a/tests/auto/qgeoboundingarea/tst_qgeoboundingarea.cpp b/tests/auto/qgeoshape/tst_qgeoshape.cpp index 5f1c68c4..45775eea 100644 --- a/tests/auto/qgeoboundingarea/tst_qgeoboundingarea.cpp +++ b/tests/auto/qgeoshape/tst_qgeoshape.cpp @@ -40,9 +40,9 @@ ****************************************************************************/ #include <QtTest/QtTest> -#include <QtLocation/QGeoBoundingArea> +#include <QtLocation/QGeoShape> -class tst_qgeoboundingarea : public QObject +class tst_qgeoshape : public QObject { Q_OBJECT @@ -50,17 +50,17 @@ private slots: void testArea(); }; -void tst_qgeoboundingarea::testArea() +void tst_qgeoshape::testArea() { - QGeoBoundingArea area; + QGeoShape area; QVERIFY(!area.isValid()); QVERIFY(area.isEmpty()); - QCOMPARE(area.type(), QGeoBoundingArea::UnknownType); + QCOMPARE(area.type(), QGeoShape::UnknownType); QVERIFY(!area.contains(QGeoCoordinate())); - // QGeoBoundingArea never constructs a QGeoBoundingAreaPrivate. Hence d_ptr is always 0. + // QGeoShape never constructs a QGeoShapePrivate. Hence d_ptr is always 0. - QGeoBoundingArea area2; + QGeoShape area2; QCOMPARE(area, area2); @@ -68,10 +68,10 @@ void tst_qgeoboundingarea::testArea() QCOMPARE(area, area2); - QGeoBoundingArea area3(area2); + QGeoShape area3(area2); QCOMPARE(area2, area3); } -QTEST_MAIN(tst_qgeoboundingarea) -#include "tst_qgeoboundingarea.moc" +QTEST_MAIN(tst_qgeoshape) +#include "tst_qgeoshape.moc" diff --git a/tests/auto/qmlinterface/data/TestBoundingCircle.qml b/tests/auto/qmlinterface/data/TestGeoCircle.qml index 7b6fb4da..b505a365 100644 --- a/tests/auto/qmlinterface/data/TestBoundingCircle.qml +++ b/tests/auto/qmlinterface/data/TestGeoCircle.qml @@ -41,7 +41,7 @@ import QtLocation 5.0 -BoundingCircle { +GeoCircle { center: TestCoordinate { } radius: 30.0 } diff --git a/tests/auto/qmlinterface/data/TestBoundingBox.qml b/tests/auto/qmlinterface/data/TestGeoRectangle.qml index db79a900..14d785ce 100644 --- a/tests/auto/qmlinterface/data/TestBoundingBox.qml +++ b/tests/auto/qmlinterface/data/TestGeoRectangle.qml @@ -41,7 +41,7 @@ import QtLocation 5.0 -BoundingBox { +GeoRectangle { center: TestCoordinate { } height: 30.0 width: 40.0 diff --git a/tests/auto/qmlinterface/data/TestLocation.qml b/tests/auto/qmlinterface/data/TestLocation.qml index e6368ae8..046b7459 100644 --- a/tests/auto/qmlinterface/data/TestLocation.qml +++ b/tests/auto/qmlinterface/data/TestLocation.qml @@ -43,6 +43,6 @@ import QtLocation 5.0 Location { address: TestAddress { } - boundingBox: TestBoundingBox { } + boundingBox: TestGeoRectangle { } coordinate: TestCoordinate { } } diff --git a/tests/auto/qmlinterface/qmlinterface.pro b/tests/auto/qmlinterface/qmlinterface.pro index 93864587..2b346d0e 100644 --- a/tests/auto/qmlinterface/qmlinterface.pro +++ b/tests/auto/qmlinterface/qmlinterface.pro @@ -22,8 +22,6 @@ OTHER_FILES += \ data/TestCategory.qml \ data/TestCoordinate.qml \ data/TestAddress.qml \ - data/TestBoundingBox.qml \ - data/TestBoundingCircle.qml \ data/TestLocation.qml \ data/TestPlace.qml \ data/TestIcon.qml \ @@ -31,5 +29,7 @@ OTHER_FILES += \ data/TestSupplier.qml \ data/TestUser.qml \ data/TestPlaceAttribute.qml \ - data/TestContactDetail.qml + data/TestContactDetail.qml \ + data/TestGeoRectangle.qml \ + data/TestGeoCircle.qml diff --git a/tests/auto/qmlinterface/tst_qmlinterface.cpp b/tests/auto/qmlinterface/tst_qmlinterface.cpp index ad9c957d..ce3e800a 100644 --- a/tests/auto/qmlinterface/tst_qmlinterface.cpp +++ b/tests/auto/qmlinterface/tst_qmlinterface.cpp @@ -45,8 +45,8 @@ #include <QtQml/QQmlListReference> #include <QtLocation/QGeoCoordinate> #include <QtLocation/QGeoAddress> -#include <QtLocation/QGeoBoundingBox> -#include <QtLocation/QGeoBoundingCircle> +#include <QtLocation/QGeoRectangle> +#include <QtLocation/QGeoCircle> #include <QtLocation/QGeoLocation> #include <QtLocation/QPlaceCategory> #include <QtLocation/QPlace> @@ -67,8 +67,8 @@ public: private Q_SLOTS: void testCoordinate(); void testAddress(); - void testBoundingBox(); - void testBoundingCircle(); + void testGeoRectangle(); + void testGeoCircle(); void testLocation(); void testCategory(); void testIcon(); @@ -82,8 +82,8 @@ private Q_SLOTS: private: QGeoCoordinate m_coordinate; QGeoAddress m_address; - QGeoBoundingBox m_boundingBox; - QGeoBoundingCircle m_boundingCircle; + QGeoRectangle m_rectangle; + QGeoCircle m_boundingCircle; QGeoLocation m_location; QPlaceCategory m_category; QPlaceIcon m_icon; @@ -109,15 +109,15 @@ tst_qmlinterface::tst_qmlinterface() m_address.setState(QLatin1String("Queensland")); m_address.setStreet(QLatin1String("123 Fake Street")); - m_boundingBox.setCenter(m_coordinate); - m_boundingBox.setHeight(30.0); - m_boundingBox.setWidth(40.0); + m_rectangle.setCenter(m_coordinate); + m_rectangle.setHeight(30.0); + m_rectangle.setWidth(40.0); m_boundingCircle.setCenter(m_coordinate); m_boundingCircle.setRadius(30.0); m_location.setAddress(m_address); - m_location.setBoundingBox(m_boundingBox); + m_location.setBoundingBox(m_rectangle); m_location.setCoordinate(m_coordinate); m_category.setName(QLatin1String("Test category")); @@ -207,18 +207,18 @@ void tst_qmlinterface::testAddress() delete qmlObject; } -void tst_qmlinterface::testBoundingBox() +void tst_qmlinterface::testGeoRectangle() { QQmlEngine engine; - QQmlComponent component(&engine, SRCDIR "data/TestBoundingBox.qml"); + QQmlComponent component(&engine, SRCDIR "data/TestGeoRectangle.qml"); QVERIFY(component.isReady()); QObject *qmlObject = component.create(); - QGeoBoundingBox boundingBox = qmlObject->property("box").value<QGeoBoundingBox>(); + QGeoRectangle rectangle = qmlObject->property("rectangle").value<QGeoRectangle>(); - QCOMPARE(boundingBox, m_boundingBox); + QCOMPARE(rectangle, m_rectangle); - qmlObject->setProperty("box", QVariant::fromValue(QGeoBoundingBox())); + qmlObject->setProperty("rectangle", QVariant::fromValue(QGeoRectangle())); QCOMPARE(qmlObject->property("center").value<QGeoCoordinate>(), QGeoCoordinate()); QVERIFY(qIsNaN(qmlObject->property("height").toDouble())); @@ -227,18 +227,18 @@ void tst_qmlinterface::testBoundingBox() delete qmlObject; } -void tst_qmlinterface::testBoundingCircle() +void tst_qmlinterface::testGeoCircle() { QQmlEngine engine; - QQmlComponent component(&engine, SRCDIR "data/TestBoundingCircle.qml"); + QQmlComponent component(&engine, SRCDIR "data/TestGeoCircle.qml"); QVERIFY(component.isReady()); QObject *qmlObject = component.create(); - QGeoBoundingCircle boundingCircle = qmlObject->property("circle").value<QGeoBoundingCircle>(); + QGeoCircle boundingCircle = qmlObject->property("circle").value<QGeoCircle>(); QCOMPARE(boundingCircle, m_boundingCircle); - qmlObject->setProperty("circle", QVariant::fromValue(QGeoBoundingCircle())); + qmlObject->setProperty("circle", QVariant::fromValue(QGeoCircle())); QCOMPARE(qmlObject->property("center").value<QGeoCoordinate>(), QGeoCoordinate()); QCOMPARE(qmlObject->property("radius").toDouble(), -1.0); @@ -260,7 +260,7 @@ void tst_qmlinterface::testLocation() qmlObject->setProperty("location", QVariant::fromValue(QGeoLocation())); QCOMPARE(qmlObject->property("address").value<QGeoAddress>(), QGeoAddress()); - QCOMPARE(qmlObject->property("boundingBox").value<QGeoBoundingBox>(), QGeoBoundingBox()); + QCOMPARE(qmlObject->property("boundingBox").value<QGeoRectangle>(), QGeoRectangle()); QCOMPARE(qmlObject->property("coordinate").value<QGeoCoordinate>(), QGeoCoordinate()); delete qmlObject; diff --git a/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp b/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp index 5ef4dd5f..0e61037c 100644 --- a/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp +++ b/tests/auto/qplacemanager_jsondb/tst_qplacemanager_jsondb.cpp @@ -39,14 +39,16 @@ ** ****************************************************************************/ -#include <QCoreApplication> -#include <QString> +#include <QtCore/QCoreApplication> +#include <QtCore/QString> #include <QtTest/QtTest> #include <QtCore/qnumeric.h> #include <QtGui/QImageReader> +#include <QtJsonDb/QJsonDbCreateRequest> +#include <QtJsonDb/QJsonDbReadRequest> +#include <QtLocation/QGeoCircle> +#include <QtLocation/QGeoRectangle> -#include <qgeoboundingbox.h> -#include <qgeoboundingcircle.h> #include <qgeoserviceprovider.h> #include <qplacemanager.h> #include <qplacecategory.h> @@ -64,11 +66,8 @@ #include "jsondbutils.h" #include "../placemanager_utils/placemanager_utils.h" -#include <QtJsonDb/QJsonDbCreateRequest> -#include <QtJsonDb/QJsonDbReadRequest> - -Q_DECLARE_METATYPE(QPlaceIdReply *); -Q_DECLARE_METATYPE(QJsonObject); +Q_DECLARE_METATYPE(QPlaceIdReply *) +Q_DECLARE_METATYPE(QJsonObject) QT_USE_NAMESPACE @@ -1212,7 +1211,7 @@ void tst_QPlaceManagerJsonDb::searchByBox() doSavePlaces(places); QPlaceSearchRequest request; - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(5.0, -5.0), QGeoCoordinate(-5.0, 5.0))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(5.0, -5.0), QGeoCoordinate(-5.0, 5.0))); QList<QPlace> places1; doSearch(request, &places1); @@ -1228,7 +1227,7 @@ void tst_QPlaceManagerJsonDb::searchByBox() QCOMPARE(testSet1, inBoxSet1); - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(5.0, 10.0), QGeoCoordinate(-5.0, 20.0))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(5.0, 10.0), QGeoCoordinate(-5.0, 20.0))); QList<QPlace> places2; doSearch(request, &places2); QCOMPARE(places2.size(), inBox2.size()); @@ -1243,7 +1242,7 @@ void tst_QPlaceManagerJsonDb::searchByBox() QCOMPARE(testSet2, inBoxSet2); - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(20.0, -5.0), QGeoCoordinate(10.0, 5.0))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(20.0, -5.0), QGeoCoordinate(10.0, 5.0))); QList<QPlace> places3; doSearch(request, &places3); @@ -1259,7 +1258,7 @@ void tst_QPlaceManagerJsonDb::searchByBox() QCOMPARE(testSet3, inBoxSet3); - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(20.0, 10.0), QGeoCoordinate(10.0, 20.0))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(20.0, 10.0), QGeoCoordinate(10.0, 20.0))); QList<QPlace> places4; doSearch(request, &places4); QCOMPARE(places4.size(), inBox4.size()); @@ -1274,7 +1273,7 @@ void tst_QPlaceManagerJsonDb::searchByBox() QCOMPARE(testSet4, inBoxSet4); - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(5.0, 175.0), QGeoCoordinate(-5.0, -175.0))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(5.0, 175.0), QGeoCoordinate(-5.0, -175.0))); QList<QPlace> places5; doSearch(request, &places5); QCOMPARE(places5.size(), inBox5.size()); @@ -1300,17 +1299,17 @@ void tst_QPlaceManagerJsonDb::searchByBox() QCOMPARE(testSet5, inBoxSet5); //try a box that finds nothing - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(-70,-70), QGeoCoordinate(-80,-60))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(-70,-70), QGeoCoordinate(-80,-60))); QVERIFY(doSearch(request, &places)); QCOMPARE(places.count(), 0); //--- Test error conditions //bottom right latitude > top left latitude - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(20,20), QGeoCoordinate(50,30))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(20,20), QGeoCoordinate(50,30))); QVERIFY(doSearch(request,&places, QPlaceReply::BadArgumentError)); //try an invalid coordinate for one of the corners - request.setSearchArea(QGeoBoundingBox(QGeoCoordinate(qQNaN(),20),QGeoCoordinate(10,30))); + request.setSearchArea(QGeoRectangle(QGeoCoordinate(qQNaN(),20),QGeoCoordinate(10,30))); QVERIFY(doSearch(request,&places, QPlaceReply::BadArgumentError)); } @@ -1425,7 +1424,7 @@ void tst_QPlaceManagerJsonDb::searchByCircle() QPlaceSearchRequest request; for (int j = 0; j < filterCoords.size(); ++j) { QList<QPlace> places; - request.setSearchArea(QGeoBoundingCircle(filterCoords.at(j),dist)); + request.setSearchArea(QGeoCircle(filterCoords.at(j),dist)); if (i ==2 || i ==3) continue; //TODO: Testing poles, ignore for now @@ -1451,55 +1450,55 @@ void tst_QPlaceManagerJsonDb::searchByCircle() //--- Test error conditions and edge cases //try a circle that covers the north pole QPlaceSearchRequest request; - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(89.91,0),11000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(89.91,0),11000)); QVERIFY(doSearch(request,&places, QPlaceReply::BadArgumentError)); QCOMPARE(places.count(), 0); //try a circle that's close to but does not cover the north pole - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(89.91,0),9000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(89.91,0),9000)); QVERIFY(doSearch(request,&places, QPlaceReply::NoError)); //try a circle that covers the south pole - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(-89.91,180),11000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(-89.91,180),11000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QCOMPARE(places.count(), 0); //try a circle that's close to but does not cover the south pole - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(-89.91,180),9000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(-89.91,180),9000)); QVERIFY(doSearch(request, &places, QPlaceReply::NoError)); //try a radius of 0 - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(11.0,11.0), 0)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(11.0,11.0), 0)); QVERIFY(doSearch(request, &places)); QCOMPARE(places.count(), 1); QCOMPARE(places.at(0).location().coordinate().latitude(), 11.0); QCOMPARE(places.at(0).location().coordinate().longitude(), 11.0); //try an invalid center - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(), 5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(), 5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); //try an invalid latitude for the center - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(qQNaN(),50), 5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(qQNaN(),50), 5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); //try a proximity filter with an out of range latitude - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(90,10), 5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(90,10), 5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(150,10), 5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(150,10), 5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); //try a proximity filter with an out of range longitude - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(-12,180.1),5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(-12,180.1),5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); - request.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(-12,-180.1),5000)); + request.setSearchArea(QGeoCircle(QGeoCoordinate(-12,-180.1),5000)); QVERIFY(doSearch(request, &places, QPlaceReply::BadArgumentError)); QVERIFY(places.isEmpty()); } @@ -1573,7 +1572,7 @@ void tst_QPlaceManagerJsonDb::searchWithDistanceHint() setVisibility(places, QtLocation::DeviceVisibility); QPlaceSearchRequest searchRequest; - QGeoBoundingCircle circle(QGeoCoordinate(20,20)); + QGeoCircle circle(QGeoCoordinate(20,20)); searchRequest.setSearchArea(circle); searchRequest.setRelevanceHint(QPlaceSearchRequest::DistanceHint); QList<QPlace> results; @@ -1990,7 +1989,7 @@ void tst_QPlaceManagerJsonDb::compatiblePlace() QGeoLocation location; location.setAddress(address); location.setCoordinate(coord); - location.setBoundingBox(QGeoBoundingBox(QGeoCoordinate(20,20), QGeoCoordinate(10,30))); + location.setBoundingBox(QGeoRectangle(QGeoCoordinate(20,20), QGeoCoordinate(10,30))); place.setLocation(location); QPlaceContactDetail phone; diff --git a/tests/auto/qplacesearchreply/tst_qplacesearchreply.cpp b/tests/auto/qplacesearchreply/tst_qplacesearchreply.cpp index 1c6ddf05..43c58303 100644 --- a/tests/auto/qplacesearchreply/tst_qplacesearchreply.cpp +++ b/tests/auto/qplacesearchreply/tst_qplacesearchreply.cpp @@ -43,8 +43,8 @@ #include <QtTest/QtTest> #include <QtLocation/QPlaceSearchReply> -#include <QtLocation/QGeoBoundingCircle> #include <QtLocation/QPlaceResult> +#include <QtLocation/QGeoCircle> QT_USE_NAMESPACE @@ -103,7 +103,7 @@ void tst_QPlaceSearchReply::requestTest() request.setLimit(10); request.setOffset(50); - QGeoBoundingCircle circle; + QGeoCircle circle; circle.setCenter(QGeoCoordinate(10,20)); request.setSearchArea(circle); diff --git a/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp b/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp index 76139e3f..8d47318e 100644 --- a/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp +++ b/tests/auto/qplacesearchrequest/tst_qplacesearchrequest.cpp @@ -41,10 +41,9 @@ #include <QtCore/QString> #include <QtTest/QtTest> - -#include <qplacesearchrequest.h> -#include <qgeoboundingcircle.h> -#include <qgeoboundingbox.h> +#include <QtLocation/QPlaceSearchRequest> +#include <QtLocation/QGeoCircle> +#include <QtLocation/QGeoRectangle> QT_USE_NAMESPACE @@ -108,56 +107,56 @@ void tst_QPlaceSearchRequest::categoriesTest() void tst_QPlaceSearchRequest::boundingCircleTest() { QPlaceSearchRequest query; - QVERIFY2(query.searchArea() == QGeoBoundingArea(), "Wrong default value"); - QGeoBoundingCircle circle; + QVERIFY2(query.searchArea() == QGeoShape(), "Wrong default value"); + QGeoCircle circle; circle.setCenter(QGeoCoordinate(30,20)); circle.setRadius(500.0); query.setSearchArea(circle); - QVERIFY(query.searchArea() != QGeoBoundingArea()); - QVERIFY(query.searchArea().type() == QGeoBoundingArea::CircleType); + QVERIFY(query.searchArea() != QGeoShape()); + QVERIFY(query.searchArea().type() == QGeoShape::CircleType); QVERIFY(query.searchArea() == circle); - QGeoBoundingCircle retrievedCircle = query.searchArea(); + QGeoCircle retrievedCircle = query.searchArea(); QVERIFY2(retrievedCircle.center() == QGeoCoordinate(30,20), "Wrong value returned"); QVERIFY2(retrievedCircle.radius() == 500.0, "Wrong value returned"); query.clear(); - QVERIFY2(query.searchArea() == QGeoBoundingArea(), "Search area not cleared"); + QVERIFY2(query.searchArea() == QGeoShape(), "Search area not cleared"); } void tst_QPlaceSearchRequest::boundingBoxTest() { QPlaceSearchRequest query; - QVERIFY2(query.searchArea() == QGeoBoundingArea(), "Wrong default value"); - QGeoBoundingBox box; + QVERIFY2(query.searchArea() == QGeoShape(), "Wrong default value"); + QGeoRectangle box; box.setTopLeft(QGeoCoordinate(30,20)); box.setBottomRight(QGeoCoordinate(10,50)); query.setSearchArea(box); - QVERIFY(query.searchArea() != QGeoBoundingArea()); - QVERIFY(query.searchArea().type() == QGeoBoundingArea::BoxType); + QVERIFY(query.searchArea() != QGeoShape()); + QVERIFY(query.searchArea().type() == QGeoShape::RectangleType); QVERIFY(query.searchArea() == box); - QGeoBoundingBox retrievedBox = query.searchArea(); + QGeoRectangle retrievedBox = query.searchArea(); QVERIFY2(retrievedBox.topLeft() == QGeoCoordinate(30,20), "Wrong value returned"); QVERIFY2(retrievedBox.bottomRight() == QGeoCoordinate(10,50), "Wrong value returned"); query.clear(); - QVERIFY2(query.searchArea() == QGeoBoundingArea(), "Wrong cleared value returned"); + QVERIFY2(query.searchArea() == QGeoShape(), "Wrong cleared value returned"); } void tst_QPlaceSearchRequest::searchAreaTest() { //test assignment of new search area over an old search area QPlaceSearchRequest *query = new QPlaceSearchRequest; - QGeoBoundingCircle circle; + QGeoCircle circle; circle.setCenter(QGeoCoordinate(30,20)); circle.setRadius(500.0); query->setSearchArea(circle); QVERIFY(query->searchArea() == circle); - QGeoBoundingBox box; + QGeoRectangle box; box.setTopLeft(QGeoCoordinate(30,20)); box.setBottomRight(QGeoCoordinate(10,50)); query->setSearchArea(box); @@ -200,9 +199,9 @@ void tst_QPlaceSearchRequest::operatorsTest() testObj2.setSearchTerm(QLatin1String("testValue")); QVERIFY(testObj == testObj2); - QGeoBoundingBox b1(QGeoCoordinate(20,20), QGeoCoordinate(10,30)); - QGeoBoundingBox b2(QGeoCoordinate(20,20), QGeoCoordinate(10,30)); - QGeoBoundingBox b3(QGeoCoordinate(40,40), QGeoCoordinate(10,40)); + QGeoRectangle b1(QGeoCoordinate(20,20), QGeoCoordinate(10,30)); + QGeoRectangle b2(QGeoCoordinate(20,20), QGeoCoordinate(10,30)); + QGeoRectangle b3(QGeoCoordinate(40,40), QGeoCoordinate(10,40)); //testing that identical boxes match testObj.setSearchArea(b1); @@ -213,9 +212,9 @@ void tst_QPlaceSearchRequest::operatorsTest() testObj2.setSearchArea(b3); QVERIFY2(testObj != testObj2, "Different box areas identified as matching"); - QGeoBoundingCircle c1(QGeoCoordinate(5,5),500); - QGeoBoundingCircle c2(QGeoCoordinate(5,5),500); - QGeoBoundingCircle c3(QGeoCoordinate(9,9),600); + QGeoCircle c1(QGeoCoordinate(5,5),500); + QGeoCircle c2(QGeoCoordinate(5,5),500); + QGeoCircle c3(QGeoCoordinate(9,9),600); //test that identical cirlces match testObj.setSearchArea(c1); @@ -227,8 +226,8 @@ void tst_QPlaceSearchRequest::operatorsTest() QVERIFY2(testObj != testObj2, "Different circle areas identified as matching"); //test that circles and boxes do not match - QGeoBoundingBox b4(QGeoCoordinate(20,20),QGeoCoordinate(10,30)); - QGeoBoundingCircle c4(QGeoCoordinate(20,20),500); + QGeoRectangle b4(QGeoCoordinate(20,20),QGeoCoordinate(10,30)); + QGeoCircle c4(QGeoCoordinate(20,20),500); testObj.setSearchArea(b4); testObj2.setSearchArea(c4); QVERIFY2(testObj != testObj2, "Circle and box identified as matching"); @@ -249,7 +248,7 @@ void tst_QPlaceSearchRequest::clearTest() { QPlaceSearchRequest req; req.setSearchTerm("pizza"); - req.setSearchArea(QGeoBoundingCircle(QGeoCoordinate(1,1), 5000)); + req.setSearchArea(QGeoCircle(QGeoCoordinate(1,1), 5000)); QPlaceCategory category; category.setName("Fast Food"); req.setCategory(category); @@ -258,7 +257,7 @@ void tst_QPlaceSearchRequest::clearTest() req.clear(); QVERIFY(req.searchTerm().isEmpty()); - QVERIFY(req.searchArea() == QGeoBoundingArea()); + QVERIFY(req.searchArea() == QGeoShape()); QVERIFY(req.categories().isEmpty()); QVERIFY(req.limit() == -1); QVERIFY(req.offset() == 0); |