summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/json
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/json')
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index d4ce123fcc..ba19e4855d 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -149,6 +149,8 @@ private Q_SLOTS:
void arrayInitializerList();
void objectInitializerList();
+
+ void unicodeKeys();
private:
QString testDataDir;
};
@@ -2753,5 +2755,27 @@ void tst_QtJson::objectInitializerList()
#endif
}
+void tst_QtJson::unicodeKeys()
+{
+ QByteArray json = "{"
+ "\"x\u2090_1\": \"hello_1\","
+ "\"y\u2090_2\": \"hello_2\","
+ "\"T\u2090_3\": \"hello_3\","
+ "\"xyz_4\": \"hello_4\","
+ "\"abc_5\": \"hello_5\""
+ "}";
+
+ QJsonParseError error;
+ QJsonDocument doc = QJsonDocument::fromJson(json, &error);
+ QVERIFY(error.error == QJsonParseError::NoError);
+ QJsonObject o = doc.object();
+
+ QCOMPARE(o.keys().size(), 5);
+ Q_FOREACH (const QString &key, o.keys()) {
+ QString suffix = key.mid(key.indexOf(QLatin1Char('_')));
+ QCOMPARE(o[key].toString(), QString("hello") + suffix);
+ }
+}
+
QTEST_MAIN(tst_QtJson)
#include "tst_qtjson.moc"