summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-09-10 10:52:14 +0200
committerJędrzej Nowacki <jedrzej.nowacki@digia.com>2014-09-11 10:54:42 +0200
commitfa9a407b9f7b89e4785c650dcb3e80d08ea3c042 (patch)
tree87a85efb95e21e248b95904b834370b956e804b6 /tests
parent7b9f7f3891230ddd2b2ef5cf3c760a605a02ee96 (diff)
Revert "Reading QJsonObject property should not modify the object itself."
This reverts commit 20cf632ad5f3ffe7b0fd231724c971f4e07304eb. The commit produced to many problems during statics destruction. For example causing QtCreator crash (QTBUG-40987). Change-Id: Ib52f6a449c2d84deab2de792559a6a065ca45e8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp51
1 files changed, 0 insertions, 51 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index 253741c103..ce272cde03 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -92,7 +92,6 @@ private Q_SLOTS:
void nullObject();
void constNullObject();
- void undefinedKeys();
void keySorting();
void undefinedValues();
@@ -726,24 +725,12 @@ void tst_QtJson::testObjectIteration()
for (QJsonObject::iterator it = object.begin(); it != object.end(); ++it)
QVERIFY(false);
- object["undefined"];
- for (QJsonObject::iterator it = object.begin(); it != object.end(); ++it)
- QVERIFY(false);
-
const QString property = "kkk";
object.insert(property, 11);
object.take(property);
for (QJsonObject::iterator it = object.begin(); it != object.end(); ++it)
QVERIFY(false);
- object.insert(property, 11);
- object["aaa"]; // before "kkk"
- object["zzz"]; // after "kkk"
- for (QJsonObject::iterator it = object.begin(); it != object.end(); ++it)
- QCOMPARE(it.key(), property);
-
- object = QJsonObject();
-
for (int i = 0; i < 10; ++i)
object[QString::number(i)] = (double)i;
@@ -1021,7 +1008,6 @@ void tst_QtJson::nullObject()
nonNull.insert(QLatin1String("foo"), QLatin1String("bar"));
QCOMPARE(nullObject, QJsonObject());
- QCOMPARE(nullObject.size(), 0);
QVERIFY(nullObject != nonNull);
QVERIFY(nonNull != nullObject);
@@ -1039,27 +1025,8 @@ void tst_QtJson::nullObject()
QCOMPARE(nullObject.keys(), QStringList());
nullObject.remove("foo");
QCOMPARE(nullObject, QJsonObject());
- QCOMPARE(QJsonValue(nullObject["foo"]), QJsonValue(QJsonValue::Undefined));
QCOMPARE(nullObject.take("foo"), QJsonValue(QJsonValue::Undefined));
QCOMPARE(nullObject.contains("foo"), false);
- QCOMPARE(nullObject, QJsonObject());
- QCOMPARE(nullObject.size(), 0);
-
- // There is not way to check if internal temporary storage for QJsonValueRef is removed correctly by
- // remove, take or compaction but at least we should not crash
- nullObject["foo"];
- QCOMPARE(nullObject.size(), 0);
- nullObject.remove("foo");
- QCOMPARE(nullObject.size(), 0);
- nullObject["foo"];
- QCOMPARE(nullObject.size(), 0);
- nullObject.take("foo");
- QCOMPARE(nullObject.size(), 0);
- QString property("foo");
- for (int i = 0; i < 128; ++i)
- nullObject[property + QString::number(i)];
-
- QCOMPARE(nullObject.size(), 0);
}
void tst_QtJson::constNullObject()
@@ -1079,16 +1046,6 @@ void tst_QtJson::constNullObject()
QCOMPARE(nullObject["foo"], QJsonValue(QJsonValue::Undefined));
}
-void tst_QtJson::undefinedKeys()
-{
- QJsonObject null;
- QVERIFY(null.keys().isEmpty());
-
- // check that an internal udefined doesn't show up
- null["undefined"];
- QVERIFY(null.keys().isEmpty());
-}
-
void tst_QtJson::keySorting()
{
const char *json = "{ \"B\": true, \"A\": false }";
@@ -1224,11 +1181,6 @@ void tst_QtJson::toVariantMap()
QVariantMap map = object.toVariantMap();
QVERIFY(map.isEmpty());
- // check an empty object with an internal undefined
- QJsonValueRef unused = object["undefined"];
- Q_UNUSED(unused);
- QVERIFY(object.toVariantMap().isEmpty());
-
object.insert("Key", QString("Value"));
object.insert("null", QJsonValue());
QJsonArray array;
@@ -2430,7 +2382,6 @@ void tst_QtJson::objectEquals_data()
QJsonObject referencedEmpty;
referencedEmpty["undefined"];
- QTest::newRow("referenced empty vs default") << referencedEmpty << QJsonObject() << true;
QTest::newRow("referenced empty vs referenced empty") << referencedEmpty << referencedEmpty << true;
QTest::newRow("referenced empty vs object") << referencedEmpty << object1 << false;
@@ -2443,9 +2394,7 @@ void tst_QtJson::objectEquals_data()
referencedObject2["zzzzzzzzz"]; // after "property"
QTest::newRow("referenced object vs default") << referencedObject1 << QJsonObject() << false;
QTest::newRow("referenced object vs referenced object") << referencedObject1 << referencedObject1 << true;
- QTest::newRow("referenced object vs object (same)") << referencedObject1 << object1 << true;
QTest::newRow("referenced object vs object (different)") << referencedObject1 << object3 << false;
- QTest::newRow("referenced object vs referenced object (same)") << referencedObject1 << referencedObject2 << true;
}
void tst_QtJson::objectEquals()