diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-09-27 11:13:49 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-11-08 09:50:32 +0000 |
commit | baebb6aa26799e627bc3be6bf41589cef422bed2 (patch) | |
tree | dfa33faec314b1988b415a110e77c66d36b09d2b /tests/auto/corelib | |
parent | c6477286525682773ae3739fee53689e225d1b0a (diff) |
QVariant to QJsonValue::Null conversion
Adds a few missing parts of the conversion from QVariant to QJsonValue
after the introduction of the nullptr QVariant. The conversion the other
way is already implemented.
Change-Id: I8b25dec4b476c4761c5098a60944ff11c36f8bec
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r-- | tests/auto/corelib/json/tst_qtjson.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 1194260efa..17892b44a2 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1103,6 +1103,7 @@ void tst_QtJson::fromVariant() jsonObject["string"] = stringValue; jsonObject["array"] = jsonArray_variant; + QCOMPARE(QJsonValue::fromVariant(QVariant::fromValue(nullptr)), QJsonValue(QJsonValue::Null)); QCOMPARE(QJsonValue::fromVariant(QVariant(boolValue)), QJsonValue(boolValue)); QCOMPARE(QJsonValue::fromVariant(QVariant(intValue)), QJsonValue(intValue)); QCOMPARE(QJsonValue::fromVariant(QVariant(uintValue)), QJsonValue(static_cast<double>(uintValue))); @@ -1179,7 +1180,7 @@ void tst_QtJson::toVariantMap() array.append(true); array.append(999.); array.append(QLatin1String("string")); - array.append(QJsonValue()); + array.append(QJsonValue::Null); object.insert("Array", array); map = object.toVariantMap(); @@ -1203,12 +1204,12 @@ void tst_QtJson::toVariantHash() QVERIFY(hash.isEmpty()); object.insert("Key", QString("Value")); - object.insert("null", QJsonValue()); + object.insert("null", QJsonValue::Null); QJsonArray array; array.append(true); array.append(999.); array.append(QLatin1String("string")); - array.append(QJsonValue()); + array.append(QJsonValue::Null); object.insert("Array", array); hash = object.toVariantHash(); |