aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/blackbox/testdata/qt5plugin/echointerface.h24
-rw-r--r--tests/auto/blackbox/testdata/qt5plugin/echoplugin.cpp8
-rw-r--r--tests/auto/blackbox/testdata/qt5plugin/echoplugin.h19
-rw-r--r--tests/auto/blackbox/testdata/qt5plugin/echoplugin.json.source1
-rw-r--r--tests/auto/blackbox/testdata/qt5plugin/plugin.qbp31
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp4
6 files changed, 87 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/qt5plugin/echointerface.h b/tests/auto/blackbox/testdata/qt5plugin/echointerface.h
new file mode 100644
index 000000000..228a911e6
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qt5plugin/echointerface.h
@@ -0,0 +1,24 @@
+
+#ifndef ECHOINTERFACE_H
+#define ECHOINTERFACE_H
+
+#include <QString>
+
+//! [0]
+class EchoInterface
+{
+public:
+ virtual ~EchoInterface() {}
+ virtual QString echo(const QString &message) = 0;
+};
+
+
+QT_BEGIN_NAMESPACE
+
+#define EchoInterface_iid "org.qt-project.Qt.Examples.EchoInterface"
+
+Q_DECLARE_INTERFACE(EchoInterface, EchoInterface_iid)
+QT_END_NAMESPACE
+
+//! [0]
+#endif
diff --git a/tests/auto/blackbox/testdata/qt5plugin/echoplugin.cpp b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.cpp
new file mode 100644
index 000000000..0bf2ed77d
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.cpp
@@ -0,0 +1,8 @@
+#include <QtWidgets>
+
+#include "echoplugin.h"
+
+QString EchoPlugin::echo(const QString &message)
+{
+ return message;
+}
diff --git a/tests/auto/blackbox/testdata/qt5plugin/echoplugin.h b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.h
new file mode 100644
index 000000000..9f8d71c5c
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.h
@@ -0,0 +1,19 @@
+
+#ifndef ECHOPLUGIN_H
+#define ECHOPLUGIN_H
+
+#include <QObject>
+#include <QtPlugin>
+#include "echointerface.h"
+
+class EchoPlugin : public QObject, EchoInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.Examples.EchoInterface" FILE "echoplugin.json")
+ Q_INTERFACES(EchoInterface)
+
+public:
+ QString echo(const QString &message);
+};
+
+#endif
diff --git a/tests/auto/blackbox/testdata/qt5plugin/echoplugin.json.source b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.json.source
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qt5plugin/echoplugin.json.source
@@ -0,0 +1 @@
+{}
diff --git a/tests/auto/blackbox/testdata/qt5plugin/plugin.qbp b/tests/auto/blackbox/testdata/qt5plugin/plugin.qbp
new file mode 100644
index 000000000..c3cc43b25
--- /dev/null
+++ b/tests/auto/blackbox/testdata/qt5plugin/plugin.qbp
@@ -0,0 +1,31 @@
+import qbs.base
+import qbs.fileinfo as FileInfo
+
+DynamicLibrary {
+ name: "echoplugin"
+ files: [
+ "echoplugin.h",
+ "echoplugin.cpp",
+ "echoplugin.json.source"
+ ]
+
+ Depends { name: "Qt.widgets" }
+ Depends { name: "cpp" }
+ cpp.includePaths: buildDirectory
+
+ Transformer {
+ inputs: ["echoplugin.json.source"]
+ Artifact {
+ fileName: "echoplugin.json"
+ fileTags: ["qt_plugin_metadata"]
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "generating " + FileInfo.fileName(output.fileName);
+ cmd.sourceCode = function() {
+ File.copy(input.fileName, output.fileName);
+ }
+ return cmd;
+ }
+ }
+}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 907a3ad48..d5cdb7d75 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -174,6 +174,9 @@ void TestBlackbox::build_project_data()
QTest::newRow("BPs in Sources")
<< QString("buildproperties_source")
<< QString(qbs::HostOsInfo::appendExecutableSuffix(buildDir + "/HelloWorld"));
+ QTest::newRow("Qt5 plugin")
+ << QString("qt5plugin")
+ << QString(buildDir + QLatin1String("/") + qbs::HostOsInfo::dynamicLibraryName("echoplugin"));
}
void TestBlackbox::build_project()
@@ -182,6 +185,7 @@ void TestBlackbox::build_project()
QFETCH(QString, productFileName);
if (!projectSubDir.startsWith('/'))
projectSubDir.prepend('/');
+ QVERIFY(QFile::exists(testDataDir + projectSubDir));
QDir::setCurrent(testDataDir + projectSubDir);
QCOMPARE(runQbs(), 0);