mirror of
https://github.com/reactos/CMake.git
synced 2025-02-26 15:05:34 +00:00
Autogen: Tests: Add moc include tests
This commit is contained in:
parent
50805693ba
commit
39c4819eaa
@ -206,6 +206,14 @@ target_link_libraries(skipRccB ${QT_LIBRARIES})
|
||||
# Source files with the same basename in different subdirectories
|
||||
add_subdirectory(sameName)
|
||||
|
||||
# -- Test
|
||||
# Tests various include moc patterns
|
||||
add_subdirectory(mocIncludeStrict)
|
||||
|
||||
# -- Test
|
||||
# Tests various include moc patterns
|
||||
add_subdirectory(mocIncludeRelaxed)
|
||||
|
||||
# -- Test
|
||||
# Complex test case
|
||||
add_subdirectory(complex)
|
||||
|
24
Tests/QtAutogen/mocInclude/ObjA.cpp
Normal file
24
Tests/QtAutogen/mocInclude/ObjA.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "ObjA.hpp"
|
||||
|
||||
class SubObjA : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjA() {}
|
||||
~SubObjA() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjA::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjA::go()
|
||||
{
|
||||
SubObjA subObj;
|
||||
}
|
||||
|
||||
#include "ObjA.moc"
|
13
Tests/QtAutogen/mocInclude/ObjA.hpp
Normal file
13
Tests/QtAutogen/mocInclude/ObjA.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef OBJA_HPP
|
||||
#define OBJA_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ObjA : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
25
Tests/QtAutogen/mocInclude/ObjB.cpp
Normal file
25
Tests/QtAutogen/mocInclude/ObjB.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "ObjB.hpp"
|
||||
|
||||
class SubObjB : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjB() {}
|
||||
~SubObjB() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjB::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjB::go()
|
||||
{
|
||||
SubObjB subObj;
|
||||
}
|
||||
|
||||
#include "ObjB.moc"
|
||||
#include "moc_ObjB.cpp"
|
13
Tests/QtAutogen/mocInclude/ObjB.hpp
Normal file
13
Tests/QtAutogen/mocInclude/ObjB.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef OBJB_HPP
|
||||
#define OBJB_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ObjB : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
26
Tests/QtAutogen/mocInclude/ObjC.cpp
Normal file
26
Tests/QtAutogen/mocInclude/ObjC.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "ObjC.hpp"
|
||||
|
||||
class SubObjC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjC() {}
|
||||
~SubObjC() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjC::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjC::go()
|
||||
{
|
||||
SubObjC subObj;
|
||||
}
|
||||
|
||||
#include "ObjC.moc"
|
||||
// Not the own header
|
||||
#include "moc_ObjD.cpp"
|
13
Tests/QtAutogen/mocInclude/ObjC.hpp
Normal file
13
Tests/QtAutogen/mocInclude/ObjC.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef OBJC_HPP
|
||||
#define OBJC_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ObjC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
26
Tests/QtAutogen/mocInclude/ObjD.cpp
Normal file
26
Tests/QtAutogen/mocInclude/ObjD.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include "ObjD.hpp"
|
||||
|
||||
class SubObjD : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjD() {}
|
||||
~SubObjD() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjD::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjD::go()
|
||||
{
|
||||
SubObjD subObj;
|
||||
}
|
||||
|
||||
#include "ObjD.moc"
|
||||
// Header in subdirectory
|
||||
#include "subA/moc_SubObjA.cpp"
|
13
Tests/QtAutogen/mocInclude/ObjD.hpp
Normal file
13
Tests/QtAutogen/mocInclude/ObjD.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef OBJD_HPP
|
||||
#define OBJD_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class ObjD : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
#endif
|
27
Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
Normal file
27
Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "SubObjA.hpp"
|
||||
|
||||
namespace subA {
|
||||
|
||||
class SubObjA : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjA() {}
|
||||
~SubObjA() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjA::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjA::go()
|
||||
{
|
||||
SubObjA subObj;
|
||||
}
|
||||
}
|
||||
|
||||
#include "SubObjA.moc"
|
16
Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
Normal file
16
Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef SUBOBJA_HPP
|
||||
#define SUBOBJA_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace subA {
|
||||
|
||||
class ObjA : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
27
Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
Normal file
27
Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "SubObjB.hpp"
|
||||
|
||||
namespace subB {
|
||||
|
||||
class SubObjB : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjB() {}
|
||||
~SubObjB() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjB::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjB::go()
|
||||
{
|
||||
SubObjB subObj;
|
||||
}
|
||||
}
|
||||
|
||||
#include "SubObjB.moc"
|
16
Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
Normal file
16
Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef SUBOBJB_HPP
|
||||
#define SUBOBJB_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace subB {
|
||||
|
||||
class ObjB : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
27
Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
Normal file
27
Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "SubObjC.hpp"
|
||||
|
||||
namespace subC {
|
||||
|
||||
class SubObjC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SubObjC() {}
|
||||
~SubObjC() {}
|
||||
|
||||
Q_SLOT
|
||||
void aSlot();
|
||||
};
|
||||
|
||||
void SubObjC::aSlot()
|
||||
{
|
||||
}
|
||||
|
||||
void ObjC::go()
|
||||
{
|
||||
SubObjC subObj;
|
||||
}
|
||||
}
|
||||
|
||||
#include "SubObjC.moc"
|
16
Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
Normal file
16
Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef SUBOBJC_HPP
|
||||
#define SUBOBJC_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace subC {
|
||||
|
||||
class ObjC : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
18
Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
Normal file
18
Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Test moc include patterns
|
||||
|
||||
set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
|
||||
|
||||
include_directories("../mocInclude")
|
||||
|
||||
add_executable(mocIncludeRelaxed
|
||||
../mocInclude/ObjA.cpp
|
||||
../mocInclude/ObjB.cpp
|
||||
../mocInclude/ObjC.cpp
|
||||
../mocInclude/ObjD.cpp
|
||||
../mocInclude/subA/SubObjA.cpp
|
||||
../mocInclude/subB/SubObjB.cpp
|
||||
../mocInclude/subC/SubObjC.cpp
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(mocIncludeRelaxed ${QT_LIBRARIES})
|
||||
set_target_properties(mocIncludeRelaxed PROPERTIES AUTOMOC ON)
|
14
Tests/QtAutogen/mocIncludeRelaxed/main.cpp
Normal file
14
Tests/QtAutogen/mocIncludeRelaxed/main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "ObjA.hpp"
|
||||
#include "ObjB.hpp"
|
||||
#include "ObjC.hpp"
|
||||
|
||||
int main(int argv, char** args)
|
||||
{
|
||||
ObjA objA;
|
||||
ObjB objB;
|
||||
ObjC objC;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Header in global subdirectory
|
||||
#include "subB/moc_SubObjB.cpp"
|
18
Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
Normal file
18
Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
# Test moc include patterns
|
||||
|
||||
set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
|
||||
|
||||
include_directories("../mocInclude")
|
||||
|
||||
add_executable(mocIncludeStrict
|
||||
../mocInclude/ObjA.cpp
|
||||
../mocInclude/ObjB.cpp
|
||||
../mocInclude/ObjC.cpp
|
||||
../mocInclude/ObjD.cpp
|
||||
../mocInclude/subA/SubObjA.cpp
|
||||
../mocInclude/subB/SubObjB.cpp
|
||||
../mocInclude/subC/SubObjC.cpp
|
||||
main.cpp
|
||||
)
|
||||
target_link_libraries(mocIncludeStrict ${QT_LIBRARIES})
|
||||
set_target_properties(mocIncludeStrict PROPERTIES AUTOMOC ON)
|
14
Tests/QtAutogen/mocIncludeStrict/main.cpp
Normal file
14
Tests/QtAutogen/mocIncludeStrict/main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "ObjA.hpp"
|
||||
#include "ObjB.hpp"
|
||||
#include "ObjC.hpp"
|
||||
|
||||
int main(int argv, char** args)
|
||||
{
|
||||
ObjA objA;
|
||||
ObjB objB;
|
||||
ObjC objC;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Header in global subdirectory
|
||||
#include "subB/moc_SubObjB.cpp"
|
Loading…
x
Reference in New Issue
Block a user