aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata-qt
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-01 10:55:23 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-01 13:08:26 +0000
commit7780e9b6e4cbaf33c1f5ccae279bbc1ec63ef755 (patch)
tree2c390ba8460f12b3cdae3d00897b6a4423449d7a /tests/auto/blackbox/testdata-qt
parentb9db9d860edee00280c46c5db51954c9db28a4ee (diff)
Qt.core: Make moc rule catch changes to moc_*.cpp inclusions
The problem was that the moc_xxx.cpp artifact gets created from the xxx.h input, but its file tags depend on whether it gets included by some cpp file or not. Because changes to such cpp files do not affect the xxx.h file in any way, the rule was not re-applied in the case such includes got added or removed. We fix this by making cpp files an auxiliary input to the moc rule, so it gets re-applied on changes to those files. Change-Id: I29b04fac3870f5a370cb7d894bc6ea56a63f6b0e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata-qt')
-rw-r--r--tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs9
-rw-r--r--tests/auto/blackbox/testdata-qt/included-moc-cpp/main.cpp7
-rw-r--r--tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.cpp3
-rw-r--r--tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.h11
4 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs b/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs
new file mode 100644
index 000000000..1ed85ccdd
--- /dev/null
+++ b/tests/auto/blackbox/testdata-qt/included-moc-cpp/included-moc-cpp.qbs
@@ -0,0 +1,9 @@
+import qbs
+
+QtApplication {
+ files: [
+ "main.cpp",
+ "myobject.cpp",
+ "myobject.h",
+ ]
+}
diff --git a/tests/auto/blackbox/testdata-qt/included-moc-cpp/main.cpp b/tests/auto/blackbox/testdata-qt/included-moc-cpp/main.cpp
new file mode 100644
index 000000000..5323e4c98
--- /dev/null
+++ b/tests/auto/blackbox/testdata-qt/included-moc-cpp/main.cpp
@@ -0,0 +1,7 @@
+#include "myobject.h"
+
+int main()
+{
+ MyObject o;
+ QObject::connect(&o, &QObject::destroyed, [] { });
+}
diff --git a/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.cpp b/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.cpp
new file mode 100644
index 000000000..de0988c24
--- /dev/null
+++ b/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.cpp
@@ -0,0 +1,3 @@
+#include "myobject.h"
+
+#include <moc_myobject.cpp>
diff --git a/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.h b/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.h
new file mode 100644
index 000000000..61c2920aa
--- /dev/null
+++ b/tests/auto/blackbox/testdata-qt/included-moc-cpp/myobject.h
@@ -0,0 +1,11 @@
+#ifndef MYOBJECT_H
+#define MYOBJECT_H
+
+#include <QObject>
+
+class MyObject : public QObject
+{
+ Q_OBJECT
+};
+
+#endif