From a4d956048b4679bf5b448340d1f3428793699990 Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Wed, 4 Nov 2020 15:19:03 +0100 Subject: 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 --- tests/auto/qml/qmltyperegistrar/BLACKLIST | 3 +++ tests/auto/qml/qmltyperegistrar/CMakeLists.txt | 1 + tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.cpp | 13 +++++++++++++ tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.h | 1 + tests/auto/qml/qmltyperegistrar/tst_qmltyperegistrar.pro | 1 + 5 files changed, 19 insertions(+) create mode 100644 tests/auto/qml/qmltyperegistrar/BLACKLIST (limited to 'tests/auto/qml/qmltyperegistrar') 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 #include #include +#include +#include + +#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 -- cgit v1.2.3