summaryrefslogtreecommitdiff
path: root/tests/auto/qplaceimage
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-08-22 14:39:26 +1000
committerabcd <qt_abcd1@ovi.com>2011-08-22 10:22:36 +0200
commit69d4a69261da1758b1a21c28a09fdd5006c51890 (patch)
treedaaac27f39281bd5ff98915f3753dae1aec93453 /tests/auto/qplaceimage
parent2c829671005e6572ae6e048aa337bb8b3ca639f9 (diff)
downloadqtlocation-69d4a69261da1758b1a21c28a09fdd5006c51890.tar.gz
Introduce Content class and rename PlaceMediaObject to PlaceImage
Paging is now implemented in terms of content objects, things like images, reviews etc should inherit off the QPlaceContent class. The main advantage of this change in C++ is that the paging code will not be duplicated for different content types, also we have less symbols which is good for plugin loading times. For now, in QML we still retain separate specialized models. In future it might be possible to just have a single model class to hold different content types. There will still however need to be separate model instances for say reviews and images. PlaceMediaObject has been renamed to PlaceImage because currently all we provide are images. It is anticipated that if there are new media types like video we would introduce QPlaceVideo and have it inherit off QPlaceContent. It is suboptimal to try define a generic media object right now when we do not have a clear idea about the use cases of each possible media type. A future change will have QPlaceReview inherit off QPlaceContent. Change-Id: Ia6cf5092e246374ed639694d7653e30429c94cc2 Reviewed-on: http://codereview.qt.nokia.com/3284 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com> Reviewed-by: abcd <qt_abcd1@ovi.com>
Diffstat (limited to 'tests/auto/qplaceimage')
-rw-r--r--tests/auto/qplaceimage/qplaceimage.pro7
-rw-r--r--tests/auto/qplaceimage/tst_qplaceimage.cpp108
2 files changed, 115 insertions, 0 deletions
diff --git a/tests/auto/qplaceimage/qplaceimage.pro b/tests/auto/qplaceimage/qplaceimage.pro
new file mode 100644
index 00000000..b6a2805a
--- /dev/null
+++ b/tests/auto/qplaceimage/qplaceimage.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+CONFIG += testcase
+TARGET = tst_qplaceimage
+
+SOURCES += tst_qplaceimage.cpp
+
+QT += location testlib
diff --git a/tests/auto/qplaceimage/tst_qplaceimage.cpp b/tests/auto/qplaceimage/tst_qplaceimage.cpp
new file mode 100644
index 00000000..ddeea2b5
--- /dev/null
+++ b/tests/auto/qplaceimage/tst_qplaceimage.cpp
@@ -0,0 +1,108 @@
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include <qplaceimage.h>
+
+QT_USE_NAMESPACE
+
+class tst_QPlaceImage : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QPlaceImage();
+
+private Q_SLOTS:
+ void constructorTest();
+ void supplierTest();
+ void urlTest();
+ void thumbnailUrlTest();
+ void idTest();
+ void metaInfoTest();
+ void mimeTypeTest();
+ void operatorsTest();
+};
+
+tst_QPlaceImage::tst_QPlaceImage()
+{
+}
+
+void tst_QPlaceImage::constructorTest()
+{
+ QPlaceImage testObj;
+ testObj.setId("testId");
+ QPlaceImage *testObjPtr = new QPlaceImage(testObj);
+ QVERIFY2(testObjPtr != NULL, "Copy constructor - null");
+ QVERIFY2(*testObjPtr == testObj, "Copy constructor - compare");
+ delete testObjPtr;
+}
+
+void tst_QPlaceImage::supplierTest()
+{
+ QPlaceImage testObj;
+ QVERIFY2(testObj.supplier().supplierId() == QString(), "Wrong default value");
+ QPlaceSupplier sup;
+ sup.setName("testName1");
+ sup.setSupplierId("testId");
+ testObj.setSupplier(sup);
+ QVERIFY2(testObj.supplier() == sup, "Wrong value returned");
+}
+
+void tst_QPlaceImage::urlTest()
+{
+ QUrl imageUrl("testText");
+
+ QPlaceImage testObj;
+ QVERIFY2(testObj.url() == QString(), "Wrong default value");
+ testObj.setUrl(imageUrl);
+ QVERIFY2(testObj.url() == imageUrl, "Wrong value returned");
+}
+
+void tst_QPlaceImage::thumbnailUrlTest()
+{
+ QUrl thumbnailUrl("testText");
+
+ QPlaceImage testObj;
+ QVERIFY2(testObj.thumbnailUrl() == QString(), "Wrong default value");
+ testObj.setThumbnailUrl(thumbnailUrl);
+ QVERIFY2(testObj.thumbnailUrl() == thumbnailUrl, "Wrong value returned");
+}
+
+void tst_QPlaceImage::idTest()
+{
+ QPlaceImage testObj;
+ QVERIFY2(testObj.id() == QString(), "Wrong default value");
+ testObj.setId("testText");
+ QVERIFY2(testObj.id() == "testText", "Wrong value returned");
+}
+
+void tst_QPlaceImage::metaInfoTest()
+{
+ QPlaceImage testObj;
+ QVERIFY2(testObj.metaInfo() == QString(), "Wrong default value");
+ testObj.setMetaInfo("testText");
+ QVERIFY2(testObj.metaInfo() == "testText", "Wrong value returned");
+}
+
+void tst_QPlaceImage::mimeTypeTest()
+{
+ QPlaceImage testObj;
+ QVERIFY2(testObj.mimeType() == QString(), "Wrong default value");
+ testObj.setMimeType("testText");
+ QVERIFY2(testObj.mimeType() == "testText", "Wrong value returned");
+}
+
+void tst_QPlaceImage::operatorsTest()
+{
+ QPlaceImage testObj;
+ testObj.setMimeType("testValue");
+ QPlaceImage testObj2;
+ testObj2 = testObj;
+ QVERIFY2(testObj == testObj2, "Not copied correctly");
+ testObj2.setId("testValue2");
+ QVERIFY2(testObj != testObj2, "Object should be different");
+}
+
+QTEST_APPLESS_MAIN(tst_QPlaceImage);
+
+#include "tst_qplaceimage.moc"