diff options
author | Peter Hartmann <phartmann@rim.com> | 2012-12-14 20:23:25 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-12-20 16:48:36 +0100 |
commit | fbdea2c9938601186dbbab96a3ac571f764ba141 (patch) | |
tree | 7a117769f492d341a78d15b45e8b429f9c64d46a /tests/auto | |
parent | b2c44985e740d0a0ea86b7b9f4cc849258ac2340 (diff) |
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>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
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<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"); |