{
Q_OBJECT
private slots:
- //void convertTileNumberToSceneCoordinate();
+ void convertTileNumberToSceneCoordinate();
// void setViewLocation();
- //void convertLatLonToTile();
+ void convertLatLonToSceneCoordinate();
void calculateRect();
void setLocation();
// void removeTilesOutOfBounds();
*
* Different zoom levels are also tested
*/
-//void TestMapEngine::convertTileNumberToSceneCoordinate()
-//{
-// QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(18, QPoint(0,0)), QPoint(0,0));
-// QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(18, QPoint(1,2)), QPoint(256,512));
-// QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(16, QPoint(3,4)), QPoint(3072,4096));
-//}
+void TestMapEngine::convertTileNumberToSceneCoordinate()
+{
+ QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(18, QPoint(0,0)), QPoint(0,0));
+ QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(18, QPoint(1,2)), QPoint(256,512));
+ QCOMPARE(MapEngine::convertTileNumberToSceneCoordinate(16, QPoint(3,4)), QPoint(3072,4096));
+}
/**
* @brief DUMMY TESTCASE!
//}
/**
-* @brief Test converting real world cordinates to tile numbers
+* @brief Test converting real world cordinates to scene coordinates
* @todo Implement
*/
-//void TestMapEngine::convertLatLonToTile()
-//{
-// QCOMPARE(MapEngine::convertLatLonToTile(7, QPointF(25.5, 65.0)), QPoint(73, 33));
-// QCOMPARE(MapEngine::convertLatLonToTile(1, QPointF(25.5, 65.0)), QPoint(1, 0));
-// QCOMPARE(MapEngine::convertLatLonToTile(1, QPointF(-190.0, 65.0)), QPoint(UNDEFINED, UNDEFINED));
-// QCOMPARE(MapEngine::convertLatLonToTile(100, QPointF(20.0, 65.0)), QPoint(UNDEFINED, UNDEFINED));
-//}
+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));
+}
void TestMapEngine::calculateRect()
{
engine.viewResized(QSize(800, 480));
engine.setZoomLevel(14);
- int zoomFactor = 1 << (MAX_ZOOM_LEVEL - engine.getZoomLevel());
+ int zoomFactor = 1 << (MAX_MAP_ZOOM_LEVEL - engine.getZoomLevel());
QRect grid1 = QRect(-1, 0, 6, 4);
QCOMPARE(engine.calculateGrid(QPointF(550.23*zoomFactor, 550.23*zoomFactor)), grid1);
engine.setZoomLevel(14);
engine.viewResized(QSize(800, 480));
- int zoomFactor = 1 << (MAX_ZOOM_LEVEL - engine.getZoomLevel());
+ int zoomFactor = 1 << (MAX_MAP_ZOOM_LEVEL - engine.getZoomLevel());
QSignalSpy fetchImageSpy(&engine, SIGNAL(fetchImage(QUrl)));
QTest::qWait(1000);
void TestMapEngine::convert()
{
- int zoomFactor = 1 << (MAX_ZOOM_LEVEL - 14);
+ int zoomFactor = 1 << (MAX_MAP_ZOOM_LEVEL - 14);
QPoint tileNumber = QPoint(1020, 500);
QPointF sceneCoordinate = QPointF(tileNumber.x()*TILE_SIZE_X*zoomFactor, tileNumber.y()*TILE_SIZE_Y*zoomFactor);
engine.viewResized(QSize(800, 480));
engine.setZoomLevel(14);
- int zoomFactor = 1 << (MAX_ZOOM_LEVEL - engine.getZoomLevel());
+ int zoomFactor = 1 << (MAX_MAP_ZOOM_LEVEL - engine.getZoomLevel());
engine.calculateTileGrid(QPointF(1020*TILE_SIZE_X*zoomFactor, 500*TILE_SIZE_X*zoomFactor));
}