diff options
-rw-r--r-- | src/corelib/json/qjsonobject.cpp | 2 | ||||
-rw-r--r-- | tests/auto/corelib/json/tst_qtjson.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/json/qjsonobject.cpp b/src/corelib/json/qjsonobject.cpp index bc74092f59..cd68db8dc6 100644 --- a/src/corelib/json/qjsonobject.cpp +++ b/src/corelib/json/qjsonobject.cpp @@ -223,6 +223,8 @@ QVariantMap QJsonObject::toVariantMap() const /*! Returns a list of all keys in this object. + + The list is sorted lexographically. */ QStringList QJsonObject::keys() const { diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 56a5a28c50..b6cfc39bb9 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1051,6 +1051,8 @@ void tst_QtJson::keySorting() QCOMPARE(it.key(), QLatin1String("A")); ++it; QCOMPARE(it.key(), QLatin1String("B")); + + QCOMPARE(o.keys(), QStringList() << QLatin1String("A") << QLatin1String("B")); } void tst_QtJson::undefinedValues() |