diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-01-22 10:38:34 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@digia.com> | 2015-02-11 09:22:25 +0000 |
commit | fe1726fd7d33a5e1bda863ca6000bc3b9806b1aa (patch) | |
tree | 20c33cd76fa1ac1c82f3afb2017052e8273af80c | |
parent | 51ce5b482997f76b8890876b07337b29609728e5 (diff) |
Document and further test that QJsonObject::keys() is sorted.
Change-Id: I6b145c1240cce85ad3fea6fb90ddbed629487f83
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-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() |