Autogen: Tests: Extend AUTOMOC include patterns test

This commit is contained in:
Sebastian Holtermann 2018-01-18 10:31:49 +01:00
parent a1d491ca27
commit ff91a5d54b
6 changed files with 82 additions and 2 deletions

View File

@ -2,7 +2,14 @@ cmake_minimum_required(VERSION 3.10)
project(MocOnly)
include("../AutogenTest.cmake")
# Test different Q_OBJECT position styles
add_executable(mocOnly StyleA.cpp StyleB.cpp main.cpp)
add_executable(mocOnly
main.cpp
# Test different Q_OBJECT position styles
StyleA.cpp
StyleB.cpp
# Test different moc_/.moc include positions
IncA.cpp
IncB.cpp
)
set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
target_link_libraries(mocOnly ${QT_LIBRARIES})

View File

@ -0,0 +1,19 @@
#include "moc_IncA.cpp"
/// AUTOMOC moc_ include on the first line of the file!
#include "IncA.hpp"
/// @brief Source local QObject
///
class IncAPrivate : public QObject
{
Q_OBJECT
public:
IncAPrivate(){};
};
IncA::IncA()
{
IncAPrivate priv;
}
#include "IncA.moc"

View File

@ -0,0 +1,15 @@
#ifndef INCA_HPP
#define INCA_HPP
#include <QObject>
/// @brief Test moc include pattern in the source file
///
class IncA : public QObject
{
Q_OBJECT
public:
IncA();
};
#endif

View File

@ -0,0 +1,19 @@
#include "IncB.hpp"
/// @brief Source local QObject
///
class IncBPrivate : public QObject
{
Q_OBJECT
public:
IncBPrivate(){};
};
IncB::IncB()
{
IncBPrivate priv;
}
/// AUTOMOC moc_ include on the last line of the file!
#include "IncB.moc"
#include "moc_IncB.cpp"

View File

@ -0,0 +1,15 @@
#ifndef INCB_HPP
#define INCB_HPP
#include <QObject>
/// @brief Test moc include pattern in the source file
///
class IncB : public QObject
{
Q_OBJECT
public:
IncB();
};
#endif

View File

@ -1,3 +1,5 @@
#include "IncA.hpp"
#include "IncB.hpp"
#include "StyleA.hpp"
#include "StyleB.hpp"
@ -5,5 +7,8 @@ int main(int argv, char** args)
{
StyleA styleA;
StyleB styleB;
IncA incA;
IncB incB;
return 0;
}