aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-06-19 10:24:01 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-25 01:50:37 +0200
commit2c4595ad02ff35011c24ea71c193d5a9710bec30 (patch)
treea6eb3d3da97e2aafd3fff03de22b1d884bdd2d25 /tests
parent2753e9a795537df10c5a3b64ec9f6d8d81381837 (diff)
Decode directory separators in source URLs
URLs with encoded directory-separator characters are not correctly processed by QUrl. Task-number: QTBUG-25981 Change-Id: I78173ef44c4850774b56753335bea34db04c0735 Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp3
-rw-r--r--tests/auto/quick/qquickloader/data/subdir/Test.qml5
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp4
3 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 248cc0d803..658874f46d 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -1557,11 +1557,12 @@ void tst_qqmlproperty::urlHandling_data()
<< QString("/main.qml")
<< QByteArray("http://www.example.com/main.qml?type=text/qml&comment=now%20working?");
+ // Although 'text%2Fqml' is pre-encoded, it will be decoded to allow correct QUrl classification
QTest::newRow("preencodedQuery")
<< 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/qml&comment=now%20working%3F");
QTest::newRow("encodableFragment")
<< QByteArray("http://www.example.com/main.qml?type=text/qml#start+30000|volume+50%")
diff --git a/tests/auto/quick/qquickloader/data/subdir/Test.qml b/tests/auto/quick/qquickloader/data/subdir/Test.qml
new file mode 100644
index 0000000000..3abbd89d46
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/subdir/Test.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+Item {
+ id: test
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index dfe02c649f..dc21af89d7 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -201,6 +201,10 @@ void tst_QQuickLoader::sourceOrComponent_data()
QTest::addColumn<QString>("errorString");
QTest::newRow("source") << "source" << "source: 'Rect120x60.qml'\n" << testFileUrl("Rect120x60.qml") << "";
+ QTest::newRow("source with subdir") << "source" << "source: 'subdir/Test.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir literal") << "source" << "source: 'subdir%2fTest.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir optimized binding") << "source" << "source: 'subdir' + '%2fTest.qml'\n" << testFileUrl("subdir/Test.qml") << "";
+ QTest::newRow("source with encoded subdir binding") << "source" << "source: encodeURIComponent('subdir/Test.qml')\n" << testFileUrl("subdir/Test.qml") << "";
QTest::newRow("sourceComponent") << "component" << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << "";
QTest::newRow("invalid source") << "source" << "source: 'IDontExist.qml'\n" << testFileUrl("IDontExist.qml")
<< QString(testFileUrl("IDontExist.qml").toString() + ": File not found");