const qreal xCoordinate = 65.525;
const qreal yCoordinate = 25.345;
const QPointF testLocationPoint(65.525, 25.345);
- const QPointF defaultLocationPoint(DEFAULT_LONGITUDE,DEFAULT_LATITUDE);
+ const QPointF defaultLocationPoint(UNDEFINED, UNDEFINED);
const QPointF locationIconOffset(-MAP_OWN_LOCATION_ICON_SIZE/2, -MAP_OWN_LOCATION_ICON_SIZE/2);
const int itemIgnoresTransformationsFlagValue = 0x20;
}
/**
* @brief Test method for constructors.
- * Tests that positions are set correctly.
- * Tests that Z-values are set correctly.
- * Tests that offses are set correctly.
- * Tests that ItemIgnoresTransformations flag is set.
+ *
+ * Tests that default position is set correctly.
+ * Tests that item has pixmap set.
+ * Tests that Z-value is set correctly.
+ * Tests that offset is set correctly.
+ * Tests that ItemIgnoresTransformations flag is set.
*/
void testConstructors();
-
- /**
- * @brief Creates instance of OwnLocationItem.
- * Sets test position for location item in geographic coordinates.
- * Reads position from location item in scene coordinates and
- * verifies that it is correctly formed.
- */
- void testSetAndGetPosition();
-
- /**
- * @brief Creates instance of OwnLocationItem.
- * Verifies that instance is visible.
- * Hides instance and verifies that it is not visible.
- */
- void testHideAndShowPosition();
};
void TestOwnLocationItem::testConstructors()
{
- OwnLocationItem ownLocationItem(defaultLocationPoint);
+ OwnLocationItem ownLocationItem;
// Test Pixmap
QPixmap pixmap;
QCOMPARE (pixmap.isNull(), false);
// Test Position
- QCOMPARE(ownLocationItem.position(),
- MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));
+ QCOMPARE(ownLocationItem.pos(), defaultLocationPoint);
// Test Z-value
QCOMPARE(static_cast<int>(ownLocationItem.zValue()), OWN_LOCATION_ICON_Z_LEVEL);
QCOMPARE(ownLocationItemFlags, itemIgnoresTransformationsFlagValue);
}
- void TestOwnLocationItem::testSetAndGetPosition()
- {
- OwnLocationItem ownLocation(defaultLocationPoint);
-
- QCOMPARE(ownLocation.position(),
- MapEngine::convertLatLonToSceneCoordinate(defaultLocationPoint));
-
- ownLocation.setPosition(testLocationPoint);
-
- QCOMPARE(ownLocation.position(),
- MapEngine::convertLatLonToSceneCoordinate(testLocationPoint));
- }
-
- void TestOwnLocationItem::testHideAndShowPosition()
- {
- OwnLocationItem ownLocation(defaultLocationPoint);
- QCOMPARE(ownLocation.isVisible(), true);
-
- ownLocation.hideLocation();
- QCOMPARE(ownLocation.isVisible(), false);
-
- ownLocation.showLocation();
- QCOMPARE(ownLocation.isVisible(), true);
- }
-
QTEST_MAIN(TestOwnLocationItem)
#include "testownlocationitem.moc"