From 0441b2d4c332e0ae6e5ca52878985b826e8f68ca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 30 Mar 2012 10:31:37 -0300 Subject: Merge QUrl::DecodeAllDelimiters and QUrl::DecodeUnambiguousDelimiters There's little value in having the DecodeUnambiguousDelimiters option since neither QUrl nor QUrlQuery can return values that are ambiguous in that particular context, ever. This option could be used to encode a character if, when placed in a URL, it would need to be encoded. Such cases are hash (#) or question marks (?) in the path component, or slashes (/) and at signs (@) in the userinfo. However, we don't need two enums for that, since there are no other characters that can appear in either form. Still, leave two bits for this enum. In the future, if we want to split the gen-delims from the sub-delims, we are able to. Change-Id: If5416b524680eb67dd4abbe7d072ca0ef7218506 Reviewed-by: Shane Kearns --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 6 +++--- tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 8b94a8ef66..aae970eac6 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -2674,7 +2674,7 @@ void tst_QUrl::componentEncodings_data() // and test that %2f is *not* decoded to a slash in the path // don't test the query because in this mode it doesn't transform anything QTest::newRow("decoded-gendelims-unchanging") << QUrl("x://:%3a@host/%2f%3a%40#%23%3a%2f%3f%40") - << int(QUrl::DecodeUnambiguousDelimiters) + << int(QUrl::DecodeDelimiters) << "" << ":" << "::" << "host" << "::@host" << "/%2F:@" << "" << "#:/?@" @@ -2707,7 +2707,7 @@ void tst_QUrl::componentEncodings_data() << QString() << "!$()*+,;=:/?[]@" << QString() << "?!$()*+,;=:/?[]@"; QTest::newRow("undecoded-delims-query") << QUrl("?%21%24%26%27%28%29%2a%2b%2c%2f%3a%3b%3d%3f%40%5b%5d") - << int(QUrl::DecodeUnambiguousDelimiters) + << int(QUrl::DecodeDelimiters) << QString() << QString() << QString() << QString() << QString() << QString() << "%21%24%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D" << QString() @@ -2726,7 +2726,7 @@ void tst_QUrl::componentEncodings_data() "?%22%3C%3E%5E%5C%7B%7C%7D#%22%3C%3E%5E%5C%7B%7C%7D"; QTest::newRow("decoded-others") << QUrl("x://%22%3C%3E%5E%5C%7B%7C%7D:%22%3C%3E%5E%5C%7B%7C%7D@host" "/%22%3C%3E%5E%5C%7B%7C%7D?%22%3C%3E%5E%5C%7B%7C%7D#%22%3C%3E%5E%5C%7B%7C%7D") - << int(QUrl::DecodeAllDelimiters) + << int(QUrl::DecodeDelimiters) << "\"<>^\\{|}" << "\"<>^\\{|}" << "\"<>^\\{|}:\"<>^\\{|}" << "host" << "\"<>^\\{|}:\"<>^\\{|}@host" << "/\"<>^\\{|}" << "\"<>^\\{|}" << "\"<>^\\{|}" diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index ec9170bd7d..24b651a8a3 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -605,8 +605,8 @@ void tst_QUrlQuery::encodedSetQueryItems_data() QTest::newRow("ampersand") << "%26=%26" << "%26" << "%26" << F(QUrl::PrettyDecoded) << "%26=%26" << "&" << "&"; QTest::newRow("hash") << "#=#" << "%23" << "%23" << F(QUrl::PrettyDecoded) - << "%23=%23" << "#" << "#"; - QTest::newRow("decode-hash") << "%23=%23" << "%23" << "%23" << F(QUrl::DecodeAllDelimiters) + << "#=#" << "#" << "#"; + QTest::newRow("decode-hash") << "%23=%23" << "%23" << "%23" << F(QUrl::DecodeDelimiters) << "#=#" << "#" << "#"; QTest::newRow("percent") << "%25=%25" << "%25" << "%25" << F(QUrl::PrettyDecoded) @@ -623,7 +623,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::DecodeAllDelimiters) + QTest::newRow("decode-2b") << "%2b=%2b" << "%2b" << "%2b" << F(QUrl::DecodeDelimiters) << "%2B=%2B" << "%2B" << "%2B"; @@ -680,7 +680,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::DecodeAllDelimiters), expected); + COMPARE_ITEMS(query.queryItems(QUrl::DecodeDelimiters), expected); } { -- cgit v1.2.3