diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-03-30 17:48:42 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 23:32:26 +0200 |
commit | 1b7e9dba75f18342911bc6954be3e754322f091f (patch) | |
tree | 1dfb775910294ff8d02e60cfa9c2bf178baa6221 /tests/auto/corelib/io/qurlquery | |
parent | 997ac954abe8e4f7d9323f13a79989f277de8301 (diff) |
Change the component formatting enum values so the default is zero
By having the default value equal to zero, we follow the principle of
least surprise. For example, if we had
url.path()
and we refactored to
url.path(QUrl::DecodeSpaces)
Then instead of ensuring spaces are decoded, we make spaces the only
thing encoded (unicode, delimiters and reserved characters are
encoded).
Besides, modifying the default can only be used to encode something
that wasn't encoded previously, so having the enums as Encode makes
more sense.
As a side-effect, toEncoded() does not support any extra encoding
options.
Change-Id: I2624ec446e65c2d979e9ca2f81bd3db22b00bb13
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tests/auto/corelib/io/qurlquery')
-rw-r--r-- | tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index 24b651a8a3..7148a71153 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -593,10 +593,13 @@ void tst_QUrlQuery::encodedSetQueryItems_data() QTest::newRow("encode-space") << " = " << " " << " " << F(QUrl::FullyEncoded) << "%20=%20" << "%20" << "%20"; - QTest::newRow("non-delimiters") << "%3C%5C%3E=%7B%7C%7D%5E%60" << "%3C%5C%3E" << "%7B%7C%7D%5E%60" << F(QUrl::PrettyDecoded) + // tri-state + QTest::newRow("decode-non-delimiters") << "%3C%5C%3E=%7B%7C%7D%5E%60" << "%3C%5C%3E" << "%7B%7C%7D%5E%60" << F(QUrl::DecodeReserved) << "<\\>={|}^`" << "<\\>" << "{|}^`"; - QTest::newRow("encode-non-delimiters") << "<\\>={|}^`" << "<\\>" << "{|}^`" << F(QUrl::FullyEncoded) + QTest::newRow("encode-non-delimiters") << "<\\>={|}^`" << "<\\>" << "{|}^`" << F(QUrl::EncodeReserved) << "%3C%5C%3E=%7B%7C%7D%5E%60" << "%3C%5C%3E" << "%7B%7C%7D%5E%60"; + QTest::newRow("pretty-non-delimiters") << "<\\>={|}^`" << "<\\>" << "{|}^`" << F(QUrl::PrettyDecoded) + << "%3C%5C%3E=%7B%7C%7D%5E%60" << "<\\>" << "{|}^`"; QTest::newRow("equals") << "%3D=%3D" << "%3D" << "%3D" << F(QUrl::PrettyDecoded) << "%3D=%3D" << "=" << "="; @@ -606,7 +609,7 @@ void tst_QUrlQuery::encodedSetQueryItems_data() << "%26=%26" << "&" << "&"; QTest::newRow("hash") << "#=#" << "%23" << "%23" << F(QUrl::PrettyDecoded) << "#=#" << "#" << "#"; - QTest::newRow("decode-hash") << "%23=%23" << "%23" << "%23" << F(QUrl::DecodeDelimiters) + QTest::newRow("decode-hash") << "%23=%23" << "%23" << "%23" << F(QUrl::PrettyDecoded) << "#=#" << "#" << "#"; QTest::newRow("percent") << "%25=%25" << "%25" << "%25" << F(QUrl::PrettyDecoded) @@ -623,7 +626,7 @@ void tst_QUrlQuery::encodedSetQueryItems_data() // plus signs must not be touched QTest::newRow("encode-plus") << "+=+" << "+" << "+" << F(QUrl::FullyEncoded) << "+=+" << "+" << "+"; - QTest::newRow("decode-2b") << "%2b=%2b" << "%2b" << "%2b" << F(QUrl::DecodeDelimiters) + QTest::newRow("decode-2b") << "%2b=%2b" << "%2b" << "%2b" << F(QUrl::MostDecoded) << "%2B=%2B" << "%2B" << "%2B"; @@ -680,7 +683,7 @@ void tst_QUrlQuery::differentDelimiters() expected << qItem("foo", "bar") << qItem("hello", "world"); COMPARE_ITEMS(query.queryItems(), expected); COMPARE_ITEMS(query.queryItems(QUrl::FullyEncoded), expected); - COMPARE_ITEMS(query.queryItems(QUrl::DecodeDelimiters), expected); + COMPARE_ITEMS(query.queryItems(QUrl::MostDecoded), expected); } { |