summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-07-27 16:35:50 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-02 07:26:18 +0200
commitd7850b7e6e91016350d89554a66c9361927dd22f (patch)
treec7b2e85570cda41a6126a6776c96c0580639f07a /tests
parent7d8d130aa3ea4f11f6ceaccac0e9abeed480029c (diff)
downloadqtlocation-d7850b7e6e91016350d89554a66c9361927dd22f.tar.gz
Expand QPlaceReview unit test to test conversions
Change-Id: Ib3a50e6cf1e0c9ac5e1d57fc2add2b433980e88a Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qplacereview/tst_qplacereview.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/auto/qplacereview/tst_qplacereview.cpp b/tests/auto/qplacereview/tst_qplacereview.cpp
index 68a6bf68..d9fe3992 100644
--- a/tests/auto/qplacereview/tst_qplacereview.cpp
+++ b/tests/auto/qplacereview/tst_qplacereview.cpp
@@ -46,6 +46,8 @@
#include <QtLocation/QPlaceSupplier>
#include <QtLocation/QPlaceUser>
+#include "../utils/qlocationtestutils_p.h"
+
QT_USE_NAMESPACE
class tst_QPlaceReview : public QObject
@@ -55,6 +57,12 @@ class tst_QPlaceReview : public QObject
public:
tst_QPlaceReview();
+ //needed for QLocationTestUtils::testConversion
+ QPlaceReview initialSubObject();
+ bool checkType(const QPlaceContent &);
+ void detach(QPlaceContent *);
+ void setSubClassProperty(QPlaceReview *);
+
private Q_SLOTS:
void constructorTest();
void supplierTest();
@@ -66,12 +74,52 @@ private Q_SLOTS:
void titleTest();
void userTest();
void operatorsTest();
+ void conversionTest();
};
tst_QPlaceReview::tst_QPlaceReview()
{
}
+QPlaceReview tst_QPlaceReview::initialSubObject()
+{
+ QPlaceUser user;
+ user.setName("user 1");
+ user.setUserId("0001");
+
+ QPlaceSupplier supplier;
+ supplier.setName("supplier");
+ supplier.setSupplierId("1");
+
+ QPlaceReview review;
+ review.setTitle("title");
+ review.setText("text");
+ review.setRating(4.5);
+ review.setLanguage("en");
+ review.setDateTime(QDateTime::fromString("01:02 03/04/2000",
+ "hh:mm dd/MM/yyyy"));
+ review.setUser(user);
+ review.setSupplier(supplier);
+ review.setAttribution("attribution");
+
+ return review;
+}
+
+bool tst_QPlaceReview::checkType(const QPlaceContent &content)
+{
+ return content.type() == QPlaceContent::ReviewType;
+}
+
+void tst_QPlaceReview::detach(QPlaceContent *content)
+{
+ content->setAttribution("attribution");
+}
+
+void tst_QPlaceReview::setSubClassProperty(QPlaceReview *review)
+{
+ review->setTitle("new title");
+}
+
void tst_QPlaceReview::constructorTest()
{
QPlaceReview testObj;
@@ -173,6 +221,13 @@ void tst_QPlaceReview::userTest()
QVERIFY(review.user().name().isEmpty());
}
+void tst_QPlaceReview::conversionTest()
+{
+ QLocationTestUtils::testConversion<tst_QPlaceReview,
+ QPlaceContent,
+ QPlaceReview>(this);
+}
+
QTEST_APPLESS_MAIN(tst_QPlaceReview)
#include "tst_qplacereview.moc"