summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qurl.cpp9
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 3e711b12ec..07024d3ba8 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2356,10 +2356,16 @@ bool QUrl::operator <(const QUrl &url) const
if (cmp != 0)
return cmp < 0;
+ if (d->hasQuery() != url.d->hasQuery())
+ return url.d->hasQuery();
+
cmp = d->query.compare(url.d->query);
if (cmp != 0)
return cmp < 0;
+ if (d->hasFragment() != url.d->hasFragment())
+ return url.d->hasFragment();
+
cmp = d->fragment.compare(url.d->fragment);
return cmp < 0;
}
@@ -2376,7 +2382,8 @@ bool QUrl::operator ==(const QUrl &url) const
return url.d->isEmpty();
if (!url.d)
return d->isEmpty();
- return d->scheme == url.d->scheme &&
+ return d->sectionIsPresent == url.d->sectionIsPresent &&
+ d->scheme == url.d->scheme &&
d->userName == url.d->userName &&
d->password == url.d->password &&
d->host == url.d->host &&
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 38b9dc3198..48ff34ad56 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -307,6 +307,8 @@ void tst_QUrl::comparison2_data()
QTest::newRow("scheme-null") << QUrl("x:") << QUrl() << 1;
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;
// the following three are by choice
// the order could be the opposite and it would still be correct