tests/auto/qurl/tst_qurl.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 5 d3bac044e0f0
--- a/tests/auto/qurl/tst_qurl.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tests/auto/qurl/tst_qurl.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -90,6 +90,7 @@
 private slots:
     void getSetCheck();
     void constructing();
+    void isDetached();
     void assignment();
     void comparison();
     void copying();
@@ -318,6 +319,25 @@
     QVERIFY(!buildUNC.isEmpty());
 }
 
+void tst_QUrl::isDetached()
+{
+    QUrl url;
+    QVERIFY(!url.isDetached());
+
+    url = "http://qt.nokia.com/";
+    QVERIFY(url.isDetached());
+
+    url.clear();
+    QVERIFY(!url.isDetached());
+
+    url.setHost("qt.nokia.com");
+    QVERIFY(url.isDetached());
+
+    QUrl url2 = url;
+    QVERIFY(!url.isDetached());
+    QVERIFY(!url2.isDetached());
+}
+
 void tst_QUrl::assignment()
 {
     QUrl url("http://qt.nokia.com/");
@@ -1682,6 +1702,12 @@
 			<< QByteArray("//qt.nokia.com/index.html");
     QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray()
                         << n << QString::fromLatin1("file:///root") << QByteArray("file:///root");
+    QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde")
+                                 << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+                                 << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/");
+    QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde")
+                                     << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n
+                                     << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/");
 }
 
 void tst_QUrl::toString_constructed()
@@ -1717,6 +1743,7 @@
 
     QVERIFY(url.isValid());
     QCOMPARE(url.toString(), asString);
+    QCOMPARE(QString::fromLatin1(url.toEncoded()), QString::fromLatin1(asEncoded)); // readable in case of differences
     QCOMPARE(url.toEncoded(), asEncoded);
 }