summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen/mocPlugin
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-02-17 12:50:33 (GMT)
committerBrad King <brad.king@kitware.com>2017-02-21 15:38:49 (GMT)
commitcd74daf06f3b12f78bf7aed95ed06ff221a28da3 (patch)
treed670659848ac0d36699e13dc50200bc7dfe7c5b8 /Tests/QtAutogen/mocPlugin
parent39c4819eaa4f680411a63701b1303d79a088aece (diff)
downloadCMake-cd74daf06f3b12f78bf7aed95ed06ff221a28da3.zip
CMake-cd74daf06f3b12f78bf7aed95ed06ff221a28da3.tar.gz
CMake-cd74daf06f3b12f78bf7aed95ed06ff221a28da3.tar.bz2
Autogen: Tests: Add Q_PLUGIN_METADATA test
Diffstat (limited to 'Tests/QtAutogen/mocPlugin')
-rw-r--r--Tests/QtAutogen/mocPlugin/CMakeLists.txt25
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.hpp15
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.hpp15
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.hpp15
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.cpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.hpp8
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.hpp15
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/main.cpp6
16 files changed, 144 insertions, 0 deletions
diff --git a/Tests/QtAutogen/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
new file mode 100644
index 0000000..eed7d39
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
@@ -0,0 +1,25 @@
+cmake_minimum_required(VERSION 3.8)
+
+if (NOT QT_TEST_VERSION STREQUAL 5)
+ message(SEND_ERROR "Invalid Qt version specified.")
+endif()
+find_package(Qt5Widgets REQUIRED)
+
+if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC)
+ add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC})
+endif()
+
+configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json @ONLY)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json @ONLY)
+
+# Enable automoc
+set(CMAKE_AUTOMOC TRUE)
+
+include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles")
+link_libraries(Qt5::Widgets)
+
+add_library(PluginStyleA MODULE StyleA.cpp)
+add_library(PluginStyleB MODULE StyleB.cpp)
+add_library(PluginStyleC MODULE StyleC.cpp)
+add_library(PluginStyleD MODULE StyleD.cpp)
+add_library(PluginStyleE MODULE StyleE.cpp)
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.cpp b/Tests/QtAutogen/mocPlugin/StyleA.cpp
new file mode 100644
index 0000000..b5e8753
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+QStyle* StyleA::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.hpp b/Tests/QtAutogen/mocPlugin/StyleA.hpp
new file mode 100644
index 0000000..b105b02
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.hpp
@@ -0,0 +1,15 @@
+#ifndef STYLEA_HPP
+#define STYLEA_HPP
+
+#include <QStylePlugin>
+
+class StyleA : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in local directory
+ Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json")
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.json b/Tests/QtAutogen/mocPlugin/StyleA.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.cpp b/Tests/QtAutogen/mocPlugin/StyleB.cpp
new file mode 100644
index 0000000..17d4400
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleB.cpp
@@ -0,0 +1,6 @@
+#include "StyleB.hpp"
+
+QStyle* StyleB::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.hpp b/Tests/QtAutogen/mocPlugin/StyleB.hpp
new file mode 100644
index 0000000..ba89127
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleB.hpp
@@ -0,0 +1,15 @@
+#ifndef STYLEB_HPP
+#define STYLEB_HPP
+
+#include <QStylePlugin>
+
+class StyleB : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in local subdirectory
+ Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json")
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.cpp b/Tests/QtAutogen/mocPlugin/StyleC.cpp
new file mode 100644
index 0000000..37e7564
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleC.cpp
@@ -0,0 +1,6 @@
+#include "StyleC.hpp"
+
+QStyle* StyleC::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.hpp b/Tests/QtAutogen/mocPlugin/StyleC.hpp
new file mode 100644
index 0000000..9f71d75
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleC.hpp
@@ -0,0 +1,15 @@
+#ifndef STYLEC_HPP
+#define STYLEC_HPP
+
+#include <QStylePlugin>
+
+class StyleC : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in global root directory
+ Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json")
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.cpp b/Tests/QtAutogen/mocPlugin/StyleD.cpp
new file mode 100644
index 0000000..48398bb
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleD.cpp
@@ -0,0 +1,17 @@
+#include "StyleD.hpp"
+
+class StyleD : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in global sub director
+ Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json")
+public:
+ QStyle* create(const QString& key);
+};
+
+QStyle* StyleD::create(const QString& key)
+{
+ return 0;
+}
+
+#include "StyleD.moc"
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.hpp b/Tests/QtAutogen/mocPlugin/StyleD.hpp
new file mode 100644
index 0000000..2afe055
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleD.hpp
@@ -0,0 +1,8 @@
+#ifndef STYLED_HPP
+#define STYLED_HPP
+
+#include <QStylePlugin>
+
+class StyleD;
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.cpp b/Tests/QtAutogen/mocPlugin/StyleE.cpp
new file mode 100644
index 0000000..8fc9a7f
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleE.cpp
@@ -0,0 +1,6 @@
+#include "StyleE.hpp"
+
+QStyle* StyleE::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.hpp b/Tests/QtAutogen/mocPlugin/StyleE.hpp
new file mode 100644
index 0000000..80e0b79
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleE.hpp
@@ -0,0 +1,15 @@
+#ifndef STYLEE_HPP
+#define STYLEE_HPP
+
+#include <QStylePlugin>
+
+class StyleE : public QStylePlugin
+{
+ Q_OBJECT
+ // No Json file
+ Q_PLUGIN_METADATA(IID "org.styles.E")
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
new file mode 100644
index 0000000..bf17580
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterC" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
new file mode 100644
index 0000000..f7fcc19
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterD" ] }
diff --git a/Tests/QtAutogen/mocPlugin/main.cpp b/Tests/QtAutogen/mocPlugin/main.cpp
new file mode 100644
index 0000000..3ba2ddc
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/main.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+int main(int argv, char** args)
+{
+ return 0;
+}