private slots:
void convertTileNumberToSceneCoordinate();
// void setViewLocation();
+ void convertLatLonToSceneCoordinate_data();
void convertLatLonToSceneCoordinate();
void calculateRect();
void setLocation();
//}
/**
+ * @brief Test data for converting latitude and longitude coordinates to scene coordinates
+ */
+void TestMapEngine::convertLatLonToSceneCoordinate_data()
+{
+ QTest::addColumn<QPointF>("coordinate");
+ QTest::addColumn<QPointF>("result");
+
+ QTest::newRow("top left") << QPointF(-180, 85.0511) << QPointF(0, 0);
+ QTest::newRow("bottom right") << QPointF(180, -85.0511) << QPointF(67108863, 67108863);
+}
+
+/**
* @brief Test converting real world cordinates to scene coordinates
* @todo Implement
*/
void TestMapEngine::convertLatLonToSceneCoordinate()
{
- QCOMPARE(MapEngine::convertLatLonToSceneCoordinate(QPointF(25.5, 65.0)), QPointF(73, 33));
- QCOMPARE(MapEngine::convertLatLonToSceneCoordinate(QPointF(25.5, 65.0)), QPointF(1, 0));
- QCOMPARE(MapEngine::convertLatLonToSceneCoordinate(QPointF(-190.0, 65.0)), QPointF(UNDEFINED, UNDEFINED));
- QCOMPARE(MapEngine::convertLatLonToSceneCoordinate(QPointF(20.0, 65.0)), QPointF(UNDEFINED, UNDEFINED));
+ QFETCH(QPointF, coordinate);
+ QFETCH(QPointF, result);
+
+ QCOMPARE(MapEngine::convertLatLonToSceneCoordinate(coordinate), result);
}
void TestMapEngine::calculateRect()