diff options
author | David Faure <faure@kde.org> | 2013-07-06 09:52:49 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-08 15:20:42 +0200 |
commit | 602c911820fd8b0832dba64b37b3110580f381ae (patch) | |
tree | 872eaccaff606a1858117d27d162863df5786357 /tests/auto/corelib/io/qurl/tst_qurl.cpp | |
parent | 67ec78aac1cc0d490d8531cb2fa0c044c58da4ee (diff) |
QUrl: add "QUrl adjusted(options)" convenience method.
Change-Id: I5eea3e0dc7b56b88a56d813207b04661b8f05a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qurl/tst_qurl.cpp')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 23f245a5ae..b97ebf11f2 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -946,8 +946,12 @@ void tst_QUrl::toString() QFETCH(uint, options); QFETCH(QString, string); + QUrl::FormattingOptions opt(options); + QUrl url(urlString); - QCOMPARE(url.toString(QUrl::FormattingOptions(options)), string); + QCOMPARE(url.toString(opt), string); + + QCOMPARE(url.adjusted(opt).toString(), string); } void tst_QUrl::toAndFromStringList_data() @@ -2426,6 +2430,7 @@ void tst_QUrl::stripTrailingSlash_data() QTest::addColumn<QString>("url"); QTest::addColumn<QString>("expected"); + QTest::newRow("subdir no slash") << "ftp://kde.org/dir/subdir" << "ftp://kde.org/dir/subdir"; QTest::newRow("ftp no slash") << "ftp://ftp.de.kde.org/dir" << "ftp://ftp.de.kde.org/dir"; QTest::newRow("ftp slash") << "ftp://ftp.de.kde.org/dir/" << "ftp://ftp.de.kde.org/dir"; QTest::newRow("file slash") << "file:///dir/" << "file:///dir"; @@ -2441,6 +2446,9 @@ void tst_QUrl::stripTrailingSlash() QUrl u(url); QCOMPARE(u.toString(QUrl::StripTrailingSlash), expected); + + // Same thing, using QUrl::adjusted() + QCOMPARE(u.adjusted(QUrl::StripTrailingSlash).toString(), expected); } void tst_QUrl::hosts_data() |