From 0af9da29e487f0a6c60c379f0773a68b40ce2625 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 18:24:52 +0100 Subject: Autogen: Tests: Separate MocSkipSource test --- Tests/QtAutogen/CMakeLists.txt | 35 --------------------------- Tests/QtAutogen/CommonTests.cmake | 3 +++ Tests/QtAutogen/MocSkipSource/CMakeLists.txt | 36 ++++++++++++++++++++++++++++ Tests/QtAutogen/MocSkipSource/qItemA.cpp | 5 ++++ Tests/QtAutogen/MocSkipSource/qItemA.hpp | 13 ++++++++++ Tests/QtAutogen/MocSkipSource/qItemB.cpp | 5 ++++ Tests/QtAutogen/MocSkipSource/qItemB.hpp | 13 ++++++++++ Tests/QtAutogen/MocSkipSource/qItemC.cpp | 17 +++++++++++++ Tests/QtAutogen/MocSkipSource/qItemC.hpp | 13 ++++++++++ Tests/QtAutogen/MocSkipSource/qItemD.cpp | 17 +++++++++++++ Tests/QtAutogen/MocSkipSource/qItemD.hpp | 13 ++++++++++ Tests/QtAutogen/MocSkipSource/skipMoc.cpp | 16 +++++++++++++ Tests/QtAutogen/skipMoc.cpp | 16 ------------- Tests/QtAutogen/skipSource/qItemA.cpp | 5 ---- Tests/QtAutogen/skipSource/qItemA.hpp | 13 ---------- Tests/QtAutogen/skipSource/qItemB.cpp | 5 ---- Tests/QtAutogen/skipSource/qItemB.hpp | 13 ---------- Tests/QtAutogen/skipSource/qItemC.cpp | 17 ------------- Tests/QtAutogen/skipSource/qItemC.hpp | 13 ---------- Tests/QtAutogen/skipSource/qItemD.cpp | 17 ------------- Tests/QtAutogen/skipSource/qItemD.hpp | 13 ---------- 21 files changed, 151 insertions(+), 147 deletions(-) create mode 100644 Tests/QtAutogen/MocSkipSource/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocSkipSource/qItemA.cpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemA.hpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemB.cpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemB.hpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemC.cpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemC.hpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemD.cpp create mode 100644 Tests/QtAutogen/MocSkipSource/qItemD.hpp create mode 100644 Tests/QtAutogen/MocSkipSource/skipMoc.cpp delete mode 100644 Tests/QtAutogen/skipMoc.cpp delete mode 100644 Tests/QtAutogen/skipSource/qItemA.cpp delete mode 100644 Tests/QtAutogen/skipSource/qItemA.hpp delete mode 100644 Tests/QtAutogen/skipSource/qItemB.cpp delete mode 100644 Tests/QtAutogen/skipSource/qItemB.hpp delete mode 100644 Tests/QtAutogen/skipSource/qItemC.cpp delete mode 100644 Tests/QtAutogen/skipSource/qItemC.hpp delete mode 100644 Tests/QtAutogen/skipSource/qItemD.cpp delete mode 100644 Tests/QtAutogen/skipSource/qItemD.hpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 723747a..d09823f 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,41 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target -if(ALLOW_WRAP_CPP) - # Generate header mocs manually - qtx_wrap_cpp(skipMocWrapMoc - skipSource/qItemA.hpp - skipSource/qItemB.hpp - skipSource/qItemC.hpp - skipSource/qItemD.hpp - ) - set(skipMocSources - skipMoc.cpp - skipSource/qItemA.cpp - skipSource/qItemB.cpp - skipSource/qItemC.cpp - skipSource/qItemD.cpp - ) - # When cpp files are skipped, the hpp won't be processed either, - # unless they are mentioned in the sources - which they aren't. - set_property(SOURCE skipSource/qItemA.cpp PROPERTY SKIP_AUTOMOC ON) - set_property(SOURCE skipSource/qItemB.cpp PROPERTY SKIP_AUTOGEN ON) - # When hpp files are skipped, the cpp still get processed. - set_property(SOURCE skipSource/qItemC.hpp PROPERTY SKIP_AUTOMOC ON) - set_property(SOURCE skipSource/qItemD.hpp PROPERTY SKIP_AUTOGEN ON) - # AUTOMOC enabled only - add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc}) - set_property(TARGET skipMocA PROPERTY AUTOMOC ON) - target_link_libraries(skipMocA ${QT_LIBRARIES}) - # AUTOMOC and AUTOUIC enabled - add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc}) - set_property(TARGET skipMocB PROPERTY AUTOMOC ON) - set_property(TARGET skipMocB PROPERTY AUTOUIC ON) - target_link_libraries(skipMocB ${QT_LIBRARIES}) -endif() - -# -- Test # Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target set(skipUicSources skipUic.cpp diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index f998b74..072a853 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -7,3 +7,6 @@ endif() ADD_AUTOGEN_TEST(RccOnly rccOnly) ADD_AUTOGEN_TEST(RccEmpty rccEmpty) ADD_AUTOGEN_TEST(RccOffMocLibrary) +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(MocSkipSource) +endif() diff --git a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt new file mode 100644 index 0000000..8d1fa6a --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.10) +project(MocSkipSource) +include("../AutogenTest.cmake") + +# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target + +# Generate header mocs manually +qtx_wrap_cpp(skipMocWrapMoc + qItemA.hpp + qItemB.hpp + qItemC.hpp + qItemD.hpp +) +set(skipMocSources + skipMoc.cpp + qItemA.cpp + qItemB.cpp + qItemC.cpp + qItemD.cpp +) +# When cpp files are skipped, the hpp won't be processed either, +# unless they are mentioned in the sources - which they aren't. +set_property(SOURCE qItemA.cpp PROPERTY SKIP_AUTOMOC ON) +set_property(SOURCE qItemB.cpp PROPERTY SKIP_AUTOGEN ON) +# When hpp files are skipped, the cpp still get processed. +set_property(SOURCE qItemC.hpp PROPERTY SKIP_AUTOMOC ON) +set_property(SOURCE qItemD.hpp PROPERTY SKIP_AUTOGEN ON) +# AUTOMOC enabled only +add_executable(skipMocA ${skipMocSources} ${skipMocWrapMoc}) +set_property(TARGET skipMocA PROPERTY AUTOMOC ON) +target_link_libraries(skipMocA ${QT_LIBRARIES}) +# AUTOMOC and AUTOUIC enabled +add_executable(skipMocB ${skipMocSources} ${skipMocWrapMoc}) +set_property(TARGET skipMocB PROPERTY AUTOMOC ON) +set_property(TARGET skipMocB PROPERTY AUTOUIC ON) +target_link_libraries(skipMocB ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocSkipSource/qItemA.cpp b/Tests/QtAutogen/MocSkipSource/qItemA.cpp new file mode 100644 index 0000000..522c2c7 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemA.cpp @@ -0,0 +1,5 @@ +#include "qItemA.hpp" + +void QItemA::go() +{ +} diff --git a/Tests/QtAutogen/MocSkipSource/qItemA.hpp b/Tests/QtAutogen/MocSkipSource/qItemA.hpp new file mode 100644 index 0000000..d295faf --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemA.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMA_HPP +#define QITEMA_HPP + +#include + +class QItemA : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemB.cpp b/Tests/QtAutogen/MocSkipSource/qItemB.cpp new file mode 100644 index 0000000..636e15d --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemB.cpp @@ -0,0 +1,5 @@ +#include "qItemB.hpp" + +void QItemB::go() +{ +} diff --git a/Tests/QtAutogen/MocSkipSource/qItemB.hpp b/Tests/QtAutogen/MocSkipSource/qItemB.hpp new file mode 100644 index 0000000..1775915 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemB.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMB_HPP +#define QITEMB_HPP + +#include + +class QItemB : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.cpp b/Tests/QtAutogen/MocSkipSource/qItemC.cpp new file mode 100644 index 0000000..622f282 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemC.cpp @@ -0,0 +1,17 @@ +#include "qItemC.hpp" + +class QItemC_Local : public QObject +{ + Q_OBJECT +public: + QItemC_Local(){}; + ~QItemC_Local(){}; +}; + +void QItemC::go() +{ + QItemC_Local localObject; +} + +// We need AUTOMOC processing +#include "qItemC.moc" diff --git a/Tests/QtAutogen/MocSkipSource/qItemC.hpp b/Tests/QtAutogen/MocSkipSource/qItemC.hpp new file mode 100644 index 0000000..f06bda2 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemC.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMC_HPP +#define QITEMC_HPP + +#include + +class QItemC : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.cpp b/Tests/QtAutogen/MocSkipSource/qItemD.cpp new file mode 100644 index 0000000..fe0f4e4 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemD.cpp @@ -0,0 +1,17 @@ +#include "qItemD.hpp" + +class QItemD_Local : public QObject +{ + Q_OBJECT +public: + QItemD_Local(){}; + ~QItemD_Local(){}; +}; + +void QItemD::go() +{ + QItemD_Local localObject; +} + +// We need AUTOMOC processing +#include "qItemD.moc" diff --git a/Tests/QtAutogen/MocSkipSource/qItemD.hpp b/Tests/QtAutogen/MocSkipSource/qItemD.hpp new file mode 100644 index 0000000..99e0acb --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/qItemD.hpp @@ -0,0 +1,13 @@ +#ifndef QITEMD_HPP +#define QITEMD_HPP + +#include + +class QItemD : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/MocSkipSource/skipMoc.cpp b/Tests/QtAutogen/MocSkipSource/skipMoc.cpp new file mode 100644 index 0000000..c915334 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/skipMoc.cpp @@ -0,0 +1,16 @@ + +#include "qItemA.hpp" +#include "qItemB.hpp" +#include "qItemC.hpp" +#include "qItemD.hpp" + +int main(int, char**) +{ + QItemA itemA; + QItemB itemB; + QItemC itemC; + QItemD itemD; + + // Fails to link if the symbol is not present. + return 0; +} diff --git a/Tests/QtAutogen/skipMoc.cpp b/Tests/QtAutogen/skipMoc.cpp deleted file mode 100644 index d6b292f..0000000 --- a/Tests/QtAutogen/skipMoc.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -#include "skipSource/qItemA.hpp" -#include "skipSource/qItemB.hpp" -#include "skipSource/qItemC.hpp" -#include "skipSource/qItemD.hpp" - -int main(int, char**) -{ - QItemA itemA; - QItemB itemB; - QItemC itemC; - QItemD itemD; - - // Fails to link if the symbol is not present. - return 0; -} diff --git a/Tests/QtAutogen/skipSource/qItemA.cpp b/Tests/QtAutogen/skipSource/qItemA.cpp deleted file mode 100644 index 522c2c7..0000000 --- a/Tests/QtAutogen/skipSource/qItemA.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "qItemA.hpp" - -void QItemA::go() -{ -} diff --git a/Tests/QtAutogen/skipSource/qItemA.hpp b/Tests/QtAutogen/skipSource/qItemA.hpp deleted file mode 100644 index d295faf..0000000 --- a/Tests/QtAutogen/skipSource/qItemA.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QITEMA_HPP -#define QITEMA_HPP - -#include - -class QItemA : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; - -#endif diff --git a/Tests/QtAutogen/skipSource/qItemB.cpp b/Tests/QtAutogen/skipSource/qItemB.cpp deleted file mode 100644 index 636e15d..0000000 --- a/Tests/QtAutogen/skipSource/qItemB.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "qItemB.hpp" - -void QItemB::go() -{ -} diff --git a/Tests/QtAutogen/skipSource/qItemB.hpp b/Tests/QtAutogen/skipSource/qItemB.hpp deleted file mode 100644 index 1775915..0000000 --- a/Tests/QtAutogen/skipSource/qItemB.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QITEMB_HPP -#define QITEMB_HPP - -#include - -class QItemB : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; - -#endif diff --git a/Tests/QtAutogen/skipSource/qItemC.cpp b/Tests/QtAutogen/skipSource/qItemC.cpp deleted file mode 100644 index 622f282..0000000 --- a/Tests/QtAutogen/skipSource/qItemC.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "qItemC.hpp" - -class QItemC_Local : public QObject -{ - Q_OBJECT -public: - QItemC_Local(){}; - ~QItemC_Local(){}; -}; - -void QItemC::go() -{ - QItemC_Local localObject; -} - -// We need AUTOMOC processing -#include "qItemC.moc" diff --git a/Tests/QtAutogen/skipSource/qItemC.hpp b/Tests/QtAutogen/skipSource/qItemC.hpp deleted file mode 100644 index f06bda2..0000000 --- a/Tests/QtAutogen/skipSource/qItemC.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QITEMC_HPP -#define QITEMC_HPP - -#include - -class QItemC : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; - -#endif diff --git a/Tests/QtAutogen/skipSource/qItemD.cpp b/Tests/QtAutogen/skipSource/qItemD.cpp deleted file mode 100644 index fe0f4e4..0000000 --- a/Tests/QtAutogen/skipSource/qItemD.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "qItemD.hpp" - -class QItemD_Local : public QObject -{ - Q_OBJECT -public: - QItemD_Local(){}; - ~QItemD_Local(){}; -}; - -void QItemD::go() -{ - QItemD_Local localObject; -} - -// We need AUTOMOC processing -#include "qItemD.moc" diff --git a/Tests/QtAutogen/skipSource/qItemD.hpp b/Tests/QtAutogen/skipSource/qItemD.hpp deleted file mode 100644 index 99e0acb..0000000 --- a/Tests/QtAutogen/skipSource/qItemD.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef QITEMD_HPP -#define QITEMD_HPP - -#include - -class QItemD : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; - -#endif -- cgit v0.12