diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2012-03-29 22:11:33 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-11 23:31:41 +0200 |
commit | 8d3cb11261fe9d6ec2e071c959b836f7bfadc33d (patch) | |
tree | 6d938ebe5b957bf22ab092fd9f2e41525912d411 /tests/auto/corelib/io/qurl | |
parent | dc325aab1820029f6f665080fbadfe11a0ff9c7e (diff) |
Make QUrl handle ambiguous delimiters correctly
Refactor the way that QUrl stores and returns the components of the
URL so that ambiguous delimiters (gen-delims that could change the
meaning of the parsing) are interpreted correctly. Previously, QUrl
called "unambiguous" the form found in a full URL, even though each
item in isolation could have more characters decoded.
Now, instead, store only the fully decoded form. To recreate the
compound forms (the full URL, as well as the user info and the
authority), we need to do more processing.
This commit applies to the user name, password, path and fragment
only. The scheme, host and port do not need this work because they are
special; the query is handled separately.
Change-Id: I5907ba9b8fe048fff23c128be95668c22820663a
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tests/auto/corelib/io/qurl')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index a5c11469ad..c9f977e11f 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -225,7 +225,7 @@ void tst_QUrl::hashInPath() { QUrl withHashInPath; withHashInPath.setPath(QString::fromLatin1("hi#mum.txt")); - QCOMPARE(withHashInPath.path(), QString::fromLatin1("hi%23mum.txt")); + QCOMPARE(withHashInPath.path(), QString::fromLatin1("hi#mum.txt")); QCOMPARE(withHashInPath.path(QUrl::MostDecoded), QString::fromLatin1("hi#mum.txt")); QCOMPARE(withHashInPath.toString(QUrl::FullyEncoded), QString("hi%23mum.txt")); QCOMPARE(withHashInPath.toDisplayString(QUrl::PreferLocalFile), QString("hi%23mum.txt")); @@ -236,10 +236,9 @@ void tst_QUrl::hashInPath() const QUrl localWithHash = QUrl::fromLocalFile("/hi#mum.txt"); QCOMPARE(localWithHash.toEncoded(), QByteArray("file:///hi%23mum.txt")); QCOMPARE(localWithHash.toString(), QString("file:///hi%23mum.txt")); - QEXPECT_FAIL("", "Regression in the new QUrl, will fix soon", Abort); QCOMPARE(localWithHash.path(), QString::fromLatin1("/hi#mum.txt")); - QCOMPARE(localWithHash.toString(QUrl::PreferLocalFile), QString("/hi#mum.txt")); - QCOMPARE(localWithHash.toDisplayString(QUrl::PreferLocalFile), QString("/hi#mum.txt")); + QCOMPARE(localWithHash.toString(QUrl::PreferLocalFile | QUrl::PrettyDecoded), QString("/hi#mum.txt")); + QCOMPARE(localWithHash.toDisplayString(QUrl::PreferLocalFile | QUrl::PrettyDecoded), QString("/hi#mum.txt")); } void tst_QUrl::unc() @@ -567,7 +566,7 @@ void tst_QUrl::setUrl() { QUrl carsten; carsten.setPath("/home/gis/src/kde/kdelibs/kfile/.#kfiledetailview.cpp.1.18"); - QCOMPARE(carsten.path(), QString::fromLatin1("/home/gis/src/kde/kdelibs/kfile/.%23kfiledetailview.cpp.1.18")); + QCOMPARE(carsten.path(), QString::fromLatin1("/home/gis/src/kde/kdelibs/kfile/.#kfiledetailview.cpp.1.18")); QUrl charles; charles.setPath("/home/charles/foo%20moo"); |