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
parent
b2c44985e7
commit
fbdea2c993
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue