diff options
author | Maximilian Goldstein <max.goldstein@qt.io> | 2020-11-04 15:19:03 +0100 |
---|---|---|
committer | Maximilian Goldstein <max.goldstein@qt.io> | 2020-11-10 18:14:48 +0100 |
commit | a4d956048b4679bf5b448340d1f3428793699990 (patch) | |
tree | fd382c2b6cadb813ac1939bf8a6149beecb60b2e /tests | |
parent | d01ec7ebe3853faabc8843d169d288b4998bb209 (diff) |
qmltyperegistrar: Add past-major-version option
Adds the option to specify past major versions of modules to be registered.
This is necessary for modules that don't export any types themselves to work when built statically.
Change-Id: I4b4a379f92707ec64cbb32f91db9d010440b95a2
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Diffstat (limited to 'tests')
5 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltyperegistrar/BLACKLIST b/tests/auto/qml/qmltyperegistrar/BLACKLIST new file mode 100644 index 0000000000..6563288d0c --- /dev/null +++ b/tests/auto/qml/qmltyperegistrar/BLACKLIST @@ -0,0 +1,3 @@ +[pastMajorVersions] +windows # QTBUG-88381 + diff --git a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt index d581589f4d..db8fa4b1d6 100644 --- a/tests/auto/qml/qmltyperegistrar/CMakeLists.txt +++ b/tests/auto/qml/qmltyperegistrar/CMakeLists.txt @@ -32,6 +32,7 @@ target_compile_definitions(tst_qmltyperegistrar PRIVATE BUILD_WITH_CMAKE) # spec set_target_properties(tst_qmltyperegistrar PROPERTIES QT_QML_MODULE_VERSION 1.0 QT_QML_MODULE_URI QmlTypeRegistrarTest + QT_QML_PAST_MAJOR_VERSIONS 0 # special case QT_QMLTYPES_FILENAME tst_qmltyperegistrar.qmltypes ) diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp index 4b8502c501..2f5759d697 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp @@ -30,9 +30,14 @@ #include <QtTest/qtest.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qfile.h> +#include <QtQml/QQmlEngine> +#include <QtQml/QQmlComponent> + +#define QT_FORCE_ASSERTS 1 void tst_qmltyperegistrar::initTestCase() { + Q_ASSERT(QCoreApplication::instance()); QFile file(QCoreApplication::applicationDirPath() + "/tst_qmltyperegistrar.qmltypes"); QVERIFY(file.open(QIODevice::ReadOnly)); qmltypesData = file.readAll(); @@ -100,4 +105,12 @@ void tst_qmltyperegistrar::restrictToImportVersion() QVERIFY(!qmltypesData.contains("paletteChanged")); // Added in version 6.0 } +void tst_qmltyperegistrar::pastMajorVersions() +{ + QQmlEngine engine; + QQmlComponent c(&engine); + c.setData("import QML\nimport QmlTypeRegistrarTest 0.254\nQtObject {}", QUrl()); + QVERIFY2(!c.isError(), qPrintable(c.errorString())); +} + QTEST_MAIN(tst_qmltyperegistrar) diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h index d48f61cc10..3c00e04357 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h @@ -123,6 +123,7 @@ private slots: void accessSemantics(); void isBindable(); void restrictToImportVersion(); + void pastMajorVersions(); private: QByteArray qmltypesData; diff --git a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.pro b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.pro index fe21b122c2..4b6303ec33 100644 --- a/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.pro +++ b/tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.pro @@ -15,6 +15,7 @@ QMLTYPES_FILENAME = tst_qmltyperegistrar.qmltypes QML_FOREIGN_METATYPES += foreign/foreign_metatypes.json QML_IMPORT_NAME = QmlTypeRegistrarTest QML_IMPORT_VERSION = 1.0 +QML_PAST_MAJOR_VERSIONS = 0 INCLUDEPATH += foreign LIBS += -Lforeign -lforeign |