aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2018-03-26 13:52:17 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2018-06-19 13:30:35 +0000
commit0996f18b252504ccc2db94b16c751835e3b9be8e (patch)
tree704c832290bcb119c6ba9438f8823004798115ed /tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
parent16cf097972a72656142ab0ed797282ad95ee5713 (diff)
Fix CONFIG+=qtquickcompiler with umlauts in the file path
Instead of replacing every character that is not allowed in C++ identifiers with an underscore (which in turn could lead to collissions), replace it with the hexadecimal value of the offending character's unicode value. In addition we must use the complete suffix when mapping Foo.qml to Foo_qml.cpp. Task-number: QTBUG-68608 Started-by: Erik Verbruggen <erik.verbruggen@qt.io> Change-Id: I7e2153f0e6671b37dcaee4efb9aaae1d9b230f0c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp')
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 3b7d268f7b..6dc54a323e 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -53,6 +53,7 @@ private slots:
void workerScripts();
+ void trickyPaths_data();
void trickyPaths();
void scriptImport();
@@ -408,13 +409,26 @@ void tst_qmlcachegen::functionExpressions()
QCOMPARE(obj->property("h_connections_handler_called").toBool(), true);
}
+void tst_qmlcachegen::trickyPaths_data()
+{
+ QTest::addColumn<QString>("filePath");
+ QTest::newRow("path with spaces") << QStringLiteral(":/directory with spaces/file name with spaces.qml");
+ QTest::newRow("version style suffix 1") << QStringLiteral(":/directory with spaces/versionStyleSuffix-1.2-core-yc.qml");
+ QTest::newRow("version style suffix 2") << QStringLiteral(":/directory with spaces/versionStyleSuffix-1.2-more.qml");
+
+ // QTBUG-46375
+#if !defined(Q_OS_WIN)
+ QTest::newRow("path with umlaut") << QStringLiteral(":/Bäh.qml");
+#endif
+}
+
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);
+ QFETCH(QString, filePath);
+ QVERIFY2(QFile::exists(filePath), qPrintable(filePath));
+ QCOMPARE(QFileInfo(filePath).size(), 0);
QQmlEngine engine;
- QQmlComponent component(&engine, QUrl("qrc" + pathWithSpaces));
+ QQmlComponent component(&engine, QUrl("qrc" + filePath));
QScopedPointer<QObject> obj(component.create());
QVERIFY(!obj.isNull());
QCOMPARE(obj->property("success").toInt(), 42);