summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-11-10 21:40:31 +0100
committerAlex Neundorf <neundorf@kde.org>2011-11-10 22:12:03 +0100
commit69cf480cd65621d3db1390f78ef2d3cd1dddb5d8 (patch)
tree157df9179c1f15f2a29955ae07b316f91dac15f1
parent81c43b4fb6e46430e730e2cb268c283e47995b78 (diff)
downloadcmake-69cf480cd65621d3db1390f78ef2d3cd1dddb5d8.tar.gz
automoc: add more test cases
Alex
-rw-r--r--Tests/QtAutomoc/CMakeLists.txt2
-rw-r--r--Tests/QtAutomoc/bar.cpp28
-rw-r--r--Tests/QtAutomoc/blub.cpp40
-rw-r--r--Tests/QtAutomoc/blub.h26
-rw-r--r--Tests/QtAutomoc/main.cpp8
-rw-r--r--Tests/QtAutomoc/sub/bar.h28
6 files changed, 131 insertions, 1 deletions
diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt
index 01f6bead51..9540e52e9e 100644
--- a/Tests/QtAutomoc/CMakeLists.txt
+++ b/Tests/QtAutomoc/CMakeLists.txt
@@ -13,7 +13,7 @@ add_definitions(-DFOO)
# create an executable and a library target, both requiring automoc:
add_library(codeeditorLib STATIC codeeditor.cpp)
-add_executable(foo main.cpp calwidget.cpp foo.cpp)
+add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp)
set_target_properties(foo codeeditorLib PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutomoc/bar.cpp b/Tests/QtAutomoc/bar.cpp
new file mode 100644
index 0000000000..8be48159d0
--- /dev/null
+++ b/Tests/QtAutomoc/bar.cpp
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "sub/bar.h"
+
+#include <stdio.h>
+
+Bar::Bar()
+:QObject()
+{
+}
+
+void Bar::doBar()
+{
+ printf("Hello bar !\n");
+}
+
+#include "sub/moc_bar.cpp"
diff --git a/Tests/QtAutomoc/blub.cpp b/Tests/QtAutomoc/blub.cpp
new file mode 100644
index 0000000000..bd53972acd
--- /dev/null
+++ b/Tests/QtAutomoc/blub.cpp
@@ -0,0 +1,40 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "blub.h"
+
+#include <stdio.h>
+
+class BlubBlub : public QObject
+{
+ Q_OBJECT
+ public:
+ BlubBlub():QObject() {}
+ public slots:
+ int getValue() const { return 13; }
+};
+
+Blub::Blub()
+{
+}
+
+
+void Blub::blubber()
+{
+ BlubBlub bb;
+ printf("Blub blub %d ! \n", bb.getValue());
+}
+
+// test the case that the wrong moc-file is included, it should
+// actually be "blub.moc"
+#include "moc_blub.cpp"
diff --git a/Tests/QtAutomoc/blub.h b/Tests/QtAutomoc/blub.h
new file mode 100644
index 0000000000..1967bc1ea3
--- /dev/null
+++ b/Tests/QtAutomoc/blub.h
@@ -0,0 +1,26 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef BLUB_H
+#define BLUB_H
+
+#include <QObject>
+
+class Blub
+{
+ public:
+ Blub();
+ void blubber();
+};
+
+#endif
diff --git a/Tests/QtAutomoc/main.cpp b/Tests/QtAutomoc/main.cpp
index b7cfb410ef..58e2a191a9 100644
--- a/Tests/QtAutomoc/main.cpp
+++ b/Tests/QtAutomoc/main.cpp
@@ -43,6 +43,8 @@
#include "codeeditor.h"
#include "calwidget.h"
#include "foo.h"
+#include "blub.h"
+#include "sub/bar.h"
int main(int argv, char **args)
{
@@ -58,5 +60,11 @@ int main(int argv, char **args)
Foo foo;
foo.doFoo();
+ Blub b;
+ b.blubber();
+
+ Bar bar;
+ bar.doBar();
+
return app.exec();
}
diff --git a/Tests/QtAutomoc/sub/bar.h b/Tests/QtAutomoc/sub/bar.h
new file mode 100644
index 0000000000..db56b8ed58
--- /dev/null
+++ b/Tests/QtAutomoc/sub/bar.h
@@ -0,0 +1,28 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2004-2011 Kitware, Inc.
+ Copyright 2011 Alexander Neundorf (neundorf@kde.org)
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef BAR_H
+#define BAR_H
+
+#include <QObject>
+
+class Bar : public QObject
+{
+ Q_OBJECT
+ public:
+ Bar();
+ public slots:
+ void doBar();
+};
+
+#endif