summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/CMakeLists.txt2
-rw-r--r--tests/auto/cmake/cmake.pro7
-rw-r--r--tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.pro9
-rw-r--r--tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.pro10
-rw-r--r--tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.pro10
-rw-r--r--tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.pro10
-rw-r--r--tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.pro10
-rw-r--r--tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.json1
-rw-r--r--tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.pro9
-rw-r--r--tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.cpp10
-rw-r--r--tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.h70
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins.pro36
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins1/fake.cpp34
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins1/mockplugins1.pro10
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins1/qmockplugin.h72
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins2/fake.cpp34
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins2/mockplugins2.pro4
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins3/fake.cpp34
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins3/mockplugins3.pro11
-rw-r--r--tests/auto/cmake/mockplugins/mockplugins3/qmockauxplugin.h72
-rw-r--r--tests/auto/cmake/test_import_plugins/CMakeLists.txt111
-rw-r--r--tests/auto/cmake/test_import_plugins/check.cpp.in8
-rw-r--r--tests/auto/cmake/test_import_plugins/main.cpp101
38 files changed, 1079 insertions, 1 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 5b10a74d3f..ed900f7805 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -160,3 +160,5 @@ if (NOT CMAKE_VERSION VERSION_LESS 3.8)
# Reason: SKIP_* properties were added in CMake 3.8 only
expect_pass(test_QTBUG-63422)
endif()
+
+expect_pass(test_import_plugins BINARY ${CMAKE_CTEST_COMMAND})
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
index 9c715974f8..06509f4ad3 100644
--- a/tests/auto/cmake/cmake.pro
+++ b/tests/auto/cmake/cmake.pro
@@ -1,7 +1,12 @@
-# Cause make to do nothing.
TEMPLATE = subdirs
+# installed_cmake includes this file, and tries to add the mockplugins
+# directory relative to itself, but doesn't have its own copy of the directory.
+# So, we make the path absolute so it includes this copy of the directory
+# instead.
+SUBDIRS += $$PWD/mockplugins
+
CMAKE_QT_MODULES_UNDER_TEST = core network xml sql testlib
qtHaveModule(dbus): CMAKE_QT_MODULES_UNDER_TEST += dbus
diff --git a/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.json b/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.pro b/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.pro
new file mode 100644
index 0000000000..1ccbe924ae
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock1plugin/mock1plugin.pro
@@ -0,0 +1,9 @@
+TARGET = mock1plugin
+
+HEADERS += qmock1plugin.h
+SOURCES += qmock1plugin.cpp
+QT = mockplugins1
+
+PLUGIN_TYPE = mockplugin
+PLUGIN_CLASS_NAME = QMock1Plugin
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.cpp b/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.cpp
new file mode 100644
index 0000000000..2ee817d80a
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock1plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock1Plugin::pluginName() const
+{
+ return "QMock1Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.h b/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.h
new file mode 100644
index 0000000000..e2e114b1d9
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock1plugin/qmock1plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK1PLUGIN_H
+#define QMOCK1PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins1/QMockPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock1Plugin : public QObject, public QMockPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockPlugin_iid FILE "mock1plugin.json")
+ Q_INTERFACES(QMockPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK1PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.json b/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.pro b/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.pro
new file mode 100644
index 0000000000..75dc21cf0a
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock2plugin/mock2plugin.pro
@@ -0,0 +1,10 @@
+TARGET = mock2plugin
+
+HEADERS += qmock2plugin.h
+SOURCES += qmock2plugin.cpp
+QT = mockplugins1
+
+PLUGIN_TYPE = mockplugin
+PLUGIN_CLASS_NAME = QMock2Plugin
+PLUGIN_EXTENDS = mockplugins1
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.cpp b/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.cpp
new file mode 100644
index 0000000000..5b3280e884
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock2plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock2Plugin::pluginName() const
+{
+ return "QMock2Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.h b/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.h
new file mode 100644
index 0000000000..be99133dc8
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock2plugin/qmock2plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK2PLUGIN_H
+#define QMOCK2PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins1/QMockPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock2Plugin : public QObject, public QMockPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockPlugin_iid FILE "mock2plugin.json")
+ Q_INTERFACES(QMockPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK2PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.json b/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.pro b/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.pro
new file mode 100644
index 0000000000..ed7df603bb
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock3plugin/mock3plugin.pro
@@ -0,0 +1,10 @@
+TARGET = mock3plugin
+
+HEADERS += qmock3plugin.h
+SOURCES += qmock3plugin.cpp
+QT = mockplugins1
+
+PLUGIN_TYPE = mockplugin
+PLUGIN_CLASS_NAME = QMock3Plugin
+PLUGIN_EXTENDS = mockplugins1 mockplugins2
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.cpp b/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.cpp
new file mode 100644
index 0000000000..b38f854e4b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock3plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock3Plugin::pluginName() const
+{
+ return "QMock3Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.h b/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.h
new file mode 100644
index 0000000000..08d1aa68ce
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock3plugin/qmock3plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK3PLUGIN_H
+#define QMOCK3PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins1/QMockPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock3Plugin : public QObject, public QMockPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockPlugin_iid FILE "mock3plugin.json")
+ Q_INTERFACES(QMockPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK3PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.json b/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.pro b/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.pro
new file mode 100644
index 0000000000..4dd2d6c547
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock4plugin/mock4plugin.pro
@@ -0,0 +1,10 @@
+TARGET = mock4plugin
+
+HEADERS += qmock4plugin.h
+SOURCES += qmock4plugin.cpp
+QT = mockplugins1
+
+PLUGIN_TYPE = mockplugin
+PLUGIN_CLASS_NAME = QMock4Plugin
+PLUGIN_EXTENDS = -
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.cpp b/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.cpp
new file mode 100644
index 0000000000..5deaf7f43f
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock4plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock4Plugin::pluginName() const
+{
+ return "QMock4Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.h b/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.h
new file mode 100644
index 0000000000..0776bef002
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock4plugin/qmock4plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK4PLUGIN_H
+#define QMOCK4PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins1/QMockPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock4Plugin : public QObject, public QMockPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockPlugin_iid FILE "mock4plugin.json")
+ Q_INTERFACES(QMockPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK4PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.json b/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.pro b/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.pro
new file mode 100644
index 0000000000..29496868fe
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock5plugin/mock5plugin.pro
@@ -0,0 +1,10 @@
+TARGET = mock5plugin
+
+HEADERS += qmock5plugin.h
+SOURCES += qmock5plugin.cpp
+QT = mockplugins3
+
+PLUGIN_TYPE = mockplugin
+PLUGIN_CLASS_NAME = QMock5Plugin
+PLUGIN_EXTENDS = -
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.cpp b/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.cpp
new file mode 100644
index 0000000000..c5b4620516
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock5plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock5Plugin::pluginName() const
+{
+ return "QMock5Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.h b/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.h
new file mode 100644
index 0000000000..2f387da203
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock5plugin/qmock5plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK5PLUGIN_H
+#define QMOCK5PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins1/QMockPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock5Plugin : public QObject, public QMockPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockPlugin_iid FILE "mock5plugin.json")
+ Q_INTERFACES(QMockPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK5PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.json b/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.pro b/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.pro
new file mode 100644
index 0000000000..140f198811
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock6plugin/mock6plugin.pro
@@ -0,0 +1,9 @@
+TARGET = mock6plugin
+
+HEADERS += qmock6plugin.h
+SOURCES += qmock6plugin.cpp
+QT = mockplugins3
+
+PLUGIN_TYPE = mockauxplugin
+PLUGIN_CLASS_NAME = QMock6Plugin
+load(qt_plugin)
diff --git a/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.cpp b/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.cpp
new file mode 100644
index 0000000000..4a0329c68a
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.cpp
@@ -0,0 +1,10 @@
+#include "qmock6plugin.h"
+
+QT_BEGIN_NAMESPACE
+
+QString QMock6Plugin::pluginName() const
+{
+ return "QMock6Plugin";
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.h b/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.h
new file mode 100644
index 0000000000..6b29b6703b
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mock6plugin/qmock6plugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCK6PLUGIN_H
+#define QMOCK6PLUGIN_H
+
+#include <QObject>
+#include <QtMockPlugins3/QMockAuxPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMock6Plugin : public QObject, public QMockAuxPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QMockAuxPlugin_iid FILE "mock6plugin.json")
+ Q_INTERFACES(QMockAuxPlugin)
+public:
+ QString pluginName() const override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMOCK6PLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mockplugins.pro b/tests/auto/cmake/mockplugins/mockplugins.pro
new file mode 100644
index 0000000000..830d130a05
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins.pro
@@ -0,0 +1,36 @@
+TEMPLATE = subdirs
+
+src_mock1plugin.subdir = $$PWD/mock1plugin
+src_mock1plugin.target = sub-mockplugin1
+src_mock1plugin.depends = mockplugins1
+
+src_mock2plugin.subdir = $$PWD/mock2plugin
+src_mock2plugin.target = sub-mockplugin2
+src_mock2plugin.depends = mockplugins1
+
+src_mock3plugin.subdir = $$PWD/mock3plugin
+src_mock3plugin.target = sub-mockplugin3
+src_mock3plugin.depends = mockplugins1
+
+src_mock4plugin.subdir = $$PWD/mock4plugin
+src_mock4plugin.target = sub-mockplugin4
+src_mock4plugin.depends = mockplugins1
+
+src_mock5plugin.subdir = $$PWD/mock5plugin
+src_mock5plugin.target = sub-mockplugin5
+src_mock5plugin.depends = mockplugins3
+
+src_mock6plugin.subdir = $$PWD/mock6plugin
+src_mock6plugin.target = sub-mockplugin6
+src_mock6plugin.depends = mockplugins3
+
+SUBDIRS += \
+ mockplugins1 \
+ mockplugins2 \
+ mockplugins3 \
+ src_mock1plugin \
+ src_mock2plugin \
+ src_mock3plugin \
+ src_mock4plugin \
+ src_mock5plugin \
+ src_mock6plugin
diff --git a/tests/auto/cmake/mockplugins/mockplugins1/fake.cpp b/tests/auto/cmake/mockplugins/mockplugins1/fake.cpp
new file mode 100644
index 0000000000..f95eba6055
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins1/fake.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <QtCore/QtGlobal>
+
+// Empty exported function needed to create .lib on Windows.
+Q_DECL_EXPORT void mockplugins1_foo() {
+
+}
diff --git a/tests/auto/cmake/mockplugins/mockplugins1/mockplugins1.pro b/tests/auto/cmake/mockplugins/mockplugins1/mockplugins1.pro
new file mode 100644
index 0000000000..dd98937ee3
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins1/mockplugins1.pro
@@ -0,0 +1,10 @@
+TARGET = QtMockPlugins1
+QT = core
+MODULE_PLUGIN_TYPES = mockplugin
+
+# Fake a git_build, to force qmake to run syncqt.pl when doing a standalone tests build
+# like it is done in Coin, otherwise module headers would not be generated.
+CONFIG += git_build
+HEADERS += qmockplugin.h
+SOURCES += fake.cpp # Needed to make libtool / ar happy on macOS
+load(qt_module)
diff --git a/tests/auto/cmake/mockplugins/mockplugins1/qmockplugin.h b/tests/auto/cmake/mockplugins/mockplugins1/qmockplugin.h
new file mode 100644
index 0000000000..9427ae9212
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins1/qmockplugin.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCKPLUGIN_H
+#define QMOCKPLUGIN_H
+
+#include <QString>
+#include <QtPlugin>
+
+QT_BEGIN_NAMESPACE
+
+#define QMockPlugin_iid "org.qt-project.Qt.Tests.QMockPlugin"
+
+class QMockPlugin
+{
+public:
+ virtual ~QMockPlugin() {}
+ virtual QString pluginName() const = 0;
+};
+
+Q_DECLARE_INTERFACE(QMockPlugin, QMockPlugin_iid)
+
+QT_END_NAMESPACE
+
+#endif // QMOCKPLUGIN_H
diff --git a/tests/auto/cmake/mockplugins/mockplugins2/fake.cpp b/tests/auto/cmake/mockplugins/mockplugins2/fake.cpp
new file mode 100644
index 0000000000..384623d646
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins2/fake.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <QtCore/QtGlobal>
+
+// Empty exported function needed to create .lib on Windows.
+Q_DECL_EXPORT void mockplugins2_foo() {
+
+}
diff --git a/tests/auto/cmake/mockplugins/mockplugins2/mockplugins2.pro b/tests/auto/cmake/mockplugins/mockplugins2/mockplugins2.pro
new file mode 100644
index 0000000000..1dd03391e8
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins2/mockplugins2.pro
@@ -0,0 +1,4 @@
+TARGET = QtMockPlugins2
+QT = core
+SOURCES += fake.cpp # Needed to make libtool / ar happy on macOS
+load(qt_module)
diff --git a/tests/auto/cmake/mockplugins/mockplugins3/fake.cpp b/tests/auto/cmake/mockplugins/mockplugins3/fake.cpp
new file mode 100644
index 0000000000..9ec2b42181
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins3/fake.cpp
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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 <QtCore/QtGlobal>
+
+// Empty exported function needed to create .lib on Windows.
+Q_DECL_EXPORT void mockplugins3_foo() {
+
+}
diff --git a/tests/auto/cmake/mockplugins/mockplugins3/mockplugins3.pro b/tests/auto/cmake/mockplugins/mockplugins3/mockplugins3.pro
new file mode 100644
index 0000000000..3651abaafa
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins3/mockplugins3.pro
@@ -0,0 +1,11 @@
+TARGET = QtMockPlugins3
+QT = core
+MODULE_PLUGIN_TYPES = mockauxplugin
+
+# Fake a git_build, to force qmake to run syncqt.pl when doing a standalone tests build
+# like it is done in Coin, otherwise module headers would not be generated.
+CONFIG += git_build
+HEADERS += qmockauxplugin.h
+SOURCES += fake.cpp # Needed to make libtool / ar happy on macOS
+
+load(qt_module)
diff --git a/tests/auto/cmake/mockplugins/mockplugins3/qmockauxplugin.h b/tests/auto/cmake/mockplugins/mockplugins3/qmockauxplugin.h
new file mode 100644
index 0000000000..25e4762bac
--- /dev/null
+++ b/tests/auto/cmake/mockplugins/mockplugins3/qmockauxplugin.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QMOCKAUXPLUGIN_H
+#define QMOCKAUXPLUGIN_H
+
+#include <QString>
+#include <QtPlugin>
+
+QT_BEGIN_NAMESPACE
+
+#define QMockAuxPlugin_iid "org.qt-project.Qt.Tests.QMockAuxPlugin"
+
+class QMockAuxPlugin
+{
+public:
+ virtual ~QMockAuxPlugin() {}
+ virtual QString pluginName() const = 0;
+};
+
+Q_DECLARE_INTERFACE(QMockAuxPlugin, QMockAuxPlugin_iid)
+
+QT_END_NAMESPACE
+
+#endif // QMOCKAUXPLUGIN_H
diff --git a/tests/auto/cmake/test_import_plugins/CMakeLists.txt b/tests/auto/cmake/test_import_plugins/CMakeLists.txt
new file mode 100644
index 0000000000..a793fe211d
--- /dev/null
+++ b/tests/auto/cmake/test_import_plugins/CMakeLists.txt
@@ -0,0 +1,111 @@
+
+cmake_minimum_required(VERSION 3.1)
+
+project(import_plugins_advanced)
+enable_testing()
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHints.cmake")
+endif()
+
+# Need to find Qt5Core explicitly because the MockPlugins1 and MockPlugins2 config files
+# are in a different directory (the source dir) when doing a standalone tests build,
+# whereas Core is in the installed directory, and due to NO_DEFAULT_PATH being used
+# for the Core dependency call in Qt5MockPlugins, Core would not be found in the source
+# dir.
+find_package(Qt5 COMPONENTS Core REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
+get_target_property(qt_is_static Qt5::Core TYPE)
+
+# For a similar reason, we need to find the MockPlugins packages not via COMPONENTS argument,
+# but directly, because the location of Qt5Config.cmake is in the installed dir, while
+# the MockPlugins are in the source dir, and Qt5Config only looks for packages relative
+# to its own location.
+# The packages are still successfuly found, because the CMAKE_PREFIX_PATH populated by qmake
+# contains both the installed Qt dir, and the Qt source dir.
+find_package(Qt5MockPlugins1 REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
+find_package(Qt5MockPlugins2 REQUIRED HINTS ${Qt5Tests_PREFIX_PATH})
+
+function(create_test_executable TARGET_NAME)
+ set(CHECK_FILE ${CMAKE_BINARY_DIR}/${TARGET_NAME}_check.cpp)
+
+ set(EXPECTED_PLUGINS)
+ foreach(_p ${ARGN})
+ string(APPEND EXPECTED_PLUGINS " \"${_p}\",\n")
+ endforeach()
+ configure_file("${CMAKE_SOURCE_DIR}/check.cpp.in" ${CHECK_FILE})
+
+ add_executable(${TARGET_NAME} main.cpp ${CHECK_FILE})
+ target_link_libraries(${TARGET_NAME} Qt5::MockPlugins1)
+ add_test(test_${TARGET_NAME} ${TARGET_NAME})
+endfunction()
+
+create_test_executable(default QMock1Plugin QMock2Plugin)
+# No call to qt5_import_plugins() for the default
+
+# TODO This test is known to fail because CMake currently doesn't have a way to
+# implement its own equivalent of the PLUGIN_EXTENDS mechanism at generate-
+# time (meaning a library only gets linked if a set of other libraries are
+# *also* linked.) CMake 3.14 or beyond may have such a mechanism, but until
+# then, this test is expected to fail, because QMock3Plugin is not being
+# linked even though MockPlugins2 is present.
+create_test_executable(default_link QMock1Plugin QMock2Plugin QMock3Plugin)
+target_link_libraries(default_link Qt5::MockPlugins2)
+set_property(TEST test_default_link PROPERTY DISABLED 1)
+# No call to qt5_import_plugins() for the default
+
+create_test_executable(manual QMock1Plugin QMock2Plugin QMock3Plugin QMock4Plugin)
+qt5_import_plugins(manual
+ INCLUDE Qt5::QMock3Plugin Qt5::QMock4Plugin
+)
+
+create_test_executable(manual_genex QMock1Plugin QMock2Plugin QMock3Plugin)
+qt5_import_plugins(manual_genex
+ INCLUDE $<1:Qt5::QMock3Plugin> $<0:Qt5::QMock4Plugin>
+)
+
+create_test_executable(blacklist QMock1Plugin)
+qt5_import_plugins(blacklist
+ EXCLUDE Qt5::QMock2Plugin Qt5::QMock3Plugin
+)
+
+create_test_executable(blacklist_genex QMock1Plugin)
+qt5_import_plugins(blacklist_genex
+ EXCLUDE $<1:Qt5::QMock2Plugin> $<1:Qt5::QMock3Plugin> $<0:Qt5::QMock1Plugin>
+)
+
+create_test_executable(override QMock3Plugin QMock4Plugin)
+qt5_import_plugins(override
+ INCLUDE_BY_TYPE mockplugin Qt5::QMock3Plugin Qt5::QMock4Plugin
+)
+
+create_test_executable(override_genex QMock3Plugin)
+qt5_import_plugins(override_genex
+ INCLUDE_BY_TYPE mockplugin $<1:Qt5::QMock3Plugin> $<0:Qt5::QMock4Plugin>
+)
+
+create_test_executable(override_mix QMock2Plugin QMock3Plugin)
+qt5_import_plugins(override_mix
+ INCLUDE Qt5::QMock2Plugin
+ INCLUDE_BY_TYPE mockplugin Qt5::QMock3Plugin
+)
+
+if(NOT WIN32)
+ # Compiling an empty static array fails on Windows.
+ create_test_executable(none)
+ qt5_import_plugins(none
+ EXCLUDE_BY_TYPE mockplugin
+ )
+endif()
+
+create_test_executable(none_mix QMock3Plugin QMock4Plugin)
+qt5_import_plugins(none_mix
+ INCLUDE Qt5::QMock3Plugin Qt5::QMock4Plugin
+ EXCLUDE_BY_TYPE mockplugin
+)
+
+create_test_executable(recursive QMock5Plugin QMock6Plugin)
+qt5_import_plugins(recursive
+ INCLUDE_BY_TYPE mockplugin Qt5::QMock5Plugin
+)
diff --git a/tests/auto/cmake/test_import_plugins/check.cpp.in b/tests/auto/cmake/test_import_plugins/check.cpp.in
new file mode 100644
index 0000000000..df6ea03d2d
--- /dev/null
+++ b/tests/auto/cmake/test_import_plugins/check.cpp.in
@@ -0,0 +1,8 @@
+#include <QString>
+#include <cstddef>
+
+QString expectedPlugins[] = {
+@EXPECTED_PLUGINS@
+};
+
+std::size_t numExpectedPlugins = sizeof(expectedPlugins) / sizeof(numExpectedPlugins);
diff --git a/tests/auto/cmake/test_import_plugins/main.cpp b/tests/auto/cmake/test_import_plugins/main.cpp
new file mode 100644
index 0000000000..9fcc81754b
--- /dev/null
+++ b/tests/auto/cmake/test_import_plugins/main.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 Kitware, Inc.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** 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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QPluginLoader>
+#include <QSet>
+#include <QString>
+#include <QVector>
+
+#include <cstddef>
+#include <iostream>
+
+extern QString expectedPlugins[];
+extern std::size_t numExpectedPlugins;
+
+int main(int argc, char **argv)
+{
+#ifdef QT_STATIC
+ QSet<QString> expectedPluginSet;
+ for (std::size_t i = 0; i < numExpectedPlugins; i++) {
+ expectedPluginSet.insert(expectedPlugins[i]);
+ }
+
+ QVector<QStaticPlugin> plugins = QPluginLoader::staticPlugins();
+ QSet<QString> actualPluginSet;
+ for (QStaticPlugin plugin : plugins) {
+ actualPluginSet.insert(plugin.metaData()["className"].toString());
+ }
+
+ if (expectedPluginSet != actualPluginSet) {
+ std::cerr << "Loaded plugins do not match what was expected!" << std::endl
+ << "Expected plugins:" << std::endl;
+
+ QList<QString> expectedPluginList = expectedPluginSet.toList();
+ expectedPluginList.sort();
+ for (QString plugin : expectedPluginList) {
+ std::cerr << (actualPluginSet.contains(plugin) ? " " : "- ")
+ << plugin.toStdString() << std::endl;
+ }
+
+ std::cerr << std::endl << "Actual plugins:" << std::endl;
+
+ QList<QString> actualPluginList = actualPluginSet.toList();
+ actualPluginList.sort();
+ for (QString plugin : actualPluginList) {
+ std::cerr << (expectedPluginSet.contains(plugin) ? " " : "+ ")
+ << plugin.toStdString() << std::endl;
+ }
+
+ return 1;
+ }
+
+#endif
+ return 0;
+}