diff options
author | David Faure <faure@kde.org> | 2009-12-28 16:56:14 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-28 16:56:14 (GMT) |
commit | 8c306f8ee137baebc312a126c4e0d27bb9150f69 (patch) | |
tree | 6e4fb9f5013a1c9fd26afdfe843251261ac41337 /tests | |
parent | d0c3d9770b5c33810f12e409e2304957079a2608 (diff) | |
download | Qt-8c306f8ee137baebc312a126c4e0d27bb9150f69.zip Qt-8c306f8ee137baebc312a126c4e0d27bb9150f69.tar.gz Qt-8c306f8ee137baebc312a126c4e0d27bb9150f69.tar.bz2 |
QUrl::toEncoded() fix for the case of "password, but no username".
QUrl::setPassword() without QUrl::setUserName() is actually useful,
e.g. for kde's ldap:// slave. QUrl::toString() already handled this correctly,
but QUrl::toEncoded() would forget the password in such a case.
Autotest added.
Merge-request: 2276
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qurl/tst_qurl.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 03e77aa..70cfb61 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -1682,6 +1682,12 @@ void tst_QUrl::toString_constructed_data() << QByteArray("//qt.nokia.com/index.html"); QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray() << n << QString::fromLatin1("file:///root") << QByteArray("file:///root"); + QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde") + << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n + << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/"); + QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde") + << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n + << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/"); } void tst_QUrl::toString_constructed() @@ -1717,6 +1723,7 @@ void tst_QUrl::toString_constructed() QVERIFY(url.isValid()); QCOMPARE(url.toString(), asString); + QCOMPARE(QString::fromLatin1(url.toEncoded()), QString::fromLatin1(asEncoded)); // readable in case of differences QCOMPARE(url.toEncoded(), asEncoded); } |