aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcachegen
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-01-02 13:08:40 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-01-04 14:13:49 +0000
commit21ffde85a1b4592d24785a3ba82817de05486060 (patch)
tree6d449f5df9bd6be92906f234c2438766d95c961e /tests/auto/qml/qmlcachegen
parent604e379338e7c9e17c929063148754a30077988c (diff)
Add option to retain sources when generating QML cache
By default any .qrc files are filtered and QML and JS sources dropped when generating the cache. The new QTQUICK_COMPILER_RETAINED_RESOURCES option allows the specification of .qrc files to be kept as they are. The source fils specified in them will be available to the application. Change-Id: If45bcd95c29fe4b91f5817573964ff55b1db8a00 Fixes: QTBUG-72430 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmlcachegen')
-rw-r--r--tests/auto/qml/qmlcachegen/Retain.qml2
-rw-r--r--tests/auto/qml/qmlcachegen/qmlcachegen.pro3
-rw-r--r--tests/auto/qml/qmlcachegen/retain.qrc5
-rw-r--r--tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp8
4 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qml/qmlcachegen/Retain.qml b/tests/auto/qml/qmlcachegen/Retain.qml
new file mode 100644
index 0000000000..0e69012662
--- /dev/null
+++ b/tests/auto/qml/qmlcachegen/Retain.qml
@@ -0,0 +1,2 @@
+import QtQml 2.0
+QtObject {}
diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
index 7f7b3128cf..c7820ac1cd 100644
--- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro
+++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro
@@ -21,4 +21,7 @@ RESOURCES += Enums.qml
RESOURCES += jsmoduleimport.qml script.mjs
+RESOURCES += retain.qrc
+QTQUICK_COMPILER_RETAINED_RESOURCES += retain.qrc
+
QT += core-private qml-private testlib
diff --git a/tests/auto/qml/qmlcachegen/retain.qrc b/tests/auto/qml/qmlcachegen/retain.qrc
new file mode 100644
index 0000000000..af042b25d8
--- /dev/null
+++ b/tests/auto/qml/qmlcachegen/retain.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Retain.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
index 97ac466e94..8cfa4cb6af 100644
--- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
+++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
@@ -52,6 +52,7 @@ private slots:
void aheadOfTimeCompilation();
void functionExpressions();
void versionChecksForAheadOfTimeUnits();
+ void retainedResources();
void workerScripts();
@@ -392,6 +393,13 @@ void tst_qmlcachegen::versionChecksForAheadOfTimeUnits()
QQmlMetaType::removeCachedUnitLookupFunction(testHandler);
}
+void tst_qmlcachegen::retainedResources()
+{
+ QFile file(":/Retain.qml");
+ QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY(file.readAll().startsWith("import QtQml 2.0"));
+}
+
void tst_qmlcachegen::workerScripts()
{
QVERIFY(QFile::exists(":/workerscripts/worker.js"));