void position_data();
void position();
void positionUnsetValues();
+ void sceneLevel_data();
+ void sceneLevel();
};
/**
QCOMPARE(anotherMapTile.pos(), QPointF(-1, -1));
}
+/**
+ * @brief Data for test of setting zValues
+ */
+void TestMapTile::sceneLevel_data()
+{
+ QTest::addColumn<int>("tileZoomLevel");
+ QTest::addColumn<int>("viewZoomLevel");
+ QTest::addColumn<qreal>("result");
+
+ QTest::newRow("tile zoom 15, view zoom 17") << 15 << 17 << 15.0 + 19;
+ QTest::newRow("tile zoom 15, view zoom 16") << 15 << 16 << 15.0 + 19;
+ QTest::newRow("tile zoom 15, view zoom 15") << 15 << 15 << 15.0 + 19;
+ QTest::newRow("tile zoom 15, view zoom 14") << 15 << 14 << 13.5 + 19;
+ QTest::newRow("tile zoom 15, view zoom 13") << 15 << 13 << 11.5 + 19;
+ QTest::newRow("tile zoom 15, view zoom 12") << 15 << 12 << 9.5 + 19;
+ QTest::newRow("tile zoom 18, view zoom 1") << 18 << 1 << -15.5 + 19;
+ QTest::newRow("tile zoom 18, view zoom 0") << 18 << 0 << -17.5 + 19;
+}
+
+/**
+ * @brief Test setting zValues (drawing order)
+ */
+void TestMapTile::sceneLevel()
+{
+ QFETCH(int, tileZoomLevel);
+ QFETCH(int, viewZoomLevel);
+ QFETCH(qreal, result);
+
+ MapTile tile;
+ tile.setZoomLevel(tileZoomLevel);
+ tile.setSceneLevel(viewZoomLevel);
+ QCOMPARE(tile.zValue(), result);
+}
+
QTEST_MAIN(TestMapTile)
#include "testmaptile.moc"
MapView *m_mapView;
};
-TestMapView::TestMapView() : m_mapView(0)
+/**
+ * @brief Constructor for setting pointer to MapView to NULL
+ */
+TestMapView::TestMapView() : m_mapView(NULL)
{
}
+/**
+ * @brief Test case initialization
+ */
void TestMapView::init()
{
m_mapView = new MapView();
QVERIFY(m_mapView);
}
+/**
+ * @brief Test case cleanup
+ */
void TestMapView::cleanup()
{
delete m_mapView;
m_mapView = 0;
}
+/**
+ * @brief Test data for zoom level change test
+ */
void TestMapView::zoomLevelChange_data()
{
QTest::addColumn<int>("zoomLevel");
QTest::newRow("zoom 15") << 15 << 0.125;
}
+/**
+ * @brief Test view zoom level scaling
+ */
void TestMapView::zoomLevelChange()
{
QFETCH(int, zoomLevel);