summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-15 15:41:44 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-25 16:03:42 +0200
commit7dce96220003e3fa3f932341aaecd8e7f55f4d95 (patch)
treea8bafd0eca632b98f84b2a1f8b5424d8a13dccf0 /tests/auto
parentf16de5c1fd8cf0e9d6a37aaa771144ccc4220fba (diff)
Add operator-> to QJson iterators
The iterators for QJsonArray and QJsonObject are currently lacking an operator-> definition. Unfortunately it is not possible to do in clean way without redefining either the iterators or QJsonValueRef class. This patch instead adds two fake pointer classes that are only used to handle the operator-> return value. Task-number: QTBUG-29573 Change-Id: Ief785a6afbbedc9e89cf3b6f3958c2c755997a66 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index ebe7333c47..d4ce123fcc 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -746,6 +746,8 @@ void tst_QtJson::testObjectIteration()
QCOMPARE(object.size(), 10);
+ QCOMPARE(object.begin()->toDouble(), object.constBegin()->toDouble());
+
for (QJsonObject::iterator it = object.begin(); it != object.end(); ++it) {
QJsonValue value = it.value();
QCOMPARE((double)it.key().toInt(), value.toDouble());
@@ -822,6 +824,8 @@ void tst_QtJson::testArrayIteration()
QCOMPARE((double)i, value.toDouble());
}
+ QCOMPARE(array.begin()->toDouble(), array.constBegin()->toDouble());
+
{
QJsonArray array2 = array;
QVERIFY(array == array2);