From 31c5b237c4f0eb6848c7d2e3ae84232c6f8f6d26 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 11 Apr 2012 14:05:32 -0300 Subject: [PATCH] Update test after QUrl minor behaviour change 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 --- tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index f2521e9..d99ed30 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -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); } } -- 2.7.4