diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-03-06 13:05:09 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-07 00:03:07 +0100 |
commit | 53bbea232830af3f056cd8253c4ff4dd33f525c7 (patch) | |
tree | f47a5e83f8c01540b4ff7d4db4fb58769b90d9f1 /tests/auto/corelib/json | |
parent | 7ae6a6e744f92db2626b7c9b38175dc4140a4eaf (diff) |
Fix parsing of unicode escape sequences
Change-Id: I63a7cd3a571fb47c97157bcb2ca29c4239c600ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/json')
-rw-r--r-- | tests/auto/corelib/json/test.bjson | bin | 60992 -> 60992 bytes | |||
-rw-r--r-- | tests/auto/corelib/json/tst_qtjson.cpp | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/json/test.bjson b/tests/auto/corelib/json/test.bjson Binary files differindex aa412eec67..9a0515f3ef 100644 --- a/tests/auto/corelib/json/test.bjson +++ b/tests/auto/corelib/json/test.bjson diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index f5b4f17732..f35831c900 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -115,6 +115,8 @@ private Q_SLOTS: void testCompaction(); void testDebugStream(); void testCompactionError(); + + void parseUnicodeEscapes(); private: QString testDataDir; }; @@ -1758,5 +1760,19 @@ void TestQtJson::testCompactionError() } } +void TestQtJson::parseUnicodeEscapes() +{ + const QByteArray json = "[ \"A\\u00e4\\u00C4\" ]"; + + QJsonDocument doc = QJsonDocument::fromJson(json); + QJsonArray array = doc.array(); + + QString result = QLatin1String("A"); + result += QChar(0xe4); + result += QChar(0xc4); + + QCOMPARE(array.first().toString(), result); +} + QTEST_MAIN(TestQtJson) #include "tst_qtjson.moc" |