diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-05-21 18:44:31 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-22 20:56:38 +0200 |
commit | f0ec001242228bd6ee73ca320a82365a3f9323aa (patch) | |
tree | 32f2d72dfaf412b9f55f22bab03fa53ac4d6a692 /tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | |
parent | 4793356ce769b301ff39ce304b731cffc2ad2741 (diff) |
Port away from QUrl::MostDecoded
Since we're about to introduce QUrl::FullyDecoded, this
QUrl::MostDecoded value would be confusing. Replace its uses with what
was intended at the point in question.
Change-Id: Iefd87bc33d37bace507c5cb0f206fa902e08e2df
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp')
-rw-r--r-- | tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp index 43266f185b..68aaa198a8 100644 --- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp +++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp @@ -822,7 +822,9 @@ static void addUtf8Data(const char *name, const char *data) QString encoded = QByteArray(data).toPercentEncoding(); QString decoded = QString::fromUtf8(data); - QTest::newRow(QByteArray("decode-") + name) << encoded << QUrl::ComponentFormattingOptions(QUrl::MostDecoded) << decoded; + // this data contains invaild UTF-8 sequences, so FullyDecoded doesn't work (by design) + // use PrettyDecoded instead + QTest::newRow(QByteArray("decode-") + name) << encoded << QUrl::ComponentFormattingOptions(QUrl::PrettyDecoded) << decoded; QTest::newRow(QByteArray("encode-") + name) << decoded << QUrl::ComponentFormattingOptions(QUrl::FullyEncoded) << encoded; } @@ -898,21 +900,21 @@ void tst_QUrlInternal::encodingRecode_data() } // encode control characters - QTest::newRow("encode-control") << "\1abc\2\033esc" << F(QUrl::MostDecoded) << "%01abc%02%1Besc"; - QTest::newRow("encode-nul") << QString::fromLatin1("abc\0def", 7) << F(QUrl::MostDecoded) << "abc%00def"; + QTest::newRow("encode-control") << "\1abc\2\033esc" << F(QUrl::PrettyDecoded) << "%01abc%02%1Besc"; + QTest::newRow("encode-nul") << QString::fromLatin1("abc\0def", 7) << F(QUrl::PrettyDecoded) << "abc%00def"; // space - QTest::newRow("space-leave-decoded") << "Hello World " << F(QUrl::MostDecoded) << "Hello World "; + QTest::newRow("space-leave-decoded") << "Hello World " << F(QUrl::PrettyDecoded) << "Hello World "; QTest::newRow("space-leave-encoded") << "Hello%20World%20" << F(QUrl::FullyEncoded) << "Hello%20World%20"; QTest::newRow("space-encode") << "Hello World " << F(QUrl::FullyEncoded) << "Hello%20World%20"; - QTest::newRow("space-decode") << "Hello%20World%20" << F(QUrl::MostDecoded) << "Hello World "; + QTest::newRow("space-decode") << "Hello%20World%20" << F(QUrl::PrettyDecoded) << "Hello World "; // decode unreserved QTest::newRow("unreserved-decode") << "%66%6f%6f%42a%72" << F(QUrl::FullyEncoded) << "fooBar"; // mix encoding with decoding - QTest::newRow("encode-control-decode-space") << "\1\2%200" << F(QUrl::MostDecoded) << "%01%02 0"; - QTest::newRow("decode-space-encode-control") << "%20\1\2" << F(QUrl::MostDecoded) << " %01%02"; + QTest::newRow("encode-control-decode-space") << "\1\2%200" << F(QUrl::PrettyDecoded) << "%01%02 0"; + QTest::newRow("decode-space-encode-control") << "%20\1\2" << F(QUrl::PrettyDecoded) << " %01%02"; // decode and encode valid UTF-8 data // invalid is tested in encodingRecodeInvalidUtf8 @@ -947,11 +949,11 @@ void tst_QUrlInternal::encodingRecode_data() QTest::newRow("ff") << "%ff" << F(QUrl::FullyEncoded) << "%FF"; // decode UTF-8 mixed with non-UTF-8 and unreserved - QTest::newRow("utf8-mix-1") << "%80%C2%80" << F(QUrl::MostDecoded) << QString::fromUtf8("%80\xC2\x80"); - QTest::newRow("utf8-mix-2") << "%C2%C2%80" << F(QUrl::MostDecoded) << QString::fromUtf8("%C2\xC2\x80"); - QTest::newRow("utf8-mix-3") << "%E0%C2%80" << F(QUrl::MostDecoded) << QString::fromUtf8("%E0\xC2\x80"); - QTest::newRow("utf8-mix-3") << "A%C2%80" << F(QUrl::MostDecoded) << QString::fromUtf8("A\xC2\x80"); - QTest::newRow("utf8-mix-3") << "%C2%80A" << F(QUrl::MostDecoded) << QString::fromUtf8("\xC2\x80""A"); + QTest::newRow("utf8-mix-1") << "%80%C2%80" << F(QUrl::PrettyDecoded) << QString::fromUtf8("%80\xC2\x80"); + QTest::newRow("utf8-mix-2") << "%C2%C2%80" << F(QUrl::PrettyDecoded) << QString::fromUtf8("%C2\xC2\x80"); + QTest::newRow("utf8-mix-3") << "%E0%C2%80" << F(QUrl::PrettyDecoded) << QString::fromUtf8("%E0\xC2\x80"); + QTest::newRow("utf8-mix-3") << "A%C2%80" << F(QUrl::PrettyDecoded) << QString::fromUtf8("A\xC2\x80"); + QTest::newRow("utf8-mix-3") << "%C2%80A" << F(QUrl::PrettyDecoded) << QString::fromUtf8("\xC2\x80""A"); } void tst_QUrlInternal::encodingRecode() @@ -993,7 +995,7 @@ void tst_QUrlInternal::encodingRecodeInvalidUtf8() // prepend some data to be sure that it remains there QString output = QTest::currentDataTag(); - if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), QUrl::MostDecoded)) + if (!qt_urlRecode(output, input.constData(), input.constData() + input.length(), QUrl::PrettyDecoded)) output += input; QCOMPARE(output, QTest::currentDataTag() + input); |