diff options
Diffstat (limited to 'tests/auto/corelib/io/qurl/tst_qurl.cpp')
-rw-r--r-- | tests/auto/corelib/io/qurl/tst_qurl.cpp | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 1f59336fc6..898aefffd3 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -79,6 +79,8 @@ private slots: void toString(); void toString_constructed_data(); void toString_constructed(); + void toAndFromStringList_data(); + void toAndFromStringList(); void isParentOf_data(); void isParentOf(); void toLocalFile_data(); @@ -948,6 +950,25 @@ void tst_QUrl::toString() QCOMPARE(url.toString(QUrl::FormattingOptions(options)), string); } +void tst_QUrl::toAndFromStringList_data() +{ + QTest::addColumn<QStringList>("strings"); + + QTest::newRow("empty") << QStringList(); + QTest::newRow("local") << (QStringList() << "file:///tmp" << "file:///"); + QTest::newRow("remote") << (QStringList() << "http://qt-project.org"); +} + +void tst_QUrl::toAndFromStringList() +{ + QFETCH(QStringList, strings); + + const QList<QUrl> urls = QUrl::fromStringList(strings); + QCOMPARE(urls.count(), strings.count()); + const QStringList converted = QUrl::toStringList(urls); + QCOMPARE(converted, strings); +} + //### more tests ... what do we expect ... void tst_QUrl::isParentOf_data() { @@ -2163,33 +2184,52 @@ void tst_QUrl::tldRestrictions_data() // current whitelist QTest::newRow("ac") << QString("ac") << true; + QTest::newRow("ar") << QString("ar") << true; + QTest::newRow("asia") << QString("asia") << true; QTest::newRow("at") << QString("at") << true; + QTest::newRow("biz") << QString("biz") << true; QTest::newRow("br") << QString("br") << true; QTest::newRow("cat") << QString("cat") << true; QTest::newRow("ch") << QString("ch") << true; QTest::newRow("cl") << QString("cl") << true; QTest::newRow("cn") << QString("cn") << true; + QTest::newRow("com") << QString("com") << true; QTest::newRow("de") << QString("de") << true; QTest::newRow("dk") << QString("dk") << true; + QTest::newRow("es") << QString("es") << true; QTest::newRow("fi") << QString("fi") << true; + QTest::newRow("gr") << QString("gr") << true; QTest::newRow("hu") << QString("hu") << true; + QTest::newRow("il") << QString("il") << true; QTest::newRow("info") << QString("info") << true; QTest::newRow("io") << QString("io") << true; + QTest::newRow("is") << QString("is") << true; + QTest::newRow("ir") << QString("ir") << true; QTest::newRow("jp") << QString("jp") << true; QTest::newRow("kr") << QString("kr") << true; QTest::newRow("li") << QString("li") << true; QTest::newRow("lt") << QString("lt") << true; + QTest::newRow("lu") << QString("lu") << true; + QTest::newRow("lv") << QString("lv") << true; QTest::newRow("museum") << QString("museum") << true; + QTest::newRow("name") << QString("name") << true; + QTest::newRow("net") << QString("name") << true; QTest::newRow("no") << QString("no") << true; + QTest::newRow("nu") << QString("nu") << true; + QTest::newRow("nz") << QString("nz") << true; + QTest::newRow("org") << QString("org") << true; + QTest::newRow("pl") << QString("pl") << true; + QTest::newRow("pr") << QString("pr") << true; QTest::newRow("se") << QString("se") << true; QTest::newRow("sh") << QString("sh") << true; + QTest::newRow("tel") << QString("tel") << true; QTest::newRow("th") << QString("th") << true; QTest::newRow("tm") << QString("tm") << true; QTest::newRow("tw") << QString("tw") << true; + QTest::newRow("ua") << QString("ua") << true; QTest::newRow("vn") << QString("vn") << true; // known blacklists: - QTest::newRow("com") << QString("com") << false; QTest::newRow("foo") << QString("foo") << false; } @@ -2796,6 +2836,12 @@ void tst_QUrl::effectiveTLDs_data() QTest::newRow("yes6") << QUrl::fromEncoded("http://www.com.com.cn") << ".com.cn"; QTest::newRow("yes7") << QUrl::fromEncoded("http://www.test.org.ws") << ".org.ws"; QTest::newRow("yes9") << QUrl::fromEncoded("http://www.com.co.uk.wallonie.museum") << ".wallonie.museum"; + QTest::newRow("yes10") << QUrl::fromEncoded("http://www.com.evje-og-hornnes.no") << ".evje-og-hornnes.no"; + QTest::newRow("yes11") << QUrl::fromEncoded("http://www.bla.kamijima.ehime.jp") << ".kamijima.ehime.jp"; + QTest::newRow("yes12") << QUrl::fromEncoded("http://www.bla.kakuda.miyagi.jp") << ".kakuda.miyagi.jp"; + QTest::newRow("yes13") << QUrl::fromEncoded("http://mypage.betainabox.com") << ".betainabox.com"; + QTest::newRow("yes14") << QUrl::fromEncoded("http://mypage.rhcloud.com") << ".rhcloud.com"; + QTest::newRow("yes15") << QUrl::fromEncoded("http://mypage.int.az") << ".int.az"; } void tst_QUrl::effectiveTLDs() |