QUrl auto tests: make sure setAuthority is consistent with setHost

... with respect to empty and null strings.

Change-Id: Ic107d5bcc8b659497a567b75a7244caceba5a715
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Peter Hartmann 2012-12-14 20:23:25 +01:00 committed by The Qt Project
parent b2c44985e7
commit fbdea2c993
1 changed files with 24 additions and 0 deletions

View File

@ -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<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::clear()
{
QUrl url("a");