diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-10-30 15:04:37 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-11-02 09:40:27 +0000 |
commit | e7bb51e497cd5836472f4414d254f560ceab2663 (patch) | |
tree | 1394f9f1c7b5b53c684d355ff4b7078a74acbc98 /tests/auto/blackbox/testdata-qt | |
parent | 072251bf003fa687ed3e356f0a78a38f06633ae1 (diff) |
Qt: Support mocable files with the same name in the same product
Change-Id: I6ba4a31acfd63724ef92b1fe1c0bf5ded353bbe8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata-qt')
8 files changed, 108 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/main.cpp b/tests/auto/blackbox/testdata-qt/moc-same-file-name/main.cpp new file mode 100644 index 000000000..1ca3fc9e2 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/main.cpp @@ -0,0 +1,8 @@ +#include "src1/someclass.h" +#include "src2/someclass.h" + +int main() +{ + Src1::SomeClass sc1; + Src2::SomeClass sc2; +} diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/moc-same-file-name.qbs b/tests/auto/blackbox/testdata-qt/moc-same-file-name/moc-same-file-name.qbs new file mode 100644 index 000000000..890535fe9 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/moc-same-file-name.qbs @@ -0,0 +1,26 @@ +import qbs + +QtApplication { + name: "app" + files: "main.cpp" + Group { + name: "src1" + Qt.core.generatedHeadersDir: product.buildDirectory + "/qt.headers_src1" + prefix: name + '/' + files: [ + "someclass.cpp", + "someclass.h", + "somefile.cpp", + ] + } + Group { + name: "src2" + prefix: name + '/' + Qt.core.generatedHeadersDir: product.buildDirectory + "/qt.headers_src2" + files: [ + "someclass.cpp", + "someclass.h", + "somefile.cpp", + ] + } +} diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.cpp b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.cpp new file mode 100644 index 000000000..2f9cf8bd0 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.cpp @@ -0,0 +1,7 @@ +#include "someclass.h" + +namespace Src1 { + +SomeClass::SomeClass(QObject *parent) : QObject(parent) { } + +} diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.h b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.h new file mode 100644 index 000000000..cc5eefd8f --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/someclass.h @@ -0,0 +1,17 @@ +#ifndef SOMECLASS1_H +#define SOMECLASS1_H + +#include <QObject> + +namespace Src1 { + +class SomeClass : public QObject +{ + Q_OBJECT +public: + SomeClass(QObject *parent = nullptr); +}; + +} + +#endif diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/somefile.cpp b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/somefile.cpp new file mode 100644 index 000000000..a2e46e815 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src1/somefile.cpp @@ -0,0 +1,13 @@ +#include <QObject> + +class MyClass1 : public QObject +{ + Q_OBJECT +}; + +static void f() +{ + MyClass1 m; +} + +#include <somefile.moc> diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.cpp b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.cpp new file mode 100644 index 000000000..13be460b4 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.cpp @@ -0,0 +1,7 @@ +#include "someclass.h" + +namespace Src2 { + +SomeClass::SomeClass(QObject *parent) : QObject(parent) { } + +} diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.h b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.h new file mode 100644 index 000000000..fe8a400af --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/someclass.h @@ -0,0 +1,17 @@ +#ifndef SOMECLASS2_H +#define SOMECLASS2_H + +#include <QObject> + +namespace Src2 { + +class SomeClass : public QObject +{ + Q_OBJECT +public: + SomeClass(QObject *parent = nullptr); +}; + +} + +#endif diff --git a/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/somefile.cpp b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/somefile.cpp new file mode 100644 index 000000000..770183a57 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/moc-same-file-name/src2/somefile.cpp @@ -0,0 +1,13 @@ +#include <QObject> + +class MyClass2 : public QObject +{ + Q_OBJECT +}; + +static void f() +{ + MyClass2 m; +} + +#include <somefile.moc> |