summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 29b88980ad..7ee4f74999 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -165,6 +165,8 @@ private slots:
void componentEncodings();
void setComponents_data();
void setComponents();
+ void streaming_data();
+ void streaming();
};
// Testing get/set functions
@@ -3146,5 +3148,37 @@ void tst_QUrl::setComponents()
}
}
+void tst_QUrl::streaming_data()
+{
+ QTest::addColumn<QString>("urlStr");
+
+ QTest::newRow("origURL") << "http://www.website.com/directory/?#ref";
+ QTest::newRow("urlWithPassAndNoUser") << "ftp://:password@ftp.kde.org/path";
+ QTest::newRow("accentuated") << QString::fromUtf8("trash:/été");
+ QTest::newRow("withPercents") << "http://host/path%25path?%3Fque%25ry#%23ref%25";
+ QTest::newRow("empty") << "";
+ QVERIFY(!QUrl("ptal://mlc:usb").isValid());
+ QTest::newRow("invalid") << "ptal://mlc:usb";
+ QTest::newRow("ipv6") << "http://[::ffff:129.144.52.38]:81?query";
+}
+
+void tst_QUrl::streaming()
+{
+ QFETCH(QString, urlStr);
+ QUrl url(urlStr);
+
+ QByteArray buffer;
+ QDataStream writeStream( &buffer, QIODevice::WriteOnly );
+ writeStream << url;
+
+ QDataStream stream( buffer );
+ QUrl restored;
+ stream >> restored;
+ if (url.isValid())
+ QCOMPARE(restored.url(), url.url());
+ else
+ QVERIFY(!restored.isValid());
+}
+
QTEST_MAIN(tst_QUrl)
#include "tst_qurl.moc"