diff options
-rw-r--r-- | tests/auto/qml/qmlcachegen/qmlcachegen.pro | 2 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/trickypaths.qml | 4 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/trickypaths.qrc | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp | 14 | ||||
-rw-r--r-- | tools/qmlcachegen/generateloader.cpp | 1 |
5 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro index bad912c781..a2f963e8c3 100644 --- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro +++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro @@ -10,4 +10,6 @@ RESOURCES += workerscripts_test RESOURCES += versionchecks.qml +RESOURCES += trickypaths.qrc + QT += core-private qml-private testlib diff --git a/tests/auto/qml/qmlcachegen/trickypaths.qml b/tests/auto/qml/qmlcachegen/trickypaths.qml new file mode 100644 index 0000000000..0836808dc2 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/trickypaths.qml @@ -0,0 +1,4 @@ +import QtQml 2.0 +QtObject { + property int success: 42 +} diff --git a/tests/auto/qml/qmlcachegen/trickypaths.qrc b/tests/auto/qml/qmlcachegen/trickypaths.qrc new file mode 100644 index 0000000000..271cf6571e --- /dev/null +++ b/tests/auto/qml/qmlcachegen/trickypaths.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource prefix="/directory with spaces"> +<file alias="file name with spaces.qml">trickypaths.qml</file> +</qresource> +</RCC> diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp index 1c05005c90..5c1692f086 100644 --- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp +++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp @@ -52,6 +52,8 @@ private slots: void versionChecksForAheadOfTimeUnits(); void workerScripts(); + + void trickyPaths(); }; // A wrapper around QQmlComponent to ensure the temporary reference counts @@ -402,6 +404,18 @@ void tst_qmlcachegen::functionExpressions() QCOMPARE(obj->property("h_connections_handler_called").toBool(), true); } +void tst_qmlcachegen::trickyPaths() +{ + QString pathWithSpaces(QStringLiteral(":/directory with spaces/file name with spaces.qml")); + QVERIFY2(QFile::exists(pathWithSpaces), qPrintable(pathWithSpaces)); + QCOMPARE(QFileInfo(pathWithSpaces).size(), 0); + QQmlEngine engine; + QQmlComponent component(&engine, QUrl("qrc" + pathWithSpaces)); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + QCOMPARE(obj->property("success").toInt(), 42); +} + QTEST_GUILESS_MAIN(tst_qmlcachegen) #include "tst_qmlcachegen.moc" diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp index a2e673d15a..96528a9477 100644 --- a/tools/qmlcachegen/generateloader.cpp +++ b/tools/qmlcachegen/generateloader.cpp @@ -51,6 +51,7 @@ QString symbolNamespaceForPath(const QString &relativePath) symbol.replace(QLatin1Char('.'), QLatin1Char('_')); symbol.replace(QLatin1Char('+'), QLatin1Char('_')); symbol.replace(QLatin1Char('-'), QLatin1Char('_')); + symbol.replace(QLatin1Char(' '), QLatin1Char('_')); return symbol; } |