diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 740e205336..971fe27f30 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -149,6 +149,8 @@ private slots: void toEncoded(); void setAuthority_data(); void setAuthority(); + void setEmptyAuthority_data(); + void setEmptyAuthority(); void clear(); void resolvedWithAbsoluteSchemes() const; void resolvedWithAbsoluteSchemes_data() const; @@ -2498,6 +2500,28 @@ void tst_QUrl::setAuthority() QCOMPARE(u.toString(), url); } +void tst_QUrl::setEmptyAuthority_data() +{ + QTest::addColumn("host"); + QTest::addColumn("authority"); + QTest::addColumn("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::clear() { QUrl url("a");