Update test after QUrl minor behaviour change
authorThiago Macieira <thiago.macieira@intel.com>
Wed, 11 Apr 2012 17:05:32 +0000 (14:05 -0300)
committerQt by Nokia <qt-info@nokia.com>
Thu, 12 Apr 2012 03:02:39 +0000 (05:02 +0200)
Changes required:
 - Uppercase the hex in percent-encodings
 - The tolerant decoder treats all % as broken if any one is broken
   (Input "%2B50%" is rendered now "%252B50%25", where previously it
   was "%2B50%25)

The extra test is just so we use QString first. If the test fails, we
get a nicer output from QtTest, instead of the hex dump it uses for
QByteArray.

Change-Id: I4c5cbfa3be962c648b50a69dc8bc3c4acc551e62
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp

index f2521e9..d99ed30 100644 (file)
@@ -1431,10 +1431,10 @@ void tst_qqmlproperty::urlHandling_data()
         << QByteArray("http://www.example.com/main%20file.qml");
 
     QTest::newRow("preencodedName")
-        << QByteArray("http://www.example.com/resources%7cmain%20file.qml")
+        << QByteArray("http://www.example.com/resources%7Cmain%20file.qml")
         << QString("http")
         << QString("/resources|main file.qml")
-        << QByteArray("http://www.example.com/resources%7cmain%20file.qml");
+        << QByteArray("http://www.example.com/resources%7Cmain%20file.qml");
 
     QTest::newRow("encodableQuery")
         << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now working?")
@@ -1443,10 +1443,10 @@ void tst_qqmlproperty::urlHandling_data()
         << QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working?");
 
     QTest::newRow("preencodedQuery")
-        << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now working%3f")
+        << QByteArray("http://www.example.com/main.qml?type=text%2Fqml&comment=now working%3F")
         << QString("http")
         << QString("/main.qml")
-        << QByteArray("http://www.example.com/main.qml?type=text%2fqml&comment=now%20working%3f");
+        << QByteArray("http://www.example.com/main.qml?type=text%2Fqml&comment=now%20working%3F");
 
     QTest::newRow("encodableFragment")
         << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000|volume+50%")
@@ -1454,11 +1454,11 @@ void tst_qqmlproperty::urlHandling_data()
         << QString("/main.qml")
         << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume+50%25");
 
-    QTest::newRow("preencodedFragment")
-        << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%")
+    QTest::newRow("improperlyEncodedFragment")
+        << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7Cvolume%2B50%")
         << QString("http")
         << QString("/main.qml")
-        << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%7cvolume%2b50%25");
+        << QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000%257Cvolume%252B50%25");
 }
 
 void tst_qqmlproperty::urlHandling()
@@ -1480,6 +1480,7 @@ void tst_qqmlproperty::urlHandling()
 
         QCOMPARE(byteArrayResult.scheme(), scheme);
         QCOMPARE(byteArrayResult.path(), path);
+        QCOMPARE(byteArrayResult.toString(QUrl::FullyEncoded), QString::fromUtf8(encoded));
         QCOMPARE(byteArrayResult.toEncoded(), encoded);
     }
 
@@ -1493,6 +1494,7 @@ void tst_qqmlproperty::urlHandling()
 
         QCOMPARE(stringResult.scheme(), scheme);
         QCOMPARE(stringResult.path(), path);
+        QCOMPARE(stringResult.toString(QUrl::FullyEncoded), QString::fromUtf8(encoded));
         QCOMPARE(stringResult.toEncoded(), encoded);
     }
 }