equal
deleted
inserted
replaced
1 /**************************************************************************** |
1 /**************************************************************************** |
2 ** |
2 ** |
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
4 ** All rights reserved. |
4 ** All rights reserved. |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
6 ** |
6 ** |
7 ** This file is part of the test suite of the Qt Toolkit. |
7 ** This file is part of the test suite of the Qt Toolkit. |
8 ** |
8 ** |
163 void nameprep_testsuite(); |
163 void nameprep_testsuite(); |
164 void ace_testsuite_data(); |
164 void ace_testsuite_data(); |
165 void ace_testsuite(); |
165 void ace_testsuite(); |
166 void std3violations_data(); |
166 void std3violations_data(); |
167 void std3violations(); |
167 void std3violations(); |
|
168 void std3deviations_data(); |
|
169 void std3deviations(); |
168 void tldRestrictions_data(); |
170 void tldRestrictions_data(); |
169 void tldRestrictions(); |
171 void tldRestrictions(); |
170 void emptyQueryOrFragment(); |
172 void emptyQueryOrFragment(); |
171 void hasFragment_data(); |
173 void hasFragment_data(); |
172 void hasFragment(); |
174 void hasFragment(); |
1680 QTest::newRow("data1") << n << n << n << QString::fromLatin1("qt.nokia.com") << -1 << QString::fromLatin1("index.html") |
1682 QTest::newRow("data1") << n << n << n << QString::fromLatin1("qt.nokia.com") << -1 << QString::fromLatin1("index.html") |
1681 << QByteArray() << n << QString::fromLatin1("//qt.nokia.com/index.html") |
1683 << QByteArray() << n << QString::fromLatin1("//qt.nokia.com/index.html") |
1682 << QByteArray("//qt.nokia.com/index.html"); |
1684 << QByteArray("//qt.nokia.com/index.html"); |
1683 QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray() |
1685 QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray() |
1684 << n << QString::fromLatin1("file:///root") << QByteArray("file:///root"); |
1686 << n << QString::fromLatin1("file:///root") << QByteArray("file:///root"); |
|
1687 QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde") |
|
1688 << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n |
|
1689 << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/"); |
|
1690 QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde") |
|
1691 << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n |
|
1692 << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/"); |
1685 } |
1693 } |
1686 |
1694 |
1687 void tst_QUrl::toString_constructed() |
1695 void tst_QUrl::toString_constructed() |
1688 { |
1696 { |
1689 QFETCH(QString, scheme); |
1697 QFETCH(QString, scheme); |
1715 if (!fragment.isEmpty()) |
1723 if (!fragment.isEmpty()) |
1716 url.setFragment(fragment); |
1724 url.setFragment(fragment); |
1717 |
1725 |
1718 QVERIFY(url.isValid()); |
1726 QVERIFY(url.isValid()); |
1719 QCOMPARE(url.toString(), asString); |
1727 QCOMPARE(url.toString(), asString); |
|
1728 QCOMPARE(QString::fromLatin1(url.toEncoded()), QString::fromLatin1(asEncoded)); // readable in case of differences |
1720 QCOMPARE(url.toEncoded(), asEncoded); |
1729 QCOMPARE(url.toEncoded(), asEncoded); |
1721 } |
1730 } |
1722 |
1731 |
1723 |
1732 |
1724 void tst_QUrl::isParentOf() |
1733 void tst_QUrl::isParentOf() |
1821 { |
1830 { |
1822 QTest::addColumn<QString>("urlStr"); |
1831 QTest::addColumn<QString>("urlStr"); |
1823 QTest::addColumn<QString>("res"); |
1832 QTest::addColumn<QString>("res"); |
1824 |
1833 |
1825 //next we fill it with data |
1834 //next we fill it with data |
1826 QTest::newRow( "data0" ) << QString("Makefile") << QString("Makefile"); // nolonger add file by defualt |
1835 QTest::newRow( "data0" ) << QString("Makefile") << QString("Makefile"); // nolonger add file by default |
1827 QTest::newRow( "data1" ) << QString("Makefile") << QString("Makefile"); |
1836 QTest::newRow( "data1" ) << QString("Makefile") << QString("Makefile"); |
1828 QTest::newRow( "data2" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); |
1837 QTest::newRow( "data2" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); |
1829 QTest::newRow( "data3" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); |
1838 QTest::newRow( "data3" ) << QString("ftp://ftp.qt.nokia.com/qt/INSTALL") << QString("ftp://ftp.qt.nokia.com/qt/INSTALL"); |
1830 } |
1839 } |
1831 |
1840 |
3229 |
3238 |
3230 QTest::newRow("control") << "\033foo" << false; |
3239 QTest::newRow("control") << "\033foo" << false; |
3231 QTest::newRow("bang") << "foo!" << false; |
3240 QTest::newRow("bang") << "foo!" << false; |
3232 QTest::newRow("plus") << "foo+bar" << false; |
3241 QTest::newRow("plus") << "foo+bar" << false; |
3233 QTest::newRow("dot") << "foo.bar"; |
3242 QTest::newRow("dot") << "foo.bar"; |
|
3243 QTest::newRow("startingdot") << ".bar" << false; |
|
3244 QTest::newRow("startingdot2") << ".example.com" << false; |
3234 QTest::newRow("slash") << "foo/bar" << true; |
3245 QTest::newRow("slash") << "foo/bar" << true; |
3235 QTest::newRow("colon") << "foo:80" << true; |
3246 QTest::newRow("colon") << "foo:80" << true; |
3236 QTest::newRow("question") << "foo?bar" << true; |
3247 QTest::newRow("question") << "foo?bar" << true; |
3237 QTest::newRow("at") << "foo@bar" << true; |
3248 QTest::newRow("at") << "foo@bar" << true; |
3238 QTest::newRow("backslash") << "foo\\bar" << false; |
3249 QTest::newRow("backslash") << "foo\\bar" << false; |
3271 if (validUrl) |
3282 if (validUrl) |
3272 return; // test ends here for these cases |
3283 return; // test ends here for these cases |
3273 |
3284 |
3274 url = QUrl("http://" + source + "/some/path"); |
3285 url = QUrl("http://" + source + "/some/path"); |
3275 QVERIFY(!url.isValid()); |
3286 QVERIFY(!url.isValid()); |
|
3287 } |
|
3288 |
|
3289 void tst_QUrl::std3deviations_data() |
|
3290 { |
|
3291 QTest::addColumn<QString>("source"); |
|
3292 |
|
3293 QTest::newRow("ending-dot") << "example.com."; |
|
3294 QTest::newRow("ending-dot3002") << QString("example.com") + QChar(0x3002); |
|
3295 } |
|
3296 |
|
3297 void tst_QUrl::std3deviations() |
|
3298 { |
|
3299 QFETCH(QString, source); |
|
3300 QVERIFY(!QUrl::toAce(source).isEmpty()); |
|
3301 |
|
3302 QUrl url; |
|
3303 url.setHost(source); |
|
3304 QVERIFY(!url.host().isEmpty()); |
3276 } |
3305 } |
3277 |
3306 |
3278 void tst_QUrl::tldRestrictions_data() |
3307 void tst_QUrl::tldRestrictions_data() |
3279 { |
3308 { |
3280 QTest::addColumn<QString>("tld"); |
3309 QTest::addColumn<QString>("tld"); |