Autogen: Tests: Update AUTOMOC_MACRO_NAMES test

This commit is contained in:
Sebastian Holtermann 2017-09-25 20:10:26 +02:00
parent 08041dd15e
commit 084ace47b6
15 changed files with 139 additions and 49 deletions

View File

@ -65,15 +65,6 @@ add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySo
set_property(TARGET mocOnly PROPERTY AUTOMOC ON)
target_link_libraries(mocOnly ${QT_LIBRARIES})
# -- Test
# MOC AUTOMOC_MACRO_NAMES
if (NOT QT_TEST_VERSION STREQUAL 4)
add_executable(mocMacroName mocMacroName/main.cpp mocMacroName/MacroName.cpp)
set_property(TARGET mocMacroName PROPERTY AUTOMOC ON)
set_property(TARGET mocMacroName PROPERTY AUTOMOC_MACRO_NAMES "QO_ALIAS")
target_link_libraries(mocMacroName ${QT_LIBRARIES})
endif()
# -- Test
# UIC only
if(ALLOW_WRAP_CPP)
@ -188,8 +179,10 @@ set_property(TARGET skipRccB PROPERTY AUTOMOC ON)
target_link_libraries(skipRccB ${QT_LIBRARIES})
# -- Test
# Source files with the same basename in different subdirectories
add_subdirectory(sameName)
# MOC AUTOMOC_MACRO_NAMES
if (NOT QT_TEST_VERSION STREQUAL 4)
add_subdirectory(mocMacroName)
endif()
# -- Test
# Tests AUTOMOC with generated sources
@ -216,6 +209,10 @@ add_subdirectory(uicInclude)
# OBJECT libraries
add_subdirectory(objectLibrary)
# -- Test
# Source files with the same basename in different subdirectories
add_subdirectory(sameName)
# -- Test
# Complex test case
add_subdirectory(complex)

View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.9)
list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS")
add_executable(mmn main.cpp Gadget.cpp Object.cpp Object1Aliased.cpp Object2Aliased.cpp)
set_property(TARGET mmn PROPERTY AUTOMOC ON)
set_property(TARGET mmn APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS")
target_link_libraries(mmn ${QT_LIBRARIES})

View File

@ -0,0 +1,8 @@
#ifndef CUSTOM_MACROS_HPP
#define CUSTOM_MACROS_HPP
#include <QObject>
#define QO1_ALIAS Q_OBJECT
#define QO2_ALIAS Q_OBJECT
#endif

View File

@ -0,0 +1,6 @@
#include "Gadget.hpp"
Gadget::Gadget()
: test(0)
{
}

View File

@ -0,0 +1,15 @@
#ifndef GADGET_HPP
#define GADGET_HPP
#include <QMetaType>
class Gadget
{
Q_GADGET
Q_PROPERTY(int test MEMBER test)
public:
Gadget();
int test;
};
#endif

View File

@ -1,7 +0,0 @@
#ifndef MACROALIAS_HPP
#define MACROALIAS_HPP
#include <QObject>
#define QO_ALIAS Q_OBJECT
#endif

View File

@ -1,9 +0,0 @@
#include "MacroName.hpp"
MacroName::MacroName()
{
}
void MacroName::aSlot()
{
}

View File

@ -1,20 +0,0 @@
#ifndef MACRONAME_HPP
#define MACRONAME_HPP
#include "MacroAlias.hpp"
// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
class MacroName : public QObject
{
QO_ALIAS
public:
MacroName();
signals:
void aSignal();
public slots:
void aSlot();
};
#endif

View File

@ -0,0 +1,9 @@
#include "Object.hpp"
Object::Object()
{
}
void Object::aSlot()
{
}

View File

@ -0,0 +1,19 @@
#ifndef OBJECT_HPP
#define OBJECT_HPP
#include <QObject>
class Object : public QObject
{
Q_OBJECT
Q_PROPERTY(int test MEMBER test)
public:
Object();
Q_SLOT
void aSlot();
int test;
};
#endif

View File

@ -0,0 +1,9 @@
#include "Object1Aliased.hpp"
Object1Aliased::Object1Aliased()
{
}
void Object1Aliased::aSlot()
{
}

View File

@ -0,0 +1,20 @@
#ifndef OBJECTALIASED_HPP
#define OBJECTALIASED_HPP
#include "CustomMacros.hpp"
// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
class Object1Aliased : public QObject
{
QO1_ALIAS
public:
Object1Aliased();
signals:
void aSignal();
public slots:
void aSlot();
};
#endif

View File

@ -0,0 +1,9 @@
#include "Object2Aliased.hpp"
Object2Aliased::Object2Aliased()
{
}
void Object2Aliased::aSlot()
{
}

View File

@ -0,0 +1,20 @@
#ifndef OBJECT2ALIASED_HPP
#define OBJECT2ALIASED_HPP
#include "CustomMacros.hpp"
// Test Qt object macro hidden in a macro (AUTOMOC_MACRO_NAMES)
class Object2Aliased : public QObject
{
QO2_ALIAS
public:
Object2Aliased();
signals:
void aSignal();
public slots:
void aSlot();
};
#endif

View File

@ -1,7 +1,13 @@
#include "MacroName.hpp"
#include "Gadget.hpp"
#include "Object.hpp"
#include "Object1Aliased.hpp"
#include "Object2Aliased.hpp"
int main(int argv, char** args)
{
MacroName macroName;
Gadget gadget;
Object object;
Object1Aliased object1Aliased;
Object2Aliased object2Aliased;
return 0;
}