From ff91a5d54b5458eaebab6be814624925a02eccd7 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Thu, 18 Jan 2018 10:31:49 +0100 Subject: Autogen: Tests: Extend AUTOMOC include patterns test --- Tests/QtAutogen/MocOnly/CMakeLists.txt | 11 +++++++++-- Tests/QtAutogen/MocOnly/IncA.cpp | 19 +++++++++++++++++++ Tests/QtAutogen/MocOnly/IncA.hpp | 15 +++++++++++++++ Tests/QtAutogen/MocOnly/IncB.cpp | 19 +++++++++++++++++++ Tests/QtAutogen/MocOnly/IncB.hpp | 15 +++++++++++++++ Tests/QtAutogen/MocOnly/main.cpp | 5 +++++ 6 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 Tests/QtAutogen/MocOnly/IncA.cpp create mode 100644 Tests/QtAutogen/MocOnly/IncA.hpp create mode 100644 Tests/QtAutogen/MocOnly/IncB.cpp create mode 100644 Tests/QtAutogen/MocOnly/IncB.hpp diff --git a/Tests/QtAutogen/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt index 33feadf..a37a2ae 100644 --- a/Tests/QtAutogen/MocOnly/CMakeLists.txt +++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt @@ -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}) diff --git a/Tests/QtAutogen/MocOnly/IncA.cpp b/Tests/QtAutogen/MocOnly/IncA.cpp new file mode 100644 index 0000000..94610cd --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.cpp @@ -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" diff --git a/Tests/QtAutogen/MocOnly/IncA.hpp b/Tests/QtAutogen/MocOnly/IncA.hpp new file mode 100644 index 0000000..ecc889f --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.hpp @@ -0,0 +1,15 @@ +#ifndef INCA_HPP +#define INCA_HPP + +#include + +/// @brief Test moc include pattern in the source file +/// +class IncA : public QObject +{ + Q_OBJECT +public: + IncA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/IncB.cpp b/Tests/QtAutogen/MocOnly/IncB.cpp new file mode 100644 index 0000000..bd441a9 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.cpp @@ -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" diff --git a/Tests/QtAutogen/MocOnly/IncB.hpp b/Tests/QtAutogen/MocOnly/IncB.hpp new file mode 100644 index 0000000..8331ea2 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.hpp @@ -0,0 +1,15 @@ +#ifndef INCB_HPP +#define INCB_HPP + +#include + +/// @brief Test moc include pattern in the source file +/// +class IncB : public QObject +{ + Q_OBJECT +public: + IncB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/main.cpp b/Tests/QtAutogen/MocOnly/main.cpp index 06f8d81..1611f97 100644 --- a/Tests/QtAutogen/MocOnly/main.cpp +++ b/Tests/QtAutogen/MocOnly/main.cpp @@ -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; } -- cgit v0.12