summaryrefslogtreecommitdiff
path: root/tests/auto/qplaceeditorial
diff options
context:
space:
mode:
authorabcd <amos.choy@nokia.com>2012-07-27 13:59:20 +1000
committerQt by Nokia <qt-info@nokia.com>2012-08-02 07:25:20 +0200
commit7d8d130aa3ea4f11f6ceaccac0e9abeed480029c (patch)
tree511849e7f94ac38c2857672082c94417bfd02df4 /tests/auto/qplaceeditorial
parent29760b127b4f4a6de8d178f6049b05f1c338ffb0 (diff)
downloadqtlocation-7d8d130aa3ea4f11f6ceaccac0e9abeed480029c.tar.gz
Fix detachment of QPlaceEditorial objects
During shared d-pointer detachment of a QPlaceEditorial instance, the QPlaceContent fields were not copied. The QPlaceEditorial unit test has been modified to check this issue. Change-Id: Icb216f9c910ca1d13f7ece16ab18e67e3e6ec500 Reviewed-by: Alex <alex.blasche@nokia.com>
Diffstat (limited to 'tests/auto/qplaceeditorial')
-rw-r--r--tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp b/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
index 0583a20e..cf26d515 100644
--- a/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
+++ b/tests/auto/qplaceeditorial/tst_qplaceeditorial.cpp
@@ -44,6 +44,9 @@
#include <QtLocation/QPlaceEditorial>
#include <QtLocation/QPlaceSupplier>
+#include <QtLocation/QPlaceUser>
+
+#include "../utils/qlocationtestutils_p.h"
QT_USE_NAMESPACE
@@ -54,6 +57,12 @@ class tst_QPlaceEditorial : public QObject
public:
tst_QPlaceEditorial();
+ //needed for QLocationTestUtils::testConversion
+ QPlaceEditorial initialSubObject();
+ bool checkType(const QPlaceContent &);
+ void detach(QPlaceContent *);
+ void setSubClassProperty(QPlaceEditorial *);
+
private Q_SLOTS:
void constructorTest();
void supplierTest();
@@ -61,12 +70,48 @@ private Q_SLOTS:
void titleTest();
void languageTest();
void operatorsTest();
+ void conversionTest();
};
tst_QPlaceEditorial::tst_QPlaceEditorial()
{
}
+QPlaceEditorial tst_QPlaceEditorial::initialSubObject()
+{
+ QPlaceUser user;
+ user.setName("user 1");
+ user.setUserId("0001");
+
+ QPlaceSupplier supplier;
+ supplier.setName("supplier");
+ supplier.setSupplierId("1");
+
+ QPlaceEditorial editorial;
+ editorial.setTitle("title");
+ editorial.setText("text");
+ editorial.setLanguage("en");
+ editorial.setUser(user);
+ editorial.setSupplier(supplier);
+ editorial.setAttribution("attribution");
+
+ return editorial;
+}
+
+bool tst_QPlaceEditorial::checkType(const QPlaceContent &content)
+{
+ return content.type() == QPlaceContent::EditorialType;
+}
+
+void tst_QPlaceEditorial::detach(QPlaceContent *content)
+{
+ content->setAttribution("attribution");
+}
+
+void tst_QPlaceEditorial::setSubClassProperty(QPlaceEditorial * editorial)
+{
+ editorial->setTitle("new title");
+}
void tst_QPlaceEditorial::constructorTest()
{
QPlaceEditorial testObj;
@@ -123,6 +168,12 @@ void tst_QPlaceEditorial::operatorsTest()
QVERIFY2(testObj != testObj2, "Object should be different");
}
+void tst_QPlaceEditorial::conversionTest()
+{
+ QLocationTestUtils::testConversion<tst_QPlaceEditorial,
+ QPlaceContent,
+ QPlaceEditorial>(this);
+}
QTEST_APPLESS_MAIN(tst_QPlaceEditorial);
#include "tst_qplaceeditorial.moc"