From fb7e52ca3d920ca1de8b2abb23da3d83db988eca Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:15:26 +0100 Subject: Autogen: Tests: Separate MocMacroName test --- Tests/QtAutogen/CMakeLists.txt | 6 ------ Tests/QtAutogen/CommonTests.cmake | 3 +++ Tests/QtAutogen/MocMacroName/CMakeLists.txt | 17 +++++++++++++++++ Tests/QtAutogen/MocMacroName/CustomMacros.hpp | 8 ++++++++ Tests/QtAutogen/MocMacroName/Gadget.cpp | 6 ++++++ Tests/QtAutogen/MocMacroName/Gadget.hpp | 19 +++++++++++++++++++ Tests/QtAutogen/MocMacroName/Object.cpp | 10 ++++++++++ Tests/QtAutogen/MocMacroName/Object.hpp | 22 ++++++++++++++++++++++ Tests/QtAutogen/MocMacroName/Object1Aliased.cpp | 9 +++++++++ Tests/QtAutogen/MocMacroName/Object1Aliased.hpp | 20 ++++++++++++++++++++ Tests/QtAutogen/MocMacroName/Object2Aliased.cpp | 9 +++++++++ Tests/QtAutogen/MocMacroName/Object2Aliased.hpp | 20 ++++++++++++++++++++ Tests/QtAutogen/MocMacroName/main.cpp | 13 +++++++++++++ Tests/QtAutogen/mocMacroName/CMakeLists.txt | 8 -------- Tests/QtAutogen/mocMacroName/CustomMacros.hpp | 8 -------- Tests/QtAutogen/mocMacroName/Gadget.cpp | 6 ------ Tests/QtAutogen/mocMacroName/Gadget.hpp | 15 --------------- Tests/QtAutogen/mocMacroName/Object.cpp | 9 --------- Tests/QtAutogen/mocMacroName/Object.hpp | 19 ------------------- Tests/QtAutogen/mocMacroName/Object1Aliased.cpp | 9 --------- Tests/QtAutogen/mocMacroName/Object1Aliased.hpp | 20 -------------------- Tests/QtAutogen/mocMacroName/Object2Aliased.cpp | 9 --------- Tests/QtAutogen/mocMacroName/Object2Aliased.hpp | 20 -------------------- Tests/QtAutogen/mocMacroName/main.cpp | 13 ------------- 24 files changed, 156 insertions(+), 142 deletions(-) create mode 100644 Tests/QtAutogen/MocMacroName/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocMacroName/CustomMacros.hpp create mode 100644 Tests/QtAutogen/MocMacroName/Gadget.cpp create mode 100644 Tests/QtAutogen/MocMacroName/Gadget.hpp create mode 100644 Tests/QtAutogen/MocMacroName/Object.cpp create mode 100644 Tests/QtAutogen/MocMacroName/Object.hpp create mode 100644 Tests/QtAutogen/MocMacroName/Object1Aliased.cpp create mode 100644 Tests/QtAutogen/MocMacroName/Object1Aliased.hpp create mode 100644 Tests/QtAutogen/MocMacroName/Object2Aliased.cpp create mode 100644 Tests/QtAutogen/MocMacroName/Object2Aliased.hpp create mode 100644 Tests/QtAutogen/MocMacroName/main.cpp delete mode 100644 Tests/QtAutogen/mocMacroName/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocMacroName/CustomMacros.hpp delete mode 100644 Tests/QtAutogen/mocMacroName/Gadget.cpp delete mode 100644 Tests/QtAutogen/mocMacroName/Gadget.hpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object.cpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object.hpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object1Aliased.cpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object1Aliased.hpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object2Aliased.cpp delete mode 100644 Tests/QtAutogen/mocMacroName/Object2Aliased.hpp delete mode 100644 Tests/QtAutogen/mocMacroName/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index e5940d8..6b54b1a 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,12 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# MOC AUTOMOC_MACRO_NAMES -if (NOT QT_TEST_VERSION STREQUAL 4) - add_subdirectory(mocMacroName) -endif() - -# -- Test # Tests AUTOMOC with generated sources add_subdirectory(mocDepends) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index fdf41b6..6a92873 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -12,3 +12,6 @@ if(QT_TEST_ALLOW_QT_MACROS) endif() ADD_AUTOGEN_TEST(UicSkipSource) ADD_AUTOGEN_TEST(RccSkipSource) +if(NOT QT_TEST_VERSION STREQUAL 4) + ADD_AUTOGEN_TEST(MocMacroName mocMacroName) +endif() diff --git a/Tests/QtAutogen/MocMacroName/CMakeLists.txt b/Tests/QtAutogen/MocMacroName/CMakeLists.txt new file mode 100644 index 0000000..f0251a2 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(MocMacroName) +include("../AutogenTest.cmake") + +# Test CMAKE_AUTOMOC_MACRO_NAMES and AUTOMOC_MACRO_NAMES +list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "QO1_ALIAS") + +add_executable(mocMacroName + main.cpp + Gadget.cpp + Object.cpp + Object1Aliased.cpp + Object2Aliased.cpp +) +set_property(TARGET mocMacroName PROPERTY AUTOMOC ON) +set_property(TARGET mocMacroName APPEND PROPERTY AUTOMOC_MACRO_NAMES "QO2_ALIAS") +target_link_libraries(mocMacroName ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocMacroName/CustomMacros.hpp b/Tests/QtAutogen/MocMacroName/CustomMacros.hpp new file mode 100644 index 0000000..93e5bfd --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/CustomMacros.hpp @@ -0,0 +1,8 @@ +#ifndef CUSTOM_MACROS_HPP +#define CUSTOM_MACROS_HPP + +#include +#define QO1_ALIAS Q_OBJECT +#define QO2_ALIAS Q_OBJECT + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Gadget.cpp b/Tests/QtAutogen/MocMacroName/Gadget.cpp new file mode 100644 index 0000000..d7cb515 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Gadget.cpp @@ -0,0 +1,6 @@ +#include "Gadget.hpp" + +Gadget::Gadget() + : _test(0) +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Gadget.hpp b/Tests/QtAutogen/MocMacroName/Gadget.hpp new file mode 100644 index 0000000..cab792e --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Gadget.hpp @@ -0,0 +1,19 @@ +#ifndef GADGET_HPP +#define GADGET_HPP + +#include + +class Gadget +{ + Q_GADGET + Q_PROPERTY(int test READ getTest) +public: + Gadget(); + + int getTest() { return _test; } + +private: + int _test; +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Object.cpp b/Tests/QtAutogen/MocMacroName/Object.cpp new file mode 100644 index 0000000..800ebf3 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object.cpp @@ -0,0 +1,10 @@ +#include "Object.hpp" + +Object::Object() + : _test(0) +{ +} + +void Object::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object.hpp b/Tests/QtAutogen/MocMacroName/Object.hpp new file mode 100644 index 0000000..aadae1f --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object.hpp @@ -0,0 +1,22 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT + Q_PROPERTY(int test READ getTest) +public: + Object(); + + int getTest() { return _test; } + + Q_SLOT + void aSlot(); + +private: + int _test; +}; + +#endif diff --git a/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp new file mode 100644 index 0000000..b8b4806 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object1Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object1Aliased.hpp" + +Object1Aliased::Object1Aliased() +{ +} + +void Object1Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp new file mode 100644 index 0000000..6c6bb40 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object1Aliased.hpp @@ -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 diff --git a/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp new file mode 100644 index 0000000..4b09dd1 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object2Aliased.cpp @@ -0,0 +1,9 @@ +#include "Object2Aliased.hpp" + +Object2Aliased::Object2Aliased() +{ +} + +void Object2Aliased::aSlot() +{ +} diff --git a/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp new file mode 100644 index 0000000..b9bdc12 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/Object2Aliased.hpp @@ -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 diff --git a/Tests/QtAutogen/MocMacroName/main.cpp b/Tests/QtAutogen/MocMacroName/main.cpp new file mode 100644 index 0000000..3b45d04 --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/main.cpp @@ -0,0 +1,13 @@ +#include "Gadget.hpp" +#include "Object.hpp" +#include "Object1Aliased.hpp" +#include "Object2Aliased.hpp" + +int main(int argv, char** args) +{ + Gadget gadget; + Object object; + Object1Aliased object1Aliased; + Object2Aliased object2Aliased; + return 0; +} diff --git a/Tests/QtAutogen/mocMacroName/CMakeLists.txt b/Tests/QtAutogen/mocMacroName/CMakeLists.txt deleted file mode 100644 index 08e6803..0000000 --- a/Tests/QtAutogen/mocMacroName/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -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}) diff --git a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp b/Tests/QtAutogen/mocMacroName/CustomMacros.hpp deleted file mode 100644 index 93e5bfd..0000000 --- a/Tests/QtAutogen/mocMacroName/CustomMacros.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CUSTOM_MACROS_HPP -#define CUSTOM_MACROS_HPP - -#include -#define QO1_ALIAS Q_OBJECT -#define QO2_ALIAS Q_OBJECT - -#endif diff --git a/Tests/QtAutogen/mocMacroName/Gadget.cpp b/Tests/QtAutogen/mocMacroName/Gadget.cpp deleted file mode 100644 index 167faeb..0000000 --- a/Tests/QtAutogen/mocMacroName/Gadget.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "Gadget.hpp" - -Gadget::Gadget() - : test(0) -{ -} diff --git a/Tests/QtAutogen/mocMacroName/Gadget.hpp b/Tests/QtAutogen/mocMacroName/Gadget.hpp deleted file mode 100644 index 2587ed2..0000000 --- a/Tests/QtAutogen/mocMacroName/Gadget.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GADGET_HPP -#define GADGET_HPP - -#include - -class Gadget -{ - Q_GADGET - Q_PROPERTY(int test MEMBER test) -public: - Gadget(); - int test; -}; - -#endif diff --git a/Tests/QtAutogen/mocMacroName/Object.cpp b/Tests/QtAutogen/mocMacroName/Object.cpp deleted file mode 100644 index c0b4f33..0000000 --- a/Tests/QtAutogen/mocMacroName/Object.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Object.hpp" - -Object::Object() -{ -} - -void Object::aSlot() -{ -} diff --git a/Tests/QtAutogen/mocMacroName/Object.hpp b/Tests/QtAutogen/mocMacroName/Object.hpp deleted file mode 100644 index 0c40824..0000000 --- a/Tests/QtAutogen/mocMacroName/Object.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OBJECT_HPP -#define OBJECT_HPP - -#include - -class Object : public QObject -{ - Q_OBJECT - Q_PROPERTY(int test MEMBER test) -public: - Object(); - - Q_SLOT - void aSlot(); - - int test; -}; - -#endif diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp deleted file mode 100644 index b8b4806..0000000 --- a/Tests/QtAutogen/mocMacroName/Object1Aliased.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Object1Aliased.hpp" - -Object1Aliased::Object1Aliased() -{ -} - -void Object1Aliased::aSlot() -{ -} diff --git a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp deleted file mode 100644 index 6c6bb40..0000000 --- a/Tests/QtAutogen/mocMacroName/Object1Aliased.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#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 diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp deleted file mode 100644 index 4b09dd1..0000000 --- a/Tests/QtAutogen/mocMacroName/Object2Aliased.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "Object2Aliased.hpp" - -Object2Aliased::Object2Aliased() -{ -} - -void Object2Aliased::aSlot() -{ -} diff --git a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp b/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp deleted file mode 100644 index b9bdc12..0000000 --- a/Tests/QtAutogen/mocMacroName/Object2Aliased.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#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 diff --git a/Tests/QtAutogen/mocMacroName/main.cpp b/Tests/QtAutogen/mocMacroName/main.cpp deleted file mode 100644 index 3b45d04..0000000 --- a/Tests/QtAutogen/mocMacroName/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "Gadget.hpp" -#include "Object.hpp" -#include "Object1Aliased.hpp" -#include "Object2Aliased.hpp" - -int main(int argv, char** args) -{ - Gadget gadget; - Object object; - Object1Aliased object1Aliased; - Object2Aliased object2Aliased; - return 0; -} -- cgit v0.12