diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2020-06-26 15:44:23 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2020-07-02 14:17:16 +0200 |
commit | b92a4558aa56c25a9a766ec0cc97699892a672e2 (patch) | |
tree | 0e8bfe5671b415c85ec2379a6fc7bf2931c93352 /tests | |
parent | 6b72b1a6861ddc10356c5505a00e2204fdfe83e5 (diff) |
Revive QTQUICK_COMPILER_SKIPPED_RESOURCES
There are valid reasons not to compile some resources with qmlcachegen.
Fixes: QTBUG-85243
Change-Id: I9a1233864ed5dda0c264e61db596a9d8c80ea1f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 41890402db086f4c61e052cef7659eb6b003dc77)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmlcachegen/data/skip.qrc | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/qmlcachegen.pro | 5 | ||||
-rw-r--r-- | tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp | 13 |
3 files changed, 21 insertions, 2 deletions
diff --git a/tests/auto/qml/qmlcachegen/data/skip.qrc b/tests/auto/qml/qmlcachegen/data/skip.qrc new file mode 100644 index 0000000000..391e4f7508 --- /dev/null +++ b/tests/auto/qml/qmlcachegen/data/skip.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/not/"> + <file alias="Skip.qml">Retain.qml</file> + </qresource> +</RCC> diff --git a/tests/auto/qml/qmlcachegen/qmlcachegen.pro b/tests/auto/qml/qmlcachegen/qmlcachegen.pro index 452bd7d04a..dc1c4dc4dc 100644 --- a/tests/auto/qml/qmlcachegen/qmlcachegen.pro +++ b/tests/auto/qml/qmlcachegen/qmlcachegen.pro @@ -28,11 +28,12 @@ workerscripts_test.prefix = /workerscripts RESOURCES += \ workerscripts_test \ trickypaths.qrc \ - data/retain.qrc + data/retain.qrc \ + data/skip.qrc # QTBUG-46375 !win32: RESOURCES += trickypaths_umlaut.qrc -QTQUICK_COMPILER_RETAINED_RESOURCES += retain.qrc +QTQUICK_COMPILER_SKIPPED_RESOURCES += data/skip.qrc QT += core-private qml-private testlib diff --git a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp index f940f9c476..3a97f50296 100644 --- a/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp +++ b/tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp @@ -56,6 +56,7 @@ private slots: void functionExpressions(); void versionChecksForAheadOfTimeUnits(); void retainedResources(); + void skippedResources(); void workerScripts(); @@ -409,6 +410,18 @@ void tst_qmlcachegen::retainedResources() QVERIFY(file.readAll().startsWith("import QtQml 2.0")); } +void tst_qmlcachegen::skippedResources() +{ + QFile file(":/not/Skip.qml"); + QVERIFY(file.open(QIODevice::ReadOnly)); + QVERIFY(file.readAll().startsWith("import QtQml 2.0")); + + QQmlMetaType::CachedUnitLookupError error = QQmlMetaType::CachedUnitLookupError::NoError; + const auto *unit = QQmlMetaType::findCachedCompilationUnit(QUrl("qrc:/not/Skip.qml"), &error); + QCOMPARE(unit, nullptr); + QCOMPARE(error, QQmlMetaType::CachedUnitLookupError::NoUnitFound); +} + void tst_qmlcachegen::workerScripts() { QVERIFY(QFile::exists(":/workerscripts/data/worker.js")); |