diff options
author | abcd <amos.choy@nokia.com> | 2012-07-27 17:34:55 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-02 07:26:51 +0200 |
commit | 5f36cfdbdeb916582f398951942c9189bbb49616 (patch) | |
tree | a981bbe5f022fca7a87d2002276c73f87bc7461f | |
parent | d7850b7e6e91016350d89554a66c9361927dd22f (diff) | |
download | qtlocation-5f36cfdbdeb916582f398951942c9189bbb49616.tar.gz |
Expaned QPlaceImage unit tests to test conversions
Change-Id: I49f86df1a9b82e11f702680a52c7a64410dfffb0
Reviewed-by: Alex <alex.blasche@nokia.com>
-rw-r--r-- | tests/auto/qplaceimage/tst_qplaceimage.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/tests/auto/qplaceimage/tst_qplaceimage.cpp b/tests/auto/qplaceimage/tst_qplaceimage.cpp index eaef9c86..f5aaec22 100644 --- a/tests/auto/qplaceimage/tst_qplaceimage.cpp +++ b/tests/auto/qplaceimage/tst_qplaceimage.cpp @@ -40,9 +40,11 @@ ****************************************************************************/ #include <QtCore/QString> +#include <QtLocation/QPlaceImage> +#include <QtLocation/QPlaceUser> #include <QtTest/QtTest> -#include <qplaceimage.h> +#include "../utils/qlocationtestutils_p.h" QT_USE_NAMESPACE @@ -53,6 +55,12 @@ class tst_QPlaceImage : public QObject public: tst_QPlaceImage(); + //needed for QLocationTestUtils::testConversion + QPlaceImage initialSubObject(); + bool checkType(const QPlaceContent &); + void detach(QPlaceContent *); + void setSubClassProperty(QPlaceImage *); + private Q_SLOTS: void constructorTest(); void supplierTest(); @@ -60,12 +68,49 @@ private Q_SLOTS: void mimeTypeTest(); void attributionTest(); void operatorsTest(); + void conversionTest(); }; tst_QPlaceImage::tst_QPlaceImage() { } +QPlaceImage tst_QPlaceImage::initialSubObject() +{ + QPlaceUser user; + user.setName("user 1"); + user.setUserId("0001"); + + QPlaceSupplier supplier; + supplier.setName("supplier"); + supplier.setSupplierId("1"); + + QPlaceImage image; + image.setUrl(QUrl(QStringLiteral("file:///opt/icon/img.png"))); + image.setImageId("0001"); + image.setMimeType("image/png"); + image.setUser(user); + image.setSupplier(supplier); + image.setAttribution("attribution"); + + return image; +} + +bool tst_QPlaceImage::checkType(const QPlaceContent &content) +{ + return content.type() == QPlaceContent::ImageType; +} + +void tst_QPlaceImage::detach(QPlaceContent *content) +{ + content->setAttribution("attribution"); +} + +void tst_QPlaceImage::setSubClassProperty(QPlaceImage *image) +{ + image->setImageId("0002"); +} + void tst_QPlaceImage::constructorTest() { QPlaceImage testObj; @@ -124,6 +169,13 @@ void tst_QPlaceImage::operatorsTest() QVERIFY2(testObj != testObj2, "Object should be different"); } +void tst_QPlaceImage::conversionTest() +{ + QLocationTestUtils::testConversion<tst_QPlaceImage, + QPlaceContent, + QPlaceImage>(this); +} + QTEST_APPLESS_MAIN(tst_QPlaceImage); #include "tst_qplaceimage.moc" |