summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@rim.com>2012-12-14 18:55:36 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-12-15 04:43:41 (GMT)
commit21666e3857cc9d4c93c6179490c1df46a795de53 (patch)
tree1d63c1f1eac3370f66b6c61bf79de6889f6a9399 /tests
parent01a05c104036b11b09ab827847cacb766ee533ad (diff)
downloadQt-21666e3857cc9d4c93c6179490c1df46a795de53.zip
Qt-21666e3857cc9d4c93c6179490c1df46a795de53.tar.gz
Qt-21666e3857cc9d4c93c6179490c1df46a795de53.tar.bz2
QUrl: make sure setAuthority is consistent with setHost
... which is important for an empty but non-null authority. In Qt5 this is already working. Change-Id: I7d389037f71320c6f06897b220633311c3611eea Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qurl/tst_qurl.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 81f646d..bccd532 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -189,6 +189,8 @@ private slots:
void toEncoded();
void setAuthority_data();
void setAuthority();
+ void setEmptyAuthority_data();
+ void setEmptyAuthority();
void errorString();
void clear();
void resolvedWithAbsoluteSchemes() const;
@@ -3776,6 +3778,28 @@ void tst_QUrl::setAuthority()
QCOMPARE(u.toString(), url);
}
+void tst_QUrl::setEmptyAuthority_data()
+{
+ QTest::addColumn<QString>("host");
+ QTest::addColumn<QString>("authority");
+ QTest::addColumn<QString>("expectedUrlString");
+
+ QTest::newRow("null host and authority") << QString() << QString() << QString("");
+ QTest::newRow("empty host and authority") << QString("") << QString("") << QString("//");
+}
+
+void tst_QUrl::setEmptyAuthority()
+{
+ QFETCH(QString, host);
+ QFETCH(QString, authority);
+ QFETCH(QString, expectedUrlString);
+ QUrl u;
+ u.setHost(host);
+ QCOMPARE(u.toString(), expectedUrlString);
+ u.setAuthority(authority);
+ QCOMPARE(u.toString(), expectedUrlString);
+}
+
void tst_QUrl::errorString()
{
QUrl u = QUrl::fromEncoded("http://strange<username>@bad_hostname/", QUrl::StrictMode);