automoc: add more test cases

Alex
This commit is contained in:
Alex Neundorf 2011-11-10 21:40:31 +01:00
parent 81c43b4fb6
commit 69cf480cd6
6 changed files with 131 additions and 1 deletions

View File

@ -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)

28
Tests/QtAutomoc/bar.cpp Normal file
View File

@ -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"

40
Tests/QtAutomoc/blub.cpp Normal file
View File

@ -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"

26
Tests/QtAutomoc/blub.h Normal file
View File

@ -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

View File

@ -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();
}

28
Tests/QtAutomoc/sub/bar.h Normal file
View File

@ -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