diff options
author | David Faure <faure@kde.org> | 2012-05-14 17:17:11 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-14 17:36:57 +0200 |
commit | 5764f5e6eaf149116a818658883cf4fae9830f30 (patch) | |
tree | 23529f990d031b0c5791a3499e8b09c4fe803988 /tests/auto/corelib/io/qurl | |
parent | feb212e1e5f64111ed061b474bb2e6b8c3886acb (diff) |
QUrl: using sectionIsPresent in operator== broke for local files.
QUrl::fromLocalFile("/foo") doesn't set Host, but QUrl("file:///foo")
does (to remember that it saw a Host section, even if empty, which is
useful for urls like "remote://"). So ignore the Host flag in operator==.
Change-Id: I4322b4a75420c4e42766c0d65c1b121f28028a76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/io/qurl')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 48ff34ad56..1f3dcae8b7 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -309,6 +309,8 @@ void tst_QUrl::comparison2_data() QTest::newRow("samescheme") << QUrl("x:") << QUrl("x:") << 0; QTest::newRow("no-fragment-empty-fragment") << QUrl("http://kde.org/dir/") << QUrl("http://kde.org/dir/#") << -1; QTest::newRow("no-query-empty-query") << QUrl("http://kde.org/dir/") << QUrl("http://kde.org/dir/?") << -1; + QTest::newRow("simple-file-url") << QUrl("file:///home/dfaure/file") << QUrl("file:///home/dfaure/file") << 0; + QTest::newRow("fromLocalFile-vs-ctor") << QUrl::fromLocalFile("/home/dfaure/file") << QUrl("file:///home/dfaure/file") << 0; // the following three are by choice // the order could be the opposite and it would still be correct @@ -2638,6 +2640,8 @@ void tst_QUrl::emptyAuthorityRemovesExistingAuthority() void tst_QUrl::acceptEmptyAuthoritySegments() { + QCOMPARE(QUrl("remote://").toString(), QString::fromLatin1("remote://")); + // Verify that foo:///bar is not mangled to foo:/bar QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar"); |