summaryrefslogtreecommitdiff
path: root/tests/auto/qplacecontentrequest
diff options
context:
space:
mode:
authorabcd <qt-info@nokia.com>2011-08-22 20:24:43 +1000
committerabcd <qt_abcd1@ovi.com>2011-08-24 09:30:54 +0200
commit631783858474a28a219bcdd704efad5ef72d0f34 (patch)
tree210ddfd11f1d78b113dd8c3ecac72ab6df6a86a5 /tests/auto/qplacecontentrequest
parente6dbdfbbad070c5ca7a4e14bdd917ee2c7b52f71 (diff)
downloadqtlocation-631783858474a28a219bcdd704efad5ef72d0f34.tar.gz
Use content mechanism to retrieve reviews
This means we no longer need the qplacereviewreply or the paginationlist. We also create a QPlaceContentRequest class to specialize in requesting content. It follows the same pattern that QPlaceContent does where the private classes use inheritance to mirror the public classes so that we only have a single d pointer instance per class(as opposed to a dpointer for QPlaceRequest and a dpointer for QPlaceContentRequest). QPlaceSeachRequest has been modified like this as well. Also in the nokia plugin we rename the qplaceimagereplyimpl class to the qplacecontentreplyimpl class. We use this to get the reviews as well as images and we no longer need the qplacereviewreplyimpl class. Change-Id: I0aa1254a4df3d136bf81f9faf0f6ec06a0773100 Reviewed-on: http://codereview.qt.nokia.com/3305 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: abcd <qt_abcd1@ovi.com>
Diffstat (limited to 'tests/auto/qplacecontentrequest')
-rw-r--r--tests/auto/qplacecontentrequest/qplacecontentrequest.pro6
-rw-r--r--tests/auto/qplacecontentrequest/tst_qplacecontentrequest.cpp76
2 files changed, 82 insertions, 0 deletions
diff --git a/tests/auto/qplacecontentrequest/qplacecontentrequest.pro b/tests/auto/qplacecontentrequest/qplacecontentrequest.pro
new file mode 100644
index 00000000..6e27c4ee
--- /dev/null
+++ b/tests/auto/qplacecontentrequest/qplacecontentrequest.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+CONFIG += testcase
+TARGET = tst_qplacecontentrequest
+SOURCES += tst_qplacecontentrequest.cpp
+
+QT += location testlib
diff --git a/tests/auto/qplacecontentrequest/tst_qplacecontentrequest.cpp b/tests/auto/qplacecontentrequest/tst_qplacecontentrequest.cpp
new file mode 100644
index 00000000..74e00915
--- /dev/null
+++ b/tests/auto/qplacecontentrequest/tst_qplacecontentrequest.cpp
@@ -0,0 +1,76 @@
+#include <QtCore/QString>
+#include <QtTest/QtTest>
+
+#include <qplacecontentrequest.h>
+
+QT_USE_NAMESPACE
+
+class tst_QPlaceContentRequest : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QPlaceContentRequest();
+
+private Q_SLOTS:
+ void contentTest();
+ void clearTest();
+};
+
+tst_QPlaceContentRequest::tst_QPlaceContentRequest()
+{
+}
+
+void tst_QPlaceContentRequest::contentTest()
+{
+ QPlaceContentRequest req;
+ QCOMPARE(req.limit(), -1);
+ QCOMPARE(req.offset(), 0);
+ QCOMPARE(req.contentType(), QPlaceContent::InvalidType);
+
+ //check that we can set the request fields
+ req.setLimit(100);
+ req.setOffset(5);
+ req.setContentType(QPlaceContent::ImageType);
+ QCOMPARE(req.limit(), 100);
+ QCOMPARE(req.offset(), 5);
+ QCOMPARE(req.contentType(), QPlaceContent::ImageType);
+
+ //check that we assignment works correctly
+ QPlaceContentRequest otherReq;
+ otherReq.setLimit(10);
+ otherReq.setOffset(15);
+ otherReq.setContentType(QPlaceContent::ReviewType);
+ req = otherReq;
+ QCOMPARE(req.limit(), 10);
+ QCOMPARE(req.offset(), 15);
+ QCOMPARE(req.contentType(), QPlaceContent::ReviewType);
+
+ //check assigningment to a base class instance and comparison
+ QPlaceRequest plainReq(otherReq);
+ QVERIFY(req == otherReq);
+
+ //check assignment from base class to derived class
+ QPlaceContentRequest contentReq = plainReq;
+ QVERIFY(contentReq == req);
+
+ //check that comparison will fail if one the fields are different
+ contentReq.setLimit(9000);
+ QVERIFY(contentReq != req);
+}
+
+void tst_QPlaceContentRequest::clearTest()
+{
+ QPlaceContentRequest req;
+ req.setContentType(QPlaceContent::ReviewType);
+ req.setLimit(9000);
+ req.setOffset(1);
+ req.clear();
+ QVERIFY(req.contentType() == QPlaceContent::InvalidType);
+ QVERIFY(req.limit() == -1);
+ QVERIFY(req.offset() == 0);
+}
+
+QTEST_APPLESS_MAIN(tst_QPlaceContentRequest);
+
+#include "tst_qplacecontentrequest.moc"