summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-05-21 18:27:26 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-22 20:56:38 +0200
commit4793356ce769b301ff39ce304b731cffc2ad2741 (patch)
tree4b7cb80609c334ad6e64c70225c035c35a8a3d60 /tests
parent6049f67eb4196475096074c1ff7e05fb417eae3b (diff)
Fix the idempotent recoding tests in tst_QUrlInternal
This was trying all the possibilities by brute force, but it turns out that some combinations are not valid so they should not be tested. What's more, it was using old values of the flags, so this was actually testing nothing. Change-Id: I6c2f5230d240fc23418df2d3a1ca905dbc47dd10 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')
-rw-r--r--tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
index 3ac2b46964..43266f185b 100644
--- a/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
+++ b/tests/auto/corelib/io/qurlinternal/tst_qurlinternal.cpp
@@ -834,9 +834,34 @@ void tst_QUrlInternal::encodingRecode_data()
QTest::addColumn<QString>("expected");
// -- idempotent tests --
- for (int i = 0; i < 0x10; ++i) {
- QByteArray code = QByteArray::number(i, 16);
- F mode = QUrl::ComponentFormattingOption(i << 12);
+ static int modes[] = { QUrl::PrettyDecoded,
+ QUrl::EncodeSpaces,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::EncodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeUnicode | QUrl::DecodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeDelimiters,
+ QUrl::EncodeSpaces | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
+ QUrl::EncodeSpaces | QUrl::EncodeReserved,
+ QUrl::EncodeSpaces | QUrl::DecodeReserved,
+
+ QUrl::EncodeUnicode,
+ QUrl::EncodeUnicode | QUrl::EncodeDelimiters,
+ QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::EncodeReserved,
+ QUrl::EncodeUnicode | QUrl::EncodeDelimiters | QUrl::DecodeReserved,
+ QUrl::EncodeUnicode | QUrl::EncodeReserved,
+
+ QUrl::EncodeDelimiters,
+ QUrl::EncodeDelimiters | QUrl::EncodeReserved,
+ QUrl::EncodeDelimiters | QUrl::DecodeReserved,
+ QUrl::EncodeReserved,
+ QUrl::DecodeReserved };
+ for (uint i = 0; i < sizeof(modes)/sizeof(modes[0]); ++i) {
+ QByteArray code = QByteArray::number(modes[i], 16);
+ F mode = QUrl::ComponentFormattingOption(modes[i]);
QTest::newRow("null-0x" + code) << QString() << mode << QString();
QTest::newRow("empty-0x" + code) << "" << mode << "";