diff options
Diffstat (limited to 'tests/auto')
10 files changed, 131 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt index d0aa1a9aa9..2fcce3d7c9 100644 --- a/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt +++ b/tests/auto/qml/qqmlmoduleplugin/CMakeLists.txt @@ -30,6 +30,7 @@ qt_add_test(tst_qqmlmoduleplugin Qt::GuiPrivate Qt::Network Qt::QmlPrivate + Qt::QuickShapesPrivate TESTDATA ${test_data} ) @@ -107,3 +108,4 @@ add_subdirectory(plugin.2/childplugin) add_subdirectory(plugin.2.1/childplugin) add_subdirectory(plugin.2.2) add_subdirectory(moduleWithQmlSingleton) +add_subdirectory(optionalPlugin) diff --git a/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/.prev_CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/.prev_CMakeLists.txt new file mode 100644 index 0000000000..375ade482a --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/.prev_CMakeLists.txt @@ -0,0 +1,21 @@ +# Generated from optionalPlugin.pro. + +##################################################################### +## optionalPlugin Generic Library: +##################################################################### + +qt_add_cmake_library(optionalPlugin + MODULE + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/QtQuick/Shapes" + SOURCES + optionalPlugin.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Qml +) + +#### Keys ignored in scope 1:.:.:optionalPlugin.pro:<TRUE>: +# IMPORT_FILES = "qmldir" +# TEMPLATE = "lib" + +qt_autogen_tools_initial_setup(optionalPlugin) diff --git a/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/CMakeLists.txt b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/CMakeLists.txt new file mode 100644 index 0000000000..49b2bce8b7 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/CMakeLists.txt @@ -0,0 +1,26 @@ +# Generated from optionalPlugin.pro. + +##################################################################### +## optionalPlugin Generic Library: +##################################################################### + +qt_add_cmake_library(optionalPlugin + MODULE + OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../imports/QtQuick/Shapes" + SOURCES + optionalPlugin.cpp + PUBLIC_LIBRARIES + Qt::Core + Qt::Qml +) + +#### Keys ignored in scope 1:.:.:optionalPlugin.pro:<TRUE>: +# IMPORT_FILES = "qmldir" +# TEMPLATE = "lib" + +qt_autogen_tools_initial_setup(optionalPlugin) +# special case begin +file(COPY qmldir + DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/../imports/QtQuick/Shapes" +) +# special case end diff --git a/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.cpp new file mode 100644 index 0000000000..46855d76c9 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtQml/qqmlextensionplugin.h> +#include <QtQml/qqml.h> +#include <QDebug> + +class OptionalPlugin : public QQmlEngineExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) + +public: + OptionalPlugin() + { + qFatal("optional plugin created"); + } +}; + +#include "optionalPlugin.moc" + diff --git a/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.pro b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.pro new file mode 100644 index 0000000000..f1d64f969a --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/optionalPlugin.pro @@ -0,0 +1,10 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = optionalPlugin.cpp +QT = core qml +DESTDIR = ../imports/QtQuick/Shapes + +IMPORT_FILES = \ + qmldir + +include (../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/qmldir b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/qmldir new file mode 100644 index 0000000000..0d37717621 --- /dev/null +++ b/tests/auto/qml/qqmlmoduleplugin/optionalPlugin/qmldir @@ -0,0 +1,2 @@ +module QtQuick.Shapes +optional plugin optionalPlugin diff --git a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro index 44b3ab14e6..518e911179 100644 --- a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro @@ -1,4 +1,3 @@ -QT = core TEMPLATE = subdirs SUBDIRS =\ plugin\ @@ -21,9 +20,8 @@ SUBDIRS =\ plugin.2/childplugin\ plugin.2.1/childplugin\ plugin.2.2\ - moduleWithQmlSingleton + moduleWithQmlSingleton\ + optionalPlugin tst_qqmlmoduleplugin_pro.depends += plugin SUBDIRS += tst_qqmlmoduleplugin.pro - -QT += core-private gui-private qml-private diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index f15d53d022..3590eeb768 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -39,6 +39,8 @@ #include <QCborValue> #endif +#include <QtQuickShapes/private/qquickshapesglobal_p.h> + #if defined(Q_OS_MAC) // For _PC_CASE_SENSITIVE #include <unistd.h> @@ -83,6 +85,7 @@ private slots: void importsChildPlugin21(); void parallelPluginImport(); void multiSingleton(); + void optionalPlugin(); private: QString m_importsDirectory; @@ -805,6 +808,20 @@ void tst_qqmlmoduleplugin::multiSingleton() delete object; } +void tst_qqmlmoduleplugin::optionalPlugin() +{ + // Force QtQuickShapes to be linked. + volatile auto registration = &qml_register_types_QtQuick_Shapes; + Q_UNUSED(registration); + + QQmlEngine engine; + engine.setImportPathList({m_importsDirectory}); + QQmlComponent component(&engine); + component.setData("import QtQuick.Shapes\nShapePath {}\n", QUrl()); + QScopedPointer<QObject> object10(component.create()); + QVERIFY(!object10.isNull()); +} + QTEST_MAIN(tst_qqmlmoduleplugin) diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro index 118ca26ee9..38de349cf7 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.pro @@ -18,4 +18,4 @@ staticPlugin.files = moduleWithStaticPlugin staticPlugin.prefix = /qt-project.org/imports/ RESOURCES += staticPlugin -QT += core-private gui-private qml-private network testlib +QT += core-private gui-private qml-private network testlib quickshapes-private diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index e5a6573ca7..c7792ec4f5 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -351,6 +351,10 @@ public: if (line.isEmpty()) continue; QList<QByteArray> segments = line.split(' '); + if (segments.startsWith("optional")) { + result.append("optional "); + segments.removeFirst(); + } if (segments.startsWith("plugin")) { if (segments.length() == 2) { segments.append(path); |