From 227a7974f426e0966d1736c66dd606b068985d1b Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 17:09:30 +0100 Subject: Autogen: Tests: Add basic scripts for separate tests --- Tests/CMakeLists.txt | 4 ++ Tests/Qt4Autogen/CMakeLists.txt | 9 ++++ Tests/Qt5Autogen/CMakeLists.txt | 6 +++ Tests/QtAutogen/AutogenTest.cmake | 53 ++++++++++++++++++++++++ Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/DefinesTest/CMakeLists.txt | 13 ++++++ Tests/QtAutogen/DefinesTest/defines_test.cpp | 38 +++++++++++++++++ Tests/QtAutogen/TestMacros.cmake | 61 ++++++++++++++++++++++++++++ 8 files changed, 185 insertions(+) create mode 100644 Tests/Qt4Autogen/CMakeLists.txt create mode 100644 Tests/Qt5Autogen/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenTest.cmake create mode 100644 Tests/QtAutogen/CommonTests.cmake create mode 100644 Tests/QtAutogen/DefinesTest/CMakeLists.txt create mode 100644 Tests/QtAutogen/DefinesTest/defines_test.cpp create mode 100644 Tests/QtAutogen/TestMacros.cmake diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 1d13f1c..5608933 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1263,6 +1263,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release find_package(Qt5Widgets QUIET NO_MODULE) endif() if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) + add_subdirectory(Qt5Autogen) + add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" @@ -1309,6 +1311,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") endif() if(QT4_WORKS AND QT_QTGUI_FOUND) + add_subdirectory(Qt4Autogen) + add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogen" diff --git a/Tests/Qt4Autogen/CMakeLists.txt b/Tests/Qt4Autogen/CMakeLists.txt new file mode 100644 index 0000000..818e888 --- /dev/null +++ b/Tests/Qt4Autogen/CMakeLists.txt @@ -0,0 +1,9 @@ +# Set Qt test version and include the Autogen test macros +set(QT_TEST_VERSION 4) +include("../QtAutogen/TestMacros.cmake") + +# Qt4 only tests +ADD_AUTOGEN_TEST(DefinesTest) + +# Common tests +include("../QtAutogen/CommonTests.cmake") diff --git a/Tests/Qt5Autogen/CMakeLists.txt b/Tests/Qt5Autogen/CMakeLists.txt new file mode 100644 index 0000000..527e5ff --- /dev/null +++ b/Tests/Qt5Autogen/CMakeLists.txt @@ -0,0 +1,6 @@ +# Set Qt test version and include the Autogen test macros +set(QT_TEST_VERSION 5) +include("../QtAutogen/TestMacros.cmake") + +# Common tests +include("../QtAutogen/CommonTests.cmake") diff --git a/Tests/QtAutogen/AutogenTest.cmake b/Tests/QtAutogen/AutogenTest.cmake new file mode 100644 index 0000000..8c0a14f --- /dev/null +++ b/Tests/QtAutogen/AutogenTest.cmake @@ -0,0 +1,53 @@ + +# Tell find_package(Qt5) where to find Qt. +if(QT_QMAKE_EXECUTABLE) + get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) + get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) + list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) +endif() + +if (QT_TEST_VERSION STREQUAL 4) + find_package(Qt4 REQUIRED) + include(UseQt4) + + set(QT_QTCORE_TARGET Qt4::QtCore) + set(QT_QTGUI_TARGET Qt4::QtGui) + + # Qt macros + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + macro(qtx_generate_moc) + qt4_generate_moc(${ARGN}) + endmacro() + +elseif(QT_TEST_VERSION STREQUAL 5) + find_package(Qt5Widgets REQUIRED) + + set(QT_QTCORE_TARGET Qt5::Core) + set(QT_QTGUI_TARGET Qt5::Widgets) + + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + set(QT_LIBRARIES Qt5::Widgets) + + if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) + endif() + + # Qt macros + macro(qtx_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + macro(qtx_generate_moc) + qt5_generate_moc(${ARGN}) + endmacro() + +else() + message(SEND_ERROR "Invalid Qt version specified: ${QT_TEST_VERSION}") +endif() + +# Get Qt compile features +get_property(QT_COMPILE_FEATURES + TARGET ${QT_QTCORE_TARGET} + PROPERTY INTERFACE_COMPILE_FEATURES +) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake new file mode 100644 index 0000000..0eaf831 --- /dev/null +++ b/Tests/QtAutogen/CommonTests.cmake @@ -0,0 +1 @@ +# Autogen tests common for Qt4 and Qt5 diff --git a/Tests/QtAutogen/DefinesTest/CMakeLists.txt b/Tests/QtAutogen/DefinesTest/CMakeLists.txt new file mode 100644 index 0000000..de22845 --- /dev/null +++ b/Tests/QtAutogen/DefinesTest/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.10) +project(DefinesTest) + +# Qt4 only definitions test +if(NOT QT_TEST_VERSION STREQUAL 4) + message(ERROR "Invalid Qt test version. This test is for Qt4 only.") +endif() + +find_package(Qt4 REQUIRED) + +add_executable(DefinesTest defines_test.cpp) +set_target_properties(DefinesTest PROPERTIES AUTOMOC TRUE) +target_link_libraries(DefinesTest Qt4::QtGui) diff --git a/Tests/QtAutogen/DefinesTest/defines_test.cpp b/Tests/QtAutogen/DefinesTest/defines_test.cpp new file mode 100644 index 0000000..cf4e9cb --- /dev/null +++ b/Tests/QtAutogen/DefinesTest/defines_test.cpp @@ -0,0 +1,38 @@ + +#include + +#ifdef QT_GUI_LIB +#include + +class SomeDocument : public QTextDocument +{ + Q_OBJECT + +Q_SIGNALS: + void someSig(); +}; +#endif + +#ifdef QT_CORE_LIB +class SomeObject : public QObject +{ + Q_OBJECT + +Q_SIGNALS: + void someSig(); +}; +#endif + +int main(int argc, char** argv) +{ +#ifdef QT_CORE_LIB + QMetaObject sosmo = SomeObject::staticMetaObject; +#endif +#ifdef QT_GUI_LIB + QMetaObject sdsmo = SomeDocument::staticMetaObject; +#endif + + return 0; +} + +#include "defines_test.moc" diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake new file mode 100644 index 0000000..849a733 --- /dev/null +++ b/Tests/QtAutogen/TestMacros.cmake @@ -0,0 +1,61 @@ +# Autogen build options +set(Autogen_BUILD_OPTIONS "-DQT_TEST_VERSION=${QT_TEST_VERSION}") +if(NOT CMAKE_CONFIGURATION_TYPES) + list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$") +endif() +list(APPEND Autogen_BUILD_OPTIONS + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" +) + +# A macro to add a QtAutogen test +macro(ADD_AUTOGEN_TEST NAME) + if(${ARGC} GREATER 1) + # On Windows there is no RPATH, so while Qt might be available for building, + # the required dlls may not be in the PATH, so we can't run the executables + # on that platform. + if(WIN32) + set(_TestCommand --test-command ${CMAKE_CTEST_COMMAND} -V) + else() + set(_TestCommand --test-command ${ARGN}) + endif() + endif() + + set(_QtXAutogen "Qt${QT_TEST_VERSION}Autogen") + set(_SourceDir "${CMake_SOURCE_DIR}/Tests/QtAutogen/${NAME}") + set(_BuildDir "${CMake_BINARY_DIR}/Tests/${_QtXAutogen}/${NAME}") + add_test(NAME "${_QtXAutogen}.${NAME}" COMMAND "${CMAKE_CTEST_COMMAND}" + --build-and-test + "${_SourceDir}" + "${_BuildDir}" + ${build_generator_args} + --build-project ${NAME} + --build-exe-dir "${_BuildDir}" + --force-new-ctest-process + --build-options ${build_options} ${Autogen_BUILD_OPTIONS} + ${_TestCommand} + ) + list(APPEND TEST_BUILD_DIRS "${_BuildDir}") + unset(_TestCommand) + unset(_QtXAutogen) + unset(_SourceDir) + unset(_BuildDir) +endmacro() + + +# Allow using qtx_wrap_cpp and qtx_generate_moc or not +set(ALLOW_WRAP_CPP TRUE) +# Do a simple check if there is are non ASCII character in the build path +string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR}) +if(NON_ASCII_BDIR) + # Qt4 moc does not support utf8 paths in _parameter files generated by + # qtx_wrap_cpp + # https://bugreports.qt.io/browse/QTBUG-35480 + if(QT_TEST_VERSION STREQUAL 4) + set(ALLOW_WRAP_CPP FALSE) + endif() + # On windows qtx_wrap_cpp also fails in Qt5 when used on a path that + # contains non ASCII characters + if(WIN32) + set(ALLOW_WRAP_CPP FALSE) + endif() +endif() -- cgit v0.12 From 0b8597a86ee8bed2c34f52d309fd57b5f29a1595 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 17:29:23 +0100 Subject: Autogen: Tests: Separate mocOnly and mocOnlyOpts tests --- Tests/QtAutogen/CMakeLists.txt | 11 ----------- Tests/QtAutogen/CommonTests.cmake | 2 ++ Tests/QtAutogen/MocOnly/CMakeLists.txt | 8 ++++++++ Tests/QtAutogen/MocOnly/StyleA.cpp | 5 +++++ Tests/QtAutogen/MocOnly/StyleA.hpp | 17 +++++++++++++++++ Tests/QtAutogen/MocOnly/StyleB.cpp | 5 +++++ Tests/QtAutogen/MocOnly/StyleB.hpp | 16 ++++++++++++++++ Tests/QtAutogen/MocOnly/main.cpp | 9 +++++++++ Tests/QtAutogen/MocOptions/CMakeLists.txt | 9 +++++++++ Tests/QtAutogen/MocOptions/Object.cpp | 5 +++++ Tests/QtAutogen/MocOptions/Object.hpp | 13 +++++++++++++ Tests/QtAutogen/MocOptions/main.cpp | 7 +++++++ Tests/QtAutogen/TestMacros.cmake | 7 +++---- Tests/QtAutogen/mocOnlySource/StyleA.cpp | 5 ----- Tests/QtAutogen/mocOnlySource/StyleA.hpp | 15 --------------- Tests/QtAutogen/mocOnlySource/StyleB.cpp | 5 ----- Tests/QtAutogen/mocOnlySource/StyleB.hpp | 16 ---------------- Tests/QtAutogen/mocOnlySource/main.cpp | 9 --------- 18 files changed, 99 insertions(+), 65 deletions(-) create mode 100644 Tests/QtAutogen/MocOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocOnly/StyleA.cpp create mode 100644 Tests/QtAutogen/MocOnly/StyleA.hpp create mode 100644 Tests/QtAutogen/MocOnly/StyleB.cpp create mode 100644 Tests/QtAutogen/MocOnly/StyleB.hpp create mode 100644 Tests/QtAutogen/MocOnly/main.cpp create mode 100644 Tests/QtAutogen/MocOptions/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocOptions/Object.cpp create mode 100644 Tests/QtAutogen/MocOptions/Object.hpp create mode 100644 Tests/QtAutogen/MocOptions/main.cpp delete mode 100644 Tests/QtAutogen/mocOnlySource/StyleA.cpp delete mode 100644 Tests/QtAutogen/mocOnlySource/StyleA.hpp delete mode 100644 Tests/QtAutogen/mocOnlySource/StyleB.cpp delete mode 100644 Tests/QtAutogen/mocOnlySource/StyleB.hpp delete mode 100644 Tests/QtAutogen/mocOnlySource/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index dff9d0c..160903a 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,17 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# MOC only -add_executable(mocOnly mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) -set_property(TARGET mocOnly PROPERTY AUTOMOC ON) -target_link_libraries(mocOnly ${QT_LIBRARIES}) - -add_executable(mocOnlyOpts mocOnlySource/main.cpp mocOnlySource/StyleA.cpp mocOnlySource/StyleB.cpp) -set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC ON) -set_property(TARGET mocOnlyOpts PROPERTY AUTOMOC_MOC_OPTIONS "-nw") -target_link_libraries(mocOnlyOpts ${QT_LIBRARIES}) - -# -- Test # UIC only if(ALLOW_WRAP_CPP) qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 0eaf831..5abbee5 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -1 +1,3 @@ # Autogen tests common for Qt4 and Qt5 +ADD_AUTOGEN_TEST(MocOnly mocOnly) +ADD_AUTOGEN_TEST(MocOptions mocOptions) diff --git a/Tests/QtAutogen/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt new file mode 100644 index 0000000..33feadf --- /dev/null +++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +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) +set_property(TARGET mocOnly PROPERTY AUTOMOC ON) +target_link_libraries(mocOnly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocOnly/StyleA.cpp b/Tests/QtAutogen/MocOnly/StyleA.cpp new file mode 100644 index 0000000..ced1dd1 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/StyleA.cpp @@ -0,0 +1,5 @@ +#include "StyleA.hpp" + +StyleA::StyleA() +{ +} diff --git a/Tests/QtAutogen/MocOnly/StyleA.hpp b/Tests/QtAutogen/MocOnly/StyleA.hpp new file mode 100644 index 0000000..5ba0a87 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/StyleA.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEA_HPP +#define STYLEA_HPP + +#include + +/* clang-format off */ +/// Q_OBJECT on a single new line +/// +class StyleA : public QObject +{ + Q_OBJECT +public: + StyleA(); +}; +/* clang-format on */ + +#endif diff --git a/Tests/QtAutogen/MocOnly/StyleB.cpp b/Tests/QtAutogen/MocOnly/StyleB.cpp new file mode 100644 index 0000000..bec6c1c --- /dev/null +++ b/Tests/QtAutogen/MocOnly/StyleB.cpp @@ -0,0 +1,5 @@ +#include "StyleB.hpp" + +StyleB::StyleB() +{ +} diff --git a/Tests/QtAutogen/MocOnly/StyleB.hpp b/Tests/QtAutogen/MocOnly/StyleB.hpp new file mode 100644 index 0000000..86abaa8 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/StyleB.hpp @@ -0,0 +1,16 @@ +#ifndef STYLEB_HPP +#define STYLEB_HPP + +#include + +/* clang-format off */ +/// Q_OBJECT behind a brace on a new line +/// +class StyleB : public QObject +{ Q_OBJECT +public: + StyleB(); +}; +/* clang-format on */ + +#endif diff --git a/Tests/QtAutogen/MocOnly/main.cpp b/Tests/QtAutogen/MocOnly/main.cpp new file mode 100644 index 0000000..06f8d81 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/main.cpp @@ -0,0 +1,9 @@ +#include "StyleA.hpp" +#include "StyleB.hpp" + +int main(int argv, char** args) +{ + StyleA styleA; + StyleB styleB; + return 0; +} diff --git a/Tests/QtAutogen/MocOptions/CMakeLists.txt b/Tests/QtAutogen/MocOptions/CMakeLists.txt new file mode 100644 index 0000000..f64b37b --- /dev/null +++ b/Tests/QtAutogen/MocOptions/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOptions) +include("../AutogenTest.cmake") + +# Test extra options passed to moc via AUTOMOC_MOC_OPTIONS +add_executable(mocOptions Object.cpp main.cpp) +set_property(TARGET mocOptions PROPERTY AUTOMOC ON) +set_property(TARGET mocOptions PROPERTY AUTOMOC_MOC_OPTIONS "-nw") +target_link_libraries(mocOptions ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocOptions/Object.cpp b/Tests/QtAutogen/MocOptions/Object.cpp new file mode 100644 index 0000000..ad109f1 --- /dev/null +++ b/Tests/QtAutogen/MocOptions/Object.cpp @@ -0,0 +1,5 @@ +#include "Object.hpp" + +Object::Object() +{ +} diff --git a/Tests/QtAutogen/MocOptions/Object.hpp b/Tests/QtAutogen/MocOptions/Object.hpp new file mode 100644 index 0000000..e7a6142 --- /dev/null +++ b/Tests/QtAutogen/MocOptions/Object.hpp @@ -0,0 +1,13 @@ +#ifndef Object_HPP +#define Object_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + Object(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOptions/main.cpp b/Tests/QtAutogen/MocOptions/main.cpp new file mode 100644 index 0000000..7aeab1a --- /dev/null +++ b/Tests/QtAutogen/MocOptions/main.cpp @@ -0,0 +1,7 @@ +#include "Object.hpp" + +int main(int argv, char** args) +{ + Object object; + return 0; +} diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake index 849a733..966f3b8 100644 --- a/Tests/QtAutogen/TestMacros.cmake +++ b/Tests/QtAutogen/TestMacros.cmake @@ -41,9 +41,8 @@ macro(ADD_AUTOGEN_TEST NAME) unset(_BuildDir) endmacro() - # Allow using qtx_wrap_cpp and qtx_generate_moc or not -set(ALLOW_WRAP_CPP TRUE) +set(QT_TEST_ALLOW_QT_MACROS TRUE) # Do a simple check if there is are non ASCII character in the build path string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR}) if(NON_ASCII_BDIR) @@ -51,11 +50,11 @@ if(NON_ASCII_BDIR) # qtx_wrap_cpp # https://bugreports.qt.io/browse/QTBUG-35480 if(QT_TEST_VERSION STREQUAL 4) - set(ALLOW_WRAP_CPP FALSE) + set(QT_TEST_ALLOW_QT_MACROS FALSE) endif() # On windows qtx_wrap_cpp also fails in Qt5 when used on a path that # contains non ASCII characters if(WIN32) - set(ALLOW_WRAP_CPP FALSE) + set(QT_TEST_ALLOW_QT_MACROS FALSE) endif() endif() diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.cpp b/Tests/QtAutogen/mocOnlySource/StyleA.cpp deleted file mode 100644 index ced1dd1..0000000 --- a/Tests/QtAutogen/mocOnlySource/StyleA.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "StyleA.hpp" - -StyleA::StyleA() -{ -} diff --git a/Tests/QtAutogen/mocOnlySource/StyleA.hpp b/Tests/QtAutogen/mocOnlySource/StyleA.hpp deleted file mode 100644 index 66735b6..0000000 --- a/Tests/QtAutogen/mocOnlySource/StyleA.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef STYLEA_HPP -#define STYLEA_HPP - -#include - -/// Q_OBJECT on a single new line -/// -class StyleA : public QObject -{ - Q_OBJECT -public: - StyleA(); -}; - -#endif diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.cpp b/Tests/QtAutogen/mocOnlySource/StyleB.cpp deleted file mode 100644 index bec6c1c..0000000 --- a/Tests/QtAutogen/mocOnlySource/StyleB.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "StyleB.hpp" - -StyleB::StyleB() -{ -} diff --git a/Tests/QtAutogen/mocOnlySource/StyleB.hpp b/Tests/QtAutogen/mocOnlySource/StyleB.hpp deleted file mode 100644 index 425daf8..0000000 --- a/Tests/QtAutogen/mocOnlySource/StyleB.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef STYLEB_HPP -#define STYLEB_HPP - -#include - -/* clang-format off */ -/// Q_OBJECT behind a brace -/// -class StyleB : public QObject -{ Q_OBJECT -public: - StyleB(); -}; -/* clang-format on */ - -#endif diff --git a/Tests/QtAutogen/mocOnlySource/main.cpp b/Tests/QtAutogen/mocOnlySource/main.cpp deleted file mode 100644 index 06f8d81..0000000 --- a/Tests/QtAutogen/mocOnlySource/main.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "StyleA.hpp" -#include "StyleB.hpp" - -int main(int argv, char** args) -{ - StyleA styleA; - StyleB styleB; - return 0; -} -- cgit v0.12 From 6273b8354902e1af124d6f9b4a0ba23cf5e8a9b9 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 17:38:13 +0100 Subject: Autogen: Tests: Separate uicOnly test --- Tests/QtAutogen/CMakeLists.txt | 9 --------- Tests/QtAutogen/CommonTests.cmake | 3 +++ Tests/QtAutogen/UicOnly/CMakeLists.txt | 10 ++++++++++ Tests/QtAutogen/UicOnly/uiconly.cpp | 18 ++++++++++++++++++ Tests/QtAutogen/UicOnly/uiconly.h | 20 ++++++++++++++++++++ Tests/QtAutogen/UicOnly/uiconly.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/uicOnlySource/uiconly.cpp | 18 ------------------ Tests/QtAutogen/uicOnlySource/uiconly.h | 20 -------------------- Tests/QtAutogen/uicOnlySource/uiconly.ui | 24 ------------------------ 9 files changed, 75 insertions(+), 71 deletions(-) create mode 100644 Tests/QtAutogen/UicOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicOnly/uiconly.cpp create mode 100644 Tests/QtAutogen/UicOnly/uiconly.h create mode 100644 Tests/QtAutogen/UicOnly/uiconly.ui delete mode 100644 Tests/QtAutogen/uicOnlySource/uiconly.cpp delete mode 100644 Tests/QtAutogen/uicOnlySource/uiconly.h delete mode 100644 Tests/QtAutogen/uicOnlySource/uiconly.ui diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 160903a..85029d1 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,15 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# UIC only -if(ALLOW_WRAP_CPP) - qtx_wrap_cpp(uicOnlyMoc uicOnlySource/uiconly.h) - add_executable(uicOnly uicOnlySource/uiconly.cpp ${uicOnlyMoc}) - set_property(TARGET uicOnly PROPERTY AUTOUIC ON) - target_link_libraries(uicOnly ${QT_LIBRARIES}) -endif() - -# -- Test # RCC only add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc) set_property(TARGET rccOnly PROPERTY AUTORCC ON) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 5abbee5..9121f41 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -1,3 +1,6 @@ # Autogen tests common for Qt4 and Qt5 ADD_AUTOGEN_TEST(MocOnly mocOnly) ADD_AUTOGEN_TEST(MocOptions mocOptions) +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(UicOnly uicOnly) +endif() diff --git a/Tests/QtAutogen/UicOnly/CMakeLists.txt b/Tests/QtAutogen/UicOnly/CMakeLists.txt new file mode 100644 index 0000000..89a9a1b --- /dev/null +++ b/Tests/QtAutogen/UicOnly/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(UicOnly) +include("../AutogenTest.cmake") + +# Test AUTOUIC being enabled only +# The moc is provided by the Qt macro +qtx_wrap_cpp(uicOnlyMoc uiconly.h) +add_executable(uicOnly uiconly.cpp ${uicOnlyMoc}) +set_property(TARGET uicOnly PROPERTY AUTOUIC ON) +target_link_libraries(uicOnly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/UicOnly/uiconly.cpp b/Tests/QtAutogen/UicOnly/uiconly.cpp new file mode 100644 index 0000000..7b91b25 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiconly.cpp @@ -0,0 +1,18 @@ + +#include "uiconly.h" + +UicOnly::UicOnly(QWidget* parent) + : QWidget(parent) + , ui(new Ui::UicOnly) +{ +} + +UicOnly::~UicOnly() +{ + delete ui; +} + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/UicOnly/uiconly.h b/Tests/QtAutogen/UicOnly/uiconly.h new file mode 100644 index 0000000..8f4eebe --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiconly.h @@ -0,0 +1,20 @@ + +#ifndef UIC_ONLY_H +#define UIC_ONLY_H + +#include + +#include "ui_uiconly.h" + +class UicOnly : public QWidget +{ + Q_OBJECT +public: + explicit UicOnly(QWidget* parent = 0); + ~UicOnly(); + +private: + Ui::UicOnly* ui; +}; + +#endif diff --git a/Tests/QtAutogen/UicOnly/uiconly.ui b/Tests/QtAutogen/UicOnly/uiconly.ui new file mode 100644 index 0000000..13fb832 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiconly.ui @@ -0,0 +1,24 @@ + + + UicOnly + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/uicOnlySource/uiconly.cpp b/Tests/QtAutogen/uicOnlySource/uiconly.cpp deleted file mode 100644 index 7b91b25..0000000 --- a/Tests/QtAutogen/uicOnlySource/uiconly.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -#include "uiconly.h" - -UicOnly::UicOnly(QWidget* parent) - : QWidget(parent) - , ui(new Ui::UicOnly) -{ -} - -UicOnly::~UicOnly() -{ - delete ui; -} - -int main() -{ - return 0; -} diff --git a/Tests/QtAutogen/uicOnlySource/uiconly.h b/Tests/QtAutogen/uicOnlySource/uiconly.h deleted file mode 100644 index 8f4eebe..0000000 --- a/Tests/QtAutogen/uicOnlySource/uiconly.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef UIC_ONLY_H -#define UIC_ONLY_H - -#include - -#include "ui_uiconly.h" - -class UicOnly : public QWidget -{ - Q_OBJECT -public: - explicit UicOnly(QWidget* parent = 0); - ~UicOnly(); - -private: - Ui::UicOnly* ui; -}; - -#endif diff --git a/Tests/QtAutogen/uicOnlySource/uiconly.ui b/Tests/QtAutogen/uicOnlySource/uiconly.ui deleted file mode 100644 index 13fb832..0000000 --- a/Tests/QtAutogen/uicOnlySource/uiconly.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - UicOnly - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - -- cgit v0.12 From f00e6c7c7024a784d2da310ba7b5f4a67e60fdff Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 17:46:58 +0100 Subject: Autogen: Tests: Separate RccOnly and RccEmpty tests --- Tests/QtAutogen/CMakeLists.txt | 12 ------------ Tests/QtAutogen/CommonTests.cmake | 2 ++ Tests/QtAutogen/RccEmpty/CMakeLists.txt | 8 ++++++++ Tests/QtAutogen/RccEmpty/rccEmpty.cpp | 9 +++++++++ Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc | 4 ++++ Tests/QtAutogen/RccOnly/CMakeLists.txt | 8 ++++++++ Tests/QtAutogen/RccOnly/rccOnly.cpp | 9 +++++++++ Tests/QtAutogen/RccOnly/rccOnlyRes.qrc | 5 +++++ Tests/QtAutogen/rccEmpty.cpp | 9 --------- Tests/QtAutogen/rccEmptyRes.qrc | 4 ---- Tests/QtAutogen/rccOnly.cpp | 9 --------- Tests/QtAutogen/rccOnlyRes.qrc | 5 ----- 12 files changed, 45 insertions(+), 39 deletions(-) create mode 100644 Tests/QtAutogen/RccEmpty/CMakeLists.txt create mode 100644 Tests/QtAutogen/RccEmpty/rccEmpty.cpp create mode 100644 Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc create mode 100644 Tests/QtAutogen/RccOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/RccOnly/rccOnly.cpp create mode 100644 Tests/QtAutogen/RccOnly/rccOnlyRes.qrc delete mode 100644 Tests/QtAutogen/rccEmpty.cpp delete mode 100644 Tests/QtAutogen/rccEmptyRes.qrc delete mode 100644 Tests/QtAutogen/rccOnly.cpp delete mode 100644 Tests/QtAutogen/rccOnlyRes.qrc diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 85029d1..9125bd7 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,18 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# RCC only -add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc) -set_property(TARGET rccOnly PROPERTY AUTORCC ON) -target_link_libraries(rccOnly ${QT_QTCORE_TARGET}) - -# -- Test -# RCC empty -add_executable(rccEmpty rccEmpty.cpp rccEmptyRes.qrc) -set_property(TARGET rccEmpty PROPERTY AUTORCC ON) -target_link_libraries(rccEmpty ${QT_QTCORE_TARGET}) - -# -- Test # Add not_generated_file.qrc to the source list to get the file-level # dependency, but don't generate a c++ file from it. Disable the AUTORCC # feature for this target. This tests that qrc files in the sources don't diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 9121f41..0950062 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -4,3 +4,5 @@ ADD_AUTOGEN_TEST(MocOptions mocOptions) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(UicOnly uicOnly) endif() +ADD_AUTOGEN_TEST(RccOnly rccOnly) +ADD_AUTOGEN_TEST(RccEmpty rccEmpty) diff --git a/Tests/QtAutogen/RccEmpty/CMakeLists.txt b/Tests/QtAutogen/RccEmpty/CMakeLists.txt new file mode 100644 index 0000000..3b16edc --- /dev/null +++ b/Tests/QtAutogen/RccEmpty/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(RccEmpty) +include("../AutogenTest.cmake") + +# Test AUTORCC on a .qrc file with no resource files +add_executable(rccEmpty rccEmpty.cpp rccEmptyRes.qrc) +set_property(TARGET rccEmpty PROPERTY AUTORCC ON) +target_link_libraries(rccEmpty ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/RccEmpty/rccEmpty.cpp b/Tests/QtAutogen/RccEmpty/rccEmpty.cpp new file mode 100644 index 0000000..7f2c527 --- /dev/null +++ b/Tests/QtAutogen/RccEmpty/rccEmpty.cpp @@ -0,0 +1,9 @@ + +extern int qInitResources_rccEmptyRes(); + +int main(int, char**) +{ + // Fails to link if the symbol is not present. + qInitResources_rccEmptyRes(); + return 0; +} diff --git a/Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc b/Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc new file mode 100644 index 0000000..4ca9cd5 --- /dev/null +++ b/Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/Tests/QtAutogen/RccOnly/CMakeLists.txt b/Tests/QtAutogen/RccOnly/CMakeLists.txt new file mode 100644 index 0000000..a65dee4 --- /dev/null +++ b/Tests/QtAutogen/RccOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(RccOnly) +include("../AutogenTest.cmake") + +# Test AUTORCC being enabled only +add_executable(rccOnly rccOnly.cpp rccOnlyRes.qrc) +set_property(TARGET rccOnly PROPERTY AUTORCC ON) +target_link_libraries(rccOnly ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/RccOnly/rccOnly.cpp b/Tests/QtAutogen/RccOnly/rccOnly.cpp new file mode 100644 index 0000000..61c7bf4 --- /dev/null +++ b/Tests/QtAutogen/RccOnly/rccOnly.cpp @@ -0,0 +1,9 @@ + +extern int qInitResources_rccOnlyRes(); + +int main(int, char**) +{ + // Fails to link if the symbol is not present. + qInitResources_rccOnlyRes(); + return 0; +} diff --git a/Tests/QtAutogen/RccOnly/rccOnlyRes.qrc b/Tests/QtAutogen/RccOnly/rccOnlyRes.qrc new file mode 100644 index 0000000..5551348 --- /dev/null +++ b/Tests/QtAutogen/RccOnly/rccOnlyRes.qrc @@ -0,0 +1,5 @@ + + + rccOnly.cpp + + diff --git a/Tests/QtAutogen/rccEmpty.cpp b/Tests/QtAutogen/rccEmpty.cpp deleted file mode 100644 index 7f2c527..0000000 --- a/Tests/QtAutogen/rccEmpty.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -extern int qInitResources_rccEmptyRes(); - -int main(int, char**) -{ - // Fails to link if the symbol is not present. - qInitResources_rccEmptyRes(); - return 0; -} diff --git a/Tests/QtAutogen/rccEmptyRes.qrc b/Tests/QtAutogen/rccEmptyRes.qrc deleted file mode 100644 index 4ca9cd5..0000000 --- a/Tests/QtAutogen/rccEmptyRes.qrc +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/Tests/QtAutogen/rccOnly.cpp b/Tests/QtAutogen/rccOnly.cpp deleted file mode 100644 index 61c7bf4..0000000 --- a/Tests/QtAutogen/rccOnly.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -extern int qInitResources_rccOnlyRes(); - -int main(int, char**) -{ - // Fails to link if the symbol is not present. - qInitResources_rccOnlyRes(); - return 0; -} diff --git a/Tests/QtAutogen/rccOnlyRes.qrc b/Tests/QtAutogen/rccOnlyRes.qrc deleted file mode 100644 index 5551348..0000000 --- a/Tests/QtAutogen/rccOnlyRes.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - rccOnly.cpp - - -- cgit v0.12 From f658bdaa7c7899a46caf402d4114999019897d46 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 18:03:20 +0100 Subject: Autogen: Tests: Separate RccOffMocLibrary test --- Tests/QtAutogen/CMakeLists.txt | 16 ---------------- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt | 17 +++++++++++++++++ Tests/QtAutogen/RccOffMocLibrary/empty.cpp | 1 + Tests/QtAutogen/RccOffMocLibrary/empty.h | 9 +++++++++ Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc | 5 +++++ Tests/QtAutogen/empty.cpp | 1 - Tests/QtAutogen/empty.h | 9 --------- Tests/QtAutogen/not_generated_file.qrc | 5 ----- 9 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt create mode 100644 Tests/QtAutogen/RccOffMocLibrary/empty.cpp create mode 100644 Tests/QtAutogen/RccOffMocLibrary/empty.h create mode 100644 Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc delete mode 100644 Tests/QtAutogen/empty.cpp delete mode 100644 Tests/QtAutogen/empty.h delete mode 100644 Tests/QtAutogen/not_generated_file.qrc diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 9125bd7..723747a 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,22 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Add not_generated_file.qrc to the source list to get the file-level -# dependency, but don't generate a c++ file from it. Disable the AUTORCC -# feature for this target. This tests that qrc files in the sources don't -# have an effect on generation if AUTORCC is off. -add_library(empty STATIC empty.cpp not_generated_file.qrc) -set_target_properties(empty PROPERTIES AUTORCC OFF) -set_target_properties(empty PROPERTIES AUTOMOC TRUE) -target_link_libraries(empty no_link_language) -add_library(no_link_language STATIC empty.h) -set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) -# Pass Qt compiler features to targets that don't link against Qt -target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES}) -target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES}) - - -# -- Test # Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target if(ALLOW_WRAP_CPP) # Generate header mocs manually diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 0950062..f998b74 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -6,3 +6,4 @@ if(QT_TEST_ALLOW_QT_MACROS) endif() ADD_AUTOGEN_TEST(RccOnly rccOnly) ADD_AUTOGEN_TEST(RccEmpty rccEmpty) +ADD_AUTOGEN_TEST(RccOffMocLibrary) diff --git a/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt new file mode 100644 index 0000000..7f7432e --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(RccOffMocLibrary) +include("../AutogenTest.cmake") + +# Add not_generated_file.qrc to the source list to get the file-level +# dependency, but don't generate a c++ file from it. Disable the AUTORCC +# feature for this target. This tests that qrc files in the sources don't +# have an effect on generation if AUTORCC is off. +add_library(empty STATIC empty.cpp not_generated_file.qrc) +set_target_properties(empty PROPERTIES AUTORCC OFF) +set_target_properties(empty PROPERTIES AUTOMOC TRUE) +target_link_libraries(empty no_link_language) +add_library(no_link_language STATIC empty.h) +set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE) +# Pass Qt compiler features to targets that don't link against Qt +target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES}) +target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES}) diff --git a/Tests/QtAutogen/RccOffMocLibrary/empty.cpp b/Tests/QtAutogen/RccOffMocLibrary/empty.cpp new file mode 100644 index 0000000..ab32cf6 --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/empty.cpp @@ -0,0 +1 @@ +// No content diff --git a/Tests/QtAutogen/RccOffMocLibrary/empty.h b/Tests/QtAutogen/RccOffMocLibrary/empty.h new file mode 100644 index 0000000..6bdd2ac --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/empty.h @@ -0,0 +1,9 @@ + +#include + +class Empty : public QObject +{ + Q_OBJECT +public: + explicit Empty(QObject* parent = 0) {} +}; diff --git a/Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc b/Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc new file mode 100644 index 0000000..c769834 --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc @@ -0,0 +1,5 @@ + + + abc.cpp + + diff --git a/Tests/QtAutogen/empty.cpp b/Tests/QtAutogen/empty.cpp deleted file mode 100644 index ab32cf6..0000000 --- a/Tests/QtAutogen/empty.cpp +++ /dev/null @@ -1 +0,0 @@ -// No content diff --git a/Tests/QtAutogen/empty.h b/Tests/QtAutogen/empty.h deleted file mode 100644 index 6bdd2ac..0000000 --- a/Tests/QtAutogen/empty.h +++ /dev/null @@ -1,9 +0,0 @@ - -#include - -class Empty : public QObject -{ - Q_OBJECT -public: - explicit Empty(QObject* parent = 0) {} -}; diff --git a/Tests/QtAutogen/not_generated_file.qrc b/Tests/QtAutogen/not_generated_file.qrc deleted file mode 100644 index c769834..0000000 --- a/Tests/QtAutogen/not_generated_file.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - abc.cpp - - -- cgit v0.12 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 From f11321efd11ce4958d45f4673465b5b9484f1af2 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 18:47:15 +0100 Subject: Autogen: Tests: Separate UicSkipSource test --- Tests/QtAutogen/CMakeLists.txt | 20 -------------------- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/UicSkipSource/CMakeLists.txt | 22 ++++++++++++++++++++++ Tests/QtAutogen/UicSkipSource/skipUic.cpp | 22 ++++++++++++++++++++++ Tests/QtAutogen/UicSkipSource/skipUicGen.cpp | 7 +++++++ Tests/QtAutogen/UicSkipSource/skipUicGen.hpp | 8 ++++++++ Tests/QtAutogen/UicSkipSource/skipUicNoGen1.cpp | 7 +++++++ Tests/QtAutogen/UicSkipSource/skipUicNoGen1.hpp | 8 ++++++++ Tests/QtAutogen/UicSkipSource/skipUicNoGen2.cpp | 7 +++++++ Tests/QtAutogen/UicSkipSource/skipUicNoGen2.hpp | 8 ++++++++ Tests/QtAutogen/UicSkipSource/ui_nogen1.h | 6 ++++++ Tests/QtAutogen/UicSkipSource/ui_nogen2.h | 6 ++++++ Tests/QtAutogen/UicSkipSource/uigen1.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicSkipSource/uigen2.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/skipSource/skipUicGen.cpp | 7 ------- Tests/QtAutogen/skipSource/skipUicGen.hpp | 8 -------- Tests/QtAutogen/skipSource/skipUicNoGen1.cpp | 7 ------- Tests/QtAutogen/skipSource/skipUicNoGen1.hpp | 8 -------- Tests/QtAutogen/skipSource/skipUicNoGen2.cpp | 7 ------- Tests/QtAutogen/skipSource/skipUicNoGen2.hpp | 8 -------- Tests/QtAutogen/skipSource/ui_nogen1.h | 6 ------ Tests/QtAutogen/skipSource/ui_nogen2.h | 6 ------ Tests/QtAutogen/skipSource/uigen1.ui | 24 ------------------------ Tests/QtAutogen/skipSource/uigen2.ui | 24 ------------------------ Tests/QtAutogen/skipUic.cpp | 22 ---------------------- 25 files changed, 150 insertions(+), 147 deletions(-) create mode 100644 Tests/QtAutogen/UicSkipSource/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicSkipSource/skipUic.cpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicGen.cpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicGen.hpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicNoGen1.cpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicNoGen1.hpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicNoGen2.cpp create mode 100644 Tests/QtAutogen/UicSkipSource/skipUicNoGen2.hpp create mode 100644 Tests/QtAutogen/UicSkipSource/ui_nogen1.h create mode 100644 Tests/QtAutogen/UicSkipSource/ui_nogen2.h create mode 100644 Tests/QtAutogen/UicSkipSource/uigen1.ui create mode 100644 Tests/QtAutogen/UicSkipSource/uigen2.ui delete mode 100644 Tests/QtAutogen/skipSource/skipUicGen.cpp delete mode 100644 Tests/QtAutogen/skipSource/skipUicGen.hpp delete mode 100644 Tests/QtAutogen/skipSource/skipUicNoGen1.cpp delete mode 100644 Tests/QtAutogen/skipSource/skipUicNoGen1.hpp delete mode 100644 Tests/QtAutogen/skipSource/skipUicNoGen2.cpp delete mode 100644 Tests/QtAutogen/skipSource/skipUicNoGen2.hpp delete mode 100644 Tests/QtAutogen/skipSource/ui_nogen1.h delete mode 100644 Tests/QtAutogen/skipSource/ui_nogen2.h delete mode 100644 Tests/QtAutogen/skipSource/uigen1.ui delete mode 100644 Tests/QtAutogen/skipSource/uigen2.ui delete mode 100644 Tests/QtAutogen/skipUic.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index d09823f..317de7e 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,26 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target -set(skipUicSources - skipUic.cpp - skipSource/skipUicGen.cpp - skipSource/skipUicNoGen1.cpp - skipSource/skipUicNoGen2.cpp -) -set_property(SOURCE skipSource/skipUicNoGen1.cpp PROPERTY SKIP_AUTOUIC ON) -set_property(SOURCE skipSource/skipUicNoGen2.cpp PROPERTY SKIP_AUTOGEN ON) -# AUTOUIC enabled -add_executable(skipUicA ${skipUicSources}) -set_property(TARGET skipUicA PROPERTY AUTOUIC ON) -target_link_libraries(skipUicA ${QT_LIBRARIES}) -# AUTOUIC and AUTOMOC enabled -add_executable(skipUicB ${skipUicSources}) -set_property(TARGET skipUicB PROPERTY AUTOUIC ON) -set_property(TARGET skipUicB PROPERTY AUTOMOC ON) -target_link_libraries(skipUicB ${QT_LIBRARIES}) - -# -- Test # Test for SKIP_AUTORCC and SKIP_AUTOGEN on an AUTORCC enabled target set(skipRccSources skipRcc.cpp diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 072a853..2c4788b 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -10,3 +10,4 @@ ADD_AUTOGEN_TEST(RccOffMocLibrary) if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocSkipSource) endif() +ADD_AUTOGEN_TEST(UicSkipSource) diff --git a/Tests/QtAutogen/UicSkipSource/CMakeLists.txt b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt new file mode 100644 index 0000000..e94864d --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(UicSkipSource) +include("../AutogenTest.cmake") + +# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target +set(skipUicSources + skipUic.cpp + skipUicGen.cpp + skipUicNoGen1.cpp + skipUicNoGen2.cpp +) +set_property(SOURCE skipUicNoGen1.cpp PROPERTY SKIP_AUTOUIC ON) +set_property(SOURCE skipUicNoGen2.cpp PROPERTY SKIP_AUTOGEN ON) +# AUTOUIC enabled +add_executable(skipUicA ${skipUicSources}) +set_property(TARGET skipUicA PROPERTY AUTOUIC ON) +target_link_libraries(skipUicA ${QT_LIBRARIES}) +# AUTOUIC and AUTOMOC enabled +add_executable(skipUicB ${skipUicSources}) +set_property(TARGET skipUicB PROPERTY AUTOUIC ON) +set_property(TARGET skipUicB PROPERTY AUTOMOC ON) +target_link_libraries(skipUicB ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/UicSkipSource/skipUic.cpp b/Tests/QtAutogen/UicSkipSource/skipUic.cpp new file mode 100644 index 0000000..c4a7ce9 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUic.cpp @@ -0,0 +1,22 @@ + +#include "skipUicGen.hpp" +#include "skipUicNoGen1.hpp" +#include "skipUicNoGen2.hpp" + +int main(int, char**) +{ + skipGen(); + skipNoGen1(); + skipNoGen2(); + + return 0; +} + +// -- Function definitions +void ui_nogen1() +{ +} + +void ui_nogen2() +{ +} diff --git a/Tests/QtAutogen/UicSkipSource/skipUicGen.cpp b/Tests/QtAutogen/UicSkipSource/skipUicGen.cpp new file mode 100644 index 0000000..d2a55a6 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicGen.cpp @@ -0,0 +1,7 @@ + +#include "skipUicGen.hpp" +#include "ui_uigen2.h" + +void skipGen() +{ +} diff --git a/Tests/QtAutogen/UicSkipSource/skipUicGen.hpp b/Tests/QtAutogen/UicSkipSource/skipUicGen.hpp new file mode 100644 index 0000000..3669f0e --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicGen.hpp @@ -0,0 +1,8 @@ +#ifndef SKIPUICGEN_HPP +#define SKIPUICGEN_HPP + +#include "ui_uigen1.h" + +void skipGen(); + +#endif diff --git a/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.cpp b/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.cpp new file mode 100644 index 0000000..f591a42 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.cpp @@ -0,0 +1,7 @@ + +#include "skipUicNoGen1.hpp" +#include "ui_nogen2.h" + +void skipNoGen1() +{ +} diff --git a/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.hpp b/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.hpp new file mode 100644 index 0000000..2864695 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicNoGen1.hpp @@ -0,0 +1,8 @@ +#ifndef SKIPUICNOGEN1_H +#define SKIPUICNOGEN1_H + +#include "ui_nogen1.h" + +void skipNoGen1(); + +#endif diff --git a/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.cpp b/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.cpp new file mode 100644 index 0000000..8c1c324 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.cpp @@ -0,0 +1,7 @@ + +#include "skipUicNoGen2.hpp" +#include "ui_nogen2.h" + +void skipNoGen2() +{ +} diff --git a/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.hpp b/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.hpp new file mode 100644 index 0000000..7c38193 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/skipUicNoGen2.hpp @@ -0,0 +1,8 @@ +#ifndef SKIPUICNOGEN2_H +#define SKIPUICNOGEN2_H + +#include "ui_nogen1.h" + +void skipNoGen2(); + +#endif diff --git a/Tests/QtAutogen/UicSkipSource/ui_nogen1.h b/Tests/QtAutogen/UicSkipSource/ui_nogen1.h new file mode 100644 index 0000000..a7be52b --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/ui_nogen1.h @@ -0,0 +1,6 @@ +#ifndef UI_NOGEN1_H +#define UI_NOGEN1_H + +void ui_nogen1(); + +#endif diff --git a/Tests/QtAutogen/UicSkipSource/ui_nogen2.h b/Tests/QtAutogen/UicSkipSource/ui_nogen2.h new file mode 100644 index 0000000..4e500a4 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/ui_nogen2.h @@ -0,0 +1,6 @@ +#ifndef UI_NOGEN2_H +#define UI_NOGEN2_H + +void ui_nogen2(); + +#endif diff --git a/Tests/QtAutogen/UicSkipSource/uigen1.ui b/Tests/QtAutogen/UicSkipSource/uigen1.ui new file mode 100644 index 0000000..fc7cb82 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/uigen1.ui @@ -0,0 +1,24 @@ + + + UiGen1 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicSkipSource/uigen2.ui b/Tests/QtAutogen/UicSkipSource/uigen2.ui new file mode 100644 index 0000000..01f08d2 --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/uigen2.ui @@ -0,0 +1,24 @@ + + + UiGen2 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/skipSource/skipUicGen.cpp b/Tests/QtAutogen/skipSource/skipUicGen.cpp deleted file mode 100644 index d2a55a6..0000000 --- a/Tests/QtAutogen/skipSource/skipUicGen.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "skipUicGen.hpp" -#include "ui_uigen2.h" - -void skipGen() -{ -} diff --git a/Tests/QtAutogen/skipSource/skipUicGen.hpp b/Tests/QtAutogen/skipSource/skipUicGen.hpp deleted file mode 100644 index 3669f0e..0000000 --- a/Tests/QtAutogen/skipSource/skipUicGen.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SKIPUICGEN_HPP -#define SKIPUICGEN_HPP - -#include "ui_uigen1.h" - -void skipGen(); - -#endif diff --git a/Tests/QtAutogen/skipSource/skipUicNoGen1.cpp b/Tests/QtAutogen/skipSource/skipUicNoGen1.cpp deleted file mode 100644 index f591a42..0000000 --- a/Tests/QtAutogen/skipSource/skipUicNoGen1.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "skipUicNoGen1.hpp" -#include "ui_nogen2.h" - -void skipNoGen1() -{ -} diff --git a/Tests/QtAutogen/skipSource/skipUicNoGen1.hpp b/Tests/QtAutogen/skipSource/skipUicNoGen1.hpp deleted file mode 100644 index 2864695..0000000 --- a/Tests/QtAutogen/skipSource/skipUicNoGen1.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SKIPUICNOGEN1_H -#define SKIPUICNOGEN1_H - -#include "ui_nogen1.h" - -void skipNoGen1(); - -#endif diff --git a/Tests/QtAutogen/skipSource/skipUicNoGen2.cpp b/Tests/QtAutogen/skipSource/skipUicNoGen2.cpp deleted file mode 100644 index 8c1c324..0000000 --- a/Tests/QtAutogen/skipSource/skipUicNoGen2.cpp +++ /dev/null @@ -1,7 +0,0 @@ - -#include "skipUicNoGen2.hpp" -#include "ui_nogen2.h" - -void skipNoGen2() -{ -} diff --git a/Tests/QtAutogen/skipSource/skipUicNoGen2.hpp b/Tests/QtAutogen/skipSource/skipUicNoGen2.hpp deleted file mode 100644 index 7c38193..0000000 --- a/Tests/QtAutogen/skipSource/skipUicNoGen2.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef SKIPUICNOGEN2_H -#define SKIPUICNOGEN2_H - -#include "ui_nogen1.h" - -void skipNoGen2(); - -#endif diff --git a/Tests/QtAutogen/skipSource/ui_nogen1.h b/Tests/QtAutogen/skipSource/ui_nogen1.h deleted file mode 100644 index a7be52b..0000000 --- a/Tests/QtAutogen/skipSource/ui_nogen1.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef UI_NOGEN1_H -#define UI_NOGEN1_H - -void ui_nogen1(); - -#endif diff --git a/Tests/QtAutogen/skipSource/ui_nogen2.h b/Tests/QtAutogen/skipSource/ui_nogen2.h deleted file mode 100644 index 5d547d4..0000000 --- a/Tests/QtAutogen/skipSource/ui_nogen2.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef UI_NOGEN2_H -#define UI_NOGEN2_H - -void ui_nogen2(); - -#endif \ No newline at end of file diff --git a/Tests/QtAutogen/skipSource/uigen1.ui b/Tests/QtAutogen/skipSource/uigen1.ui deleted file mode 100644 index fc7cb82..0000000 --- a/Tests/QtAutogen/skipSource/uigen1.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - UiGen1 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/skipSource/uigen2.ui b/Tests/QtAutogen/skipSource/uigen2.ui deleted file mode 100644 index 01f08d2..0000000 --- a/Tests/QtAutogen/skipSource/uigen2.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - UiGen2 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/skipUic.cpp b/Tests/QtAutogen/skipUic.cpp deleted file mode 100644 index 0adf011..0000000 --- a/Tests/QtAutogen/skipUic.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -#include "skipSource/skipUicGen.hpp" -#include "skipSource/skipUicNoGen1.hpp" -#include "skipSource/skipUicNoGen2.hpp" - -int main(int, char**) -{ - skipGen(); - skipNoGen1(); - skipNoGen2(); - - return 0; -} - -// -- Function definitions -void ui_nogen1() -{ -} - -void ui_nogen2() -{ -} -- cgit v0.12 From 5cab8c307c7df585152e3ab9e007574cb0e690dc Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 18:55:43 +0100 Subject: Autogen: Tests: Separate RccSkipSource test --- Tests/QtAutogen/CMakeLists.txt | 21 --------------------- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/RccSkipSource/CMakeLists.txt | 23 +++++++++++++++++++++++ Tests/QtAutogen/RccSkipSource/skipRcc.cpp | 9 +++++++++ Tests/QtAutogen/RccSkipSource/skipRccBad1.qrc | 5 +++++ Tests/QtAutogen/RccSkipSource/skipRccBad2.qrc | 5 +++++ Tests/QtAutogen/RccSkipSource/skipRccGood.qrc | 6 ++++++ Tests/QtAutogen/skipRcc.cpp | 9 --------- Tests/QtAutogen/skipSource/skipRccBad1.qrc | 5 ----- Tests/QtAutogen/skipSource/skipRccBad2.qrc | 5 ----- Tests/QtAutogen/skipSource/skipRccGood.qrc | 6 ------ 11 files changed, 49 insertions(+), 46 deletions(-) create mode 100644 Tests/QtAutogen/RccSkipSource/CMakeLists.txt create mode 100644 Tests/QtAutogen/RccSkipSource/skipRcc.cpp create mode 100644 Tests/QtAutogen/RccSkipSource/skipRccBad1.qrc create mode 100644 Tests/QtAutogen/RccSkipSource/skipRccBad2.qrc create mode 100644 Tests/QtAutogen/RccSkipSource/skipRccGood.qrc delete mode 100644 Tests/QtAutogen/skipRcc.cpp delete mode 100644 Tests/QtAutogen/skipSource/skipRccBad1.qrc delete mode 100644 Tests/QtAutogen/skipSource/skipRccBad2.qrc delete mode 100644 Tests/QtAutogen/skipSource/skipRccGood.qrc diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 317de7e..e5940d8 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,27 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Test for SKIP_AUTORCC and SKIP_AUTOGEN on an AUTORCC enabled target -set(skipRccSources - skipRcc.cpp - skipSource/skipRccBad1.qrc - skipSource/skipRccBad2.qrc - skipSource/skipRccGood.qrc -) -set_property(SOURCE skipSource/skipRccBad1.qrc PROPERTY SKIP_AUTORCC ON) -set_property(SOURCE skipSource/skipRccBad2.qrc PROPERTY SKIP_AUTOGEN ON) -# AUTORCC enabled -add_executable(skipRccA ${skipRccSources}) -set_property(TARGET skipRccA PROPERTY AUTORCC ON) -target_link_libraries(skipRccA ${QT_LIBRARIES}) -# AUTORCC, AUTOUIC and AUTOMOC enabled -add_executable(skipRccB ${skipRccSources}) -set_property(TARGET skipRccB PROPERTY AUTORCC ON) -set_property(TARGET skipRccB PROPERTY AUTOUIC ON) -set_property(TARGET skipRccB PROPERTY AUTOMOC ON) -target_link_libraries(skipRccB ${QT_LIBRARIES}) - -# -- Test # MOC AUTOMOC_MACRO_NAMES if (NOT QT_TEST_VERSION STREQUAL 4) add_subdirectory(mocMacroName) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 2c4788b..fdf41b6 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -11,3 +11,4 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocSkipSource) endif() ADD_AUTOGEN_TEST(UicSkipSource) +ADD_AUTOGEN_TEST(RccSkipSource) diff --git a/Tests/QtAutogen/RccSkipSource/CMakeLists.txt b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt new file mode 100644 index 0000000..f8a8032 --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) +project(RccSkipSource) +include("../AutogenTest.cmake") + +# Test for SKIP_AUTORCC and SKIP_AUTOGEN on an AUTORCC enabled target +set(skipRccSources + skipRcc.cpp + skipRccBad1.qrc + skipRccBad2.qrc + skipRccGood.qrc +) +set_property(SOURCE skipRccBad1.qrc PROPERTY SKIP_AUTORCC ON) +set_property(SOURCE skipRccBad2.qrc PROPERTY SKIP_AUTOGEN ON) +# AUTORCC enabled +add_executable(skipRccA ${skipRccSources}) +set_property(TARGET skipRccA PROPERTY AUTORCC ON) +target_link_libraries(skipRccA ${QT_LIBRARIES}) +# AUTORCC, AUTOUIC and AUTOMOC enabled +add_executable(skipRccB ${skipRccSources}) +set_property(TARGET skipRccB PROPERTY AUTORCC ON) +set_property(TARGET skipRccB PROPERTY AUTOUIC ON) +set_property(TARGET skipRccB PROPERTY AUTOMOC ON) +target_link_libraries(skipRccB ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/RccSkipSource/skipRcc.cpp b/Tests/QtAutogen/RccSkipSource/skipRcc.cpp new file mode 100644 index 0000000..ec57110 --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/skipRcc.cpp @@ -0,0 +1,9 @@ + +extern int qInitResources_skipRccGood(); + +int main(int, char**) +{ + // Fails to link if the symbol is not present. + qInitResources_skipRccGood(); + return 0; +} diff --git a/Tests/QtAutogen/RccSkipSource/skipRccBad1.qrc b/Tests/QtAutogen/RccSkipSource/skipRccBad1.qrc new file mode 100644 index 0000000..6cbd9ed --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/skipRccBad1.qrc @@ -0,0 +1,5 @@ + + + skipRccGood.cpp>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> + + diff --git a/Tests/QtAutogen/RccSkipSource/skipRccBad2.qrc b/Tests/QtAutogen/RccSkipSource/skipRccBad2.qrc new file mode 100644 index 0000000..b32c589 --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/skipRccBad2.qrc @@ -0,0 +1,5 @@ +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< + + skipRccGood.cpp + + diff --git a/Tests/QtAutogen/RccSkipSource/skipRccGood.qrc b/Tests/QtAutogen/RccSkipSource/skipRccGood.qrc new file mode 100644 index 0000000..21a94b0 --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/skipRccGood.qrc @@ -0,0 +1,6 @@ + + + skipRccBad1.qrc + skipRccBad2.qrc + + diff --git a/Tests/QtAutogen/skipRcc.cpp b/Tests/QtAutogen/skipRcc.cpp deleted file mode 100644 index ec57110..0000000 --- a/Tests/QtAutogen/skipRcc.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -extern int qInitResources_skipRccGood(); - -int main(int, char**) -{ - // Fails to link if the symbol is not present. - qInitResources_skipRccGood(); - return 0; -} diff --git a/Tests/QtAutogen/skipSource/skipRccBad1.qrc b/Tests/QtAutogen/skipSource/skipRccBad1.qrc deleted file mode 100644 index 6cbd9ed..0000000 --- a/Tests/QtAutogen/skipSource/skipRccBad1.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - skipRccGood.cpp>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> - - diff --git a/Tests/QtAutogen/skipSource/skipRccBad2.qrc b/Tests/QtAutogen/skipSource/skipRccBad2.qrc deleted file mode 100644 index b32c589..0000000 --- a/Tests/QtAutogen/skipSource/skipRccBad2.qrc +++ /dev/null @@ -1,5 +0,0 @@ ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< - - skipRccGood.cpp - - diff --git a/Tests/QtAutogen/skipSource/skipRccGood.qrc b/Tests/QtAutogen/skipSource/skipRccGood.qrc deleted file mode 100644 index 21a94b0..0000000 --- a/Tests/QtAutogen/skipSource/skipRccGood.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - skipRccBad1.qrc - skipRccBad2.qrc - - -- cgit v0.12 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 From 7971202b3c58f78008f5b651c048910fcc49c49f Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:27:10 +0100 Subject: Autogen: Tests: Separate MocDepends test --- Tests/QtAutogen/CMakeLists.txt | 4 - Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/MocDepends/CMakeLists.txt | 139 +++++++++++++++++++++ Tests/QtAutogen/MocDepends/object_invalid.hpp.in | 1 + Tests/QtAutogen/MocDepends/object_valid.hpp.in | 14 +++ Tests/QtAutogen/MocDepends/simpleLib.cpp.in | 9 ++ Tests/QtAutogen/MocDepends/simpleLib.hpp.in | 14 +++ Tests/QtAutogen/MocDepends/testATDFile.cpp | 9 ++ Tests/QtAutogen/MocDepends/testATDTarget.cpp | 9 ++ Tests/QtAutogen/MocDepends/testGenFile.cpp | 8 ++ Tests/QtAutogen/MocDepends/testGenLib.cpp | 12 ++ Tests/QtAutogen/MocDepends/testGenLib.hpp | 16 +++ Tests/QtAutogen/MocDepends/testGenTarget.cpp | 9 ++ Tests/QtAutogen/mocDepends/CMakeLists.txt | 151 ----------------------- Tests/QtAutogen/mocDepends/object_invalid.hpp.in | 1 - Tests/QtAutogen/mocDepends/object_valid.hpp.in | 14 --- Tests/QtAutogen/mocDepends/simpleLib.cpp.in | 9 -- Tests/QtAutogen/mocDepends/simpleLib.hpp.in | 14 --- Tests/QtAutogen/mocDepends/testATDFile.cpp | 9 -- Tests/QtAutogen/mocDepends/testATDTarget.cpp | 9 -- Tests/QtAutogen/mocDepends/testGenFile.cpp | 8 -- Tests/QtAutogen/mocDepends/testGenLib.cpp | 12 -- Tests/QtAutogen/mocDepends/testGenLib.hpp | 16 --- Tests/QtAutogen/mocDepends/testGenTarget.cpp | 9 -- 24 files changed, 241 insertions(+), 256 deletions(-) create mode 100644 Tests/QtAutogen/MocDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocDepends/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/object_valid.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/simpleLib.cpp.in create mode 100644 Tests/QtAutogen/MocDepends/simpleLib.hpp.in create mode 100644 Tests/QtAutogen/MocDepends/testATDFile.cpp create mode 100644 Tests/QtAutogen/MocDepends/testATDTarget.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenFile.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenLib.cpp create mode 100644 Tests/QtAutogen/MocDepends/testGenLib.hpp create mode 100644 Tests/QtAutogen/MocDepends/testGenTarget.cpp delete mode 100644 Tests/QtAutogen/mocDepends/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocDepends/object_invalid.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/object_valid.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/simpleLib.cpp.in delete mode 100644 Tests/QtAutogen/mocDepends/simpleLib.hpp.in delete mode 100644 Tests/QtAutogen/mocDepends/testATDFile.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testATDTarget.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenFile.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenLib.cpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenLib.hpp delete mode 100644 Tests/QtAutogen/mocDepends/testGenTarget.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 6b54b1a..43fc851 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests AUTOMOC with generated sources -add_subdirectory(mocDepends) - -# -- Test # Tests various include moc patterns if(ALLOW_WRAP_CPP) add_subdirectory(mocIncludeStrict) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 6a92873..3cd93ab 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -15,3 +15,4 @@ ADD_AUTOGEN_TEST(RccSkipSource) if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() +ADD_AUTOGEN_TEST(MocDepends) diff --git a/Tests/QtAutogen/MocDepends/CMakeLists.txt b/Tests/QtAutogen/MocDepends/CMakeLists.txt new file mode 100644 index 0000000..6ea72be --- /dev/null +++ b/Tests/QtAutogen/MocDepends/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.10) +project(MocDepends) +include("../AutogenTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- Test dependency on header generated by a custom command +# +# The ORIGIN_autogen target must depend on the same *GENERATED* source files as +# the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenFile_autogen target of +# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* +# by a custom command. +# If mocDepGenFile_autogen gets built *before* or in *parallel* to the +# custom command, the build will fail. That's because GenFile.hpp, +# which is required by mocDepGenFile_autogen, is only valid after the +# custom command has been completed. +# +# The sleep seconds artificially increase the build time of the custom command +# to simulate a slow file generation process that takes longer to run than +# the build of the mocDepGenFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) + +add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) +target_link_libraries(mocDepGenFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) + + +# -- Test dependency on header generating custom target +# +# The ORIGIN_autogen target must depend on the same user defined targets +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepTarget_autogen target of +# mocDepTarget to the utility target mocDepTargetUtil. +# If mocDepTarget_autogen gets built *before* or in *parallel* to +# mocDepTargetUtil, the build will fail. That's +# because GenTarget.hpp, which is required by mocDepTarget_autogen, +# is only valid after the mocDepTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of mocDepTargetUtil +# to simulate a slow utility target build that takes longer to run than +# the build of the mocDepTarget_autogen target. +add_custom_target(mocDepTargetUtil + BYPRODUCTS ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) + +add_executable(mocDepTarget testGenTarget.cpp) +target_link_libraries(mocDepTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) +add_dependencies(mocDepTarget mocDepTargetUtil) + + +# -- Test 3: Depend on generated linked library +# The ORIGIN_autogen target must depend on the same linked libraries +# as the ORIGIN target. This is a requirement to ensure that all files for the +# ORIGIN target are generated before the ORIGIN_autogen target is built. +# +# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib +# to the user generated library SimpleLib, which mocDepGenLib links to. +# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, +# the build will fail. That's because simpleLib.hpp, which is required by +# mocDepGenLib_autogen, is only valid after the SimpleLib build has been +# completed. +# +# The sleep seconds artificially increase the build time of SimpleLib +# to simulate a slow utility library build that takes longer to run than +# the build of the mocDepGenLib_autogen target. +add_custom_command( + OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) +add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) +target_link_libraries(SimpleLib ${QT_QTCORE_TARGET}) + +add_executable(mocDepGenLib testGenLib.cpp) +target_link_libraries(mocDepGenLib SimpleLib ${QT_QTCORE_TARGET}) +set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) + + +# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency +# +# This tests the dependency of the mocDepATDFile_autogen target of +# mocDepATDTarget to the utility target mocDepATDFileUtil. +# If mocDepATDFile_autogen gets built *before* or in *parallel* to +# mocDepATDFileUtil, the build will fail. That's +# because ATDFile.hpp, which is required by mocDepATDFile_autogen, +# is only valid after the mocDepATDFileUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDFileUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDFile_autogen target. +add_custom_command( + OUTPUT ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) + +add_executable(mocDepATDFile testATDFile.cpp) +target_link_libraries(mocDepATDFile ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) + + +# -- Test AUTOGEN_TARGET_DEPENDS with target dependency +# +# This tests the dependency of the mocDepATDTarget_autogen target of +# mocDepATDTarget to the utility target mocDepATDTargetUtil. +# If mocDepATDTarget_autogen gets built *before* or in *parallel* to +# mocDepATDTargetUtil, the build will fail. That's +# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, +# is only valid after the mocDepATDTargetUtil build has been completed. +# +# The sleep seconds artificially increase the build time of +# mocDepATDTargetUtil to simulate a slow utility target build that takes +# longer to run than the build of the mocDepATDTarget_autogen target. +add_custom_target(mocDepATDTargetUtil + BYPRODUCTS ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp + COMMAND ${CMAKE_COMMAND} -E sleep 3 + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) + +add_executable(mocDepATDTarget testATDTarget.cpp) +target_link_libraries(mocDepATDTarget ${QT_QTCORE_TARGET}) +set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) +set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/MocDepends/object_invalid.hpp.in b/Tests/QtAutogen/MocDepends/object_invalid.hpp.in new file mode 100644 index 0000000..854d9a1 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/MocDepends/object_valid.hpp.in b/Tests/QtAutogen/MocDepends/object_valid.hpp.in new file mode 100644 index 0000000..f364f7c --- /dev/null +++ b/Tests/QtAutogen/MocDepends/object_valid.hpp.in @@ -0,0 +1,14 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/MocDepends/simpleLib.cpp.in b/Tests/QtAutogen/MocDepends/simpleLib.cpp.in new file mode 100644 index 0000000..fa33bd3 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/simpleLib.cpp.in @@ -0,0 +1,9 @@ +#include "simpleLib.hpp" + +SimpleLib::SimpleLib() +{ +} + +SimpleLib::~SimpleLib() +{ +} diff --git a/Tests/QtAutogen/MocDepends/simpleLib.hpp.in b/Tests/QtAutogen/MocDepends/simpleLib.hpp.in new file mode 100644 index 0000000..b65b0cb --- /dev/null +++ b/Tests/QtAutogen/MocDepends/simpleLib.hpp.in @@ -0,0 +1,14 @@ +#ifndef SIMPLE_LIB_H +#define SIMPLE_LIB_H + +#include + +class SimpleLib : public QObject +{ + Q_OBJECT +public: + SimpleLib(); + ~SimpleLib(); +}; + +#endif diff --git a/Tests/QtAutogen/MocDepends/testATDFile.cpp b/Tests/QtAutogen/MocDepends/testATDFile.cpp new file mode 100644 index 0000000..6bddfcd --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testATDTarget.cpp b/Tests/QtAutogen/MocDepends/testATDTarget.cpp new file mode 100644 index 0000000..831fc26 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testGenFile.cpp b/Tests/QtAutogen/MocDepends/testGenFile.cpp new file mode 100644 index 0000000..7df6e13 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenFile.cpp @@ -0,0 +1,8 @@ + +#include "GenFile.hpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/MocDepends/testGenLib.cpp b/Tests/QtAutogen/MocDepends/testGenLib.cpp new file mode 100644 index 0000000..c14e159 --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenLib.cpp @@ -0,0 +1,12 @@ + +#include "testGenLib.hpp" + +int main() +{ + SimpleLib libObject; + LObject lobject; + return 0; +} + +// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp +#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/MocDepends/testGenLib.hpp b/Tests/QtAutogen/MocDepends/testGenLib.hpp new file mode 100644 index 0000000..408335b --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenLib.hpp @@ -0,0 +1,16 @@ +#ifndef TEST3_HPP +#define TEST3_HPP + +#include "simpleLib.hpp" +#include + +// This object triggers the AUTOMOC on this file +class LObject : public QObject +{ + Q_OBJECT +public: + Q_SLOT + void aSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/MocDepends/testGenTarget.cpp b/Tests/QtAutogen/MocDepends/testGenTarget.cpp new file mode 100644 index 0000000..911076e --- /dev/null +++ b/Tests/QtAutogen/MocDepends/testGenTarget.cpp @@ -0,0 +1,9 @@ + +#include "GenTarget.hpp" +#include "moc_GenTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt deleted file mode 100644 index 8217b8d..0000000 --- a/Tests/QtAutogen/mocDepends/CMakeLists.txt +++ /dev/null @@ -1,151 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(mocDepends CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) -set(CBD ${CMAKE_CURRENT_BINARY_DIR}) - -# -- Test dependency on header generated by a custom command -# -# The ORIGIN_autogen target must depend on the same *GENERATED* source files as -# the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenFile_autogen target of -# mocDepGenFile to the source file GenFile.hpp, which is *GENERATED* -# by a custom command. -# If mocDepGenFile_autogen gets built *before* or in *parallel* to the -# custom command, the build will fail. That's because GenFile.hpp, -# which is required by mocDepGenFile_autogen, is only valid after the -# custom command has been completed. -# -# The sleep seconds artificially increase the build time of the custom command -# to simulate a slow file generation process that takes longer to run than -# the build of the mocDepGenFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenFile.hpp) - -add_executable(mocDepGenFile testGenFile.cpp ${CBD}/GenFile.hpp) -target_link_libraries(mocDepGenFile ${QT_CORE_TARGET}) -set_target_properties(mocDepGenFile PROPERTIES AUTOMOC TRUE) - - -# -- Test dependency on header generating custom target -# -# The ORIGIN_autogen target must depend on the same user defined targets -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepTarget_autogen target of -# mocDepTarget to the utility target mocDepTargetUtil. -# If mocDepTarget_autogen gets built *before* or in *parallel* to -# mocDepTargetUtil, the build will fail. That's -# because GenTarget.hpp, which is required by mocDepTarget_autogen, -# is only valid after the mocDepTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of mocDepTargetUtil -# to simulate a slow utility target build that takes longer to run than -# the build of the mocDepTarget_autogen target. -add_custom_target(mocDepTargetUtil - BYPRODUCTS ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/GenTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/GenTarget.hpp) - -add_executable(mocDepTarget testGenTarget.cpp) -target_link_libraries(mocDepTarget ${QT_CORE_TARGET}) -set_target_properties(mocDepTarget PROPERTIES AUTOMOC TRUE) -add_dependencies(mocDepTarget mocDepTargetUtil) - - -# -- Test 3: Depend on generated linked library -# The ORIGIN_autogen target must depend on the same linked libraries -# as the ORIGIN target. This is a requirement to ensure that all files for the -# ORIGIN target are generated before the ORIGIN_autogen target is built. -# -# This tests the dependency of the mocDepGenLib_autogen target of mocDepGenLib -# to the user generated library SimpleLib, which mocDepGenLib links to. -# If mocDepGenLib_autogen gets built *before* or in *parallel* to SimpleLib, -# the build will fail. That's because simpleLib.hpp, which is required by -# mocDepGenLib_autogen, is only valid after the SimpleLib build has been -# completed. -# -# The sleep seconds artificially increase the build time of SimpleLib -# to simulate a slow utility library build that takes longer to run than -# the build of the mocDepGenLib_autogen target. -add_custom_command( - OUTPUT ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.hpp.in ${CBD}/simpleLib.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/simpleLib.cpp.in ${CBD}/simpleLib.cpp) -add_library(SimpleLib STATIC ${CBD}/simpleLib.hpp ${CBD}/simpleLib.cpp) -target_link_libraries(SimpleLib ${QT_CORE_TARGET}) - -add_executable(mocDepGenLib testGenLib.cpp) -target_link_libraries(mocDepGenLib SimpleLib ${QT_CORE_TARGET}) -set_target_properties(mocDepGenLib PROPERTIES AUTOMOC TRUE) - - -# -- Test AUTOGEN_TARGET_DEPENDS with GENERATED file dependency -# -# This tests the dependency of the mocDepATDFile_autogen target of -# mocDepATDTarget to the utility target mocDepATDFileUtil. -# If mocDepATDFile_autogen gets built *before* or in *parallel* to -# mocDepATDFileUtil, the build will fail. That's -# because ATDFile.hpp, which is required by mocDepATDFile_autogen, -# is only valid after the mocDepATDFileUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDFileUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDFile_autogen target. -add_custom_command( - OUTPUT ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDFile.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDFile.hpp) - -add_executable(mocDepATDFile testATDFile.cpp) -target_link_libraries(mocDepATDFile ${QT_CORE_TARGET}) -set_target_properties(mocDepATDFile PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDFile PROPERTIES AUTOGEN_TARGET_DEPENDS ${CBD}/ATDFile.hpp) - - -# -- Test AUTOGEN_TARGET_DEPENDS with target dependency -# -# This tests the dependency of the mocDepATDTarget_autogen target of -# mocDepATDTarget to the utility target mocDepATDTargetUtil. -# If mocDepATDTarget_autogen gets built *before* or in *parallel* to -# mocDepATDTargetUtil, the build will fail. That's -# because ATDTarget.hpp, which is required by mocDepATDTarget_autogen, -# is only valid after the mocDepATDTargetUtil build has been completed. -# -# The sleep seconds artificially increase the build time of -# mocDepATDTargetUtil to simulate a slow utility target build that takes -# longer to run than the build of the mocDepATDTarget_autogen target. -add_custom_target(mocDepATDTargetUtil - BYPRODUCTS ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_invalid.hpp.in ${CBD}/ATDTarget.hpp - COMMAND ${CMAKE_COMMAND} -E sleep 3 - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/object_valid.hpp.in ${CBD}/ATDTarget.hpp) - -add_executable(mocDepATDTarget testATDTarget.cpp) -target_link_libraries(mocDepATDTarget ${QT_CORE_TARGET}) -set_target_properties(mocDepATDTarget PROPERTIES AUTOMOC TRUE) -set_target_properties(mocDepATDTarget PROPERTIES AUTOGEN_TARGET_DEPENDS mocDepATDTargetUtil) diff --git a/Tests/QtAutogen/mocDepends/object_invalid.hpp.in b/Tests/QtAutogen/mocDepends/object_invalid.hpp.in deleted file mode 100644 index 854d9a1..0000000 --- a/Tests/QtAutogen/mocDepends/object_invalid.hpp.in +++ /dev/null @@ -1 +0,0 @@ -#ifndef diff --git a/Tests/QtAutogen/mocDepends/object_valid.hpp.in b/Tests/QtAutogen/mocDepends/object_valid.hpp.in deleted file mode 100644 index f364f7c..0000000 --- a/Tests/QtAutogen/mocDepends/object_valid.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJECT_HPP -#define OBJECT_HPP - -#include - -class Object : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/simpleLib.cpp.in b/Tests/QtAutogen/mocDepends/simpleLib.cpp.in deleted file mode 100644 index fa33bd3..0000000 --- a/Tests/QtAutogen/mocDepends/simpleLib.cpp.in +++ /dev/null @@ -1,9 +0,0 @@ -#include "simpleLib.hpp" - -SimpleLib::SimpleLib() -{ -} - -SimpleLib::~SimpleLib() -{ -} diff --git a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in b/Tests/QtAutogen/mocDepends/simpleLib.hpp.in deleted file mode 100644 index b65b0cb..0000000 --- a/Tests/QtAutogen/mocDepends/simpleLib.hpp.in +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SIMPLE_LIB_H -#define SIMPLE_LIB_H - -#include - -class SimpleLib : public QObject -{ - Q_OBJECT -public: - SimpleLib(); - ~SimpleLib(); -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/testATDFile.cpp b/Tests/QtAutogen/mocDepends/testATDFile.cpp deleted file mode 100644 index 6bddfcd..0000000 --- a/Tests/QtAutogen/mocDepends/testATDFile.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDFile.hpp" -#include "moc_ATDFile.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/mocDepends/testATDTarget.cpp b/Tests/QtAutogen/mocDepends/testATDTarget.cpp deleted file mode 100644 index 831fc26..0000000 --- a/Tests/QtAutogen/mocDepends/testATDTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "ATDTarget.hpp" -#include "moc_ATDTarget.cpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/mocDepends/testGenFile.cpp b/Tests/QtAutogen/mocDepends/testGenFile.cpp deleted file mode 100644 index 7df6e13..0000000 --- a/Tests/QtAutogen/mocDepends/testGenFile.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -#include "GenFile.hpp" - -int main() -{ - Object obj; - return 0; -} diff --git a/Tests/QtAutogen/mocDepends/testGenLib.cpp b/Tests/QtAutogen/mocDepends/testGenLib.cpp deleted file mode 100644 index c14e159..0000000 --- a/Tests/QtAutogen/mocDepends/testGenLib.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "testGenLib.hpp" - -int main() -{ - SimpleLib libObject; - LObject lobject; - return 0; -} - -// Depend on and AUTOMOC the SimpleLib header simpleLib.hpp -#include "moc_simpleLib.cpp" diff --git a/Tests/QtAutogen/mocDepends/testGenLib.hpp b/Tests/QtAutogen/mocDepends/testGenLib.hpp deleted file mode 100644 index 408335b..0000000 --- a/Tests/QtAutogen/mocDepends/testGenLib.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef TEST3_HPP -#define TEST3_HPP - -#include "simpleLib.hpp" -#include - -// This object triggers the AUTOMOC on this file -class LObject : public QObject -{ - Q_OBJECT -public: - Q_SLOT - void aSlot(){}; -}; - -#endif diff --git a/Tests/QtAutogen/mocDepends/testGenTarget.cpp b/Tests/QtAutogen/mocDepends/testGenTarget.cpp deleted file mode 100644 index 911076e..0000000 --- a/Tests/QtAutogen/mocDepends/testGenTarget.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "GenTarget.hpp" -#include "moc_GenTarget.cpp" - -int main() -{ - Object obj; - return 0; -} -- cgit v0.12 From cc66d356510c51b5240239a212a511fb0d23dc9a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:40:17 +0100 Subject: Autogen: Tests: Separate MocInclude test --- Tests/QtAutogen/CMakeLists.txt | 7 --- Tests/QtAutogen/CommonTests.cmake | 4 ++ Tests/QtAutogen/MocInclude/EObjA.cpp | 44 ++++++++++++++ Tests/QtAutogen/MocInclude/EObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra.hpp | 18 ++++++ Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/EObjA_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/EObjB.cpp | 45 ++++++++++++++ Tests/QtAutogen/MocInclude/EObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/EObjB_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/LObjA.cpp | 39 ++++++++++++ Tests/QtAutogen/MocInclude/LObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/LObjA_p.h | 12 ++++ Tests/QtAutogen/MocInclude/LObjB.cpp | 40 ++++++++++++ Tests/QtAutogen/MocInclude/LObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/LObjB_p.h | 12 ++++ Tests/QtAutogen/MocInclude/ObjA.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/ObjA.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/ObjA_p.h | 12 ++++ Tests/QtAutogen/MocInclude/ObjB.cpp | 22 +++++++ Tests/QtAutogen/MocInclude/ObjB.hpp | 19 ++++++ Tests/QtAutogen/MocInclude/ObjB_p.h | 12 ++++ Tests/QtAutogen/MocInclude/SObjA.cpp | 11 ++++ Tests/QtAutogen/MocInclude/SObjA.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjB.cpp.in | 11 ++++ Tests/QtAutogen/MocInclude/SObjB.hpp.in | 15 +++++ Tests/QtAutogen/MocInclude/SObjC.cpp | 35 +++++++++++ Tests/QtAutogen/MocInclude/SObjC.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjCExtra.cpp | 31 ++++++++++ Tests/QtAutogen/MocInclude/SObjCExtra.hpp | 15 +++++ Tests/QtAutogen/MocInclude/SObjCExtra.moc.in | 4 ++ Tests/QtAutogen/MocInclude/shared.cmake | 71 ++++++++++++++++++++++ Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp | 20 ++++++ Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp | 18 ++++++ .../QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp | 12 ++++ Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp | 41 +++++++++++++ Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp | 17 ++++++ Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp | 15 +++++ Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt | 20 ++++++ Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp | 12 ++++ Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp | 12 ++++ Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp | 22 +++++++ Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp | 30 +++++++++ Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp | 14 +++++ Tests/QtAutogen/MocIncludeRelaxed/main.cpp | 26 ++++++++ Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt | 10 +++ Tests/QtAutogen/MocIncludeStrict/main.cpp | 26 ++++++++ Tests/QtAutogen/mocInclude/EObjA.cpp | 43 ------------- Tests/QtAutogen/mocInclude/EObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/EObjAExtra.cpp | 20 ------ Tests/QtAutogen/mocInclude/EObjAExtra.hpp | 18 ------ Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/EObjA_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/EObjB.cpp | 44 -------------- Tests/QtAutogen/mocInclude/EObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/EObjB_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/LObjA.cpp | 39 ------------ Tests/QtAutogen/mocInclude/LObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/LObjA_p.h | 12 ---- Tests/QtAutogen/mocInclude/LObjB.cpp | 40 ------------ Tests/QtAutogen/mocInclude/LObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/LObjB_p.h | 12 ---- Tests/QtAutogen/mocInclude/ObjA.cpp | 20 ------ Tests/QtAutogen/mocInclude/ObjA.hpp | 19 ------ Tests/QtAutogen/mocInclude/ObjA_p.h | 12 ---- Tests/QtAutogen/mocInclude/ObjB.cpp | 22 ------- Tests/QtAutogen/mocInclude/ObjB.hpp | 19 ------ Tests/QtAutogen/mocInclude/ObjB_p.h | 12 ---- Tests/QtAutogen/mocInclude/SObjA.cpp | 11 ---- Tests/QtAutogen/mocInclude/SObjA.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjB.cpp.in | 11 ---- Tests/QtAutogen/mocInclude/SObjB.hpp.in | 15 ----- Tests/QtAutogen/mocInclude/SObjC.cpp | 35 ----------- Tests/QtAutogen/mocInclude/SObjC.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjCExtra.cpp | 31 ---------- Tests/QtAutogen/mocInclude/SObjCExtra.hpp | 15 ----- Tests/QtAutogen/mocInclude/SObjCExtra.moc.in | 4 -- Tests/QtAutogen/mocInclude/shared.cmake | 71 ---------------------- Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp | 20 ------ Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp | 18 ------ .../QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp | 12 ---- Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp | 41 ------------- Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp | 17 ------ Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp | 15 ----- Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt | 17 ------ Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp | 12 ---- Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp | 12 ---- Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp | 22 ------- Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp | 30 --------- Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp | 14 ----- Tests/QtAutogen/mocIncludeRelaxed/main.cpp | 26 -------- Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt | 6 -- Tests/QtAutogen/mocIncludeStrict/main.cpp | 26 -------- 100 files changed, 1010 insertions(+), 1004 deletions(-) create mode 100644 Tests/QtAutogen/MocInclude/EObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjA_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/EObjB_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjA_p.h create mode 100644 Tests/QtAutogen/MocInclude/LObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/LObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/LObjB_p.h create mode 100644 Tests/QtAutogen/MocInclude/ObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/ObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/ObjA_p.h create mode 100644 Tests/QtAutogen/MocInclude/ObjB.cpp create mode 100644 Tests/QtAutogen/MocInclude/ObjB.hpp create mode 100644 Tests/QtAutogen/MocInclude/ObjB_p.h create mode 100644 Tests/QtAutogen/MocInclude/SObjA.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjA.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjB.cpp.in create mode 100644 Tests/QtAutogen/MocInclude/SObjB.hpp.in create mode 100644 Tests/QtAutogen/MocInclude/SObjC.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjC.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/SObjCExtra.moc.in create mode 100644 Tests/QtAutogen/MocInclude/shared.cmake create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp create mode 100644 Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp create mode 100644 Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp create mode 100644 Tests/QtAutogen/MocIncludeRelaxed/main.cpp create mode 100644 Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocIncludeStrict/main.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjA_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/EObjB_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjA_p.h delete mode 100644 Tests/QtAutogen/mocInclude/LObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/LObjB_p.h delete mode 100644 Tests/QtAutogen/mocInclude/ObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjA_p.h delete mode 100644 Tests/QtAutogen/mocInclude/ObjB.cpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjB.hpp delete mode 100644 Tests/QtAutogen/mocInclude/ObjB_p.h delete mode 100644 Tests/QtAutogen/mocInclude/SObjA.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjA.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjB.cpp.in delete mode 100644 Tests/QtAutogen/mocInclude/SObjB.hpp.in delete mode 100644 Tests/QtAutogen/mocInclude/SObjC.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjC.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/SObjCExtra.moc.in delete mode 100644 Tests/QtAutogen/mocInclude/shared.cmake delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp delete mode 100644 Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp delete mode 100644 Tests/QtAutogen/mocIncludeRelaxed/main.cpp delete mode 100644 Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocIncludeStrict/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 43fc851..5775117 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,13 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests various include moc patterns -if(ALLOW_WRAP_CPP) - add_subdirectory(mocIncludeStrict) - add_subdirectory(mocIncludeRelaxed) -endif() - -# -- Test # Tests policy 0071 if(ALLOW_WRAP_CPP) add_subdirectory(mocCMP0071) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 3cd93ab..4d89eae 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -16,3 +16,7 @@ if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(MocMacroName mocMacroName) endif() ADD_AUTOGEN_TEST(MocDepends) +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) + ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) +endif() diff --git a/Tests/QtAutogen/MocInclude/EObjA.cpp b/Tests/QtAutogen/MocInclude/EObjA.cpp new file mode 100644 index 0000000..7681c29 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA.cpp @@ -0,0 +1,44 @@ +#include "EObjA.hpp" +#include "EObjAExtra.hpp" +#include "EObjA_p.hpp" + +class EObjALocal : public QObject +{ + Q_OBJECT +public: + EObjALocal(); + ~EObjALocal(); +}; + +EObjALocal::EObjALocal() +{ +} + +EObjALocal::~EObjALocal() +{ +} + +EObjAPrivate::EObjAPrivate() +{ + EObjALocal localObj; + EObjAExtra extraObj; +} + +EObjAPrivate::~EObjAPrivate() +{ +} + +EObjA::EObjA() + : d(new EObjAPrivate) +{ +} + +EObjA::~EObjA() +{ + delete d; +} + +// For EObjALocal +#include "EObjA.moc" +// - Not the own header +#include "moc_EObjAExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/EObjA.hpp b/Tests/QtAutogen/MocInclude/EObjA.hpp new file mode 100644 index 0000000..0939ab6 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA.hpp @@ -0,0 +1,19 @@ +#ifndef EOBJA_HPP +#define EOBJA_HPP + +#include + +// Sources includes a moc_ includes of an extra object +class EObjAPrivate; +class EObjA : public QObject +{ + Q_OBJECT +public: + EObjA(); + ~EObjA(); + +private: + EObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.cpp b/Tests/QtAutogen/MocInclude/EObjAExtra.cpp new file mode 100644 index 0000000..369ca8f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra.cpp @@ -0,0 +1,20 @@ +#include "EObjAExtra.hpp" +#include "EObjAExtra_p.hpp" + +EObjAExtraPrivate::EObjAExtraPrivate() +{ +} + +EObjAExtraPrivate::~EObjAExtraPrivate() +{ +} + +EObjAExtra::EObjAExtra() + : d(new EObjAExtraPrivate) +{ +} + +EObjAExtra::~EObjAExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra.hpp new file mode 100644 index 0000000..b10681d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra.hpp @@ -0,0 +1,18 @@ +#ifndef EOBJAEXTRA_HPP +#define EOBJAEXTRA_HPP + +#include + +class EObjAExtraPrivate; +class EObjAExtra : public QObject +{ + Q_OBJECT +public: + EObjAExtra(); + ~EObjAExtra(); + +private: + EObjAExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp new file mode 100644 index 0000000..dea6cb5 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJAEXTRA_P_HPP +#define EOBJAEXTRA_P_HPP + +class EObjAExtraPrivate : public QObject +{ + Q_OBJECT +public: + EObjAExtraPrivate(); + ~EObjAExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjA_p.hpp b/Tests/QtAutogen/MocInclude/EObjA_p.hpp new file mode 100644 index 0000000..1e0d7e1 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJA_P_HPP +#define EOBJA_P_HPP + +class EObjAPrivate : public QObject +{ + Q_OBJECT +public: + EObjAPrivate(); + ~EObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjB.cpp b/Tests/QtAutogen/MocInclude/EObjB.cpp new file mode 100644 index 0000000..3068c68 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB.cpp @@ -0,0 +1,45 @@ +#include "EObjB.hpp" +#include "EObjB_p.hpp" +#include "subExtra/EObjBExtra.hpp" + +class EObjBLocal : public QObject +{ + Q_OBJECT +public: + EObjBLocal(); + ~EObjBLocal(); +}; + +EObjBLocal::EObjBLocal() +{ +} + +EObjBLocal::~EObjBLocal() +{ +} + +EObjBPrivate::EObjBPrivate() +{ + EObjBLocal localObj; + EObjBExtra extraObj; +} + +EObjBPrivate::~EObjBPrivate() +{ +} + +EObjB::EObjB() + : d(new EObjBPrivate) +{ +} + +EObjB::~EObjB() +{ + delete d; +} + +// For EObjBLocal +#include "EObjB.moc" +// - Not the own header +// - in a subdirectory +#include "subExtra/moc_EObjBExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/EObjB.hpp b/Tests/QtAutogen/MocInclude/EObjB.hpp new file mode 100644 index 0000000..6632bdb --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB.hpp @@ -0,0 +1,19 @@ +#ifndef EOBJB_HPP +#define EOBJB_HPP + +#include + +// Sources includes a moc_ includes of an extra object in a subdirectory +class EObjBPrivate; +class EObjB : public QObject +{ + Q_OBJECT +public: + EObjB(); + ~EObjB(); + +private: + EObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/EObjB_p.hpp b/Tests/QtAutogen/MocInclude/EObjB_p.hpp new file mode 100644 index 0000000..2905f28 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJB_P_HPP +#define EOBJB_P_HPP + +class EObjBPrivate : public QObject +{ + Q_OBJECT +public: + EObjBPrivate(); + ~EObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjA.cpp b/Tests/QtAutogen/MocInclude/LObjA.cpp new file mode 100644 index 0000000..9aae991 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA.cpp @@ -0,0 +1,39 @@ +#include "LObjA.hpp" +#include "LObjA_p.h" + +class LObjALocal : public QObject +{ + Q_OBJECT +public: + LObjALocal(); + ~LObjALocal(); +}; + +LObjALocal::LObjALocal() +{ +} + +LObjALocal::~LObjALocal() +{ +} + +LObjAPrivate::LObjAPrivate() +{ + LObjALocal localObj; +} + +LObjAPrivate::~LObjAPrivate() +{ +} + +LObjA::LObjA() + : d(new LObjAPrivate) +{ +} + +LObjA::~LObjA() +{ + delete d; +} + +#include "LObjA.moc" diff --git a/Tests/QtAutogen/MocInclude/LObjA.hpp b/Tests/QtAutogen/MocInclude/LObjA.hpp new file mode 100644 index 0000000..aac670c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA.hpp @@ -0,0 +1,19 @@ +#ifndef LOBJA_HPP +#define LOBJA_HPP + +#include + +// Object source comes with a .moc include +class LObjAPrivate; +class LObjA : public QObject +{ + Q_OBJECT +public: + LObjA(); + ~LObjA(); + +private: + LObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjA_p.h b/Tests/QtAutogen/MocInclude/LObjA_p.h new file mode 100644 index 0000000..ebe8395 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA_p.h @@ -0,0 +1,12 @@ +#ifndef LOBJA_P_HPP +#define LOBJA_P_HPP + +class LObjAPrivate : public QObject +{ + Q_OBJECT +public: + LObjAPrivate(); + ~LObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjB.cpp b/Tests/QtAutogen/MocInclude/LObjB.cpp new file mode 100644 index 0000000..7485d8f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB.cpp @@ -0,0 +1,40 @@ +#include "LObjB.hpp" +#include "LObjB_p.h" + +class LObjBLocal : public QObject +{ + Q_OBJECT +public: + LObjBLocal(); + ~LObjBLocal(); +}; + +LObjBLocal::LObjBLocal() +{ +} + +LObjBLocal::~LObjBLocal() +{ +} + +LObjBPrivate::LObjBPrivate() +{ + LObjBLocal localObj; +} + +LObjBPrivate::~LObjBPrivate() +{ +} + +LObjB::LObjB() + : d(new LObjBPrivate) +{ +} + +LObjB::~LObjB() +{ + delete d; +} + +#include "LObjB.moc" +#include "moc_LObjB.cpp" diff --git a/Tests/QtAutogen/MocInclude/LObjB.hpp b/Tests/QtAutogen/MocInclude/LObjB.hpp new file mode 100644 index 0000000..eb4e58d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB.hpp @@ -0,0 +1,19 @@ +#ifndef LLObjB_HPP +#define LLObjB_HPP + +#include + +// Object source comes with a .moc and a _moc include +class LObjBPrivate; +class LObjB : public QObject +{ + Q_OBJECT +public: + LObjB(); + ~LObjB(); + +private: + LObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/LObjB_p.h b/Tests/QtAutogen/MocInclude/LObjB_p.h new file mode 100644 index 0000000..b871f2d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB_p.h @@ -0,0 +1,12 @@ +#ifndef LOBJB_P_HPP +#define LOBJB_P_HPP + +class LObjBPrivate : public QObject +{ + Q_OBJECT +public: + LObjBPrivate(); + ~LObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjA.cpp b/Tests/QtAutogen/MocInclude/ObjA.cpp new file mode 100644 index 0000000..6f6b90e --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA.cpp @@ -0,0 +1,20 @@ +#include "ObjA.hpp" +#include "ObjA_p.h" + +ObjAPrivate::ObjAPrivate() +{ +} + +ObjAPrivate::~ObjAPrivate() +{ +} + +ObjA::ObjA() + : d(new ObjAPrivate) +{ +} + +ObjA::~ObjA() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/ObjA.hpp b/Tests/QtAutogen/MocInclude/ObjA.hpp new file mode 100644 index 0000000..f16c924 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA.hpp @@ -0,0 +1,19 @@ +#ifndef OBJA_HPP +#define OBJA_HPP + +#include + +// Object source comes without any _moc/.moc includes +class ObjAPrivate; +class ObjA : public QObject +{ + Q_OBJECT +public: + ObjA(); + ~ObjA(); + +private: + ObjAPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjA_p.h b/Tests/QtAutogen/MocInclude/ObjA_p.h new file mode 100644 index 0000000..eb60c98 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA_p.h @@ -0,0 +1,12 @@ +#ifndef OBJA_P_HPP +#define OBJA_P_HPP + +class ObjAPrivate : public QObject +{ + Q_OBJECT +public: + ObjAPrivate(); + ~ObjAPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjB.cpp b/Tests/QtAutogen/MocInclude/ObjB.cpp new file mode 100644 index 0000000..a6f2509 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB.cpp @@ -0,0 +1,22 @@ +#include "ObjB.hpp" +#include "ObjB_p.h" + +ObjBPrivate::ObjBPrivate() +{ +} + +ObjBPrivate::~ObjBPrivate() +{ +} + +ObjB::ObjB() + : d(new ObjBPrivate) +{ +} + +ObjB::~ObjB() +{ + delete d; +} + +#include "moc_ObjB.cpp" diff --git a/Tests/QtAutogen/MocInclude/ObjB.hpp b/Tests/QtAutogen/MocInclude/ObjB.hpp new file mode 100644 index 0000000..2ac8d17 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB.hpp @@ -0,0 +1,19 @@ +#ifndef ObjB_HPP +#define ObjB_HPP + +#include + +// Object source comes with a _moc include +class ObjBPrivate; +class ObjB : public QObject +{ + Q_OBJECT +public: + ObjB(); + ~ObjB(); + +private: + ObjBPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/ObjB_p.h b/Tests/QtAutogen/MocInclude/ObjB_p.h new file mode 100644 index 0000000..418da65 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB_p.h @@ -0,0 +1,12 @@ +#ifndef OBJB_P_HPP +#define OBJB_P_HPP + +class ObjBPrivate : public QObject +{ + Q_OBJECT +public: + ObjBPrivate(); + ~ObjBPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjA.cpp b/Tests/QtAutogen/MocInclude/SObjA.cpp new file mode 100644 index 0000000..7e75bf9 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjA.cpp @@ -0,0 +1,11 @@ +#include "SObjA.hpp" + +SObjA::SObjA() +{ +} + +SObjA::~SObjA() +{ +} + +#include "SObjA.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjA.hpp b/Tests/QtAutogen/MocInclude/SObjA.hpp new file mode 100644 index 0000000..1436abc --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjA.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJA_HPP +#define SOBJA_HPP + +#include + +// Object source includes externally generated .moc file +class SObjA : public QObject +{ + Q_OBJECT +public: + SObjA(); + ~SObjA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjB.cpp.in b/Tests/QtAutogen/MocInclude/SObjB.cpp.in new file mode 100644 index 0000000..b1cc12a --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjB.cpp.in @@ -0,0 +1,11 @@ +#include "SObjB.hpp" + +SObjB::SObjB() +{ +} + +SObjB::~SObjB() +{ +} + +#include "SObjB.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjB.hpp.in b/Tests/QtAutogen/MocInclude/SObjB.hpp.in new file mode 100644 index 0000000..5e396ae --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjB.hpp.in @@ -0,0 +1,15 @@ +#ifndef SOBJB_HPP +#define SOBJB_HPP + +#include + +// Object source includes externally generated .moc file +class SObjB : public QObject +{ + Q_OBJECT +public: + SObjB(); + ~SObjB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjC.cpp b/Tests/QtAutogen/MocInclude/SObjC.cpp new file mode 100644 index 0000000..1e8d397 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjC.cpp @@ -0,0 +1,35 @@ +#include "SObjC.hpp" + +void SObjCLocalFunction(); + +class SObjCLocal : public QObject +{ + Q_OBJECT + +public: + SObjCLocal(); + ~SObjCLocal(); +}; + +SObjCLocal::SObjCLocal() +{ +} + +SObjCLocal::~SObjCLocal() +{ +} + +SObjC::SObjC() +{ + SObjCLocal localObject; + SObjCLocalFunction(); +} + +SObjC::~SObjC() +{ +} + +#include "SObjC.moc" +#include "moc_SObjC.cpp" +// Include moc_ file for which the header is SKIP_AUTOMOC enabled +#include "moc_SObjCExtra.cpp" diff --git a/Tests/QtAutogen/MocInclude/SObjC.hpp b/Tests/QtAutogen/MocInclude/SObjC.hpp new file mode 100644 index 0000000..def0f9d --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjC.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJC_HPP +#define SOBJC_HPP + +#include + +// Object source includes externally generated .moc file +class SObjC : public QObject +{ + Q_OBJECT +public: + SObjC(); + ~SObjC(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.cpp b/Tests/QtAutogen/MocInclude/SObjCExtra.cpp new file mode 100644 index 0000000..55dd1c3 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.cpp @@ -0,0 +1,31 @@ +#include "SObjCExtra.hpp" + +class SObjCLocalExtra : public QObject +{ + Q_OBJECT + +public: + SObjCLocalExtra(); + ~SObjCLocalExtra(); +}; + +SObjCLocalExtra::SObjCLocalExtra() +{ +} + +SObjCLocalExtra::~SObjCLocalExtra() +{ +} + +SObjCExtra::SObjCExtra() +{ +} + +SObjCExtra::~SObjCExtra() +{ +} + +// Externally generated header moc +#include "SObjCExtra_extMoc.cpp" +// AUTOMOC generated source moc +#include "SObjCExtra.moc" diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.hpp b/Tests/QtAutogen/MocInclude/SObjCExtra.hpp new file mode 100644 index 0000000..08545ac --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.hpp @@ -0,0 +1,15 @@ +#ifndef SOBJCEXTRA_HPP +#define SOBJCEXTRA_HPP + +#include + +// Object source includes externally generated .moc file +class SObjCExtra : public QObject +{ + Q_OBJECT +public: + SObjCExtra(); + ~SObjCExtra(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in new file mode 100644 index 0000000..00fc4aa --- /dev/null +++ b/Tests/QtAutogen/MocInclude/SObjCExtra.moc.in @@ -0,0 +1,4 @@ + +void SObjCLocalFunction() +{ +} diff --git a/Tests/QtAutogen/MocInclude/shared.cmake b/Tests/QtAutogen/MocInclude/shared.cmake new file mode 100644 index 0000000..2ca2841 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/shared.cmake @@ -0,0 +1,71 @@ +# Test moc include patterns +include_directories("../MocInclude") +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +# Generate .moc file externally and enabled SKIP_AUTOMOC on the file +qtx_generate_moc( + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc) +set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON) + +# Generate .moc file externally from generated source file +# and enabled SKIP_AUTOMOC on the source file +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.hpp.in + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.cpp.in + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp) +qtx_generate_moc( + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc) +set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON) + +# Generate moc file externally and enabled SKIP_AUTOMOC on the header +qtx_generate_moc( + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp) +set_property( + SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp + PROPERTY SKIP_AUTOMOC ON) +# Custom target to depend on +set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp) +add_custom_target("${MOC_INCLUDE_NAME}_SOBJC" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp + BYPRODUCTS ${SOBJC_MOC} + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.moc.in + ${SOBJC_MOC}) + +# MOC_INCLUDE_NAME must be defined by the includer +add_executable(${MOC_INCLUDE_NAME} + # Common sources + ../MocInclude/ObjA.cpp + ../MocInclude/ObjB.cpp + + ../MocInclude/LObjA.cpp + ../MocInclude/LObjB.cpp + + ../MocInclude/EObjA.cpp + ../MocInclude/EObjAExtra.cpp + ../MocInclude/EObjB.cpp + ../MocInclude/subExtra/EObjBExtra.cpp + + ../MocInclude/SObjA.cpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp + ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc + ../MocInclude/SObjC.cpp + ../MocInclude/SObjCExtra.hpp + ../MocInclude/SObjCExtra.cpp + + ../MocInclude/subGlobal/GObj.cpp + main.cpp +) +add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC") +target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES}) +set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp new file mode 100644 index 0000000..c697866 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.cpp @@ -0,0 +1,20 @@ +#include "EObjBExtra.hpp" +#include "EObjBExtra_p.hpp" + +EObjBExtraPrivate::EObjBExtraPrivate() +{ +} + +EObjBExtraPrivate::~EObjBExtraPrivate() +{ +} + +EObjBExtra::EObjBExtra() + : d(new EObjBExtraPrivate) +{ +} + +EObjBExtra::~EObjBExtra() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp new file mode 100644 index 0000000..3798d7f --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra.hpp @@ -0,0 +1,18 @@ +#ifndef EOBJBEXTRA_HPP +#define EOBJBEXTRA_HPP + +#include + +class EObjBExtraPrivate; +class EObjBExtra : public QObject +{ + Q_OBJECT +public: + EObjBExtra(); + ~EObjBExtra(); + +private: + EObjBExtraPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp new file mode 100644 index 0000000..db8a096 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp @@ -0,0 +1,12 @@ +#ifndef EOBJBEXTRA_P_HPP +#define EOBJBEXTRA_P_HPP + +class EObjBExtraPrivate : public QObject +{ + Q_OBJECT +public: + EObjBExtraPrivate(); + ~EObjBExtraPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp new file mode 100644 index 0000000..6b92f21 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp @@ -0,0 +1,41 @@ +#include "GObj.hpp" +#include "GObj_p.hpp" + +namespace subGlobal { + +class GObjLocal : public QObject +{ + Q_OBJECT +public: + GObjLocal(); + ~GObjLocal(); +}; + +GObjLocal::GObjLocal() +{ +} + +GObjLocal::~GObjLocal() +{ +} + +GObjPrivate::GObjPrivate() +{ +} + +GObjPrivate::~GObjPrivate() +{ +} + +GObj::GObj() +{ + GObjLocal localObj; +} + +GObj::~GObj() +{ +} +} + +// For the local QObject +#include "GObj.moc" diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp new file mode 100644 index 0000000..2f9ee82 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp @@ -0,0 +1,17 @@ +#ifndef GOBJ_HPP +#define GOBJ_HPP + +#include + +namespace subGlobal { + +class GObj : public QObject +{ + Q_OBJECT +public: + GObj(); + ~GObj(); +}; +} + +#endif diff --git a/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp new file mode 100644 index 0000000..7b37dfd --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp @@ -0,0 +1,15 @@ +#ifndef GOBJ_P_HPP +#define GOBJ_P_HPP + +namespace subGlobal { + +class GObjPrivate : public QObject +{ + Q_OBJECT +public: + GObjPrivate(); + ~GObjPrivate(); +}; +} + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt new file mode 100644 index 0000000..b1c4fc3 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeRelaxed) +include("../AutogenTest.cmake") + +# Test moc include patterns +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) + +# Shared executable +set(MOC_INCLUDE_NAME "mocIncludeRelaxed") +include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake) + +# Relaxed ony executable +add_executable(mocIncludeRelaxedOnly + RObjA.cpp + RObjB.cpp + RObjC.cpp + RMain.cpp +) +target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES}) +set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp new file mode 100644 index 0000000..5b2c070 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RMain.cpp @@ -0,0 +1,12 @@ +// Relaxed AUTOMOC objects +#include "RObjA.hpp" +#include "RObjB.hpp" +#include "RObjC.hpp" + +int main(int argv, char** args) +{ + RObjA rObjA; + RObjB rObjB; + RObjC rObjC; + return 0; +} diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp new file mode 100644 index 0000000..2e2cf6a --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.cpp @@ -0,0 +1,12 @@ +#include "RObjA.hpp" + +RObjA::RObjA() +{ +} + +RObjA::~RObjA() +{ +} + +// Relaxed include should moc the header instead +#include "RObjA.moc" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp new file mode 100644 index 0000000..5974187 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjA.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJA_HPP +#define ROBJA_HPP + +#include + +class RObjA : public QObject +{ + Q_OBJECT +public: + RObjA(); + ~RObjA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp new file mode 100644 index 0000000..c56d10f --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.cpp @@ -0,0 +1,22 @@ +#include "RObjB.hpp" +#include "RObjBExtra.hpp" + +RObjBExtra::RObjBExtra() +{ +} + +RObjBExtra::~RObjBExtra() +{ +} + +RObjB::RObjB() +{ + RObjBExtra extraObject; +} + +RObjB::~RObjB() +{ +} + +// Relaxed mode should run moc on RObjBExtra.hpp instead +#include "RObjBExtra.moc" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp new file mode 100644 index 0000000..d6d0474 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjB.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJB_HPP +#define ROBJB_HPP + +#include + +class RObjB : public QObject +{ + Q_OBJECT +public: + RObjB(); + ~RObjB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp new file mode 100644 index 0000000..5d6be75 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjBExtra.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJBEXTRA_HPP +#define ROBJBEXTRA_HPP + +#include + +class RObjBExtra : public QObject +{ + Q_OBJECT +public: + RObjBExtra(); + ~RObjBExtra(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp new file mode 100644 index 0000000..4ba32f5 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.cpp @@ -0,0 +1,30 @@ +#include "RObjC.hpp" +#include + +class RObjCPrivate : public QObject +{ + Q_OBJECT +public: + RObjCPrivate(); + ~RObjCPrivate(); +}; + +RObjCPrivate::RObjCPrivate() +{ +} + +RObjCPrivate::~RObjCPrivate() +{ +} + +RObjC::RObjC() +{ + RObjCPrivate privateObject; +} + +RObjC::~RObjC() +{ +} + +// Relaxed include should moc this source instead of the header +#include "moc_RObjC.cpp" diff --git a/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp new file mode 100644 index 0000000..5552ede --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/RObjC.hpp @@ -0,0 +1,14 @@ +#ifndef ROBJC_HPP +#define ROBJC_HPP + +#include + +class RObjC : public QObject +{ + Q_OBJECT +public: + RObjC(); + ~RObjC(); +}; + +#endif diff --git a/Tests/QtAutogen/MocIncludeRelaxed/main.cpp b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp new file mode 100644 index 0000000..5a3148d --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/main.cpp @@ -0,0 +1,26 @@ +#include "EObjA.hpp" +#include "EObjB.hpp" +#include "LObjA.hpp" +#include "LObjB.hpp" +#include "ObjA.hpp" +#include "ObjB.hpp" +#include "SObjA.hpp" +#include "SObjB.hpp" +#include "subGlobal/GObj.hpp" + +int main(int argv, char** args) +{ + subGlobal::GObj gObj; + ObjA objA; + ObjB objB; + LObjA lObjA; + LObjB lObjB; + EObjA eObjA; + EObjB eObjB; + SObjA sObjA; + SObjB sObjB; + return 0; +} + +// Header in global subdirectory +#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt new file mode 100644 index 0000000..2cf0fed --- /dev/null +++ b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeStrict) +include("../AutogenTest.cmake") + +# Test moc include patterns +set(CMAKE_AUTOMOC_RELAXED_MODE FALSE) + +# Shared executable +set(MOC_INCLUDE_NAME "mocIncludeStrict") +include(${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/shared.cmake) diff --git a/Tests/QtAutogen/MocIncludeStrict/main.cpp b/Tests/QtAutogen/MocIncludeStrict/main.cpp new file mode 100644 index 0000000..5a3148d --- /dev/null +++ b/Tests/QtAutogen/MocIncludeStrict/main.cpp @@ -0,0 +1,26 @@ +#include "EObjA.hpp" +#include "EObjB.hpp" +#include "LObjA.hpp" +#include "LObjB.hpp" +#include "ObjA.hpp" +#include "ObjB.hpp" +#include "SObjA.hpp" +#include "SObjB.hpp" +#include "subGlobal/GObj.hpp" + +int main(int argv, char** args) +{ + subGlobal::GObj gObj; + ObjA objA; + ObjB objB; + LObjA lObjA; + LObjB lObjB; + EObjA eObjA; + EObjB eObjB; + SObjA sObjA; + SObjB sObjB; + return 0; +} + +// Header in global subdirectory +#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjA.cpp b/Tests/QtAutogen/mocInclude/EObjA.cpp deleted file mode 100644 index ca713b2..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "EObjA.hpp" -#include "EObjAExtra.hpp" -#include "EObjA_p.hpp" - -class EObjALocal : public QObject -{ - Q_OBJECT -public: - EObjALocal(); - ~EObjALocal(); -}; - -EObjALocal::EObjALocal() -{ -} - -EObjALocal::~EObjALocal() -{ -} - -EObjAPrivate::EObjAPrivate() -{ - EObjALocal localObj; - EObjAExtra extraObj; -} - -EObjAPrivate::~EObjAPrivate() -{ -} - -EObjA::EObjA() - : d(new EObjAPrivate) -{ -} - -EObjA::~EObjA() -{ -} - -// For EObjALocal -#include "EObjA.moc" -// - Not the own header -#include "moc_EObjAExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjA.hpp b/Tests/QtAutogen/mocInclude/EObjA.hpp deleted file mode 100644 index 0939ab6..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EOBJA_HPP -#define EOBJA_HPP - -#include - -// Sources includes a moc_ includes of an extra object -class EObjAPrivate; -class EObjA : public QObject -{ - Q_OBJECT -public: - EObjA(); - ~EObjA(); - -private: - EObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.cpp b/Tests/QtAutogen/mocInclude/EObjAExtra.cpp deleted file mode 100644 index 369ca8f..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "EObjAExtra.hpp" -#include "EObjAExtra_p.hpp" - -EObjAExtraPrivate::EObjAExtraPrivate() -{ -} - -EObjAExtraPrivate::~EObjAExtraPrivate() -{ -} - -EObjAExtra::EObjAExtra() - : d(new EObjAExtraPrivate) -{ -} - -EObjAExtra::~EObjAExtra() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra.hpp deleted file mode 100644 index b10681d..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EOBJAEXTRA_HPP -#define EOBJAEXTRA_HPP - -#include - -class EObjAExtraPrivate; -class EObjAExtra : public QObject -{ - Q_OBJECT -public: - EObjAExtra(); - ~EObjAExtra(); - -private: - EObjAExtraPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp b/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp deleted file mode 100644 index dea6cb5..0000000 --- a/Tests/QtAutogen/mocInclude/EObjAExtra_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJAEXTRA_P_HPP -#define EOBJAEXTRA_P_HPP - -class EObjAExtraPrivate : public QObject -{ - Q_OBJECT -public: - EObjAExtraPrivate(); - ~EObjAExtraPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjA_p.hpp b/Tests/QtAutogen/mocInclude/EObjA_p.hpp deleted file mode 100644 index 1e0d7e1..0000000 --- a/Tests/QtAutogen/mocInclude/EObjA_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJA_P_HPP -#define EOBJA_P_HPP - -class EObjAPrivate : public QObject -{ - Q_OBJECT -public: - EObjAPrivate(); - ~EObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjB.cpp b/Tests/QtAutogen/mocInclude/EObjB.cpp deleted file mode 100644 index d19fbfa..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include "EObjB.hpp" -#include "EObjB_p.hpp" -#include "subExtra/EObjBExtra.hpp" - -class EObjBLocal : public QObject -{ - Q_OBJECT -public: - EObjBLocal(); - ~EObjBLocal(); -}; - -EObjBLocal::EObjBLocal() -{ -} - -EObjBLocal::~EObjBLocal() -{ -} - -EObjBPrivate::EObjBPrivate() -{ - EObjBLocal localObj; - EObjBExtra extraObj; -} - -EObjBPrivate::~EObjBPrivate() -{ -} - -EObjB::EObjB() - : d(new EObjBPrivate) -{ -} - -EObjB::~EObjB() -{ -} - -// For EObjBLocal -#include "EObjB.moc" -// - Not the own header -// - in a subdirectory -#include "subExtra/moc_EObjBExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/EObjB.hpp b/Tests/QtAutogen/mocInclude/EObjB.hpp deleted file mode 100644 index 6632bdb..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EOBJB_HPP -#define EOBJB_HPP - -#include - -// Sources includes a moc_ includes of an extra object in a subdirectory -class EObjBPrivate; -class EObjB : public QObject -{ - Q_OBJECT -public: - EObjB(); - ~EObjB(); - -private: - EObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/EObjB_p.hpp b/Tests/QtAutogen/mocInclude/EObjB_p.hpp deleted file mode 100644 index 2905f28..0000000 --- a/Tests/QtAutogen/mocInclude/EObjB_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJB_P_HPP -#define EOBJB_P_HPP - -class EObjBPrivate : public QObject -{ - Q_OBJECT -public: - EObjBPrivate(); - ~EObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjA.cpp b/Tests/QtAutogen/mocInclude/LObjA.cpp deleted file mode 100644 index 9aae991..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include "LObjA.hpp" -#include "LObjA_p.h" - -class LObjALocal : public QObject -{ - Q_OBJECT -public: - LObjALocal(); - ~LObjALocal(); -}; - -LObjALocal::LObjALocal() -{ -} - -LObjALocal::~LObjALocal() -{ -} - -LObjAPrivate::LObjAPrivate() -{ - LObjALocal localObj; -} - -LObjAPrivate::~LObjAPrivate() -{ -} - -LObjA::LObjA() - : d(new LObjAPrivate) -{ -} - -LObjA::~LObjA() -{ - delete d; -} - -#include "LObjA.moc" diff --git a/Tests/QtAutogen/mocInclude/LObjA.hpp b/Tests/QtAutogen/mocInclude/LObjA.hpp deleted file mode 100644 index aac670c..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef LOBJA_HPP -#define LOBJA_HPP - -#include - -// Object source comes with a .moc include -class LObjAPrivate; -class LObjA : public QObject -{ - Q_OBJECT -public: - LObjA(); - ~LObjA(); - -private: - LObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjA_p.h b/Tests/QtAutogen/mocInclude/LObjA_p.h deleted file mode 100644 index ebe8395..0000000 --- a/Tests/QtAutogen/mocInclude/LObjA_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LOBJA_P_HPP -#define LOBJA_P_HPP - -class LObjAPrivate : public QObject -{ - Q_OBJECT -public: - LObjAPrivate(); - ~LObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjB.cpp b/Tests/QtAutogen/mocInclude/LObjB.cpp deleted file mode 100644 index 7485d8f..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "LObjB.hpp" -#include "LObjB_p.h" - -class LObjBLocal : public QObject -{ - Q_OBJECT -public: - LObjBLocal(); - ~LObjBLocal(); -}; - -LObjBLocal::LObjBLocal() -{ -} - -LObjBLocal::~LObjBLocal() -{ -} - -LObjBPrivate::LObjBPrivate() -{ - LObjBLocal localObj; -} - -LObjBPrivate::~LObjBPrivate() -{ -} - -LObjB::LObjB() - : d(new LObjBPrivate) -{ -} - -LObjB::~LObjB() -{ - delete d; -} - -#include "LObjB.moc" -#include "moc_LObjB.cpp" diff --git a/Tests/QtAutogen/mocInclude/LObjB.hpp b/Tests/QtAutogen/mocInclude/LObjB.hpp deleted file mode 100644 index eb4e58d..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef LLObjB_HPP -#define LLObjB_HPP - -#include - -// Object source comes with a .moc and a _moc include -class LObjBPrivate; -class LObjB : public QObject -{ - Q_OBJECT -public: - LObjB(); - ~LObjB(); - -private: - LObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/LObjB_p.h b/Tests/QtAutogen/mocInclude/LObjB_p.h deleted file mode 100644 index b871f2d..0000000 --- a/Tests/QtAutogen/mocInclude/LObjB_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LOBJB_P_HPP -#define LOBJB_P_HPP - -class LObjBPrivate : public QObject -{ - Q_OBJECT -public: - LObjBPrivate(); - ~LObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjA.cpp b/Tests/QtAutogen/mocInclude/ObjA.cpp deleted file mode 100644 index 6f6b90e..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "ObjA.hpp" -#include "ObjA_p.h" - -ObjAPrivate::ObjAPrivate() -{ -} - -ObjAPrivate::~ObjAPrivate() -{ -} - -ObjA::ObjA() - : d(new ObjAPrivate) -{ -} - -ObjA::~ObjA() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/ObjA.hpp b/Tests/QtAutogen/mocInclude/ObjA.hpp deleted file mode 100644 index f16c924..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OBJA_HPP -#define OBJA_HPP - -#include - -// Object source comes without any _moc/.moc includes -class ObjAPrivate; -class ObjA : public QObject -{ - Q_OBJECT -public: - ObjA(); - ~ObjA(); - -private: - ObjAPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjA_p.h b/Tests/QtAutogen/mocInclude/ObjA_p.h deleted file mode 100644 index eb60c98..0000000 --- a/Tests/QtAutogen/mocInclude/ObjA_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OBJA_P_HPP -#define OBJA_P_HPP - -class ObjAPrivate : public QObject -{ - Q_OBJECT -public: - ObjAPrivate(); - ~ObjAPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjB.cpp b/Tests/QtAutogen/mocInclude/ObjB.cpp deleted file mode 100644 index a6f2509..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "ObjB.hpp" -#include "ObjB_p.h" - -ObjBPrivate::ObjBPrivate() -{ -} - -ObjBPrivate::~ObjBPrivate() -{ -} - -ObjB::ObjB() - : d(new ObjBPrivate) -{ -} - -ObjB::~ObjB() -{ - delete d; -} - -#include "moc_ObjB.cpp" diff --git a/Tests/QtAutogen/mocInclude/ObjB.hpp b/Tests/QtAutogen/mocInclude/ObjB.hpp deleted file mode 100644 index 2ac8d17..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ObjB_HPP -#define ObjB_HPP - -#include - -// Object source comes with a _moc include -class ObjBPrivate; -class ObjB : public QObject -{ - Q_OBJECT -public: - ObjB(); - ~ObjB(); - -private: - ObjBPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/ObjB_p.h b/Tests/QtAutogen/mocInclude/ObjB_p.h deleted file mode 100644 index 418da65..0000000 --- a/Tests/QtAutogen/mocInclude/ObjB_p.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef OBJB_P_HPP -#define OBJB_P_HPP - -class ObjBPrivate : public QObject -{ - Q_OBJECT -public: - ObjBPrivate(); - ~ObjBPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjA.cpp b/Tests/QtAutogen/mocInclude/SObjA.cpp deleted file mode 100644 index 7e75bf9..0000000 --- a/Tests/QtAutogen/mocInclude/SObjA.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "SObjA.hpp" - -SObjA::SObjA() -{ -} - -SObjA::~SObjA() -{ -} - -#include "SObjA.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjA.hpp b/Tests/QtAutogen/mocInclude/SObjA.hpp deleted file mode 100644 index 1436abc..0000000 --- a/Tests/QtAutogen/mocInclude/SObjA.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJA_HPP -#define SOBJA_HPP - -#include - -// Object source includes externally generated .moc file -class SObjA : public QObject -{ - Q_OBJECT -public: - SObjA(); - ~SObjA(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjB.cpp.in b/Tests/QtAutogen/mocInclude/SObjB.cpp.in deleted file mode 100644 index b1cc12a..0000000 --- a/Tests/QtAutogen/mocInclude/SObjB.cpp.in +++ /dev/null @@ -1,11 +0,0 @@ -#include "SObjB.hpp" - -SObjB::SObjB() -{ -} - -SObjB::~SObjB() -{ -} - -#include "SObjB.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjB.hpp.in b/Tests/QtAutogen/mocInclude/SObjB.hpp.in deleted file mode 100644 index 5e396ae..0000000 --- a/Tests/QtAutogen/mocInclude/SObjB.hpp.in +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJB_HPP -#define SOBJB_HPP - -#include - -// Object source includes externally generated .moc file -class SObjB : public QObject -{ - Q_OBJECT -public: - SObjB(); - ~SObjB(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjC.cpp b/Tests/QtAutogen/mocInclude/SObjC.cpp deleted file mode 100644 index 1e8d397..0000000 --- a/Tests/QtAutogen/mocInclude/SObjC.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "SObjC.hpp" - -void SObjCLocalFunction(); - -class SObjCLocal : public QObject -{ - Q_OBJECT - -public: - SObjCLocal(); - ~SObjCLocal(); -}; - -SObjCLocal::SObjCLocal() -{ -} - -SObjCLocal::~SObjCLocal() -{ -} - -SObjC::SObjC() -{ - SObjCLocal localObject; - SObjCLocalFunction(); -} - -SObjC::~SObjC() -{ -} - -#include "SObjC.moc" -#include "moc_SObjC.cpp" -// Include moc_ file for which the header is SKIP_AUTOMOC enabled -#include "moc_SObjCExtra.cpp" diff --git a/Tests/QtAutogen/mocInclude/SObjC.hpp b/Tests/QtAutogen/mocInclude/SObjC.hpp deleted file mode 100644 index def0f9d..0000000 --- a/Tests/QtAutogen/mocInclude/SObjC.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJC_HPP -#define SOBJC_HPP - -#include - -// Object source includes externally generated .moc file -class SObjC : public QObject -{ - Q_OBJECT -public: - SObjC(); - ~SObjC(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.cpp b/Tests/QtAutogen/mocInclude/SObjCExtra.cpp deleted file mode 100644 index 55dd1c3..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "SObjCExtra.hpp" - -class SObjCLocalExtra : public QObject -{ - Q_OBJECT - -public: - SObjCLocalExtra(); - ~SObjCLocalExtra(); -}; - -SObjCLocalExtra::SObjCLocalExtra() -{ -} - -SObjCLocalExtra::~SObjCLocalExtra() -{ -} - -SObjCExtra::SObjCExtra() -{ -} - -SObjCExtra::~SObjCExtra() -{ -} - -// Externally generated header moc -#include "SObjCExtra_extMoc.cpp" -// AUTOMOC generated source moc -#include "SObjCExtra.moc" diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.hpp b/Tests/QtAutogen/mocInclude/SObjCExtra.hpp deleted file mode 100644 index 08545ac..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef SOBJCEXTRA_HPP -#define SOBJCEXTRA_HPP - -#include - -// Object source includes externally generated .moc file -class SObjCExtra : public QObject -{ - Q_OBJECT -public: - SObjCExtra(); - ~SObjCExtra(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in b/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in deleted file mode 100644 index 00fc4aa..0000000 --- a/Tests/QtAutogen/mocInclude/SObjCExtra.moc.in +++ /dev/null @@ -1,4 +0,0 @@ - -void SObjCLocalFunction() -{ -} diff --git a/Tests/QtAutogen/mocInclude/shared.cmake b/Tests/QtAutogen/mocInclude/shared.cmake deleted file mode 100644 index d05f27c..0000000 --- a/Tests/QtAutogen/mocInclude/shared.cmake +++ /dev/null @@ -1,71 +0,0 @@ -# Test moc include patterns -include_directories("../mocInclude") -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -# Generate .moc file externally and enabled SKIP_AUTOMOC on the file -qtx_generate_moc( - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc) -set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON) - -# Generate .moc file externally from generated source file -# and enabled SKIP_AUTOMOC on the source file -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjB.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp) -qtx_generate_moc( - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc) -set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON) - -# Generate moc file externally and enabled SKIP_AUTOMOC on the header -qtx_generate_moc( - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp) -set_property( - SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.hpp - PROPERTY SKIP_AUTOMOC ON) -# Custom target to depend on -set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp) -add_custom_target("${MOC_INCLUDE_NAME}_SOBJC" - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp - BYPRODUCTS ${SOBJC_MOC} - COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/SObjCExtra.moc.in - ${SOBJC_MOC}) - -# MOC_INCLUDE_NAME must be defined by the includer -add_executable(${MOC_INCLUDE_NAME} - # Common sources - ../mocInclude/ObjA.cpp - ../mocInclude/ObjB.cpp - - ../mocInclude/LObjA.cpp - ../mocInclude/LObjB.cpp - - ../mocInclude/EObjA.cpp - ../mocInclude/EObjAExtra.cpp - ../mocInclude/EObjB.cpp - ../mocInclude/subExtra/EObjBExtra.cpp - - ../mocInclude/SObjA.cpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp - ${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc - ../mocInclude/SObjC.cpp - ../mocInclude/SObjCExtra.hpp - ../mocInclude/SObjCExtra.cpp - - ../mocInclude/subGlobal/GObj.cpp - main.cpp -) -add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC") -target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES}) -set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp deleted file mode 100644 index c697866..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "EObjBExtra.hpp" -#include "EObjBExtra_p.hpp" - -EObjBExtraPrivate::EObjBExtraPrivate() -{ -} - -EObjBExtraPrivate::~EObjBExtraPrivate() -{ -} - -EObjBExtra::EObjBExtra() - : d(new EObjBExtraPrivate) -{ -} - -EObjBExtra::~EObjBExtra() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp deleted file mode 100644 index 3798d7f..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef EOBJBEXTRA_HPP -#define EOBJBEXTRA_HPP - -#include - -class EObjBExtraPrivate; -class EObjBExtra : public QObject -{ - Q_OBJECT -public: - EObjBExtra(); - ~EObjBExtra(); - -private: - EObjBExtraPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp b/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp deleted file mode 100644 index db8a096..0000000 --- a/Tests/QtAutogen/mocInclude/subExtra/EObjBExtra_p.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef EOBJBEXTRA_P_HPP -#define EOBJBEXTRA_P_HPP - -class EObjBExtraPrivate : public QObject -{ - Q_OBJECT -public: - EObjBExtraPrivate(); - ~EObjBExtraPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp deleted file mode 100644 index 6b92f21..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "GObj.hpp" -#include "GObj_p.hpp" - -namespace subGlobal { - -class GObjLocal : public QObject -{ - Q_OBJECT -public: - GObjLocal(); - ~GObjLocal(); -}; - -GObjLocal::GObjLocal() -{ -} - -GObjLocal::~GObjLocal() -{ -} - -GObjPrivate::GObjPrivate() -{ -} - -GObjPrivate::~GObjPrivate() -{ -} - -GObj::GObj() -{ - GObjLocal localObj; -} - -GObj::~GObj() -{ -} -} - -// For the local QObject -#include "GObj.moc" diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp deleted file mode 100644 index 2f9ee82..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef GOBJ_HPP -#define GOBJ_HPP - -#include - -namespace subGlobal { - -class GObj : public QObject -{ - Q_OBJECT -public: - GObj(); - ~GObj(); -}; -} - -#endif diff --git a/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp b/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp deleted file mode 100644 index 7b37dfd..0000000 --- a/Tests/QtAutogen/mocInclude/subGlobal/GObj_p.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GOBJ_P_HPP -#define GOBJ_P_HPP - -namespace subGlobal { - -class GObjPrivate : public QObject -{ - Q_OBJECT -public: - GObjPrivate(); - ~GObjPrivate(); -}; -} - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt deleted file mode 100644 index 97ba1df..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Test moc include patterns - -set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) - -# Shared executable -set(MOC_INCLUDE_NAME "mocIncludeRelaxed") -include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake) - -# Relaxed ony executable -add_executable(mocIncludeRelaxedOnly - RObjA.cpp - RObjB.cpp - RObjC.cpp - RMain.cpp -) -target_link_libraries(mocIncludeRelaxedOnly ${QT_LIBRARIES}) -set_target_properties(mocIncludeRelaxedOnly PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp deleted file mode 100644 index 5b2c070..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RMain.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// Relaxed AUTOMOC objects -#include "RObjA.hpp" -#include "RObjB.hpp" -#include "RObjC.hpp" - -int main(int argv, char** args) -{ - RObjA rObjA; - RObjB rObjB; - RObjC rObjC; - return 0; -} diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp deleted file mode 100644 index 2e2cf6a..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "RObjA.hpp" - -RObjA::RObjA() -{ -} - -RObjA::~RObjA() -{ -} - -// Relaxed include should moc the header instead -#include "RObjA.moc" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp deleted file mode 100644 index 5974187..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjA.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJA_HPP -#define ROBJA_HPP - -#include - -class RObjA : public QObject -{ - Q_OBJECT -public: - RObjA(); - ~RObjA(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp deleted file mode 100644 index c56d10f..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "RObjB.hpp" -#include "RObjBExtra.hpp" - -RObjBExtra::RObjBExtra() -{ -} - -RObjBExtra::~RObjBExtra() -{ -} - -RObjB::RObjB() -{ - RObjBExtra extraObject; -} - -RObjB::~RObjB() -{ -} - -// Relaxed mode should run moc on RObjBExtra.hpp instead -#include "RObjBExtra.moc" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp deleted file mode 100644 index d6d0474..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjB.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJB_HPP -#define ROBJB_HPP - -#include - -class RObjB : public QObject -{ - Q_OBJECT -public: - RObjB(); - ~RObjB(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp deleted file mode 100644 index 5d6be75..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjBExtra.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJBEXTRA_HPP -#define ROBJBEXTRA_HPP - -#include - -class RObjBExtra : public QObject -{ - Q_OBJECT -public: - RObjBExtra(); - ~RObjBExtra(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp deleted file mode 100644 index 4ba32f5..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "RObjC.hpp" -#include - -class RObjCPrivate : public QObject -{ - Q_OBJECT -public: - RObjCPrivate(); - ~RObjCPrivate(); -}; - -RObjCPrivate::RObjCPrivate() -{ -} - -RObjCPrivate::~RObjCPrivate() -{ -} - -RObjC::RObjC() -{ - RObjCPrivate privateObject; -} - -RObjC::~RObjC() -{ -} - -// Relaxed include should moc this source instead of the header -#include "moc_RObjC.cpp" diff --git a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp b/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp deleted file mode 100644 index 5552ede..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/RObjC.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ROBJC_HPP -#define ROBJC_HPP - -#include - -class RObjC : public QObject -{ - Q_OBJECT -public: - RObjC(); - ~RObjC(); -}; - -#endif diff --git a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp deleted file mode 100644 index 5a3148d..0000000 --- a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "EObjA.hpp" -#include "EObjB.hpp" -#include "LObjA.hpp" -#include "LObjB.hpp" -#include "ObjA.hpp" -#include "ObjB.hpp" -#include "SObjA.hpp" -#include "SObjB.hpp" -#include "subGlobal/GObj.hpp" - -int main(int argv, char** args) -{ - subGlobal::GObj gObj; - ObjA objA; - ObjB objB; - LObjA lObjA; - LObjB lObjB; - EObjA eObjA; - EObjB eObjB; - SObjA sObjA; - SObjB sObjB; - return 0; -} - -// Header in global subdirectory -#include "subGlobal/moc_GObj.cpp" diff --git a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt deleted file mode 100644 index 789354a..0000000 --- a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Test moc include patterns - -set(CMAKE_AUTOMOC_RELAXED_MODE FALSE) -set(MOC_INCLUDE_NAME "mocIncludeStrict") - -include(${CMAKE_CURRENT_SOURCE_DIR}/../mocInclude/shared.cmake) diff --git a/Tests/QtAutogen/mocIncludeStrict/main.cpp b/Tests/QtAutogen/mocIncludeStrict/main.cpp deleted file mode 100644 index 5a3148d..0000000 --- a/Tests/QtAutogen/mocIncludeStrict/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "EObjA.hpp" -#include "EObjB.hpp" -#include "LObjA.hpp" -#include "LObjB.hpp" -#include "ObjA.hpp" -#include "ObjB.hpp" -#include "SObjA.hpp" -#include "SObjB.hpp" -#include "subGlobal/GObj.hpp" - -int main(int argv, char** args) -{ - subGlobal::GObj gObj; - ObjA objA; - ObjB objB; - LObjA lObjA; - LObjB lObjB; - EObjA eObjA; - EObjB eObjB; - SObjA sObjA; - SObjB sObjB; - return 0; -} - -// Header in global subdirectory -#include "subGlobal/moc_GObj.cpp" -- cgit v0.12 From a2c4e3489d9ccd7150b6fda2ea7254c21dcde1b2 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:49:32 +0100 Subject: Autogen: Tests: Separate MocCMP0071 test --- Tests/QtAutogen/CMakeLists.txt | 6 ------ Tests/QtAutogen/CommonTests.cmake | 3 +++ Tests/QtAutogen/MocCMP0071/CMakeLists.txt | 6 ++++++ Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt | 16 ++++++++++++++++ Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt | 18 ++++++++++++++++++ Tests/QtAutogen/MocCMP0071/Obj.cpp | 20 ++++++++++++++++++++ Tests/QtAutogen/MocCMP0071/Obj.hpp | 19 +++++++++++++++++++ Tests/QtAutogen/MocCMP0071/Obj_p.h | 14 ++++++++++++++ Tests/QtAutogen/MocCMP0071/main.cpp | 7 +++++++ Tests/QtAutogen/mocCMP0071/CMakeLists.txt | 4 ---- Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt | 16 ---------------- Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt | 18 ------------------ Tests/QtAutogen/mocCMP0071/Obj.cpp | 20 -------------------- Tests/QtAutogen/mocCMP0071/Obj.hpp | 19 ------------------- Tests/QtAutogen/mocCMP0071/Obj_p.h | 14 -------------- Tests/QtAutogen/mocCMP0071/main.cpp | 7 ------- 16 files changed, 103 insertions(+), 104 deletions(-) create mode 100644 Tests/QtAutogen/MocCMP0071/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocCMP0071/Obj.cpp create mode 100644 Tests/QtAutogen/MocCMP0071/Obj.hpp create mode 100644 Tests/QtAutogen/MocCMP0071/Obj_p.h create mode 100644 Tests/QtAutogen/MocCMP0071/main.cpp delete mode 100644 Tests/QtAutogen/mocCMP0071/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt delete mode 100644 Tests/QtAutogen/mocCMP0071/Obj.cpp delete mode 100644 Tests/QtAutogen/mocCMP0071/Obj.hpp delete mode 100644 Tests/QtAutogen/mocCMP0071/Obj_p.h delete mode 100644 Tests/QtAutogen/mocCMP0071/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 5775117..1f50931 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,12 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests policy 0071 -if(ALLOW_WRAP_CPP) - add_subdirectory(mocCMP0071) -endif() - -# -- Test # Tests various .ui include directories add_subdirectory(uicInclude) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 4d89eae..932169b 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -20,3 +20,6 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) endif() +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(MocCMP0071) +endif() diff --git a/Tests/QtAutogen/MocCMP0071/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt new file mode 100644 index 0000000..a79f36e --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10) +project(MocCMP0071) +include("../AutogenTest.cmake") + +add_subdirectory(OLD) +add_subdirectory(NEW) diff --git a/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt new file mode 100644 index 0000000..954fe3d --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +cmake_policy(SET CMP0071 NEW) + +# *Generate* files +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) +add_custom_command( + OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp) + +add_executable(mocCMP0071New ${CBD}/Obj.cpp ${CBD}/main.cpp) +target_link_libraries(mocCMP0071New ${QT_LIBRARIES}) +set_target_properties(mocCMP0071New PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt new file mode 100644 index 0000000..68fa067 --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +cmake_policy(SET CMP0071 OLD) + +# *Generate* files +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) +add_custom_command( + OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp + COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp) + +# Generate moc files externally +qtx_wrap_cpp(mocCMP0071OldMoc ${CBD}/Obj.hpp ${CBD}/Obj_p.h) +add_executable(mocCMP0071Old ${CBD}/Obj.cpp ${CBD}/main.cpp ${mocCMP0071OldMoc}) +target_link_libraries(mocCMP0071Old ${QT_LIBRARIES}) +set_target_properties(mocCMP0071Old PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/MocCMP0071/Obj.cpp b/Tests/QtAutogen/MocCMP0071/Obj.cpp new file mode 100644 index 0000000..1ae50ed --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/Obj.cpp @@ -0,0 +1,20 @@ +#include "Obj.hpp" +#include "Obj_p.h" + +ObjPrivate::ObjPrivate() +{ +} + +ObjPrivate::~ObjPrivate() +{ +} + +Obj::Obj() + : d(new ObjPrivate) +{ +} + +Obj::~Obj() +{ + delete d; +} diff --git a/Tests/QtAutogen/MocCMP0071/Obj.hpp b/Tests/QtAutogen/MocCMP0071/Obj.hpp new file mode 100644 index 0000000..f064e47 --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/Obj.hpp @@ -0,0 +1,19 @@ +#ifndef OBJ_HPP +#define OBJ_HPP + +#include + +// Object source comes without any _moc/.moc includes +class ObjPrivate; +class Obj : public QObject +{ + Q_OBJECT +public: + Obj(); + ~Obj(); + +private: + ObjPrivate* const d; +}; + +#endif diff --git a/Tests/QtAutogen/MocCMP0071/Obj_p.h b/Tests/QtAutogen/MocCMP0071/Obj_p.h new file mode 100644 index 0000000..cb1e5df --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/Obj_p.h @@ -0,0 +1,14 @@ +#ifndef OBJ_P_HPP +#define OBJ_P_HPP + +#include + +class ObjPrivate : public QObject +{ + Q_OBJECT +public: + ObjPrivate(); + ~ObjPrivate(); +}; + +#endif diff --git a/Tests/QtAutogen/MocCMP0071/main.cpp b/Tests/QtAutogen/MocCMP0071/main.cpp new file mode 100644 index 0000000..3887840 --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/main.cpp @@ -0,0 +1,7 @@ +#include "Obj.hpp" + +int main(int argv, char** args) +{ + Obj obj; + return 0; +} diff --git a/Tests/QtAutogen/mocCMP0071/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/CMakeLists.txt deleted file mode 100644 index 003fa08..0000000 --- a/Tests/QtAutogen/mocCMP0071/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(mocCMP0071 CXX) -add_subdirectory(OLD) -add_subdirectory(NEW) diff --git a/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt deleted file mode 100644 index 0237afc..0000000 --- a/Tests/QtAutogen/mocCMP0071/NEW/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) - -# *Generate* files -set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) -set(CBD ${CMAKE_CURRENT_BINARY_DIR}) -add_custom_command( - OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp) - -add_executable(mocCMP0071New ${CBD}/Obj.cpp ${CBD}/main.cpp) -target_link_libraries(mocCMP0071New ${QT_LIBRARIES}) -set_target_properties(mocCMP0071New PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt b/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt deleted file mode 100644 index 5699433..0000000 --- a/Tests/QtAutogen/mocCMP0071/OLD/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 OLD) - -# *Generate* files -set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) -set(CBD ${CMAKE_CURRENT_BINARY_DIR}) -add_custom_command( - OUTPUT ${CBD}/Obj_p.h ${CBD}/Obj.hpp ${CBD}/Obj.cpp ${CBD}/main.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj_p.h ${CBD}/Obj_p.h - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.hpp ${CBD}/Obj.hpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../Obj.cpp ${CBD}/Obj.cpp - COMMAND ${CMAKE_COMMAND} -E copy ${CSD}/../main.cpp ${CBD}/main.cpp) - -# Generate moc files externally -qtx_wrap_cpp(mocCMP0071OldMoc ${CBD}/Obj.hpp ${CBD}/Obj_p.h) -add_executable(mocCMP0071Old ${CBD}/Obj.cpp ${CBD}/main.cpp ${mocCMP0071OldMoc}) -target_link_libraries(mocCMP0071Old ${QT_LIBRARIES}) -set_target_properties(mocCMP0071Old PROPERTIES AUTOMOC ON) diff --git a/Tests/QtAutogen/mocCMP0071/Obj.cpp b/Tests/QtAutogen/mocCMP0071/Obj.cpp deleted file mode 100644 index 1ae50ed..0000000 --- a/Tests/QtAutogen/mocCMP0071/Obj.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "Obj.hpp" -#include "Obj_p.h" - -ObjPrivate::ObjPrivate() -{ -} - -ObjPrivate::~ObjPrivate() -{ -} - -Obj::Obj() - : d(new ObjPrivate) -{ -} - -Obj::~Obj() -{ - delete d; -} diff --git a/Tests/QtAutogen/mocCMP0071/Obj.hpp b/Tests/QtAutogen/mocCMP0071/Obj.hpp deleted file mode 100644 index f064e47..0000000 --- a/Tests/QtAutogen/mocCMP0071/Obj.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef OBJ_HPP -#define OBJ_HPP - -#include - -// Object source comes without any _moc/.moc includes -class ObjPrivate; -class Obj : public QObject -{ - Q_OBJECT -public: - Obj(); - ~Obj(); - -private: - ObjPrivate* const d; -}; - -#endif diff --git a/Tests/QtAutogen/mocCMP0071/Obj_p.h b/Tests/QtAutogen/mocCMP0071/Obj_p.h deleted file mode 100644 index cb1e5df..0000000 --- a/Tests/QtAutogen/mocCMP0071/Obj_p.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OBJ_P_HPP -#define OBJ_P_HPP - -#include - -class ObjPrivate : public QObject -{ - Q_OBJECT -public: - ObjPrivate(); - ~ObjPrivate(); -}; - -#endif diff --git a/Tests/QtAutogen/mocCMP0071/main.cpp b/Tests/QtAutogen/mocCMP0071/main.cpp deleted file mode 100644 index 3887840..0000000 --- a/Tests/QtAutogen/mocCMP0071/main.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "Obj.hpp" - -int main(int argv, char** args) -{ - Obj obj; - return 0; -} -- cgit v0.12 From 0b6ad59ea6b74379f4aefb42c2402355c393c656 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 19:56:26 +0100 Subject: Autogen: Tests: Separate UicInclude test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/UicInclude/CMakeLists.txt | 11 +++++++++++ Tests/QtAutogen/UicInclude/PageC.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/PageC2.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/dirA/PageA.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/dirB/PageB.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/dirB/PageB2.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/dirB/subB/PageBsub.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/UicInclude/main.cpp | 18 ++++++++++++++++++ Tests/QtAutogen/UicInclude/main.hpp | 6 ++++++ Tests/QtAutogen/UicInclude/subC/PageCsub.ui | 24 ++++++++++++++++++++++++ Tests/QtAutogen/uicInclude/CMakeLists.txt | 8 -------- Tests/QtAutogen/uicInclude/PageC.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/PageC2.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/dirA/PageA.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/dirB/PageB.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/dirB/PageB2.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui | 24 ------------------------ Tests/QtAutogen/uicInclude/main.cpp | 18 ------------------ Tests/QtAutogen/uicInclude/main.hpp | 6 ------ Tests/QtAutogen/uicInclude/subC/PageCsub.ui | 24 ------------------------ 22 files changed, 204 insertions(+), 204 deletions(-) create mode 100644 Tests/QtAutogen/UicInclude/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicInclude/PageC.ui create mode 100644 Tests/QtAutogen/UicInclude/PageC2.ui create mode 100644 Tests/QtAutogen/UicInclude/dirA/PageA.ui create mode 100644 Tests/QtAutogen/UicInclude/dirB/PageB.ui create mode 100644 Tests/QtAutogen/UicInclude/dirB/PageB2.ui create mode 100644 Tests/QtAutogen/UicInclude/dirB/subB/PageBsub.ui create mode 100644 Tests/QtAutogen/UicInclude/main.cpp create mode 100644 Tests/QtAutogen/UicInclude/main.hpp create mode 100644 Tests/QtAutogen/UicInclude/subC/PageCsub.ui delete mode 100644 Tests/QtAutogen/uicInclude/CMakeLists.txt delete mode 100644 Tests/QtAutogen/uicInclude/PageC.ui delete mode 100644 Tests/QtAutogen/uicInclude/PageC2.ui delete mode 100644 Tests/QtAutogen/uicInclude/dirA/PageA.ui delete mode 100644 Tests/QtAutogen/uicInclude/dirB/PageB.ui delete mode 100644 Tests/QtAutogen/uicInclude/dirB/PageB2.ui delete mode 100644 Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui delete mode 100644 Tests/QtAutogen/uicInclude/main.cpp delete mode 100644 Tests/QtAutogen/uicInclude/main.hpp delete mode 100644 Tests/QtAutogen/uicInclude/subC/PageCsub.ui diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 1f50931..288ae60 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests various .ui include directories -add_subdirectory(uicInclude) - -# -- Test # OBJECT libraries add_subdirectory(objectLibrary) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 932169b..e873d06 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -23,3 +23,4 @@ endif() if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() +ADD_AUTOGEN_TEST(UicInclude uicInclude) diff --git a/Tests/QtAutogen/UicInclude/CMakeLists.txt b/Tests/QtAutogen/UicInclude/CMakeLists.txt new file mode 100644 index 0000000..56f76fb --- /dev/null +++ b/Tests/QtAutogen/UicInclude/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.10) +project(UicInclude) +include("../AutogenTest.cmake") + +# Test uic include patterns +set(CMAKE_AUTOUIC_SEARCH_PATHS "dirA") + +add_executable(uicInclude main.cpp) +target_link_libraries(uicInclude ${QT_LIBRARIES}) +set_target_properties(uicInclude PROPERTIES AUTOUIC ON) +set_property(TARGET uicInclude APPEND PROPERTY AUTOUIC_SEARCH_PATHS "dirB") diff --git a/Tests/QtAutogen/UicInclude/PageC.ui b/Tests/QtAutogen/UicInclude/PageC.ui new file mode 100644 index 0000000..bb2fb5e --- /dev/null +++ b/Tests/QtAutogen/UicInclude/PageC.ui @@ -0,0 +1,24 @@ + + + PageC + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/PageC2.ui b/Tests/QtAutogen/UicInclude/PageC2.ui new file mode 100644 index 0000000..daab868 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/PageC2.ui @@ -0,0 +1,24 @@ + + + PageC2 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/dirA/PageA.ui b/Tests/QtAutogen/UicInclude/dirA/PageA.ui new file mode 100644 index 0000000..dd81802 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/dirA/PageA.ui @@ -0,0 +1,24 @@ + + + PageA + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/dirB/PageB.ui b/Tests/QtAutogen/UicInclude/dirB/PageB.ui new file mode 100644 index 0000000..fa6dfa6 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/dirB/PageB.ui @@ -0,0 +1,24 @@ + + + PageB + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/dirB/PageB2.ui b/Tests/QtAutogen/UicInclude/dirB/PageB2.ui new file mode 100644 index 0000000..2225150 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/dirB/PageB2.ui @@ -0,0 +1,24 @@ + + + PageB2 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/dirB/subB/PageBsub.ui b/Tests/QtAutogen/UicInclude/dirB/subB/PageBsub.ui new file mode 100644 index 0000000..873016e --- /dev/null +++ b/Tests/QtAutogen/UicInclude/dirB/subB/PageBsub.ui @@ -0,0 +1,24 @@ + + + PageBsub + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInclude/main.cpp b/Tests/QtAutogen/UicInclude/main.cpp new file mode 100644 index 0000000..c8e7609 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/main.cpp @@ -0,0 +1,18 @@ + +#include "main.hpp" + +int main(int argv, char** args) +{ + return 0; +} + +// .ui files in CMAKE_AUTOUIC_SEARCH_PATHS +#include "ui_PageA.h" +// .ui files in AUTOUIC_SEARCH_PATHS +#include "sub/gen/deep/ui_PageB2.h" +#include "subB/ui_PageBsub.h" +#include "ui_PageB.h" +// .ui files in source's vicinity +#include "sub/gen/deep/ui_PageC2.h" +#include "subC/ui_PageCsub.h" +#include "ui_PageC.h" diff --git a/Tests/QtAutogen/UicInclude/main.hpp b/Tests/QtAutogen/UicInclude/main.hpp new file mode 100644 index 0000000..58ddc26 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/main.hpp @@ -0,0 +1,6 @@ +#ifndef MAIN_HPP +#define MAIN_HPP + +#include "ui_PageA.h" + +#endif diff --git a/Tests/QtAutogen/UicInclude/subC/PageCsub.ui b/Tests/QtAutogen/UicInclude/subC/PageCsub.ui new file mode 100644 index 0000000..0268326 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/subC/PageCsub.ui @@ -0,0 +1,24 @@ + + + PageCsub + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/uicInclude/CMakeLists.txt b/Tests/QtAutogen/uicInclude/CMakeLists.txt deleted file mode 100644 index f62ebb0..0000000 --- a/Tests/QtAutogen/uicInclude/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Test moc include patterns - -set(CMAKE_AUTOUIC_SEARCH_PATHS "dirA") - -add_executable(uicInclude main.cpp) -target_link_libraries(uicInclude ${QT_LIBRARIES}) -set_target_properties(uicInclude PROPERTIES AUTOUIC ON) -set_property(TARGET uicInclude APPEND PROPERTY AUTOUIC_SEARCH_PATHS "dirB") diff --git a/Tests/QtAutogen/uicInclude/PageC.ui b/Tests/QtAutogen/uicInclude/PageC.ui deleted file mode 100644 index bb2fb5e..0000000 --- a/Tests/QtAutogen/uicInclude/PageC.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageC - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/PageC2.ui b/Tests/QtAutogen/uicInclude/PageC2.ui deleted file mode 100644 index daab868..0000000 --- a/Tests/QtAutogen/uicInclude/PageC2.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageC2 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/dirA/PageA.ui b/Tests/QtAutogen/uicInclude/dirA/PageA.ui deleted file mode 100644 index dd81802..0000000 --- a/Tests/QtAutogen/uicInclude/dirA/PageA.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageA - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/dirB/PageB.ui b/Tests/QtAutogen/uicInclude/dirB/PageB.ui deleted file mode 100644 index fa6dfa6..0000000 --- a/Tests/QtAutogen/uicInclude/dirB/PageB.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageB - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/dirB/PageB2.ui b/Tests/QtAutogen/uicInclude/dirB/PageB2.ui deleted file mode 100644 index 2225150..0000000 --- a/Tests/QtAutogen/uicInclude/dirB/PageB2.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageB2 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui b/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui deleted file mode 100644 index 873016e..0000000 --- a/Tests/QtAutogen/uicInclude/dirB/subB/PageBsub.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageBsub - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/uicInclude/main.cpp b/Tests/QtAutogen/uicInclude/main.cpp deleted file mode 100644 index c8e7609..0000000 --- a/Tests/QtAutogen/uicInclude/main.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -#include "main.hpp" - -int main(int argv, char** args) -{ - return 0; -} - -// .ui files in CMAKE_AUTOUIC_SEARCH_PATHS -#include "ui_PageA.h" -// .ui files in AUTOUIC_SEARCH_PATHS -#include "sub/gen/deep/ui_PageB2.h" -#include "subB/ui_PageBsub.h" -#include "ui_PageB.h" -// .ui files in source's vicinity -#include "sub/gen/deep/ui_PageC2.h" -#include "subC/ui_PageCsub.h" -#include "ui_PageC.h" diff --git a/Tests/QtAutogen/uicInclude/main.hpp b/Tests/QtAutogen/uicInclude/main.hpp deleted file mode 100644 index 58ddc26..0000000 --- a/Tests/QtAutogen/uicInclude/main.hpp +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef MAIN_HPP -#define MAIN_HPP - -#include "ui_PageA.h" - -#endif diff --git a/Tests/QtAutogen/uicInclude/subC/PageCsub.ui b/Tests/QtAutogen/uicInclude/subC/PageCsub.ui deleted file mode 100644 index 0268326..0000000 --- a/Tests/QtAutogen/uicInclude/subC/PageCsub.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - PageCsub - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - -- cgit v0.12 From b8ef28ae1f442144f55e23b8defffe01aa350c44 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:01:48 +0100 Subject: Autogen: Tests: Separate ObjectLibrary test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/ObjectLibrary/CMakeLists.txt | 18 ++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt | 2 ++ Tests/QtAutogen/ObjectLibrary/a/classa.cpp | 7 +++++++ Tests/QtAutogen/ObjectLibrary/a/classa.h | 23 +++++++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/b/classb.cpp | 7 +++++++ Tests/QtAutogen/ObjectLibrary/b/classb.h | 23 +++++++++++++++++++++++ Tests/QtAutogen/ObjectLibrary/main.cpp | 13 +++++++++++++ Tests/QtAutogen/objectLibrary/CMakeLists.txt | 14 -------------- Tests/QtAutogen/objectLibrary/a/CMakeLists.txt | 2 -- Tests/QtAutogen/objectLibrary/a/classa.cpp | 7 ------- Tests/QtAutogen/objectLibrary/a/classa.h | 23 ----------------------- Tests/QtAutogen/objectLibrary/b/classb.cpp | 7 ------- Tests/QtAutogen/objectLibrary/b/classb.h | 23 ----------------------- Tests/QtAutogen/objectLibrary/main.cpp | 13 ------------- 16 files changed, 94 insertions(+), 93 deletions(-) create mode 100644 Tests/QtAutogen/ObjectLibrary/CMakeLists.txt create mode 100644 Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt create mode 100644 Tests/QtAutogen/ObjectLibrary/a/classa.cpp create mode 100644 Tests/QtAutogen/ObjectLibrary/a/classa.h create mode 100644 Tests/QtAutogen/ObjectLibrary/b/classb.cpp create mode 100644 Tests/QtAutogen/ObjectLibrary/b/classb.h create mode 100644 Tests/QtAutogen/ObjectLibrary/main.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/CMakeLists.txt delete mode 100644 Tests/QtAutogen/objectLibrary/a/CMakeLists.txt delete mode 100644 Tests/QtAutogen/objectLibrary/a/classa.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/a/classa.h delete mode 100644 Tests/QtAutogen/objectLibrary/b/classb.cpp delete mode 100644 Tests/QtAutogen/objectLibrary/b/classb.h delete mode 100644 Tests/QtAutogen/objectLibrary/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 288ae60..8fb9ab3 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# OBJECT libraries -add_subdirectory(objectLibrary) - -# -- Test # MacOS Framework if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) add_subdirectory(macosFW) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index e873d06..9e49153 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -24,3 +24,4 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) +ADD_AUTOGEN_TEST(ObjectLibrary someProgram) diff --git a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt new file mode 100644 index 0000000..088a24c --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +project(ObjectLibrary) +include("../AutogenTest.cmake") + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) + +# Object library a defined in a subdirectory +add_subdirectory(a) + +# Object library b defined locally +include_directories(b) +add_library(b OBJECT b/classb.cpp) +target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES}) + +# Executable with OBJECT library generator expressions +add_executable(someProgram main.cpp $ $) +target_link_libraries(someProgram ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt new file mode 100644 index 0000000..fe76ac3 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(a OBJECT classa.cpp) +target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES}) diff --git a/Tests/QtAutogen/ObjectLibrary/a/classa.cpp b/Tests/QtAutogen/ObjectLibrary/a/classa.cpp new file mode 100644 index 0000000..4f08fda --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/classa.cpp @@ -0,0 +1,7 @@ +#include "classa.h" +#include + +void ClassA::slotDoSomething() +{ + qDebug() << m_member; +} diff --git a/Tests/QtAutogen/ObjectLibrary/a/classa.h b/Tests/QtAutogen/ObjectLibrary/a/classa.h new file mode 100644 index 0000000..fa5fed9 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/a/classa.h @@ -0,0 +1,23 @@ +#ifndef CLASSA_H +#define CLASSA_H + +#include +#include + +class ClassA : public QObject +{ + Q_OBJECT +public: + ClassA() + : m_member("Hello A") + { + } + +public slots: + void slotDoSomething(); + +private: + QString m_member; +}; + +#endif diff --git a/Tests/QtAutogen/ObjectLibrary/b/classb.cpp b/Tests/QtAutogen/ObjectLibrary/b/classb.cpp new file mode 100644 index 0000000..26e0926 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/b/classb.cpp @@ -0,0 +1,7 @@ +#include "classb.h" +#include + +void ClassB::slotDoSomething() +{ + qDebug() << m_member; +} diff --git a/Tests/QtAutogen/ObjectLibrary/b/classb.h b/Tests/QtAutogen/ObjectLibrary/b/classb.h new file mode 100644 index 0000000..783bb48 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/b/classb.h @@ -0,0 +1,23 @@ +#ifndef CLASSB_H +#define CLASSB_H + +#include +#include + +class ClassB : public QObject +{ + Q_OBJECT +public: + ClassB() + : m_member("Hello B") + { + } + +public slots: + void slotDoSomething(); + +private: + QString m_member; +}; + +#endif diff --git a/Tests/QtAutogen/ObjectLibrary/main.cpp b/Tests/QtAutogen/ObjectLibrary/main.cpp new file mode 100644 index 0000000..cacf0fd --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/main.cpp @@ -0,0 +1,13 @@ +#include "a/classa.h" +#include "b/classb.h" + +int main(int argc, char** argv) +{ + ClassA a; + a.slotDoSomething(); + + ClassB b; + b.slotDoSomething(); + + return 0; +} diff --git a/Tests/QtAutogen/objectLibrary/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/CMakeLists.txt deleted file mode 100644 index 9b29a40..0000000 --- a/Tests/QtAutogen/objectLibrary/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) - -# Object library a defined in a subdirectory -add_subdirectory(a) - -# Object library b defined locally -include_directories(b) -add_library(b OBJECT b/classb.cpp) -target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES}) - -# Executable with OBJECT library generator expressions -add_executable(someProgram main.cpp $ $) -target_link_libraries(someProgram ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt deleted file mode 100644 index fe76ac3..0000000 --- a/Tests/QtAutogen/objectLibrary/a/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(a OBJECT classa.cpp) -target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES}) diff --git a/Tests/QtAutogen/objectLibrary/a/classa.cpp b/Tests/QtAutogen/objectLibrary/a/classa.cpp deleted file mode 100644 index 4f08fda..0000000 --- a/Tests/QtAutogen/objectLibrary/a/classa.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "classa.h" -#include - -void ClassA::slotDoSomething() -{ - qDebug() << m_member; -} diff --git a/Tests/QtAutogen/objectLibrary/a/classa.h b/Tests/QtAutogen/objectLibrary/a/classa.h deleted file mode 100644 index fa5fed9..0000000 --- a/Tests/QtAutogen/objectLibrary/a/classa.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CLASSA_H -#define CLASSA_H - -#include -#include - -class ClassA : public QObject -{ - Q_OBJECT -public: - ClassA() - : m_member("Hello A") - { - } - -public slots: - void slotDoSomething(); - -private: - QString m_member; -}; - -#endif diff --git a/Tests/QtAutogen/objectLibrary/b/classb.cpp b/Tests/QtAutogen/objectLibrary/b/classb.cpp deleted file mode 100644 index 26e0926..0000000 --- a/Tests/QtAutogen/objectLibrary/b/classb.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "classb.h" -#include - -void ClassB::slotDoSomething() -{ - qDebug() << m_member; -} diff --git a/Tests/QtAutogen/objectLibrary/b/classb.h b/Tests/QtAutogen/objectLibrary/b/classb.h deleted file mode 100644 index 783bb48..0000000 --- a/Tests/QtAutogen/objectLibrary/b/classb.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef CLASSB_H -#define CLASSB_H - -#include -#include - -class ClassB : public QObject -{ - Q_OBJECT -public: - ClassB() - : m_member("Hello B") - { - } - -public slots: - void slotDoSomething(); - -private: - QString m_member; -}; - -#endif diff --git a/Tests/QtAutogen/objectLibrary/main.cpp b/Tests/QtAutogen/objectLibrary/main.cpp deleted file mode 100644 index cacf0fd..0000000 --- a/Tests/QtAutogen/objectLibrary/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "a/classa.h" -#include "b/classb.h" - -int main(int argc, char** argv) -{ - ClassA a; - a.slotDoSomething(); - - ClassB b; - b.slotDoSomething(); - - return 0; -} -- cgit v0.12 From d7868687c814cded6319dd0cfd9fff5c737bf0f0 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:07:55 +0100 Subject: Autogen: Tests: Separate MacOsFW test --- Tests/QtAutogen/CMakeLists.txt | 6 ---- Tests/QtAutogen/CommonTests.cmake | 3 ++ Tests/QtAutogen/MacOsFW/CMakeLists.txt | 21 +++++++++++++ Tests/QtAutogen/MacOsFW/src/CMakeLists.txt | 33 +++++++++++++++++++ Tests/QtAutogen/MacOsFW/src/macos_fw_lib.cpp | 17 ++++++++++ Tests/QtAutogen/MacOsFW/src/macos_fw_lib.h | 18 +++++++++++ Tests/QtAutogen/MacOsFW/test/CMakeLists.txt | 19 +++++++++++ Tests/QtAutogen/MacOsFW/test/testMacosFWLib.cpp | 42 +++++++++++++++++++++++++ Tests/QtAutogen/MacOsFW/test/testMacosFWLib.h | 7 +++++ Tests/QtAutogen/macosFW/CMakeLists.txt | 20 ------------ Tests/QtAutogen/macosFW/src/CMakeLists.txt | 33 ------------------- Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp | 17 ---------- Tests/QtAutogen/macosFW/src/macos_fw_lib.h | 18 ----------- Tests/QtAutogen/macosFW/test/CMakeLists.txt | 19 ----------- Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp | 42 ------------------------- Tests/QtAutogen/macosFW/test/testMacosFWLib.h | 7 ----- 16 files changed, 160 insertions(+), 162 deletions(-) create mode 100644 Tests/QtAutogen/MacOsFW/CMakeLists.txt create mode 100644 Tests/QtAutogen/MacOsFW/src/CMakeLists.txt create mode 100644 Tests/QtAutogen/MacOsFW/src/macos_fw_lib.cpp create mode 100644 Tests/QtAutogen/MacOsFW/src/macos_fw_lib.h create mode 100644 Tests/QtAutogen/MacOsFW/test/CMakeLists.txt create mode 100644 Tests/QtAutogen/MacOsFW/test/testMacosFWLib.cpp create mode 100644 Tests/QtAutogen/MacOsFW/test/testMacosFWLib.h delete mode 100644 Tests/QtAutogen/macosFW/CMakeLists.txt delete mode 100644 Tests/QtAutogen/macosFW/src/CMakeLists.txt delete mode 100644 Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp delete mode 100644 Tests/QtAutogen/macosFW/src/macos_fw_lib.h delete mode 100644 Tests/QtAutogen/macosFW/test/CMakeLists.txt delete mode 100644 Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp delete mode 100644 Tests/QtAutogen/macosFW/test/testMacosFWLib.h diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 8fb9ab3..d13c826 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,12 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# MacOS Framework -if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) - add_subdirectory(macosFW) -endif() - -# -- Test # Source files with the same basename in different subdirectories add_subdirectory(sameName) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 9e49153..1e2894e 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -25,3 +25,6 @@ if(QT_TEST_ALLOW_QT_MACROS) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) ADD_AUTOGEN_TEST(ObjectLibrary someProgram) +if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) + ADD_AUTOGEN_TEST(MacOsFW) +endif() diff --git a/Tests/QtAutogen/MacOsFW/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/CMakeLists.txt new file mode 100644 index 0000000..26d2019 --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.10) +project(MacOsFW) +include("../AutogenTest.cmake") + +find_package(Qt5Test REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib) +set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib) + +if(POLICY CMP0042) # in CMake 3.0.0+ + set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default +endif(POLICY CMP0042) + +if(POLICY CMP0068) # in CMake 3.9+ + cmake_policy(SET CMP0068 NEW) +endif(POLICY CMP0068) + +add_subdirectory(src) +add_subdirectory(test) diff --git a/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt new file mode 100644 index 0000000..a02be00 --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt @@ -0,0 +1,33 @@ +set(MACOS_FW_LIB_VERSION "0.1") +set(MACOS_FW_LIB_SRCS + macos_fw_lib.cpp +) +set(MACOS_FW_LIB_HDRS + macos_fw_lib.h +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${Qt5Core_INCLUDE_DIRS} +) + +add_library(macos_fw_lib SHARED + ${MACOS_FW_LIB_SRCS} + ${MACOS_FW_LIB_HDRS} +) +set_target_properties(macos_fw_lib PROPERTIES AUTOMOC TRUE) +set_target_properties(macos_fw_lib PROPERTIES + CLEAN_DIRECT_OUTPUT 1 + FRAMEWORK 1 + FRAMEWORK_VERSION ${MACOS_FW_LIB_VERSION} + VERSION ${MACOS_FW_LIB_VERSION} + SOVERSION ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MACOS_FW_LIB_VERSION} + MACOSX_FRAMEWORK_IDENTIFIER org.macos.fw_lib + POSITION_INDEPENDENT_CODE ON + PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}" +) +target_link_libraries(macos_fw_lib + Qt5::Core +) diff --git a/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.cpp b/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.cpp new file mode 100644 index 0000000..881a8c9 --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.cpp @@ -0,0 +1,17 @@ +#include "macos_fw_lib.h" + +#include +#include + +MacosFWLib::MacosFWLib() +{ +} + +MacosFWLib::~MacosFWLib() +{ +} + +QString MacosFWLib::qtVersionString() const +{ + return QString(qVersion()); +} diff --git a/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.h b/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.h new file mode 100644 index 0000000..e66e0ea --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/src/macos_fw_lib.h @@ -0,0 +1,18 @@ +#ifndef MACOSFWLIB_H +#define MACOSFWLIB_H + +#include +#include + +class __attribute__((visibility("default"))) MacosFWLib : public QObject +{ + Q_OBJECT + +public: + explicit MacosFWLib(); + ~MacosFWLib(); + + QString qtVersionString() const; +}; + +#endif // MACOSFWLIB_H diff --git a/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt new file mode 100644 index 0000000..521c184 --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt @@ -0,0 +1,19 @@ +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../src +) +include_directories(SYSTEM + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Widgets_INCLUDE_DIRS} +) + +set(testname AutomocMacosFWLib) +add_executable(${testname} testMacosFWLib.cpp) +set_target_properties(${testname} PROPERTIES AUTOMOC TRUE) +target_link_libraries(${testname} + Qt5::Core + Qt5::Widgets + Qt5::Test + macos_fw_lib +) diff --git a/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.cpp b/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.cpp new file mode 100644 index 0000000..3476d61 --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.cpp @@ -0,0 +1,42 @@ +#include +#include + +#include "macos_fw_lib.h" +#include "testMacosFWLib.h" + +class TestMacosFWLib : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void cleanupTestCase(); + void init() {} + void cleanup() {} + + void testQtVersion(); +}; + +void TestMacosFWLib::initTestCase() +{ +} + +void TestMacosFWLib::cleanupTestCase() +{ +} + +void TestMacosFWLib::testQtVersion() +{ + MacosFWLib* testLib = new MacosFWLib(); + QVERIFY(testLib->qtVersionString().contains("5.")); + testLib->deleteLater(); +} + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv, false); + MacosFWLib testObject; + return QTest::qExec(&testObject, argc, argv); +} + +#include "testMacosFWLib.moc" diff --git a/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.h b/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.h new file mode 100644 index 0000000..1fe8dae --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/test/testMacosFWLib.h @@ -0,0 +1,7 @@ +#ifndef TESTMACOSFWLIB_H +#define TESTMACOSFWLIB_H + +#include "qapplication.h" +#include + +#endif // TESTMACOSFWLIB_H diff --git a/Tests/QtAutogen/macosFW/CMakeLists.txt b/Tests/QtAutogen/macosFW/CMakeLists.txt deleted file mode 100644 index 114d9ba..0000000 --- a/Tests/QtAutogen/macosFW/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(macos-fw-test) - -find_package(Qt5Test REQUIRED) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib) -set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib) - -if(POLICY CMP0042) # in CMake 3.0.0+ - set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default -endif(POLICY CMP0042) - -if(POLICY CMP0068) # in CMake 3.9+ - cmake_policy(SET CMP0068 NEW) -endif(POLICY CMP0068) - -add_subdirectory(src) -add_subdirectory(test) diff --git a/Tests/QtAutogen/macosFW/src/CMakeLists.txt b/Tests/QtAutogen/macosFW/src/CMakeLists.txt deleted file mode 100644 index a02be00..0000000 --- a/Tests/QtAutogen/macosFW/src/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -set(MACOS_FW_LIB_VERSION "0.1") -set(MACOS_FW_LIB_SRCS - macos_fw_lib.cpp -) -set(MACOS_FW_LIB_HDRS - macos_fw_lib.h -) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${Qt5Core_INCLUDE_DIRS} -) - -add_library(macos_fw_lib SHARED - ${MACOS_FW_LIB_SRCS} - ${MACOS_FW_LIB_HDRS} -) -set_target_properties(macos_fw_lib PROPERTIES AUTOMOC TRUE) -set_target_properties(macos_fw_lib PROPERTIES - CLEAN_DIRECT_OUTPUT 1 - FRAMEWORK 1 - FRAMEWORK_VERSION ${MACOS_FW_LIB_VERSION} - VERSION ${MACOS_FW_LIB_VERSION} - SOVERSION ${MACOS_FW_LIB_VERSION} - MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MACOS_FW_LIB_VERSION} - MACOSX_FRAMEWORK_IDENTIFIER org.macos.fw_lib - POSITION_INDEPENDENT_CODE ON - PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}" -) -target_link_libraries(macos_fw_lib - Qt5::Core -) diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp b/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp deleted file mode 100644 index 881a8c9..0000000 --- a/Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "macos_fw_lib.h" - -#include -#include - -MacosFWLib::MacosFWLib() -{ -} - -MacosFWLib::~MacosFWLib() -{ -} - -QString MacosFWLib::qtVersionString() const -{ - return QString(qVersion()); -} diff --git a/Tests/QtAutogen/macosFW/src/macos_fw_lib.h b/Tests/QtAutogen/macosFW/src/macos_fw_lib.h deleted file mode 100644 index e66e0ea..0000000 --- a/Tests/QtAutogen/macosFW/src/macos_fw_lib.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MACOSFWLIB_H -#define MACOSFWLIB_H - -#include -#include - -class __attribute__((visibility("default"))) MacosFWLib : public QObject -{ - Q_OBJECT - -public: - explicit MacosFWLib(); - ~MacosFWLib(); - - QString qtVersionString() const; -}; - -#endif // MACOSFWLIB_H diff --git a/Tests/QtAutogen/macosFW/test/CMakeLists.txt b/Tests/QtAutogen/macosFW/test/CMakeLists.txt deleted file mode 100644 index 521c184..0000000 --- a/Tests/QtAutogen/macosFW/test/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../src -) -include_directories(SYSTEM - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} -) - -set(testname AutomocMacosFWLib) -add_executable(${testname} testMacosFWLib.cpp) -set_target_properties(${testname} PROPERTIES AUTOMOC TRUE) -target_link_libraries(${testname} - Qt5::Core - Qt5::Widgets - Qt5::Test - macos_fw_lib -) diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp b/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp deleted file mode 100644 index 3476d61..0000000 --- a/Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -#include "macos_fw_lib.h" -#include "testMacosFWLib.h" - -class TestMacosFWLib : public QObject -{ - Q_OBJECT - -private slots: - void initTestCase(); - void cleanupTestCase(); - void init() {} - void cleanup() {} - - void testQtVersion(); -}; - -void TestMacosFWLib::initTestCase() -{ -} - -void TestMacosFWLib::cleanupTestCase() -{ -} - -void TestMacosFWLib::testQtVersion() -{ - MacosFWLib* testLib = new MacosFWLib(); - QVERIFY(testLib->qtVersionString().contains("5.")); - testLib->deleteLater(); -} - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv, false); - MacosFWLib testObject; - return QTest::qExec(&testObject, argc, argv); -} - -#include "testMacosFWLib.moc" diff --git a/Tests/QtAutogen/macosFW/test/testMacosFWLib.h b/Tests/QtAutogen/macosFW/test/testMacosFWLib.h deleted file mode 100644 index 1fe8dae..0000000 --- a/Tests/QtAutogen/macosFW/test/testMacosFWLib.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef TESTMACOSFWLIB_H -#define TESTMACOSFWLIB_H - -#include "qapplication.h" -#include - -#endif // TESTMACOSFWLIB_H -- cgit v0.12 From 45b6776ab301f4b5ec51e27863ffe061b1a0d60a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:12:30 +0100 Subject: Autogen: Tests: Separate SameName test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/SameName/CMakeLists.txt | 39 +++++++++++++++++++++++++++++++ Tests/QtAutogen/SameName/aaa/bbb/data.qrc | 6 +++++ Tests/QtAutogen/SameName/aaa/bbb/item.cpp | 22 +++++++++++++++++ Tests/QtAutogen/SameName/aaa/bbb/item.hpp | 18 ++++++++++++++ Tests/QtAutogen/SameName/aaa/data.qrc | 6 +++++ Tests/QtAutogen/SameName/aaa/item.cpp | 22 +++++++++++++++++ Tests/QtAutogen/SameName/aaa/item.hpp | 18 ++++++++++++++ Tests/QtAutogen/SameName/aaa/view.ui | 24 +++++++++++++++++++ Tests/QtAutogen/SameName/bbb/aaa/data.qrc | 6 +++++ Tests/QtAutogen/SameName/bbb/aaa/item.cpp | 22 +++++++++++++++++ Tests/QtAutogen/SameName/bbb/aaa/item.hpp | 18 ++++++++++++++ Tests/QtAutogen/SameName/bbb/data.qrc | 6 +++++ Tests/QtAutogen/SameName/bbb/item.cpp | 23 ++++++++++++++++++ Tests/QtAutogen/SameName/bbb/item.hpp | 17 ++++++++++++++ Tests/QtAutogen/SameName/bbb/view.ui | 24 +++++++++++++++++++ Tests/QtAutogen/SameName/ccc/data.qrc | 6 +++++ Tests/QtAutogen/SameName/ccc/item.cpp | 25 ++++++++++++++++++++ Tests/QtAutogen/SameName/ccc/item.hpp | 18 ++++++++++++++ Tests/QtAutogen/SameName/ccc/view.ui | 24 +++++++++++++++++++ Tests/QtAutogen/SameName/data.qrc | 5 ++++ Tests/QtAutogen/SameName/item.cpp | 20 ++++++++++++++++ Tests/QtAutogen/SameName/item.hpp | 15 ++++++++++++ Tests/QtAutogen/SameName/main.cpp | 16 +++++++++++++ Tests/QtAutogen/SameName/view.ui | 24 +++++++++++++++++++ Tests/QtAutogen/sameName/CMakeLists.txt | 34 --------------------------- Tests/QtAutogen/sameName/aaa/bbb/data.qrc | 6 ----- Tests/QtAutogen/sameName/aaa/bbb/item.cpp | 22 ----------------- Tests/QtAutogen/sameName/aaa/bbb/item.hpp | 18 -------------- Tests/QtAutogen/sameName/aaa/data.qrc | 6 ----- Tests/QtAutogen/sameName/aaa/item.cpp | 22 ----------------- Tests/QtAutogen/sameName/aaa/item.hpp | 18 -------------- Tests/QtAutogen/sameName/aaa/view.ui | 24 ------------------- Tests/QtAutogen/sameName/bbb/aaa/data.qrc | 6 ----- Tests/QtAutogen/sameName/bbb/aaa/item.cpp | 22 ----------------- Tests/QtAutogen/sameName/bbb/aaa/item.hpp | 18 -------------- Tests/QtAutogen/sameName/bbb/data.qrc | 6 ----- Tests/QtAutogen/sameName/bbb/item.cpp | 23 ------------------ Tests/QtAutogen/sameName/bbb/item.hpp | 17 -------------- Tests/QtAutogen/sameName/bbb/view.ui | 24 ------------------- Tests/QtAutogen/sameName/ccc/data.qrc | 6 ----- Tests/QtAutogen/sameName/ccc/item.cpp | 25 -------------------- Tests/QtAutogen/sameName/ccc/item.hpp | 18 -------------- Tests/QtAutogen/sameName/ccc/view.ui | 24 ------------------- Tests/QtAutogen/sameName/data.qrc | 5 ---- Tests/QtAutogen/sameName/item.cpp | 20 ---------------- Tests/QtAutogen/sameName/item.hpp | 15 ------------ Tests/QtAutogen/sameName/main.cpp | 16 ------------- Tests/QtAutogen/sameName/view.ui | 24 ------------------- 50 files changed, 425 insertions(+), 423 deletions(-) create mode 100644 Tests/QtAutogen/SameName/CMakeLists.txt create mode 100644 Tests/QtAutogen/SameName/aaa/bbb/data.qrc create mode 100644 Tests/QtAutogen/SameName/aaa/bbb/item.cpp create mode 100644 Tests/QtAutogen/SameName/aaa/bbb/item.hpp create mode 100644 Tests/QtAutogen/SameName/aaa/data.qrc create mode 100644 Tests/QtAutogen/SameName/aaa/item.cpp create mode 100644 Tests/QtAutogen/SameName/aaa/item.hpp create mode 100644 Tests/QtAutogen/SameName/aaa/view.ui create mode 100644 Tests/QtAutogen/SameName/bbb/aaa/data.qrc create mode 100644 Tests/QtAutogen/SameName/bbb/aaa/item.cpp create mode 100644 Tests/QtAutogen/SameName/bbb/aaa/item.hpp create mode 100644 Tests/QtAutogen/SameName/bbb/data.qrc create mode 100644 Tests/QtAutogen/SameName/bbb/item.cpp create mode 100644 Tests/QtAutogen/SameName/bbb/item.hpp create mode 100644 Tests/QtAutogen/SameName/bbb/view.ui create mode 100644 Tests/QtAutogen/SameName/ccc/data.qrc create mode 100644 Tests/QtAutogen/SameName/ccc/item.cpp create mode 100644 Tests/QtAutogen/SameName/ccc/item.hpp create mode 100644 Tests/QtAutogen/SameName/ccc/view.ui create mode 100644 Tests/QtAutogen/SameName/data.qrc create mode 100644 Tests/QtAutogen/SameName/item.cpp create mode 100644 Tests/QtAutogen/SameName/item.hpp create mode 100644 Tests/QtAutogen/SameName/main.cpp create mode 100644 Tests/QtAutogen/SameName/view.ui delete mode 100644 Tests/QtAutogen/sameName/CMakeLists.txt delete mode 100644 Tests/QtAutogen/sameName/aaa/bbb/data.qrc delete mode 100644 Tests/QtAutogen/sameName/aaa/bbb/item.cpp delete mode 100644 Tests/QtAutogen/sameName/aaa/bbb/item.hpp delete mode 100644 Tests/QtAutogen/sameName/aaa/data.qrc delete mode 100644 Tests/QtAutogen/sameName/aaa/item.cpp delete mode 100644 Tests/QtAutogen/sameName/aaa/item.hpp delete mode 100644 Tests/QtAutogen/sameName/aaa/view.ui delete mode 100644 Tests/QtAutogen/sameName/bbb/aaa/data.qrc delete mode 100644 Tests/QtAutogen/sameName/bbb/aaa/item.cpp delete mode 100644 Tests/QtAutogen/sameName/bbb/aaa/item.hpp delete mode 100644 Tests/QtAutogen/sameName/bbb/data.qrc delete mode 100644 Tests/QtAutogen/sameName/bbb/item.cpp delete mode 100644 Tests/QtAutogen/sameName/bbb/item.hpp delete mode 100644 Tests/QtAutogen/sameName/bbb/view.ui delete mode 100644 Tests/QtAutogen/sameName/ccc/data.qrc delete mode 100644 Tests/QtAutogen/sameName/ccc/item.cpp delete mode 100644 Tests/QtAutogen/sameName/ccc/item.hpp delete mode 100644 Tests/QtAutogen/sameName/ccc/view.ui delete mode 100644 Tests/QtAutogen/sameName/data.qrc delete mode 100644 Tests/QtAutogen/sameName/item.cpp delete mode 100644 Tests/QtAutogen/sameName/item.hpp delete mode 100644 Tests/QtAutogen/sameName/main.cpp delete mode 100644 Tests/QtAutogen/sameName/view.ui diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index d13c826..47164d2 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,10 +60,6 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Source files with the same basename in different subdirectories -add_subdirectory(sameName) - -# -- Test # Tests static library cycles add_subdirectory(staticLibraryCycle) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 1e2894e..7f72386 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -28,3 +28,4 @@ ADD_AUTOGEN_TEST(ObjectLibrary someProgram) if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) ADD_AUTOGEN_TEST(MacOsFW) endif() +ADD_AUTOGEN_TEST(SameName sameName) diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt new file mode 100644 index 0000000..c7d6e52 --- /dev/null +++ b/Tests/QtAutogen/SameName/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.10) +project(SameName) +include("../AutogenTest.cmake") + +# Test AUTOMOC and AUTORCC on source files with the same name +# but in different subdirectories + +add_executable(sameName + aaa/bbb/item.cpp + aaa/bbb/data.qrc + aaa/item.cpp + aaa/data.qrc + bbb/aaa/item.cpp + bbb/aaa/data.qrc + bbb/item.cpp + bbb/data.qrc + ccc/item.cpp + ccc/data.qrc + item.cpp + data.qrc + main.cpp +) +target_link_libraries(sameName ${QT_LIBRARIES}) +set_target_properties(sameName PROPERTIES + AUTOMOC TRUE + AUTOUIC TRUE + AUTORCC TRUE +) + +# Set different compression levels +if (QT_TEST_VERSION STREQUAL 4) + set(rccCompress "-compress") +else() + set(rccCompress "--compress") +endif() +set_target_properties(sameName PROPERTIES AUTORCC_OPTIONS "${rccCompress};0" ) +set_source_files_properties(aaa/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};1" ) +set_source_files_properties(bbb/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};2" ) +set_source_files_properties(ccc/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};3" ) diff --git a/Tests/QtAutogen/SameName/aaa/bbb/data.qrc b/Tests/QtAutogen/SameName/aaa/bbb/data.qrc new file mode 100644 index 0000000..0ea3537 --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/bbb/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/SameName/aaa/bbb/item.cpp b/Tests/QtAutogen/SameName/aaa/bbb/item.cpp new file mode 100644 index 0000000..850206f --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/bbb/item.cpp @@ -0,0 +1,22 @@ +#include "item.hpp" + +namespace aaa { +namespace bbb { + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + MocLocal obj; +} +} +} + +#include "aaa/bbb/item.moc" diff --git a/Tests/QtAutogen/SameName/aaa/bbb/item.hpp b/Tests/QtAutogen/SameName/aaa/bbb/item.hpp new file mode 100644 index 0000000..0855043 --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/bbb/item.hpp @@ -0,0 +1,18 @@ +#ifndef AAA_BBB_ITEM_HPP +#define AAA_BBB_ITEM_HPP + +#include + +namespace aaa { +namespace bbb { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} +} + +#endif diff --git a/Tests/QtAutogen/SameName/aaa/data.qrc b/Tests/QtAutogen/SameName/aaa/data.qrc new file mode 100644 index 0000000..379af60 --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/SameName/aaa/item.cpp b/Tests/QtAutogen/SameName/aaa/item.cpp new file mode 100644 index 0000000..e35d3d1 --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/item.cpp @@ -0,0 +1,22 @@ +#include "item.hpp" +// Include ui_view.h only in header + +namespace aaa { + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + Ui_ViewAAA ui; + MocLocal obj; +} +} + +#include "aaa/item.moc" diff --git a/Tests/QtAutogen/SameName/aaa/item.hpp b/Tests/QtAutogen/SameName/aaa/item.hpp new file mode 100644 index 0000000..875f72f --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/item.hpp @@ -0,0 +1,18 @@ +#ifndef AAA_ITEM_HPP +#define AAA_ITEM_HPP + +#include +// Include ui_view.h only in header +#include + +namespace aaa { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/SameName/aaa/view.ui b/Tests/QtAutogen/SameName/aaa/view.ui new file mode 100644 index 0000000..0f09980 --- /dev/null +++ b/Tests/QtAutogen/SameName/aaa/view.ui @@ -0,0 +1,24 @@ + + + ViewAAA + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/SameName/bbb/aaa/data.qrc b/Tests/QtAutogen/SameName/bbb/aaa/data.qrc new file mode 100644 index 0000000..da98009 --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/aaa/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/SameName/bbb/aaa/item.cpp b/Tests/QtAutogen/SameName/bbb/aaa/item.cpp new file mode 100644 index 0000000..7ad01c3 --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/aaa/item.cpp @@ -0,0 +1,22 @@ +#include "item.hpp" + +namespace bbb { +namespace aaa { + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + MocLocal obj; +} +} +} + +#include "bbb/aaa/item.moc" diff --git a/Tests/QtAutogen/SameName/bbb/aaa/item.hpp b/Tests/QtAutogen/SameName/bbb/aaa/item.hpp new file mode 100644 index 0000000..be07ca8 --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/aaa/item.hpp @@ -0,0 +1,18 @@ +#ifndef BBB_AAA_ITEM_HPP +#define BBB_AAA_ITEM_HPP + +#include + +namespace bbb { +namespace aaa { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} +} + +#endif diff --git a/Tests/QtAutogen/SameName/bbb/data.qrc b/Tests/QtAutogen/SameName/bbb/data.qrc new file mode 100644 index 0000000..5b080f5 --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/SameName/bbb/item.cpp b/Tests/QtAutogen/SameName/bbb/item.cpp new file mode 100644 index 0000000..9ef128e --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/item.cpp @@ -0,0 +1,23 @@ +#include "item.hpp" +// Include ui_view.h only in source +#include + +namespace bbb { + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + Ui_ViewBBB ui; + MocLocal obj; +} +} + +#include "bbb/item.moc" diff --git a/Tests/QtAutogen/SameName/bbb/item.hpp b/Tests/QtAutogen/SameName/bbb/item.hpp new file mode 100644 index 0000000..d39a9d7 --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/item.hpp @@ -0,0 +1,17 @@ +#ifndef BBB_ITEM_HPP +#define BBB_ITEM_HPP + +#include +// Include ui_view.h only in source + +namespace bbb { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/SameName/bbb/view.ui b/Tests/QtAutogen/SameName/bbb/view.ui new file mode 100644 index 0000000..a8f506e --- /dev/null +++ b/Tests/QtAutogen/SameName/bbb/view.ui @@ -0,0 +1,24 @@ + + + ViewBBB + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/SameName/ccc/data.qrc b/Tests/QtAutogen/SameName/ccc/data.qrc new file mode 100644 index 0000000..f934c39 --- /dev/null +++ b/Tests/QtAutogen/SameName/ccc/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/SameName/ccc/item.cpp b/Tests/QtAutogen/SameName/ccc/item.cpp new file mode 100644 index 0000000..ab8a281 --- /dev/null +++ b/Tests/QtAutogen/SameName/ccc/item.cpp @@ -0,0 +1,25 @@ +#include "item.hpp" +// Include ui_view.h in source and header +#include + +namespace ccc { + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + Ui_ViewCCC ui; + MocLocal obj; +} +} + +// Include own moc files +#include "ccc/item.moc" +#include "moc_item.cpp" diff --git a/Tests/QtAutogen/SameName/ccc/item.hpp b/Tests/QtAutogen/SameName/ccc/item.hpp new file mode 100644 index 0000000..20d9dd9 --- /dev/null +++ b/Tests/QtAutogen/SameName/ccc/item.hpp @@ -0,0 +1,18 @@ +#ifndef CCC_ITEM_HPP +#define CCC_ITEM_HPP + +#include +// Include ui_view.h in source and header +#include + +namespace ccc { + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; +} + +#endif diff --git a/Tests/QtAutogen/SameName/ccc/view.ui b/Tests/QtAutogen/SameName/ccc/view.ui new file mode 100644 index 0000000..7989c69 --- /dev/null +++ b/Tests/QtAutogen/SameName/ccc/view.ui @@ -0,0 +1,24 @@ + + + ViewCCC + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/SameName/data.qrc b/Tests/QtAutogen/SameName/data.qrc new file mode 100644 index 0000000..4ce0b4e --- /dev/null +++ b/Tests/QtAutogen/SameName/data.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + diff --git a/Tests/QtAutogen/SameName/item.cpp b/Tests/QtAutogen/SameName/item.cpp new file mode 100644 index 0000000..3d1fbe7 --- /dev/null +++ b/Tests/QtAutogen/SameName/item.cpp @@ -0,0 +1,20 @@ +#include "item.hpp" +// Include ui_view.h in source and header +#include + +class MocLocal : public QObject +{ + Q_OBJECT; + +public: + MocLocal() = default; + ~MocLocal() = default; +}; + +void Item::go() +{ + Ui_View ui; + MocLocal obj; +} + +#include "item.moc" diff --git a/Tests/QtAutogen/SameName/item.hpp b/Tests/QtAutogen/SameName/item.hpp new file mode 100644 index 0000000..75e83f4 --- /dev/null +++ b/Tests/QtAutogen/SameName/item.hpp @@ -0,0 +1,15 @@ +#ifndef ITEM_HPP +#define ITEM_HPP + +#include +// Include ui_view.h in source and header +#include + +class Item : public QObject +{ + Q_OBJECT + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/SameName/main.cpp b/Tests/QtAutogen/SameName/main.cpp new file mode 100644 index 0000000..a4ffcb3 --- /dev/null +++ b/Tests/QtAutogen/SameName/main.cpp @@ -0,0 +1,16 @@ +#include "aaa/bbb/item.hpp" +#include "aaa/item.hpp" +#include "bbb/aaa/item.hpp" +#include "bbb/item.hpp" +#include "ccc/item.hpp" + +int main(int argv, char** args) +{ + // Object instances + ::aaa::Item aaa_item; + ::aaa::bbb::Item aaa_bbb_item; + ::bbb::Item bbb_item; + ::bbb::aaa::Item bbb_aaa_item; + ::ccc::Item ccc_item; + return 0; +} diff --git a/Tests/QtAutogen/SameName/view.ui b/Tests/QtAutogen/SameName/view.ui new file mode 100644 index 0000000..2ffe734 --- /dev/null +++ b/Tests/QtAutogen/SameName/view.ui @@ -0,0 +1,24 @@ + + + View + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt deleted file mode 100644 index f695875..0000000 --- a/Tests/QtAutogen/sameName/CMakeLists.txt +++ /dev/null @@ -1,34 +0,0 @@ -# Test AUTOMOC and AUTORCC on source files with the same name -# but in different subdirectories - -add_executable(sameName - aaa/bbb/item.cpp - aaa/bbb/data.qrc - aaa/item.cpp - aaa/data.qrc - bbb/aaa/item.cpp - bbb/aaa/data.qrc - bbb/item.cpp - bbb/data.qrc - ccc/item.cpp - ccc/data.qrc - item.cpp - data.qrc - main.cpp -) -target_link_libraries(sameName ${QT_LIBRARIES}) -set_target_properties(sameName PROPERTIES - AUTOMOC TRUE - AUTOUIC TRUE - AUTORCC TRUE) - -# Set different compression levels -if (QT_TEST_VERSION STREQUAL 4) - set(rccCompress "-compress") -else() - set(rccCompress "--compress") -endif() -set_target_properties(sameName PROPERTIES AUTORCC_OPTIONS "${rccCompress};0" ) -set_source_files_properties(aaa/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};1" ) -set_source_files_properties(bbb/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};2" ) -set_source_files_properties(ccc/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};3" ) diff --git a/Tests/QtAutogen/sameName/aaa/bbb/data.qrc b/Tests/QtAutogen/sameName/aaa/bbb/data.qrc deleted file mode 100644 index 0ea3537..0000000 --- a/Tests/QtAutogen/sameName/aaa/bbb/data.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - item.hpp - item.cpp - - diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp b/Tests/QtAutogen/sameName/aaa/bbb/item.cpp deleted file mode 100644 index 850206f..0000000 --- a/Tests/QtAutogen/sameName/aaa/bbb/item.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "item.hpp" - -namespace aaa { -namespace bbb { - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - MocLocal obj; -} -} -} - -#include "aaa/bbb/item.moc" diff --git a/Tests/QtAutogen/sameName/aaa/bbb/item.hpp b/Tests/QtAutogen/sameName/aaa/bbb/item.hpp deleted file mode 100644 index 0855043..0000000 --- a/Tests/QtAutogen/sameName/aaa/bbb/item.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef AAA_BBB_ITEM_HPP -#define AAA_BBB_ITEM_HPP - -#include - -namespace aaa { -namespace bbb { - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; -} -} - -#endif diff --git a/Tests/QtAutogen/sameName/aaa/data.qrc b/Tests/QtAutogen/sameName/aaa/data.qrc deleted file mode 100644 index 379af60..0000000 --- a/Tests/QtAutogen/sameName/aaa/data.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - item.hpp - item.cpp - - diff --git a/Tests/QtAutogen/sameName/aaa/item.cpp b/Tests/QtAutogen/sameName/aaa/item.cpp deleted file mode 100644 index e35d3d1..0000000 --- a/Tests/QtAutogen/sameName/aaa/item.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "item.hpp" -// Include ui_view.h only in header - -namespace aaa { - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - Ui_ViewAAA ui; - MocLocal obj; -} -} - -#include "aaa/item.moc" diff --git a/Tests/QtAutogen/sameName/aaa/item.hpp b/Tests/QtAutogen/sameName/aaa/item.hpp deleted file mode 100644 index 875f72f..0000000 --- a/Tests/QtAutogen/sameName/aaa/item.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef AAA_ITEM_HPP -#define AAA_ITEM_HPP - -#include -// Include ui_view.h only in header -#include - -namespace aaa { - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; -} - -#endif diff --git a/Tests/QtAutogen/sameName/aaa/view.ui b/Tests/QtAutogen/sameName/aaa/view.ui deleted file mode 100644 index 0f09980..0000000 --- a/Tests/QtAutogen/sameName/aaa/view.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - ViewAAA - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/sameName/bbb/aaa/data.qrc b/Tests/QtAutogen/sameName/bbb/aaa/data.qrc deleted file mode 100644 index da98009..0000000 --- a/Tests/QtAutogen/sameName/bbb/aaa/data.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - item.hpp - item.cpp - - diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp b/Tests/QtAutogen/sameName/bbb/aaa/item.cpp deleted file mode 100644 index 7ad01c3..0000000 --- a/Tests/QtAutogen/sameName/bbb/aaa/item.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "item.hpp" - -namespace bbb { -namespace aaa { - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - MocLocal obj; -} -} -} - -#include "bbb/aaa/item.moc" diff --git a/Tests/QtAutogen/sameName/bbb/aaa/item.hpp b/Tests/QtAutogen/sameName/bbb/aaa/item.hpp deleted file mode 100644 index be07ca8..0000000 --- a/Tests/QtAutogen/sameName/bbb/aaa/item.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef BBB_AAA_ITEM_HPP -#define BBB_AAA_ITEM_HPP - -#include - -namespace bbb { -namespace aaa { - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; -} -} - -#endif diff --git a/Tests/QtAutogen/sameName/bbb/data.qrc b/Tests/QtAutogen/sameName/bbb/data.qrc deleted file mode 100644 index 5b080f5..0000000 --- a/Tests/QtAutogen/sameName/bbb/data.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - item.hpp - item.cpp - - diff --git a/Tests/QtAutogen/sameName/bbb/item.cpp b/Tests/QtAutogen/sameName/bbb/item.cpp deleted file mode 100644 index 9ef128e..0000000 --- a/Tests/QtAutogen/sameName/bbb/item.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "item.hpp" -// Include ui_view.h only in source -#include - -namespace bbb { - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - Ui_ViewBBB ui; - MocLocal obj; -} -} - -#include "bbb/item.moc" diff --git a/Tests/QtAutogen/sameName/bbb/item.hpp b/Tests/QtAutogen/sameName/bbb/item.hpp deleted file mode 100644 index d39a9d7..0000000 --- a/Tests/QtAutogen/sameName/bbb/item.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef BBB_ITEM_HPP -#define BBB_ITEM_HPP - -#include -// Include ui_view.h only in source - -namespace bbb { - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; -} - -#endif diff --git a/Tests/QtAutogen/sameName/bbb/view.ui b/Tests/QtAutogen/sameName/bbb/view.ui deleted file mode 100644 index a8f506e..0000000 --- a/Tests/QtAutogen/sameName/bbb/view.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - ViewBBB - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/sameName/ccc/data.qrc b/Tests/QtAutogen/sameName/ccc/data.qrc deleted file mode 100644 index f934c39..0000000 --- a/Tests/QtAutogen/sameName/ccc/data.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - item.hpp - item.cpp - - diff --git a/Tests/QtAutogen/sameName/ccc/item.cpp b/Tests/QtAutogen/sameName/ccc/item.cpp deleted file mode 100644 index ab8a281..0000000 --- a/Tests/QtAutogen/sameName/ccc/item.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "item.hpp" -// Include ui_view.h in source and header -#include - -namespace ccc { - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - Ui_ViewCCC ui; - MocLocal obj; -} -} - -// Include own moc files -#include "ccc/item.moc" -#include "moc_item.cpp" diff --git a/Tests/QtAutogen/sameName/ccc/item.hpp b/Tests/QtAutogen/sameName/ccc/item.hpp deleted file mode 100644 index 20d9dd9..0000000 --- a/Tests/QtAutogen/sameName/ccc/item.hpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef CCC_ITEM_HPP -#define CCC_ITEM_HPP - -#include -// Include ui_view.h in source and header -#include - -namespace ccc { - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; -} - -#endif diff --git a/Tests/QtAutogen/sameName/ccc/view.ui b/Tests/QtAutogen/sameName/ccc/view.ui deleted file mode 100644 index 7989c69..0000000 --- a/Tests/QtAutogen/sameName/ccc/view.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - ViewCCC - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - diff --git a/Tests/QtAutogen/sameName/data.qrc b/Tests/QtAutogen/sameName/data.qrc deleted file mode 100644 index 4ce0b4e..0000000 --- a/Tests/QtAutogen/sameName/data.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.cpp - - diff --git a/Tests/QtAutogen/sameName/item.cpp b/Tests/QtAutogen/sameName/item.cpp deleted file mode 100644 index 3d1fbe7..0000000 --- a/Tests/QtAutogen/sameName/item.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "item.hpp" -// Include ui_view.h in source and header -#include - -class MocLocal : public QObject -{ - Q_OBJECT; - -public: - MocLocal() = default; - ~MocLocal() = default; -}; - -void Item::go() -{ - Ui_View ui; - MocLocal obj; -} - -#include "item.moc" diff --git a/Tests/QtAutogen/sameName/item.hpp b/Tests/QtAutogen/sameName/item.hpp deleted file mode 100644 index 75e83f4..0000000 --- a/Tests/QtAutogen/sameName/item.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef ITEM_HPP -#define ITEM_HPP - -#include -// Include ui_view.h in source and header -#include - -class Item : public QObject -{ - Q_OBJECT - Q_SLOT - void go(); -}; - -#endif diff --git a/Tests/QtAutogen/sameName/main.cpp b/Tests/QtAutogen/sameName/main.cpp deleted file mode 100644 index a4ffcb3..0000000 --- a/Tests/QtAutogen/sameName/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "aaa/bbb/item.hpp" -#include "aaa/item.hpp" -#include "bbb/aaa/item.hpp" -#include "bbb/item.hpp" -#include "ccc/item.hpp" - -int main(int argv, char** args) -{ - // Object instances - ::aaa::Item aaa_item; - ::aaa::bbb::Item aaa_bbb_item; - ::bbb::Item bbb_item; - ::bbb::aaa::Item bbb_aaa_item; - ::ccc::Item ccc_item; - return 0; -} diff --git a/Tests/QtAutogen/sameName/view.ui b/Tests/QtAutogen/sameName/view.ui deleted file mode 100644 index 2ffe734..0000000 --- a/Tests/QtAutogen/sameName/view.ui +++ /dev/null @@ -1,24 +0,0 @@ - - - View - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - - - - - - -- cgit v0.12 From 6ce6fd426ee7649a40c2f253dbc5f814650f0992 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:22:27 +0100 Subject: Autogen: Tests: Separate StaticLibraryCycle test --- Tests/QtAutogen/CMakeLists.txt | 4 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt | 20 ++++++++++++++++++++ Tests/QtAutogen/StaticLibraryCycle/a.cpp | 12 ++++++++++++ Tests/QtAutogen/StaticLibraryCycle/a.h | 15 +++++++++++++++ Tests/QtAutogen/StaticLibraryCycle/b.cpp | 7 +++++++ Tests/QtAutogen/StaticLibraryCycle/b.h | 13 +++++++++++++ Tests/QtAutogen/StaticLibraryCycle/c.cpp | 7 +++++++ Tests/QtAutogen/StaticLibraryCycle/c.h | 13 +++++++++++++ Tests/QtAutogen/StaticLibraryCycle/main.cpp | 8 ++++++++ Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt | 17 ----------------- Tests/QtAutogen/staticLibraryCycle/a.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/a.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/b.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/b.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/c.cpp | 7 ------- Tests/QtAutogen/staticLibraryCycle/c.h | 13 ------------- Tests/QtAutogen/staticLibraryCycle/main.cpp | 8 -------- 18 files changed, 96 insertions(+), 89 deletions(-) create mode 100644 Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt create mode 100644 Tests/QtAutogen/StaticLibraryCycle/a.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/a.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/b.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/b.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/c.cpp create mode 100644 Tests/QtAutogen/StaticLibraryCycle/c.h create mode 100644 Tests/QtAutogen/StaticLibraryCycle/main.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt delete mode 100644 Tests/QtAutogen/staticLibraryCycle/a.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/a.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/b.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/b.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/c.cpp delete mode 100644 Tests/QtAutogen/staticLibraryCycle/c.h delete mode 100644 Tests/QtAutogen/staticLibraryCycle/main.cpp diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 47164d2..833f64e 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -60,9 +60,5 @@ if(NON_ASCII_BDIR AND WIN32) endif() # -- Test -# Tests static library cycles -add_subdirectory(staticLibraryCycle) - -# -- Test # Complex test case add_subdirectory(complex) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 7f72386..29bc4af 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -29,3 +29,4 @@ if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) ADD_AUTOGEN_TEST(MacOsFW) endif() ADD_AUTOGEN_TEST(SameName sameName) +ADD_AUTOGEN_TEST(StaticLibraryCycle slc) diff --git a/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt new file mode 100644 index 0000000..0c2f987 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(StaticLibraryCycle) +include("../AutogenTest.cmake") + +# Test AUTOMOC on cyclic static libraries + +set(CMAKE_AUTOMOC ON) + +# Cyclic static libraries +add_library(slc_a STATIC a.cpp) +target_link_libraries(slc_a ${QT_LIBRARIES} slc_b) + +add_library(slc_b STATIC b.cpp) +target_link_libraries(slc_b ${QT_LIBRARIES} slc_c) + +add_library(slc_c STATIC c.cpp) +target_link_libraries(slc_c ${QT_LIBRARIES} slc_a) + +add_executable(slc main.cpp) +target_link_libraries(slc ${QT_LIBRARIES} slc_a) diff --git a/Tests/QtAutogen/StaticLibraryCycle/a.cpp b/Tests/QtAutogen/StaticLibraryCycle/a.cpp new file mode 100644 index 0000000..faa52e6 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/a.cpp @@ -0,0 +1,12 @@ +#include "a.h" +#include "b.h" + +bool A::recursed = false; + +A::A() +{ + if (!A::recursed) { + A::recursed = true; + B b; + } +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/a.h b/Tests/QtAutogen/StaticLibraryCycle/a.h new file mode 100644 index 0000000..f24398e --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/a.h @@ -0,0 +1,15 @@ +#ifndef CLASSA_HPP +#define CLASSA_HPP + +#include + +class A : public QObject +{ + Q_OBJECT + static bool recursed; + +public: + A(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/b.cpp b/Tests/QtAutogen/StaticLibraryCycle/b.cpp new file mode 100644 index 0000000..a807d89 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/b.cpp @@ -0,0 +1,7 @@ +#include "b.h" +#include "c.h" + +B::B() +{ + C c; +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/b.h b/Tests/QtAutogen/StaticLibraryCycle/b.h new file mode 100644 index 0000000..ededbd8 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/b.h @@ -0,0 +1,13 @@ +#ifndef CLASSB_HPP +#define CLASSB_HPP + +#include + +class B : public QObject +{ + Q_OBJECT +public: + B(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/c.cpp b/Tests/QtAutogen/StaticLibraryCycle/c.cpp new file mode 100644 index 0000000..7d427c2 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/c.cpp @@ -0,0 +1,7 @@ +#include "c.h" +#include "a.h" + +C::C() +{ + A a; +} diff --git a/Tests/QtAutogen/StaticLibraryCycle/c.h b/Tests/QtAutogen/StaticLibraryCycle/c.h new file mode 100644 index 0000000..20f3725 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/c.h @@ -0,0 +1,13 @@ +#ifndef CLASSC_HPP +#define CLASSC_HPP + +#include + +class C : public QObject +{ + Q_OBJECT +public: + C(); +}; + +#endif diff --git a/Tests/QtAutogen/StaticLibraryCycle/main.cpp b/Tests/QtAutogen/StaticLibraryCycle/main.cpp new file mode 100644 index 0000000..f5b7fd2 --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/main.cpp @@ -0,0 +1,8 @@ +#include "a.h" + +int main(int argv, char** args) +{ + // Object instances + A a; + return 0; +} diff --git a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt deleted file mode 100644 index 144a435..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Test AUTOMOC and AUTORCC on source files with the same name -# but in different subdirectories - -set(CMAKE_AUTOMOC ON) - -# Cyclic static libraries -add_library(slc_a STATIC a.cpp) -target_link_libraries(slc_a ${QT_LIBRARIES} slc_b) - -add_library(slc_b STATIC b.cpp) -target_link_libraries(slc_b ${QT_LIBRARIES} slc_c) - -add_library(slc_c STATIC c.cpp) -target_link_libraries(slc_c ${QT_LIBRARIES} slc_a) - -add_executable(slc main.cpp) -target_link_libraries(slc ${QT_LIBRARIES} slc_a) diff --git a/Tests/QtAutogen/staticLibraryCycle/a.cpp b/Tests/QtAutogen/staticLibraryCycle/a.cpp deleted file mode 100644 index 97cc66e..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/a.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "a.h" -#include "b.h" - -A::A() -{ - B b; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/a.h b/Tests/QtAutogen/staticLibraryCycle/a.h deleted file mode 100644 index 7176170..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/a.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSA_HPP -#define CLASSA_HPP - -#include - -class A : public QObject -{ - Q_OBJECT -public: - A(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/b.cpp b/Tests/QtAutogen/staticLibraryCycle/b.cpp deleted file mode 100644 index a807d89..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/b.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "b.h" -#include "c.h" - -B::B() -{ - C c; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/b.h b/Tests/QtAutogen/staticLibraryCycle/b.h deleted file mode 100644 index ededbd8..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/b.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSB_HPP -#define CLASSB_HPP - -#include - -class B : public QObject -{ - Q_OBJECT -public: - B(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/c.cpp b/Tests/QtAutogen/staticLibraryCycle/c.cpp deleted file mode 100644 index 7d427c2..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/c.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "c.h" -#include "a.h" - -C::C() -{ - A a; -} diff --git a/Tests/QtAutogen/staticLibraryCycle/c.h b/Tests/QtAutogen/staticLibraryCycle/c.h deleted file mode 100644 index 20f3725..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/c.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef CLASSC_HPP -#define CLASSC_HPP - -#include - -class C : public QObject -{ - Q_OBJECT -public: - C(); -}; - -#endif diff --git a/Tests/QtAutogen/staticLibraryCycle/main.cpp b/Tests/QtAutogen/staticLibraryCycle/main.cpp deleted file mode 100644 index f5b7fd2..0000000 --- a/Tests/QtAutogen/staticLibraryCycle/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "a.h" - -int main(int argv, char** args) -{ - // Object instances - A a; - return 0; -} -- cgit v0.12 From 4988746e76703269d76c3fb633bafc0767fafbe4 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Fri, 8 Dec 2017 20:28:17 +0100 Subject: Autogen: Tests: Separate Complex test --- Tests/CMakeLists.txt | 34 -- Tests/QtAutogen/CMakeLists.txt | 64 ---- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/Complex/Adir/CMakeLists.txt | 8 + Tests/QtAutogen/Complex/Adir/libA.cpp | 12 + Tests/QtAutogen/Complex/Adir/libA.h | 18 + Tests/QtAutogen/Complex/Bdir/CMakeLists.txt | 9 + Tests/QtAutogen/Complex/Bdir/libB.cpp | 12 + Tests/QtAutogen/Complex/Bdir/libB.h | 22 ++ Tests/QtAutogen/Complex/CMakeLists.txt | 84 +++++ Tests/QtAutogen/Complex/abc.cpp | 39 ++ Tests/QtAutogen/Complex/abc.h | 17 + Tests/QtAutogen/Complex/abc_p.h | 19 + Tests/QtAutogen/Complex/bar.cpp | 17 + Tests/QtAutogen/Complex/blub.cpp | 31 ++ Tests/QtAutogen/Complex/blub.h | 15 + Tests/QtAutogen/Complex/calwidget.cpp | 436 ++++++++++++++++++++++ Tests/QtAutogen/Complex/calwidget.h | 127 +++++++ Tests/QtAutogen/Complex/calwidget.ui | 32 ++ Tests/QtAutogen/Complex/codeeditor.cpp | 146 ++++++++ Tests/QtAutogen/Complex/codeeditor.h | 100 +++++ Tests/QtAutogen/Complex/debug_class.cpp | 10 + Tests/QtAutogen/Complex/debug_class.h | 19 + Tests/QtAutogen/Complex/debug_class.ui | 45 +++ Tests/QtAutogen/Complex/debug_resource.qrc | 5 + Tests/QtAutogen/Complex/foo.cpp | 30 ++ Tests/QtAutogen/Complex/foo.h | 20 + Tests/QtAutogen/Complex/gadget.cpp | 4 + Tests/QtAutogen/Complex/gadget.h | 19 + Tests/QtAutogen/Complex/generated.cpp | 9 + Tests/QtAutogen/Complex/generated.h | 18 + Tests/QtAutogen/Complex/generated.txt.in | 1 + Tests/QtAutogen/Complex/generated_resource.qrc.in | 5 + Tests/QtAutogen/Complex/libC.cpp | 12 + Tests/QtAutogen/Complex/libC.h | 22 ++ Tests/QtAutogen/Complex/main.cpp | 93 +++++ Tests/QtAutogen/Complex/multiplewidgets.cpp | 19 + Tests/QtAutogen/Complex/multiplewidgets.h | 35 ++ Tests/QtAutogen/Complex/myinterface.h.in | 14 + Tests/QtAutogen/Complex/myotherinterface.h.in | 14 + Tests/QtAutogen/Complex/private_slot.cpp | 16 + Tests/QtAutogen/Complex/private_slot.h | 20 + Tests/QtAutogen/Complex/resourcetester.cpp | 26 ++ Tests/QtAutogen/Complex/resourcetester.h | 17 + Tests/QtAutogen/Complex/second_resource.qrc | 5 + Tests/QtAutogen/Complex/second_widget.cpp | 15 + Tests/QtAutogen/Complex/second_widget.h | 18 + Tests/QtAutogen/Complex/second_widget.ui | 32 ++ Tests/QtAutogen/Complex/sub/bar.h | 17 + Tests/QtAutogen/Complex/targetObjectsTest.cpp | 5 + Tests/QtAutogen/Complex/test.qrc | 5 + Tests/QtAutogen/Complex/widget1.ui | 45 +++ Tests/QtAutogen/Complex/widget2.ui | 29 ++ Tests/QtAutogen/Complex/xyz.cpp | 15 + Tests/QtAutogen/Complex/xyz.h | 17 + Tests/QtAutogen/Complex/yaf.cpp | 19 + Tests/QtAutogen/Complex/yaf.h | 15 + Tests/QtAutogen/Complex/yaf_p.h | 19 + Tests/QtAutogen/complex/Adir/CMakeLists.txt | 8 - Tests/QtAutogen/complex/Adir/libA.cpp | 12 - Tests/QtAutogen/complex/Adir/libA.h | 18 - Tests/QtAutogen/complex/Bdir/CMakeLists.txt | 9 - Tests/QtAutogen/complex/Bdir/libB.cpp | 12 - Tests/QtAutogen/complex/Bdir/libB.h | 22 -- Tests/QtAutogen/complex/CMakeLists.txt | 82 ---- Tests/QtAutogen/complex/abc.cpp | 39 -- Tests/QtAutogen/complex/abc.h | 17 - Tests/QtAutogen/complex/abc_p.h | 19 - Tests/QtAutogen/complex/bar.cpp | 17 - Tests/QtAutogen/complex/blub.cpp | 31 -- Tests/QtAutogen/complex/blub.h | 15 - Tests/QtAutogen/complex/calwidget.cpp | 436 ---------------------- Tests/QtAutogen/complex/calwidget.h | 127 ------- Tests/QtAutogen/complex/calwidget.ui | 32 -- Tests/QtAutogen/complex/codeeditor.cpp | 146 -------- Tests/QtAutogen/complex/codeeditor.h | 100 ----- Tests/QtAutogen/complex/debug_class.cpp | 10 - Tests/QtAutogen/complex/debug_class.h | 19 - Tests/QtAutogen/complex/debug_class.ui | 45 --- Tests/QtAutogen/complex/debug_resource.qrc | 5 - Tests/QtAutogen/complex/foo.cpp | 30 -- Tests/QtAutogen/complex/foo.h | 20 - Tests/QtAutogen/complex/gadget.cpp | 4 - Tests/QtAutogen/complex/gadget.h | 19 - Tests/QtAutogen/complex/generated.cpp | 9 - Tests/QtAutogen/complex/generated.h | 18 - Tests/QtAutogen/complex/generated.txt.in | 1 - Tests/QtAutogen/complex/generated_resource.qrc.in | 5 - Tests/QtAutogen/complex/libC.cpp | 12 - Tests/QtAutogen/complex/libC.h | 22 -- Tests/QtAutogen/complex/main.cpp | 93 ----- Tests/QtAutogen/complex/multiplewidgets.cpp | 19 - Tests/QtAutogen/complex/multiplewidgets.h | 35 -- Tests/QtAutogen/complex/myinterface.h.in | 14 - Tests/QtAutogen/complex/myotherinterface.h.in | 14 - Tests/QtAutogen/complex/private_slot.cpp | 16 - Tests/QtAutogen/complex/private_slot.h | 20 - Tests/QtAutogen/complex/resourcetester.cpp | 26 -- Tests/QtAutogen/complex/resourcetester.h | 17 - Tests/QtAutogen/complex/second_resource.qrc | 5 - Tests/QtAutogen/complex/second_widget.cpp | 15 - Tests/QtAutogen/complex/second_widget.h | 18 - Tests/QtAutogen/complex/second_widget.ui | 32 -- Tests/QtAutogen/complex/sub/bar.h | 17 - Tests/QtAutogen/complex/targetObjectsTest.cpp | 5 - Tests/QtAutogen/complex/test.qrc | 5 - Tests/QtAutogen/complex/widget1.ui | 45 --- Tests/QtAutogen/complex/widget2.ui | 29 -- Tests/QtAutogen/complex/xyz.cpp | 15 - Tests/QtAutogen/complex/xyz.h | 17 - Tests/QtAutogen/complex/yaf.cpp | 19 - Tests/QtAutogen/complex/yaf.h | 15 - Tests/QtAutogen/complex/yaf_p.h | 19 - Tests/QtAutogen/defines_test/CMakeLists.txt | 4 - Tests/QtAutogen/defines_test/defines_test.cpp | 38 -- 115 files changed, 1874 insertions(+), 2011 deletions(-) delete mode 100644 Tests/QtAutogen/CMakeLists.txt create mode 100644 Tests/QtAutogen/Complex/Adir/CMakeLists.txt create mode 100644 Tests/QtAutogen/Complex/Adir/libA.cpp create mode 100644 Tests/QtAutogen/Complex/Adir/libA.h create mode 100644 Tests/QtAutogen/Complex/Bdir/CMakeLists.txt create mode 100644 Tests/QtAutogen/Complex/Bdir/libB.cpp create mode 100644 Tests/QtAutogen/Complex/Bdir/libB.h create mode 100644 Tests/QtAutogen/Complex/CMakeLists.txt create mode 100644 Tests/QtAutogen/Complex/abc.cpp create mode 100644 Tests/QtAutogen/Complex/abc.h create mode 100644 Tests/QtAutogen/Complex/abc_p.h create mode 100644 Tests/QtAutogen/Complex/bar.cpp create mode 100644 Tests/QtAutogen/Complex/blub.cpp create mode 100644 Tests/QtAutogen/Complex/blub.h create mode 100644 Tests/QtAutogen/Complex/calwidget.cpp create mode 100644 Tests/QtAutogen/Complex/calwidget.h create mode 100644 Tests/QtAutogen/Complex/calwidget.ui create mode 100644 Tests/QtAutogen/Complex/codeeditor.cpp create mode 100644 Tests/QtAutogen/Complex/codeeditor.h create mode 100644 Tests/QtAutogen/Complex/debug_class.cpp create mode 100644 Tests/QtAutogen/Complex/debug_class.h create mode 100644 Tests/QtAutogen/Complex/debug_class.ui create mode 100644 Tests/QtAutogen/Complex/debug_resource.qrc create mode 100644 Tests/QtAutogen/Complex/foo.cpp create mode 100644 Tests/QtAutogen/Complex/foo.h create mode 100644 Tests/QtAutogen/Complex/gadget.cpp create mode 100644 Tests/QtAutogen/Complex/gadget.h create mode 100644 Tests/QtAutogen/Complex/generated.cpp create mode 100644 Tests/QtAutogen/Complex/generated.h create mode 100644 Tests/QtAutogen/Complex/generated.txt.in create mode 100644 Tests/QtAutogen/Complex/generated_resource.qrc.in create mode 100644 Tests/QtAutogen/Complex/libC.cpp create mode 100644 Tests/QtAutogen/Complex/libC.h create mode 100644 Tests/QtAutogen/Complex/main.cpp create mode 100644 Tests/QtAutogen/Complex/multiplewidgets.cpp create mode 100644 Tests/QtAutogen/Complex/multiplewidgets.h create mode 100644 Tests/QtAutogen/Complex/myinterface.h.in create mode 100644 Tests/QtAutogen/Complex/myotherinterface.h.in create mode 100644 Tests/QtAutogen/Complex/private_slot.cpp create mode 100644 Tests/QtAutogen/Complex/private_slot.h create mode 100644 Tests/QtAutogen/Complex/resourcetester.cpp create mode 100644 Tests/QtAutogen/Complex/resourcetester.h create mode 100644 Tests/QtAutogen/Complex/second_resource.qrc create mode 100644 Tests/QtAutogen/Complex/second_widget.cpp create mode 100644 Tests/QtAutogen/Complex/second_widget.h create mode 100644 Tests/QtAutogen/Complex/second_widget.ui create mode 100644 Tests/QtAutogen/Complex/sub/bar.h create mode 100644 Tests/QtAutogen/Complex/targetObjectsTest.cpp create mode 100644 Tests/QtAutogen/Complex/test.qrc create mode 100644 Tests/QtAutogen/Complex/widget1.ui create mode 100644 Tests/QtAutogen/Complex/widget2.ui create mode 100644 Tests/QtAutogen/Complex/xyz.cpp create mode 100644 Tests/QtAutogen/Complex/xyz.h create mode 100644 Tests/QtAutogen/Complex/yaf.cpp create mode 100644 Tests/QtAutogen/Complex/yaf.h create mode 100644 Tests/QtAutogen/Complex/yaf_p.h delete mode 100644 Tests/QtAutogen/complex/Adir/CMakeLists.txt delete mode 100644 Tests/QtAutogen/complex/Adir/libA.cpp delete mode 100644 Tests/QtAutogen/complex/Adir/libA.h delete mode 100644 Tests/QtAutogen/complex/Bdir/CMakeLists.txt delete mode 100644 Tests/QtAutogen/complex/Bdir/libB.cpp delete mode 100644 Tests/QtAutogen/complex/Bdir/libB.h delete mode 100644 Tests/QtAutogen/complex/CMakeLists.txt delete mode 100644 Tests/QtAutogen/complex/abc.cpp delete mode 100644 Tests/QtAutogen/complex/abc.h delete mode 100644 Tests/QtAutogen/complex/abc_p.h delete mode 100644 Tests/QtAutogen/complex/bar.cpp delete mode 100644 Tests/QtAutogen/complex/blub.cpp delete mode 100644 Tests/QtAutogen/complex/blub.h delete mode 100644 Tests/QtAutogen/complex/calwidget.cpp delete mode 100644 Tests/QtAutogen/complex/calwidget.h delete mode 100644 Tests/QtAutogen/complex/calwidget.ui delete mode 100644 Tests/QtAutogen/complex/codeeditor.cpp delete mode 100644 Tests/QtAutogen/complex/codeeditor.h delete mode 100644 Tests/QtAutogen/complex/debug_class.cpp delete mode 100644 Tests/QtAutogen/complex/debug_class.h delete mode 100644 Tests/QtAutogen/complex/debug_class.ui delete mode 100644 Tests/QtAutogen/complex/debug_resource.qrc delete mode 100644 Tests/QtAutogen/complex/foo.cpp delete mode 100644 Tests/QtAutogen/complex/foo.h delete mode 100644 Tests/QtAutogen/complex/gadget.cpp delete mode 100644 Tests/QtAutogen/complex/gadget.h delete mode 100644 Tests/QtAutogen/complex/generated.cpp delete mode 100644 Tests/QtAutogen/complex/generated.h delete mode 100644 Tests/QtAutogen/complex/generated.txt.in delete mode 100644 Tests/QtAutogen/complex/generated_resource.qrc.in delete mode 100644 Tests/QtAutogen/complex/libC.cpp delete mode 100644 Tests/QtAutogen/complex/libC.h delete mode 100644 Tests/QtAutogen/complex/main.cpp delete mode 100644 Tests/QtAutogen/complex/multiplewidgets.cpp delete mode 100644 Tests/QtAutogen/complex/multiplewidgets.h delete mode 100644 Tests/QtAutogen/complex/myinterface.h.in delete mode 100644 Tests/QtAutogen/complex/myotherinterface.h.in delete mode 100644 Tests/QtAutogen/complex/private_slot.cpp delete mode 100644 Tests/QtAutogen/complex/private_slot.h delete mode 100644 Tests/QtAutogen/complex/resourcetester.cpp delete mode 100644 Tests/QtAutogen/complex/resourcetester.h delete mode 100644 Tests/QtAutogen/complex/second_resource.qrc delete mode 100644 Tests/QtAutogen/complex/second_widget.cpp delete mode 100644 Tests/QtAutogen/complex/second_widget.h delete mode 100644 Tests/QtAutogen/complex/second_widget.ui delete mode 100644 Tests/QtAutogen/complex/sub/bar.h delete mode 100644 Tests/QtAutogen/complex/targetObjectsTest.cpp delete mode 100644 Tests/QtAutogen/complex/test.qrc delete mode 100644 Tests/QtAutogen/complex/widget1.ui delete mode 100644 Tests/QtAutogen/complex/widget2.ui delete mode 100644 Tests/QtAutogen/complex/xyz.cpp delete mode 100644 Tests/QtAutogen/complex/xyz.h delete mode 100644 Tests/QtAutogen/complex/yaf.cpp delete mode 100644 Tests/QtAutogen/complex/yaf.h delete mode 100644 Tests/QtAutogen/complex/yaf_p.h delete mode 100644 Tests/QtAutogen/defines_test/CMakeLists.txt delete mode 100644 Tests/QtAutogen/defines_test/defines_test.cpp diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5608933..b0bf887 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1246,10 +1246,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release # the required dlls may not be in the PATH, so we can't run the executables # on that platform. if(WIN32) - set(run_autogen_test ${CMAKE_CTEST_COMMAND} -V) set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V) else() - set(run_autogen_test complex/QtAutogen) set(run_autouic_test QtAutoUicInterface) endif() if(NOT CMAKE_CONFIGURATION_TYPES) @@ -1265,22 +1263,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) - add_test(NAME Qt5Autogen COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogen" - "${CMake_BINARY_DIR}/Tests/Qt5Autogen" - ${build_generator_args} - --build-project QtAutogen - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5Autogen" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - --test-command ${run_autogen_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5Autogen") - add_test(NAME Qt5AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" @@ -1313,22 +1295,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(QT4_WORKS AND QT_QTGUI_FOUND) add_subdirectory(Qt4Autogen) - add_test(NAME Qt4Autogen COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogen" - "${CMake_BINARY_DIR}/Tests/Qt4Autogen" - ${build_generator_args} - --build-project QtAutogen - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4Autogen" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - --test-command ${run_autogen_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4Autogen") - add_test(NAME Qt4AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt deleted file mode 100644 index 833f64e..0000000 --- a/Tests/QtAutogen/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(QtAutogen) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - - # Include this directory before using the UseQt4 file. - add_subdirectory(defines_test) - - include(UseQt4) - - set(QT_QTCORE_TARGET Qt4::QtCore) - - macro(qtx_wrap_cpp) - qt4_wrap_cpp(${ARGN}) - endmacro() - macro(qtx_generate_moc) - qt4_generate_moc(${ARGN}) - endmacro() - -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - find_package(Qt5Widgets REQUIRED) - - set(QT_QTCORE_TARGET Qt5::Core) - - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - set(QT_LIBRARIES Qt5::Widgets) - - if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) - endif() - - macro(qtx_wrap_cpp) - qt5_wrap_cpp(${ARGN}) - endmacro() - macro(qtx_generate_moc) - qt5_generate_moc(${ARGN}) - endmacro() - -endif() - -get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES) - -# Qt4 moc does not support utf8 paths in _parameter files generated by -# qtx_wrap_cpp -# https://bugreports.qt.io/browse/QTBUG-35480 -# Do a simple check if there is are non ASCII character in the build path -string(REGEX MATCH "[^ -~]+" NON_ASCII_BDIR ${CMAKE_CURRENT_BINARY_DIR}) -if((NOT NON_ASCII_BDIR) OR (NOT QT_TEST_VERSION STREQUAL 4)) - set(ALLOW_WRAP_CPP TRUE) -endif() -# On windows qtx_wrap_cpp also fails in Qt5 when used on a path that -# contains non ASCII characters -if(NON_ASCII_BDIR AND WIN32) - set(ALLOW_WRAP_CPP FALSE) -endif() - -# -- Test -# Complex test case -add_subdirectory(complex) diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 29bc4af..6921495 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -30,3 +30,4 @@ if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) endif() ADD_AUTOGEN_TEST(SameName sameName) ADD_AUTOGEN_TEST(StaticLibraryCycle slc) +ADD_AUTOGEN_TEST(Complex QtAutogen) diff --git a/Tests/QtAutogen/Complex/Adir/CMakeLists.txt b/Tests/QtAutogen/Complex/Adir/CMakeLists.txt new file mode 100644 index 0000000..a1c36ff --- /dev/null +++ b/Tests/QtAutogen/Complex/Adir/CMakeLists.txt @@ -0,0 +1,8 @@ + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +add_library(libA SHARED libA.cpp) +target_link_libraries(libA LINK_PUBLIC ${QT_QTCORE_TARGET}) +generate_export_header(libA) diff --git a/Tests/QtAutogen/Complex/Adir/libA.cpp b/Tests/QtAutogen/Complex/Adir/libA.cpp new file mode 100644 index 0000000..f79f24a --- /dev/null +++ b/Tests/QtAutogen/Complex/Adir/libA.cpp @@ -0,0 +1,12 @@ + +#include "libA.h" + +LibA::LibA(QObject* parent) + : QObject(parent) +{ +} + +int LibA::foo() +{ + return 0; +} diff --git a/Tests/QtAutogen/Complex/Adir/libA.h b/Tests/QtAutogen/Complex/Adir/libA.h new file mode 100644 index 0000000..c4eb9f7 --- /dev/null +++ b/Tests/QtAutogen/Complex/Adir/libA.h @@ -0,0 +1,18 @@ + +#ifndef LIBA_H +#define LIBA_H + +#include "liba_export.h" + +#include + +class LIBA_EXPORT LibA : public QObject +{ + Q_OBJECT +public: + explicit LibA(QObject* parent = 0); + + int foo(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/Bdir/CMakeLists.txt b/Tests/QtAutogen/Complex/Bdir/CMakeLists.txt new file mode 100644 index 0000000..d338763 --- /dev/null +++ b/Tests/QtAutogen/Complex/Bdir/CMakeLists.txt @@ -0,0 +1,9 @@ + +set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +add_library(libB SHARED libB.cpp) +generate_export_header(libB) + +target_link_libraries(libB LINK_PUBLIC libA) diff --git a/Tests/QtAutogen/Complex/Bdir/libB.cpp b/Tests/QtAutogen/Complex/Bdir/libB.cpp new file mode 100644 index 0000000..d3b6753 --- /dev/null +++ b/Tests/QtAutogen/Complex/Bdir/libB.cpp @@ -0,0 +1,12 @@ + +#include "libB.h" + +LibB::LibB(QObject* parent) + : QObject(parent) +{ +} + +int LibB::foo() +{ + return a.foo(); +} diff --git a/Tests/QtAutogen/Complex/Bdir/libB.h b/Tests/QtAutogen/Complex/Bdir/libB.h new file mode 100644 index 0000000..e4ab788 --- /dev/null +++ b/Tests/QtAutogen/Complex/Bdir/libB.h @@ -0,0 +1,22 @@ + +#ifndef LIBB_H +#define LIBB_H + +#include "libb_export.h" + +#include "libA.h" +#include + +class LIBB_EXPORT LibB : public QObject +{ + Q_OBJECT +public: + explicit LibB(QObject* parent = 0); + + int foo(); + +private: + LibA a; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/CMakeLists.txt b/Tests/QtAutogen/Complex/CMakeLists.txt new file mode 100644 index 0000000..e9feea0 --- /dev/null +++ b/Tests/QtAutogen/Complex/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 3.10) +project(Complex) +include("../AutogenTest.cmake") + +# -- Test: AUTOMOC AUTORCC AUTOUIC +add_definitions(-DFOO -DSomeDefine="Barx") + +# enable relaxed mode so automoc can handle all the special cases: +set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +# create an executable and two library targets, each requiring automoc: +add_library(codeeditorLib STATIC codeeditor.cpp) +add_library(privateSlot OBJECT private_slot.cpp) +# Pass Qt compiler features to targets that don't link against Qt +target_compile_features(codeeditorLib PRIVATE ${QT_COMPILE_FEATURES}) +target_compile_features(privateSlot PRIVATE ${QT_COMPILE_FEATURES}) + +configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY) +add_custom_command( + OUTPUT generated.txt + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/generated.txt" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" +) + +add_custom_target(generate_moc_input + DEPENDS generated.txt + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" + COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" +) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" +) + +if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) + set(debug_srcs "$<$:debug_class.cpp>" $<$:debug_resource.qrc>) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:TEST_DEBUG_CLASS>) +endif() + +# The -no-protection option disables the generation of include guards. Verify +# that setting the source file property has an effect by using this and +# issue an error in the preprocessor in calwidget.cpp if the include guard +# is defined. +set_source_files_properties(calwidget.ui PROPERTIES AUTOUIC_OPTIONS "-no-protection") + +add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + multiplewidgets.cpp + xyz.cpp yaf.cpp gadget.cpp $ + test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} + ${CMAKE_CURRENT_BINARY_DIR}/generated_resource.qrc +) +set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") + +add_executable(targetObjectsTest targetObjectsTest.cpp $) +target_link_libraries(targetObjectsTest ${QT_LIBRARIES}) + +set_target_properties( + QtAutogen codeeditorLib privateSlot targetObjectsTest + PROPERTIES + AUTOMOC TRUE +) + + +include(GenerateExportHeader) +# The order is relevant here. B depends on A, and B headers depend on A +# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we +# test that CMAKE_AUTOMOC successfully reads the include directories +# for the build interface from those targets. There has previously been +# a bug where caching of the include directories happened before +# extracting the includes to pass to moc. +add_subdirectory(Bdir) +add_subdirectory(Adir) +add_library(libC SHARED libC.cpp) +set_target_properties(libC PROPERTIES AUTOMOC TRUE) +generate_export_header(libC) +target_link_libraries(libC LINK_PUBLIC libB) +target_include_directories(libC PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +set_property(TARGET libC APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} ) + +target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC) diff --git a/Tests/QtAutogen/Complex/abc.cpp b/Tests/QtAutogen/Complex/abc.cpp new file mode 100644 index 0000000..2929b92 --- /dev/null +++ b/Tests/QtAutogen/Complex/abc.cpp @@ -0,0 +1,39 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "abc.h" +#include "abc_p.h" + +#include + +class PrintAbc : public QObject +{ + Q_OBJECT +public: + PrintAbc() + : QObject() + { + } +public slots: + void print() const { printf("abc\n"); } +}; + +Abc::Abc() + : QObject() +{ +} + +void Abc::doAbc() +{ + PrintAbc pa; + pa.print(); + AbcP abcP; + abcP.doAbcP(); +} + +// check that including the moc file for the cpp file and the header works: +#include "abc.moc" +#include "moc_abc.cpp" +#include "moc_abc_p.cpp" + +// check that including a moc file from another header works: +#include "moc_xyz.cpp" diff --git a/Tests/QtAutogen/Complex/abc.h b/Tests/QtAutogen/Complex/abc.h new file mode 100644 index 0000000..ec5f411 --- /dev/null +++ b/Tests/QtAutogen/Complex/abc.h @@ -0,0 +1,17 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef ABC_H +#define ABC_H + +#include + +class Abc : public QObject +{ + Q_OBJECT +public: + Abc(); +public slots: + void doAbc(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/abc_p.h b/Tests/QtAutogen/Complex/abc_p.h new file mode 100644 index 0000000..be98487 --- /dev/null +++ b/Tests/QtAutogen/Complex/abc_p.h @@ -0,0 +1,19 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef ABC_P_H +#define ABC_P_H + +#include + +#include + +class AbcP : public QObject +{ + Q_OBJECT +public: + AbcP() {} +public slots: + void doAbcP() { printf("I am private abc !\n"); } +}; + +#endif diff --git a/Tests/QtAutogen/Complex/bar.cpp b/Tests/QtAutogen/Complex/bar.cpp new file mode 100644 index 0000000..734bd7a --- /dev/null +++ b/Tests/QtAutogen/Complex/bar.cpp @@ -0,0 +1,17 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "sub/bar.h" + +#include + +Bar::Bar() + : QObject() +{ +} + +void Bar::doBar() +{ + printf("Hello bar !\n"); +} + +#include "sub/moc_bar.cpp" diff --git a/Tests/QtAutogen/Complex/blub.cpp b/Tests/QtAutogen/Complex/blub.cpp new file mode 100644 index 0000000..1c497e0 --- /dev/null +++ b/Tests/QtAutogen/Complex/blub.cpp @@ -0,0 +1,31 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "blub.h" + +#include + +class BlubBlub : public QObject +{ + Q_OBJECT +public: + BlubBlub() + : QObject() + { + } +public slots: + int getValue() const { return 13; } +}; + +Blub::Blub() +{ +} + +void Blub::blubber() +{ + BlubBlub bb; + printf("Blub blub %d ! \n", bb.getValue()); +} + +// test the case that the wrong moc-file is included, it should +// actually be "blub.moc" +#include "moc_blub.cpp" diff --git a/Tests/QtAutogen/Complex/blub.h b/Tests/QtAutogen/Complex/blub.h new file mode 100644 index 0000000..ff79878 --- /dev/null +++ b/Tests/QtAutogen/Complex/blub.h @@ -0,0 +1,15 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef BLUB_H +#define BLUB_H + +#include + +class Blub +{ +public: + Blub(); + void blubber(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/calwidget.cpp b/Tests/QtAutogen/Complex/calwidget.cpp new file mode 100644 index 0000000..380e982 --- /dev/null +++ b/Tests/QtAutogen/Complex/calwidget.cpp @@ -0,0 +1,436 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the examples of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** You may use this file under the terms of the BSD license as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + ** the names of its contributors may be used to endorse or promote + ** products derived from this software without specific prior written + ** permission. + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "calwidget.h" + +#include "ui_calwidget.h" +#ifdef UI_CALWIDGET_H +#error Definition of UI_CALWIDGET_H should be disabled by file option. +#endif + +Window::Window() + : ui(new Ui::Window) +{ + createPreviewGroupBox(); + createGeneralOptionsGroupBox(); + createDatesGroupBox(); + createTextFormatsGroupBox(); + + QGridLayout* layout = new QGridLayout; + layout->addWidget(previewGroupBox, 0, 0); + layout->addWidget(generalOptionsGroupBox, 0, 1); + layout->addWidget(datesGroupBox, 1, 0); + layout->addWidget(textFormatsGroupBox, 1, 1); + layout->setSizeConstraint(QLayout::SetFixedSize); + setLayout(layout); + + previewLayout->setRowMinimumHeight(0, calendar->sizeHint().height()); + previewLayout->setColumnMinimumWidth(0, calendar->sizeHint().width()); + + setWindowTitle(tr("Calendar Widget")); +} + +void Window::localeChanged(int index) +{ + calendar->setLocale(localeCombo->itemData(index).toLocale()); +} + +void Window::firstDayChanged(int index) +{ + calendar->setFirstDayOfWeek( + Qt::DayOfWeek(firstDayCombo->itemData(index).toInt())); +} + +void Window::selectionModeChanged(int index) +{ + calendar->setSelectionMode(QCalendarWidget::SelectionMode( + selectionModeCombo->itemData(index).toInt())); +} + +void Window::horizontalHeaderChanged(int index) +{ + calendar->setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat( + horizontalHeaderCombo->itemData(index).toInt())); +} + +void Window::verticalHeaderChanged(int index) +{ + calendar->setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFormat( + verticalHeaderCombo->itemData(index).toInt())); +} + +void Window::selectedDateChanged() +{ + currentDateEdit->setDate(calendar->selectedDate()); +} + +void Window::minimumDateChanged(const QDate& date) +{ + calendar->setMinimumDate(date); + maximumDateEdit->setDate(calendar->maximumDate()); +} + +void Window::maximumDateChanged(const QDate& date) +{ + calendar->setMaximumDate(date); + minimumDateEdit->setDate(calendar->minimumDate()); +} + +void Window::weekdayFormatChanged() +{ + QTextCharFormat format; + + format.setForeground(qvariant_cast( + weekdayColorCombo->itemData(weekdayColorCombo->currentIndex()))); + calendar->setWeekdayTextFormat(Qt::Monday, format); + calendar->setWeekdayTextFormat(Qt::Tuesday, format); + calendar->setWeekdayTextFormat(Qt::Wednesday, format); + calendar->setWeekdayTextFormat(Qt::Thursday, format); + calendar->setWeekdayTextFormat(Qt::Friday, format); +} + +void Window::weekendFormatChanged() +{ + QTextCharFormat format; + + format.setForeground(qvariant_cast( + weekendColorCombo->itemData(weekendColorCombo->currentIndex()))); + calendar->setWeekdayTextFormat(Qt::Saturday, format); + calendar->setWeekdayTextFormat(Qt::Sunday, format); +} + +void Window::reformatHeaders() +{ + QString text = headerTextFormatCombo->currentText(); + QTextCharFormat format; + + if (text == tr("Bold")) { + format.setFontWeight(QFont::Bold); + } else if (text == tr("Italic")) { + format.setFontItalic(true); + } else if (text == tr("Green")) { + format.setForeground(Qt::green); + } + calendar->setHeaderTextFormat(format); +} + +void Window::reformatCalendarPage() +{ + if (firstFridayCheckBox->isChecked()) { + QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); + while (firstFriday.dayOfWeek() != Qt::Friday) + firstFriday = firstFriday.addDays(1); + QTextCharFormat firstFridayFormat; + firstFridayFormat.setForeground(Qt::blue); + calendar->setDateTextFormat(firstFriday, firstFridayFormat); + } + + // May First in Red takes precedence + if (mayFirstCheckBox->isChecked()) { + const QDate mayFirst(calendar->yearShown(), 5, 1); + QTextCharFormat mayFirstFormat; + mayFirstFormat.setForeground(Qt::red); + calendar->setDateTextFormat(mayFirst, mayFirstFormat); + } +} + +void Window::createPreviewGroupBox() +{ + previewGroupBox = new QGroupBox(tr("Preview")); + + calendar = new QCalendarWidget; + calendar->setMinimumDate(QDate(1900, 1, 1)); + calendar->setMaximumDate(QDate(3000, 1, 1)); + calendar->setGridVisible(true); + + connect(calendar, SIGNAL(currentPageChanged(int, int)), this, + SLOT(reformatCalendarPage())); + + previewLayout = new QGridLayout; + previewLayout->addWidget(calendar, 0, 0, Qt::AlignCenter); + previewGroupBox->setLayout(previewLayout); +} + +void Window::createGeneralOptionsGroupBox() +{ + generalOptionsGroupBox = new QGroupBox(tr("General Options")); + + localeCombo = new QComboBox; + int curLocaleIndex = -1; + int index = 0; + for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) { + QLocale::Language lang = static_cast(_lang); + QList countries = QLocale::countriesForLanguage(lang); + for (int i = 0; i < countries.count(); ++i) { + QLocale::Country country = countries.at(i); + QString label = QLocale::languageToString(lang); + label += QLatin1Char('/'); + label += QLocale::countryToString(country); + QLocale locale(lang, country); + if (this->locale().language() == lang && + this->locale().country() == country) + curLocaleIndex = index; + localeCombo->addItem(label, locale); + ++index; + } + } + if (curLocaleIndex != -1) + localeCombo->setCurrentIndex(curLocaleIndex); + localeLabel = new QLabel(tr("&Locale")); + localeLabel->setBuddy(localeCombo); + + firstDayCombo = new QComboBox; + firstDayCombo->addItem(tr("Sunday"), Qt::Sunday); + firstDayCombo->addItem(tr("Monday"), Qt::Monday); + firstDayCombo->addItem(tr("Tuesday"), Qt::Tuesday); + firstDayCombo->addItem(tr("Wednesday"), Qt::Wednesday); + firstDayCombo->addItem(tr("Thursday"), Qt::Thursday); + firstDayCombo->addItem(tr("Friday"), Qt::Friday); + firstDayCombo->addItem(tr("Saturday"), Qt::Saturday); + + firstDayLabel = new QLabel(tr("Wee&k starts on:")); + firstDayLabel->setBuddy(firstDayCombo); + + selectionModeCombo = new QComboBox; + selectionModeCombo->addItem(tr("Single selection"), + QCalendarWidget::SingleSelection); + selectionModeCombo->addItem(tr("None"), QCalendarWidget::NoSelection); + + selectionModeLabel = new QLabel(tr("&Selection mode:")); + selectionModeLabel->setBuddy(selectionModeCombo); + + gridCheckBox = new QCheckBox(tr("&Grid")); + gridCheckBox->setChecked(calendar->isGridVisible()); + + navigationCheckBox = new QCheckBox(tr("&Navigation bar")); + navigationCheckBox->setChecked(true); + + horizontalHeaderCombo = new QComboBox; + horizontalHeaderCombo->addItem(tr("Single letter day names"), + QCalendarWidget::SingleLetterDayNames); + horizontalHeaderCombo->addItem(tr("Short day names"), + QCalendarWidget::ShortDayNames); + horizontalHeaderCombo->addItem(tr("None"), + QCalendarWidget::NoHorizontalHeader); + horizontalHeaderCombo->setCurrentIndex(1); + + horizontalHeaderLabel = new QLabel(tr("&Horizontal header:")); + horizontalHeaderLabel->setBuddy(horizontalHeaderCombo); + + verticalHeaderCombo = new QComboBox; + verticalHeaderCombo->addItem(tr("ISO week numbers"), + QCalendarWidget::ISOWeekNumbers); + verticalHeaderCombo->addItem(tr("None"), QCalendarWidget::NoVerticalHeader); + + verticalHeaderLabel = new QLabel(tr("&Vertical header:")); + verticalHeaderLabel->setBuddy(verticalHeaderCombo); + + connect(localeCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(localeChanged(int))); + connect(firstDayCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(firstDayChanged(int))); + connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(selectionModeChanged(int))); + connect(gridCheckBox, SIGNAL(toggled(bool)), calendar, + SLOT(setGridVisible(bool))); + connect(navigationCheckBox, SIGNAL(toggled(bool)), calendar, + SLOT(setNavigationBarVisible(bool))); + connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(horizontalHeaderChanged(int))); + connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(verticalHeaderChanged(int))); + + QHBoxLayout* checkBoxLayout = new QHBoxLayout; + checkBoxLayout->addWidget(gridCheckBox); + checkBoxLayout->addStretch(); + checkBoxLayout->addWidget(navigationCheckBox); + + QGridLayout* outerLayout = new QGridLayout; + outerLayout->addWidget(localeLabel, 0, 0); + outerLayout->addWidget(localeCombo, 0, 1); + outerLayout->addWidget(firstDayLabel, 1, 0); + outerLayout->addWidget(firstDayCombo, 1, 1); + outerLayout->addWidget(selectionModeLabel, 2, 0); + outerLayout->addWidget(selectionModeCombo, 2, 1); + outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); + outerLayout->addWidget(horizontalHeaderLabel, 4, 0); + outerLayout->addWidget(horizontalHeaderCombo, 4, 1); + outerLayout->addWidget(verticalHeaderLabel, 5, 0); + outerLayout->addWidget(verticalHeaderCombo, 5, 1); + generalOptionsGroupBox->setLayout(outerLayout); + + firstDayChanged(firstDayCombo->currentIndex()); + selectionModeChanged(selectionModeCombo->currentIndex()); + horizontalHeaderChanged(horizontalHeaderCombo->currentIndex()); + verticalHeaderChanged(verticalHeaderCombo->currentIndex()); +} + +void Window::createDatesGroupBox() +{ + datesGroupBox = new QGroupBox(tr("Dates")); + + minimumDateEdit = new QDateEdit; + minimumDateEdit->setDisplayFormat("MMM d yyyy"); + minimumDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + minimumDateEdit->setDate(calendar->minimumDate()); + + minimumDateLabel = new QLabel(tr("&Minimum Date:")); + minimumDateLabel->setBuddy(minimumDateEdit); + + currentDateEdit = new QDateEdit; + currentDateEdit->setDisplayFormat("MMM d yyyy"); + currentDateEdit->setDate(calendar->selectedDate()); + currentDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + + currentDateLabel = new QLabel(tr("&Current Date:")); + currentDateLabel->setBuddy(currentDateEdit); + + maximumDateEdit = new QDateEdit; + maximumDateEdit->setDisplayFormat("MMM d yyyy"); + maximumDateEdit->setDateRange(calendar->minimumDate(), + calendar->maximumDate()); + maximumDateEdit->setDate(calendar->maximumDate()); + + maximumDateLabel = new QLabel(tr("Ma&ximum Date:")); + maximumDateLabel->setBuddy(maximumDateEdit); + + connect(currentDateEdit, SIGNAL(dateChanged(QDate)), calendar, + SLOT(setSelectedDate(QDate))); + connect(calendar, SIGNAL(selectionChanged()), this, + SLOT(selectedDateChanged())); + connect(minimumDateEdit, SIGNAL(dateChanged(QDate)), this, + SLOT(minimumDateChanged(QDate))); + connect(maximumDateEdit, SIGNAL(dateChanged(QDate)), this, + SLOT(maximumDateChanged(QDate))); + + QGridLayout* dateBoxLayout = new QGridLayout; + dateBoxLayout->addWidget(currentDateLabel, 1, 0); + dateBoxLayout->addWidget(currentDateEdit, 1, 1); + dateBoxLayout->addWidget(minimumDateLabel, 0, 0); + dateBoxLayout->addWidget(minimumDateEdit, 0, 1); + dateBoxLayout->addWidget(maximumDateLabel, 2, 0); + dateBoxLayout->addWidget(maximumDateEdit, 2, 1); + dateBoxLayout->setRowStretch(3, 1); + + datesGroupBox->setLayout(dateBoxLayout); +} + +void Window::createTextFormatsGroupBox() +{ + textFormatsGroupBox = new QGroupBox(tr("Text Formats")); + + weekdayColorCombo = createColorComboBox(); + weekdayColorCombo->setCurrentIndex(weekdayColorCombo->findText(tr("Black"))); + + weekdayColorLabel = new QLabel(tr("&Weekday color:")); + weekdayColorLabel->setBuddy(weekdayColorCombo); + + weekendColorCombo = createColorComboBox(); + weekendColorCombo->setCurrentIndex(weekendColorCombo->findText(tr("Red"))); + + weekendColorLabel = new QLabel(tr("Week&end color:")); + weekendColorLabel->setBuddy(weekendColorCombo); + + headerTextFormatCombo = new QComboBox; + headerTextFormatCombo->addItem(tr("Bold")); + headerTextFormatCombo->addItem(tr("Italic")); + headerTextFormatCombo->addItem(tr("Plain")); + + headerTextFormatLabel = new QLabel(tr("&Header text:")); + headerTextFormatLabel->setBuddy(headerTextFormatCombo); + + firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue")); + + mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); + + connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(weekdayFormatChanged())); + connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, + SLOT(weekendFormatChanged())); + connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)), this, + SLOT(reformatHeaders())); + connect(firstFridayCheckBox, SIGNAL(toggled(bool)), this, + SLOT(reformatCalendarPage())); + connect(mayFirstCheckBox, SIGNAL(toggled(bool)), this, + SLOT(reformatCalendarPage())); + + QHBoxLayout* checkBoxLayout = new QHBoxLayout; + checkBoxLayout->addWidget(firstFridayCheckBox); + checkBoxLayout->addStretch(); + checkBoxLayout->addWidget(mayFirstCheckBox); + + QGridLayout* outerLayout = new QGridLayout; + outerLayout->addWidget(weekdayColorLabel, 0, 0); + outerLayout->addWidget(weekdayColorCombo, 0, 1); + outerLayout->addWidget(weekendColorLabel, 1, 0); + outerLayout->addWidget(weekendColorCombo, 1, 1); + outerLayout->addWidget(headerTextFormatLabel, 2, 0); + outerLayout->addWidget(headerTextFormatCombo, 2, 1); + outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); + textFormatsGroupBox->setLayout(outerLayout); + + weekdayFormatChanged(); + weekendFormatChanged(); + reformatHeaders(); + reformatCalendarPage(); +} + +QComboBox* Window::createColorComboBox() +{ + QComboBox* comboBox = new QComboBox; + comboBox->addItem(tr("Red"), QColor(Qt::red)); + comboBox->addItem(tr("Blue"), QColor(Qt::blue)); + comboBox->addItem(tr("Black"), QColor(Qt::black)); + comboBox->addItem(tr("Magenta"), QColor(Qt::magenta)); + return comboBox; +} + +//#include "moc_calwidget.cpp" diff --git a/Tests/QtAutogen/Complex/calwidget.h b/Tests/QtAutogen/Complex/calwidget.h new file mode 100644 index 0000000..084d959 --- /dev/null +++ b/Tests/QtAutogen/Complex/calwidget.h @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WINDOW_H +#define WINDOW_H + +#include + +class QCalendarWidget; +class QCheckBox; +class QComboBox; +class QDate; +class QDateEdit; +class QGridLayout; +class QGroupBox; +class QLabel; + +namespace Ui { +class Window; +} + +class Window : public QWidget +{ + Q_OBJECT + +public: + Window(); + +private slots: + void localeChanged(int index); + void firstDayChanged(int index); + void selectionModeChanged(int index); + void horizontalHeaderChanged(int index); + void verticalHeaderChanged(int index); + void selectedDateChanged(); + void minimumDateChanged(const QDate& date); + void maximumDateChanged(const QDate& date); + void weekdayFormatChanged(); + void weekendFormatChanged(); + void reformatHeaders(); + void reformatCalendarPage(); + +private: + void createPreviewGroupBox(); + void createGeneralOptionsGroupBox(); + void createDatesGroupBox(); + void createTextFormatsGroupBox(); + QComboBox* createColorComboBox(); + + QGroupBox* previewGroupBox; + QGridLayout* previewLayout; + QCalendarWidget* calendar; + + QGroupBox* generalOptionsGroupBox; + QLabel* localeLabel; + QLabel* firstDayLabel; + QLabel* selectionModeLabel; + QLabel* horizontalHeaderLabel; + QLabel* verticalHeaderLabel; + QComboBox* localeCombo; + QComboBox* firstDayCombo; + QComboBox* selectionModeCombo; + QCheckBox* gridCheckBox; + QCheckBox* navigationCheckBox; + QComboBox* horizontalHeaderCombo; + QComboBox* verticalHeaderCombo; + + QGroupBox* datesGroupBox; + QLabel* currentDateLabel; + QLabel* minimumDateLabel; + QLabel* maximumDateLabel; + QDateEdit* currentDateEdit; + QDateEdit* minimumDateEdit; + QDateEdit* maximumDateEdit; + + QGroupBox* textFormatsGroupBox; + QLabel* weekdayColorLabel; + QLabel* weekendColorLabel; + QLabel* headerTextFormatLabel; + QComboBox* weekdayColorCombo; + QComboBox* weekendColorCombo; + QComboBox* headerTextFormatCombo; + + QCheckBox* firstFridayCheckBox; + QCheckBox* mayFirstCheckBox; + + Ui::Window* ui; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/calwidget.ui b/Tests/QtAutogen/Complex/calwidget.ui new file mode 100644 index 0000000..1c245ca --- /dev/null +++ b/Tests/QtAutogen/Complex/calwidget.ui @@ -0,0 +1,32 @@ + + + Window + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 90 + 180 + 94 + 24 + + + + PushButton + + + + + + diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp new file mode 100644 index 0000000..0caf8a7 --- /dev/null +++ b/Tests/QtAutogen/Complex/codeeditor.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the examples of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** You may use this file under the terms of the BSD license as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + ** the names of its contributors may be used to endorse or promote + ** products derived from this software without specific prior written + ** permission. + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include + +#include "codeeditor.h" + +CodeEditor::CodeEditor(QWidget* parent) + : QPlainTextEdit(parent) +{ + lineNumberArea = new LineNumberArea(this); + + connect(this, SIGNAL(blockCountChanged(int)), this, + SLOT(updateLineNumberAreaWidth(int))); + connect(this, SIGNAL(updateRequest(QRect, int)), this, + SLOT(updateLineNumberArea(QRect, int))); + connect(this, SIGNAL(cursorPositionChanged()), this, + SLOT(highlightCurrentLine())); + + updateLineNumberAreaWidth(0); + highlightCurrentLine(); +} + +int CodeEditor::lineNumberAreaWidth() +{ + int digits = 1; + int max = qMax(1, blockCount()); + while (max >= 10) { + max /= 10; + ++digits; + } + + int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; + + return space; +} + +void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) +{ + setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); +} + +void CodeEditor::updateLineNumberArea(const QRect& rect, int dy) +{ + if (dy) + lineNumberArea->scroll(0, dy); + else + lineNumberArea->update(0, rect.y(), lineNumberArea->width(), + rect.height()); + + if (rect.contains(viewport()->rect())) + updateLineNumberAreaWidth(0); +} + +void CodeEditor::resizeEvent(QResizeEvent* e) +{ + QPlainTextEdit::resizeEvent(e); + + QRect cr = contentsRect(); + lineNumberArea->setGeometry( + QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); +} + +void CodeEditor::highlightCurrentLine() +{ + QList extraSelections; + + if (!isReadOnly()) { + QTextEdit::ExtraSelection selection; + + QColor lineColor = QColor(Qt::yellow).lighter(160); + + selection.format.setBackground(lineColor); + selection.format.setProperty(QTextFormat::FullWidthSelection, true); + selection.cursor = textCursor(); + selection.cursor.clearSelection(); + extraSelections.append(selection); + } + + setExtraSelections(extraSelections); +} + +void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) +{ + QPainter painter(lineNumberArea); + painter.fillRect(event->rect(), Qt::lightGray); + + QTextBlock block = firstVisibleBlock(); + int blockNumber = block.blockNumber(); + int top = + (int)blockBoundingGeometry(block).translated(contentOffset()).top(); + int bottom = top + (int)blockBoundingRect(block).height(); + + while (block.isValid() && top <= event->rect().bottom()) { + if (block.isVisible() && bottom >= event->rect().top()) { + QString number = QString::number(blockNumber + 1); + painter.setPen(Qt::black); + painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), + Qt::AlignRight, number); + } + + block = block.next(); + top = bottom; + bottom = top + (int)blockBoundingRect(block).height(); + ++blockNumber; + } +} + +#include "codeeditor.moc" diff --git a/Tests/QtAutogen/Complex/codeeditor.h b/Tests/QtAutogen/Complex/codeeditor.h new file mode 100644 index 0000000..b410bd4 --- /dev/null +++ b/Tests/QtAutogen/Complex/codeeditor.h @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CODEEDITOR_H +#define CODEEDITOR_H + +#include +#include + +class QPaintEvent; +class QResizeEvent; +class QSize; +class QWidget; + +class LineNumberArea; + +class CodeEditor : public QPlainTextEdit +{ + Q_OBJECT + +public: + CodeEditor(QWidget* parent = 0); + + void lineNumberAreaPaintEvent(QPaintEvent* event); + int lineNumberAreaWidth(); + +protected: + void resizeEvent(QResizeEvent* event); + +private slots: + void updateLineNumberAreaWidth(int newBlockCount); + void highlightCurrentLine(); + void updateLineNumberArea(const QRect&, int); + +private: + QWidget* lineNumberArea; +}; + +class LineNumberArea : public QWidget +{ +public: + LineNumberArea(CodeEditor* editor) + : QWidget(editor) + { + codeEditor = editor; + } + + QSize sizeHint() const + { + return QSize(codeEditor->lineNumberAreaWidth(), 0); + } + +protected: + void paintEvent(QPaintEvent* event) + { + codeEditor->lineNumberAreaPaintEvent(event); + } + +private: + CodeEditor* codeEditor; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/debug_class.cpp b/Tests/QtAutogen/Complex/debug_class.cpp new file mode 100644 index 0000000..46b09e7 --- /dev/null +++ b/Tests/QtAutogen/Complex/debug_class.cpp @@ -0,0 +1,10 @@ + +#include "debug_class.h" +#include "ui_debug_class.h" + +DebugClass::DebugClass(QWidget* parent) + : QWidget(parent) + , ui(new Ui::DebugClass) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutogen/Complex/debug_class.h b/Tests/QtAutogen/Complex/debug_class.h new file mode 100644 index 0000000..c02f0ed --- /dev/null +++ b/Tests/QtAutogen/Complex/debug_class.h @@ -0,0 +1,19 @@ + +#include + +namespace Ui { +class DebugClass; +} + +class DebugClass : public QWidget +{ + Q_OBJECT +public: + explicit DebugClass(QWidget* parent = 0); + +signals: + void someSignal(); + +private: + Ui::DebugClass* ui; +}; diff --git a/Tests/QtAutogen/Complex/debug_class.ui b/Tests/QtAutogen/Complex/debug_class.ui new file mode 100644 index 0000000..dc2e1ac --- /dev/null +++ b/Tests/QtAutogen/Complex/debug_class.ui @@ -0,0 +1,45 @@ + + + DebugClass + + + + 0 + 0 + 400 + 300 + + + + DebugClass + + + + + 50 + 20 + 82 + 21 + + + + CheckBox + + + + + + 40 + 70 + 94 + 24 + + + + PushButton + + + + + + diff --git a/Tests/QtAutogen/Complex/debug_resource.qrc b/Tests/QtAutogen/Complex/debug_resource.qrc new file mode 100644 index 0000000..db98b9b --- /dev/null +++ b/Tests/QtAutogen/Complex/debug_resource.qrc @@ -0,0 +1,5 @@ + + + debug_class.ui + + diff --git a/Tests/QtAutogen/Complex/foo.cpp b/Tests/QtAutogen/Complex/foo.cpp new file mode 100644 index 0000000..f665eee --- /dev/null +++ b/Tests/QtAutogen/Complex/foo.cpp @@ -0,0 +1,30 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "foo.h" + +#include + +class FooFoo : public QObject +{ + Q_OBJECT +public: + FooFoo() + : QObject() + { + } +public slots: + int getValue() const { return 12; } +}; + +Foo::Foo() + : QObject() +{ +} + +void Foo::doFoo() +{ + FooFoo ff; + printf("Hello automoc: %d\n", ff.getValue()); +} + +#include "foo.moc" diff --git a/Tests/QtAutogen/Complex/foo.h b/Tests/QtAutogen/Complex/foo.h new file mode 100644 index 0000000..3e03fe6 --- /dev/null +++ b/Tests/QtAutogen/Complex/foo.h @@ -0,0 +1,20 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef FOO_H +#define FOO_H + +#include + +class Foo +#ifdef FOO + : public QObject +#endif +{ + Q_OBJECT +public: + Foo(); +public slots: + void doFoo(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/gadget.cpp b/Tests/QtAutogen/Complex/gadget.cpp new file mode 100644 index 0000000..23d95fa --- /dev/null +++ b/Tests/QtAutogen/Complex/gadget.cpp @@ -0,0 +1,4 @@ + +#include "gadget.h" + +#include "moc_gadget.cpp" diff --git a/Tests/QtAutogen/Complex/gadget.h b/Tests/QtAutogen/Complex/gadget.h new file mode 100644 index 0000000..3253e31 --- /dev/null +++ b/Tests/QtAutogen/Complex/gadget.h @@ -0,0 +1,19 @@ + +#ifndef GADGET_H +#define GADGET_H + +#include + +class Gadget +{ + Q_GADGET + Q_ENUMS(Type) +public: + enum Type + { + Type0, + Type1 + }; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/generated.cpp b/Tests/QtAutogen/Complex/generated.cpp new file mode 100644 index 0000000..d514c61 --- /dev/null +++ b/Tests/QtAutogen/Complex/generated.cpp @@ -0,0 +1,9 @@ + +#include "generated.h" + +Generated::Generated(QObject* parent) + : QObject(parent) +{ +} + +#include "moc_generated.cpp" diff --git a/Tests/QtAutogen/Complex/generated.h b/Tests/QtAutogen/Complex/generated.h new file mode 100644 index 0000000..62e1607 --- /dev/null +++ b/Tests/QtAutogen/Complex/generated.h @@ -0,0 +1,18 @@ + +#ifndef GENERATED_H +#define GENERATED_H + +#include + +#include "myinterface.h" +#include "myotherinterface.h" + +class Generated : public QObject, MyInterface, MyOtherInterface +{ + Q_OBJECT + Q_INTERFACES(MyInterface MyOtherInterface) +public: + explicit Generated(QObject* parent = 0); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/generated.txt.in b/Tests/QtAutogen/Complex/generated.txt.in new file mode 100644 index 0000000..77507bb --- /dev/null +++ b/Tests/QtAutogen/Complex/generated.txt.in @@ -0,0 +1 @@ +Some generated text file. diff --git a/Tests/QtAutogen/Complex/generated_resource.qrc.in b/Tests/QtAutogen/Complex/generated_resource.qrc.in new file mode 100644 index 0000000..da5fa62 --- /dev/null +++ b/Tests/QtAutogen/Complex/generated_resource.qrc.in @@ -0,0 +1,5 @@ + + + generated.txt + + diff --git a/Tests/QtAutogen/Complex/libC.cpp b/Tests/QtAutogen/Complex/libC.cpp new file mode 100644 index 0000000..a3acff1 --- /dev/null +++ b/Tests/QtAutogen/Complex/libC.cpp @@ -0,0 +1,12 @@ + +#include "libC.h" + +LibC::LibC(QObject* parent) + : QObject(parent) +{ +} + +int LibC::foo() +{ + return b.foo(); +} diff --git a/Tests/QtAutogen/Complex/libC.h b/Tests/QtAutogen/Complex/libC.h new file mode 100644 index 0000000..3bc2bad --- /dev/null +++ b/Tests/QtAutogen/Complex/libC.h @@ -0,0 +1,22 @@ + +#ifndef LIBC_H +#define LIBC_H + +#include "libc_export.h" + +#include "libB.h" +#include + +class LIBC_EXPORT LibC : public QObject +{ + Q_OBJECT +public: + explicit LibC(QObject* parent = 0); + + int foo(); + +private: + LibB b; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/main.cpp b/Tests/QtAutogen/Complex/main.cpp new file mode 100644 index 0000000..d557c70 --- /dev/null +++ b/Tests/QtAutogen/Complex/main.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** + ** + ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the examples of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:BSD$ + ** You may use this file under the terms of the BSD license as follows: + ** + ** "Redistribution and use in source and binary forms, with or without + ** modification, are permitted provided that the following conditions are + ** met: + ** * Redistributions of source code must retain the above copyright + ** notice, this list of conditions and the following disclaimer. + ** * Redistributions in binary form must reproduce the above copyright + ** notice, this list of conditions and the following disclaimer in + ** the documentation and/or other materials provided with the + ** distribution. + ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + ** the names of its contributors may be used to endorse or promote + ** products derived from this software without specific prior written + ** permission. + ** + ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ + +#include +#include + +#include "abc.h" +#include "blub.h" +#include "calwidget.h" +#include "codeeditor.h" +#include "foo.h" +#include "libC.h" +#include "resourcetester.h" +#include "sub/bar.h" +#include "xyz.h" +#include "yaf.h" +#ifdef TEST_DEBUG_CLASS +#include "debug_class.h" +#include +#endif + +int main(int argv, char** args) +{ + QCoreApplication app(argv, args); + + Foo foo; + foo.doFoo(); + + Blub b; + b.blubber(); + + Bar bar; + bar.doBar(); + + Abc abc; + abc.doAbc(); + + Xyz xyz; + xyz.doXyz(); + + Yaf yaf; + yaf.doYaf(); + + LibC lc; + lc.foo(); + + ResourceTester rt; + + QTimer::singleShot(0, &rt, SLOT(doTest())); + +#ifdef TEST_DEBUG_CLASS + std::cout << DebugClass::staticMetaObject.className() << std::endl; +#endif + + return app.exec(); +} diff --git a/Tests/QtAutogen/Complex/multiplewidgets.cpp b/Tests/QtAutogen/Complex/multiplewidgets.cpp new file mode 100644 index 0000000..fda36ea --- /dev/null +++ b/Tests/QtAutogen/Complex/multiplewidgets.cpp @@ -0,0 +1,19 @@ + +#include "multiplewidgets.h" + +#include "ui_widget1.h" +#include "ui_widget2.h" + +Widget1::Widget1(QWidget* parent) + : QWidget(parent) + , ui(new Ui::Widget1) +{ + ui->setupUi(this); +} + +Widget2::Widget2(QWidget* parent) + : QWidget(parent) + , ui(new Ui::Widget2) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutogen/Complex/multiplewidgets.h b/Tests/QtAutogen/Complex/multiplewidgets.h new file mode 100644 index 0000000..a4d0a50 --- /dev/null +++ b/Tests/QtAutogen/Complex/multiplewidgets.h @@ -0,0 +1,35 @@ + +#ifndef MULTIPLEWIDGETS_H +#define MULTIPLEWIDGETS_H + +#include + +namespace Ui { +class Widget1; +} + +class Widget1 : public QWidget +{ + Q_OBJECT +public: + Widget1(QWidget* parent = 0); + +private: + Ui::Widget1* ui; +}; + +namespace Ui { +class Widget2; +} + +class Widget2 : public QWidget +{ + Q_OBJECT +public: + Widget2(QWidget* parent = 0); + +private: + Ui::Widget2* ui; +}; + +#endif diff --git a/Tests/QtAutogen/Complex/myinterface.h.in b/Tests/QtAutogen/Complex/myinterface.h.in new file mode 100644 index 0000000..c6c0ba1 --- /dev/null +++ b/Tests/QtAutogen/Complex/myinterface.h.in @@ -0,0 +1,14 @@ + +#ifndef MYINTERFACE_H +#define MYINTERFACE_H + +#include + +class MyInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") + +#endif diff --git a/Tests/QtAutogen/Complex/myotherinterface.h.in b/Tests/QtAutogen/Complex/myotherinterface.h.in new file mode 100644 index 0000000..d21e7af --- /dev/null +++ b/Tests/QtAutogen/Complex/myotherinterface.h.in @@ -0,0 +1,14 @@ + +#ifndef MYOTHERINTERFACE_H +#define MYOTHERINTERFACE_H + +#include + +class MyOtherInterface +{ + +}; + +Q_DECLARE_INTERFACE(MyOtherInterface, "org.cmake.example.MyOtherInterface") + +#endif diff --git a/Tests/QtAutogen/Complex/private_slot.cpp b/Tests/QtAutogen/Complex/private_slot.cpp new file mode 100644 index 0000000..ab1682a --- /dev/null +++ b/Tests/QtAutogen/Complex/private_slot.cpp @@ -0,0 +1,16 @@ + +#include "private_slot.h" + +class PrivateSlotPrivate +{ +public: + void privateSlot() {} +}; + +PrivateSlot::PrivateSlot(QObject* parent) + : QObject(parent) + , d(new PrivateSlotPrivate) +{ +} + +#include "private_slot.moc" diff --git a/Tests/QtAutogen/Complex/private_slot.h b/Tests/QtAutogen/Complex/private_slot.h new file mode 100644 index 0000000..8041eb2 --- /dev/null +++ b/Tests/QtAutogen/Complex/private_slot.h @@ -0,0 +1,20 @@ + +#ifndef PRIVATE_SLOT_H +#define PRIVATE_SLOT_H + +#include + +class PrivateSlotPrivate; + +class PrivateSlot : public QObject +{ + Q_OBJECT +public: + PrivateSlot(QObject* parent = 0); + +private: + PrivateSlotPrivate* const d; + Q_PRIVATE_SLOT(d, void privateSlot()) +}; + +#endif diff --git a/Tests/QtAutogen/Complex/resourcetester.cpp b/Tests/QtAutogen/Complex/resourcetester.cpp new file mode 100644 index 0000000..4ecb6b4 --- /dev/null +++ b/Tests/QtAutogen/Complex/resourcetester.cpp @@ -0,0 +1,26 @@ + +#include "resourcetester.h" + +#include +#include +#include +#include + +ResourceTester::ResourceTester(QObject* parent) + : QObject(parent) +{ +} + +void ResourceTester::doTest() +{ + if (!QFile::exists(":/CMakeLists.txt")) + qApp->exit(EXIT_FAILURE); + if (!QFile::exists(":/main.cpp")) + qApp->exit(EXIT_FAILURE); +#ifdef TEST_DEBUG_CLASS + if (!QFile::exists(":/debug_class.ui")) + qApp->exit(EXIT_FAILURE); +#endif + + QTimer::singleShot(0, qApp, SLOT(quit())); +} diff --git a/Tests/QtAutogen/Complex/resourcetester.h b/Tests/QtAutogen/Complex/resourcetester.h new file mode 100644 index 0000000..dbdb3ad --- /dev/null +++ b/Tests/QtAutogen/Complex/resourcetester.h @@ -0,0 +1,17 @@ + +#ifndef RESOURCE_TESTER_H +#define RESOURCE_TESTER_H + +#include + +class ResourceTester : public QObject +{ + Q_OBJECT +public: + explicit ResourceTester(QObject* parent = 0); + +private slots: + void doTest(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/second_resource.qrc b/Tests/QtAutogen/Complex/second_resource.qrc new file mode 100644 index 0000000..27bfb14 --- /dev/null +++ b/Tests/QtAutogen/Complex/second_resource.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + diff --git a/Tests/QtAutogen/Complex/second_widget.cpp b/Tests/QtAutogen/Complex/second_widget.cpp new file mode 100644 index 0000000..c575f10 --- /dev/null +++ b/Tests/QtAutogen/Complex/second_widget.cpp @@ -0,0 +1,15 @@ + +#include "second_widget.h" +#include "ui_second_widget.h" + +SecondWidget::SecondWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::SecondWidget) +{ + ui->setupUi(this); +} + +SecondWidget::~SecondWidget() +{ + delete ui; +} diff --git a/Tests/QtAutogen/Complex/second_widget.h b/Tests/QtAutogen/Complex/second_widget.h new file mode 100644 index 0000000..c7929c4 --- /dev/null +++ b/Tests/QtAutogen/Complex/second_widget.h @@ -0,0 +1,18 @@ + +#include + +namespace Ui { +class SecondWidget; +} + +class SecondWidget : public QWidget +{ + Q_OBJECT +public: + explicit SecondWidget(QWidget* parent = 0); + + ~SecondWidget(); + +private: + Ui::SecondWidget* ui; +}; diff --git a/Tests/QtAutogen/Complex/second_widget.ui b/Tests/QtAutogen/Complex/second_widget.ui new file mode 100644 index 0000000..4effa58 --- /dev/null +++ b/Tests/QtAutogen/Complex/second_widget.ui @@ -0,0 +1,32 @@ + + + SecondWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 80 + 20 + 94 + 24 + + + + PushButton + + + + + + diff --git a/Tests/QtAutogen/Complex/sub/bar.h b/Tests/QtAutogen/Complex/sub/bar.h new file mode 100644 index 0000000..e4093f6 --- /dev/null +++ b/Tests/QtAutogen/Complex/sub/bar.h @@ -0,0 +1,17 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef BAR_H +#define BAR_H + +#include + +class Bar : public QObject +{ + Q_OBJECT +public: + Bar(); +public slots: + void doBar(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/targetObjectsTest.cpp b/Tests/QtAutogen/Complex/targetObjectsTest.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/Complex/targetObjectsTest.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/Complex/test.qrc b/Tests/QtAutogen/Complex/test.qrc new file mode 100644 index 0000000..c3d4e3c --- /dev/null +++ b/Tests/QtAutogen/Complex/test.qrc @@ -0,0 +1,5 @@ + + + CMakeLists.txt + + diff --git a/Tests/QtAutogen/Complex/widget1.ui b/Tests/QtAutogen/Complex/widget1.ui new file mode 100644 index 0000000..8fce81a --- /dev/null +++ b/Tests/QtAutogen/Complex/widget1.ui @@ -0,0 +1,45 @@ + + + Widget1 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 140 + 80 + 80 + 23 + + + + PushButton + + + + + + 190 + 170 + 80 + 23 + + + + PushButton + + + + + + diff --git a/Tests/QtAutogen/Complex/widget2.ui b/Tests/QtAutogen/Complex/widget2.ui new file mode 100644 index 0000000..1f411b9 --- /dev/null +++ b/Tests/QtAutogen/Complex/widget2.ui @@ -0,0 +1,29 @@ + + + Widget2 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 20 + 20 + 256 + 192 + + + + + + + diff --git a/Tests/QtAutogen/Complex/xyz.cpp b/Tests/QtAutogen/Complex/xyz.cpp new file mode 100644 index 0000000..e46c9d3 --- /dev/null +++ b/Tests/QtAutogen/Complex/xyz.cpp @@ -0,0 +1,15 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "xyz.h" + +#include + +Xyz::Xyz() + : QObject() +{ +} + +void Xyz::doXyz() +{ + printf("This is xyz !\n"); +} diff --git a/Tests/QtAutogen/Complex/xyz.h b/Tests/QtAutogen/Complex/xyz.h new file mode 100644 index 0000000..8b813fd --- /dev/null +++ b/Tests/QtAutogen/Complex/xyz.h @@ -0,0 +1,17 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef XYZ_H +#define XYZ_H + +#include + +class Xyz : public QObject +{ + Q_OBJECT +public: + Xyz(); +public slots: + void doXyz(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/yaf.cpp b/Tests/QtAutogen/Complex/yaf.cpp new file mode 100644 index 0000000..70e26aa --- /dev/null +++ b/Tests/QtAutogen/Complex/yaf.cpp @@ -0,0 +1,19 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "yaf.h" +#include "yaf_p.h" + +#include + +Yaf::Yaf() +{ +} + +void Yaf::doYaf() +{ + YafP yafP; + yafP.doYafP(); +} + +// check that including a moc file from a private header the wrong way works: +#include "yaf_p.moc" diff --git a/Tests/QtAutogen/Complex/yaf.h b/Tests/QtAutogen/Complex/yaf.h new file mode 100644 index 0000000..f271061 --- /dev/null +++ b/Tests/QtAutogen/Complex/yaf.h @@ -0,0 +1,15 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef YAF_H +#define YAF_H + +class Yaf +{ +public: + Yaf(); + +public: + void doYaf(); +}; + +#endif diff --git a/Tests/QtAutogen/Complex/yaf_p.h b/Tests/QtAutogen/Complex/yaf_p.h new file mode 100644 index 0000000..ea5eed6 --- /dev/null +++ b/Tests/QtAutogen/Complex/yaf_p.h @@ -0,0 +1,19 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef YAF_P_H +#define YAF_P_H + +#include + +#include + +class YafP : public QObject +{ + Q_OBJECT +public: + YafP() {} +public slots: + void doYafP() { printf("I am yet another file !\n"); } +}; + +#endif diff --git a/Tests/QtAutogen/complex/Adir/CMakeLists.txt b/Tests/QtAutogen/complex/Adir/CMakeLists.txt deleted file mode 100644 index a1c36ff..0000000 --- a/Tests/QtAutogen/complex/Adir/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) - -add_library(libA SHARED libA.cpp) -target_link_libraries(libA LINK_PUBLIC ${QT_QTCORE_TARGET}) -generate_export_header(libA) diff --git a/Tests/QtAutogen/complex/Adir/libA.cpp b/Tests/QtAutogen/complex/Adir/libA.cpp deleted file mode 100644 index f79f24a..0000000 --- a/Tests/QtAutogen/complex/Adir/libA.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "libA.h" - -LibA::LibA(QObject* parent) - : QObject(parent) -{ -} - -int LibA::foo() -{ - return 0; -} diff --git a/Tests/QtAutogen/complex/Adir/libA.h b/Tests/QtAutogen/complex/Adir/libA.h deleted file mode 100644 index c4eb9f7..0000000 --- a/Tests/QtAutogen/complex/Adir/libA.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef LIBA_H -#define LIBA_H - -#include "liba_export.h" - -#include - -class LIBA_EXPORT LibA : public QObject -{ - Q_OBJECT -public: - explicit LibA(QObject* parent = 0); - - int foo(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/Bdir/CMakeLists.txt b/Tests/QtAutogen/complex/Bdir/CMakeLists.txt deleted file mode 100644 index d338763..0000000 --- a/Tests/QtAutogen/complex/Bdir/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) - -add_library(libB SHARED libB.cpp) -generate_export_header(libB) - -target_link_libraries(libB LINK_PUBLIC libA) diff --git a/Tests/QtAutogen/complex/Bdir/libB.cpp b/Tests/QtAutogen/complex/Bdir/libB.cpp deleted file mode 100644 index d3b6753..0000000 --- a/Tests/QtAutogen/complex/Bdir/libB.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "libB.h" - -LibB::LibB(QObject* parent) - : QObject(parent) -{ -} - -int LibB::foo() -{ - return a.foo(); -} diff --git a/Tests/QtAutogen/complex/Bdir/libB.h b/Tests/QtAutogen/complex/Bdir/libB.h deleted file mode 100644 index e4ab788..0000000 --- a/Tests/QtAutogen/complex/Bdir/libB.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef LIBB_H -#define LIBB_H - -#include "libb_export.h" - -#include "libA.h" -#include - -class LIBB_EXPORT LibB : public QObject -{ - Q_OBJECT -public: - explicit LibB(QObject* parent = 0); - - int foo(); - -private: - LibA a; -}; - -#endif diff --git a/Tests/QtAutogen/complex/CMakeLists.txt b/Tests/QtAutogen/complex/CMakeLists.txt deleted file mode 100644 index 2043ccf..0000000 --- a/Tests/QtAutogen/complex/CMakeLists.txt +++ /dev/null @@ -1,82 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -# -- Test: AUTOMOC AUTORCC AUTOUIC -add_definitions(-DFOO -DSomeDefine="Barx") - -# enable relaxed mode so automoc can handle all the special cases: -set(CMAKE_AUTOMOC_RELAXED_MODE TRUE) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -# create an executable and two library targets, each requiring automoc: -add_library(codeeditorLib STATIC codeeditor.cpp) -add_library(privateSlot OBJECT private_slot.cpp) -# Pass Qt compiler features to targets that don't link against Qt -target_compile_features(codeeditorLib PRIVATE ${QT_COMPILE_FEATURES}) -target_compile_features(privateSlot PRIVATE ${QT_COMPILE_FEATURES}) - -configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY) -add_custom_command( - OUTPUT generated.txt - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" "${CMAKE_CURRENT_BINARY_DIR}/generated.txt" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/generated.txt.in" - ) - -add_custom_target(generate_moc_input - DEPENDS generated.txt - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}" - COMMAND ${CMAKE_COMMAND} -E rename "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myinterface.h" -) - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" -) - -if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_GENERATOR STREQUAL Ninja) - set(debug_srcs "$<$:debug_class.cpp>" $<$:debug_resource.qrc>) - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:TEST_DEBUG_CLASS>) -endif() - -# The -no-protection option disables the generation of include guards. Verify -# that setting the source file property has an effect by using this and -# issue an error in the preprocessor in calwidget.cpp if the include guard -# is defined. -set_source_files_properties(calwidget.ui PROPERTIES AUTOUIC_OPTIONS "-no-protection") - -add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp - multiplewidgets.cpp - xyz.cpp yaf.cpp gadget.cpp $ - test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} - ${CMAKE_CURRENT_BINARY_DIR}/generated_resource.qrc -) -set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") - -add_executable(targetObjectsTest targetObjectsTest.cpp $) -target_link_libraries(targetObjectsTest ${QT_LIBRARIES}) - -set_target_properties( - QtAutogen codeeditorLib privateSlot targetObjectsTest - PROPERTIES - AUTOMOC TRUE -) - - -include(GenerateExportHeader) -# The order is relevant here. B depends on A, and B headers depend on A -# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we -# test that CMAKE_AUTOMOC successfully reads the include directories -# for the build interface from those targets. There has previously been -# a bug where caching of the include directories happened before -# extracting the includes to pass to moc. -add_subdirectory(Bdir) -add_subdirectory(Adir) -add_library(libC SHARED libC.cpp) -set_target_properties(libC PROPERTIES AUTOMOC TRUE) -generate_export_header(libC) -target_link_libraries(libC LINK_PUBLIC libB) -target_include_directories(libC PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -set_property(TARGET libC APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR} ) - -target_link_libraries(QtAutogen codeeditorLib ${QT_LIBRARIES} libC) diff --git a/Tests/QtAutogen/complex/abc.cpp b/Tests/QtAutogen/complex/abc.cpp deleted file mode 100644 index 2929b92..0000000 --- a/Tests/QtAutogen/complex/abc.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "abc.h" -#include "abc_p.h" - -#include - -class PrintAbc : public QObject -{ - Q_OBJECT -public: - PrintAbc() - : QObject() - { - } -public slots: - void print() const { printf("abc\n"); } -}; - -Abc::Abc() - : QObject() -{ -} - -void Abc::doAbc() -{ - PrintAbc pa; - pa.print(); - AbcP abcP; - abcP.doAbcP(); -} - -// check that including the moc file for the cpp file and the header works: -#include "abc.moc" -#include "moc_abc.cpp" -#include "moc_abc_p.cpp" - -// check that including a moc file from another header works: -#include "moc_xyz.cpp" diff --git a/Tests/QtAutogen/complex/abc.h b/Tests/QtAutogen/complex/abc.h deleted file mode 100644 index ec5f411..0000000 --- a/Tests/QtAutogen/complex/abc.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef ABC_H -#define ABC_H - -#include - -class Abc : public QObject -{ - Q_OBJECT -public: - Abc(); -public slots: - void doAbc(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/abc_p.h b/Tests/QtAutogen/complex/abc_p.h deleted file mode 100644 index be98487..0000000 --- a/Tests/QtAutogen/complex/abc_p.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef ABC_P_H -#define ABC_P_H - -#include - -#include - -class AbcP : public QObject -{ - Q_OBJECT -public: - AbcP() {} -public slots: - void doAbcP() { printf("I am private abc !\n"); } -}; - -#endif diff --git a/Tests/QtAutogen/complex/bar.cpp b/Tests/QtAutogen/complex/bar.cpp deleted file mode 100644 index 734bd7a..0000000 --- a/Tests/QtAutogen/complex/bar.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "sub/bar.h" - -#include - -Bar::Bar() - : QObject() -{ -} - -void Bar::doBar() -{ - printf("Hello bar !\n"); -} - -#include "sub/moc_bar.cpp" diff --git a/Tests/QtAutogen/complex/blub.cpp b/Tests/QtAutogen/complex/blub.cpp deleted file mode 100644 index 1c497e0..0000000 --- a/Tests/QtAutogen/complex/blub.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "blub.h" - -#include - -class BlubBlub : public QObject -{ - Q_OBJECT -public: - BlubBlub() - : QObject() - { - } -public slots: - int getValue() const { return 13; } -}; - -Blub::Blub() -{ -} - -void Blub::blubber() -{ - BlubBlub bb; - printf("Blub blub %d ! \n", bb.getValue()); -} - -// test the case that the wrong moc-file is included, it should -// actually be "blub.moc" -#include "moc_blub.cpp" diff --git a/Tests/QtAutogen/complex/blub.h b/Tests/QtAutogen/complex/blub.h deleted file mode 100644 index ff79878..0000000 --- a/Tests/QtAutogen/complex/blub.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef BLUB_H -#define BLUB_H - -#include - -class Blub -{ -public: - Blub(); - void blubber(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/calwidget.cpp b/Tests/QtAutogen/complex/calwidget.cpp deleted file mode 100644 index 380e982..0000000 --- a/Tests/QtAutogen/complex/calwidget.cpp +++ /dev/null @@ -1,436 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calwidget.h" - -#include "ui_calwidget.h" -#ifdef UI_CALWIDGET_H -#error Definition of UI_CALWIDGET_H should be disabled by file option. -#endif - -Window::Window() - : ui(new Ui::Window) -{ - createPreviewGroupBox(); - createGeneralOptionsGroupBox(); - createDatesGroupBox(); - createTextFormatsGroupBox(); - - QGridLayout* layout = new QGridLayout; - layout->addWidget(previewGroupBox, 0, 0); - layout->addWidget(generalOptionsGroupBox, 0, 1); - layout->addWidget(datesGroupBox, 1, 0); - layout->addWidget(textFormatsGroupBox, 1, 1); - layout->setSizeConstraint(QLayout::SetFixedSize); - setLayout(layout); - - previewLayout->setRowMinimumHeight(0, calendar->sizeHint().height()); - previewLayout->setColumnMinimumWidth(0, calendar->sizeHint().width()); - - setWindowTitle(tr("Calendar Widget")); -} - -void Window::localeChanged(int index) -{ - calendar->setLocale(localeCombo->itemData(index).toLocale()); -} - -void Window::firstDayChanged(int index) -{ - calendar->setFirstDayOfWeek( - Qt::DayOfWeek(firstDayCombo->itemData(index).toInt())); -} - -void Window::selectionModeChanged(int index) -{ - calendar->setSelectionMode(QCalendarWidget::SelectionMode( - selectionModeCombo->itemData(index).toInt())); -} - -void Window::horizontalHeaderChanged(int index) -{ - calendar->setHorizontalHeaderFormat(QCalendarWidget::HorizontalHeaderFormat( - horizontalHeaderCombo->itemData(index).toInt())); -} - -void Window::verticalHeaderChanged(int index) -{ - calendar->setVerticalHeaderFormat(QCalendarWidget::VerticalHeaderFormat( - verticalHeaderCombo->itemData(index).toInt())); -} - -void Window::selectedDateChanged() -{ - currentDateEdit->setDate(calendar->selectedDate()); -} - -void Window::minimumDateChanged(const QDate& date) -{ - calendar->setMinimumDate(date); - maximumDateEdit->setDate(calendar->maximumDate()); -} - -void Window::maximumDateChanged(const QDate& date) -{ - calendar->setMaximumDate(date); - minimumDateEdit->setDate(calendar->minimumDate()); -} - -void Window::weekdayFormatChanged() -{ - QTextCharFormat format; - - format.setForeground(qvariant_cast( - weekdayColorCombo->itemData(weekdayColorCombo->currentIndex()))); - calendar->setWeekdayTextFormat(Qt::Monday, format); - calendar->setWeekdayTextFormat(Qt::Tuesday, format); - calendar->setWeekdayTextFormat(Qt::Wednesday, format); - calendar->setWeekdayTextFormat(Qt::Thursday, format); - calendar->setWeekdayTextFormat(Qt::Friday, format); -} - -void Window::weekendFormatChanged() -{ - QTextCharFormat format; - - format.setForeground(qvariant_cast( - weekendColorCombo->itemData(weekendColorCombo->currentIndex()))); - calendar->setWeekdayTextFormat(Qt::Saturday, format); - calendar->setWeekdayTextFormat(Qt::Sunday, format); -} - -void Window::reformatHeaders() -{ - QString text = headerTextFormatCombo->currentText(); - QTextCharFormat format; - - if (text == tr("Bold")) { - format.setFontWeight(QFont::Bold); - } else if (text == tr("Italic")) { - format.setFontItalic(true); - } else if (text == tr("Green")) { - format.setForeground(Qt::green); - } - calendar->setHeaderTextFormat(format); -} - -void Window::reformatCalendarPage() -{ - if (firstFridayCheckBox->isChecked()) { - QDate firstFriday(calendar->yearShown(), calendar->monthShown(), 1); - while (firstFriday.dayOfWeek() != Qt::Friday) - firstFriday = firstFriday.addDays(1); - QTextCharFormat firstFridayFormat; - firstFridayFormat.setForeground(Qt::blue); - calendar->setDateTextFormat(firstFriday, firstFridayFormat); - } - - // May First in Red takes precedence - if (mayFirstCheckBox->isChecked()) { - const QDate mayFirst(calendar->yearShown(), 5, 1); - QTextCharFormat mayFirstFormat; - mayFirstFormat.setForeground(Qt::red); - calendar->setDateTextFormat(mayFirst, mayFirstFormat); - } -} - -void Window::createPreviewGroupBox() -{ - previewGroupBox = new QGroupBox(tr("Preview")); - - calendar = new QCalendarWidget; - calendar->setMinimumDate(QDate(1900, 1, 1)); - calendar->setMaximumDate(QDate(3000, 1, 1)); - calendar->setGridVisible(true); - - connect(calendar, SIGNAL(currentPageChanged(int, int)), this, - SLOT(reformatCalendarPage())); - - previewLayout = new QGridLayout; - previewLayout->addWidget(calendar, 0, 0, Qt::AlignCenter); - previewGroupBox->setLayout(previewLayout); -} - -void Window::createGeneralOptionsGroupBox() -{ - generalOptionsGroupBox = new QGroupBox(tr("General Options")); - - localeCombo = new QComboBox; - int curLocaleIndex = -1; - int index = 0; - for (int _lang = QLocale::C; _lang <= QLocale::LastLanguage; ++_lang) { - QLocale::Language lang = static_cast(_lang); - QList countries = QLocale::countriesForLanguage(lang); - for (int i = 0; i < countries.count(); ++i) { - QLocale::Country country = countries.at(i); - QString label = QLocale::languageToString(lang); - label += QLatin1Char('/'); - label += QLocale::countryToString(country); - QLocale locale(lang, country); - if (this->locale().language() == lang && - this->locale().country() == country) - curLocaleIndex = index; - localeCombo->addItem(label, locale); - ++index; - } - } - if (curLocaleIndex != -1) - localeCombo->setCurrentIndex(curLocaleIndex); - localeLabel = new QLabel(tr("&Locale")); - localeLabel->setBuddy(localeCombo); - - firstDayCombo = new QComboBox; - firstDayCombo->addItem(tr("Sunday"), Qt::Sunday); - firstDayCombo->addItem(tr("Monday"), Qt::Monday); - firstDayCombo->addItem(tr("Tuesday"), Qt::Tuesday); - firstDayCombo->addItem(tr("Wednesday"), Qt::Wednesday); - firstDayCombo->addItem(tr("Thursday"), Qt::Thursday); - firstDayCombo->addItem(tr("Friday"), Qt::Friday); - firstDayCombo->addItem(tr("Saturday"), Qt::Saturday); - - firstDayLabel = new QLabel(tr("Wee&k starts on:")); - firstDayLabel->setBuddy(firstDayCombo); - - selectionModeCombo = new QComboBox; - selectionModeCombo->addItem(tr("Single selection"), - QCalendarWidget::SingleSelection); - selectionModeCombo->addItem(tr("None"), QCalendarWidget::NoSelection); - - selectionModeLabel = new QLabel(tr("&Selection mode:")); - selectionModeLabel->setBuddy(selectionModeCombo); - - gridCheckBox = new QCheckBox(tr("&Grid")); - gridCheckBox->setChecked(calendar->isGridVisible()); - - navigationCheckBox = new QCheckBox(tr("&Navigation bar")); - navigationCheckBox->setChecked(true); - - horizontalHeaderCombo = new QComboBox; - horizontalHeaderCombo->addItem(tr("Single letter day names"), - QCalendarWidget::SingleLetterDayNames); - horizontalHeaderCombo->addItem(tr("Short day names"), - QCalendarWidget::ShortDayNames); - horizontalHeaderCombo->addItem(tr("None"), - QCalendarWidget::NoHorizontalHeader); - horizontalHeaderCombo->setCurrentIndex(1); - - horizontalHeaderLabel = new QLabel(tr("&Horizontal header:")); - horizontalHeaderLabel->setBuddy(horizontalHeaderCombo); - - verticalHeaderCombo = new QComboBox; - verticalHeaderCombo->addItem(tr("ISO week numbers"), - QCalendarWidget::ISOWeekNumbers); - verticalHeaderCombo->addItem(tr("None"), QCalendarWidget::NoVerticalHeader); - - verticalHeaderLabel = new QLabel(tr("&Vertical header:")); - verticalHeaderLabel->setBuddy(verticalHeaderCombo); - - connect(localeCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(localeChanged(int))); - connect(firstDayCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(firstDayChanged(int))); - connect(selectionModeCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(selectionModeChanged(int))); - connect(gridCheckBox, SIGNAL(toggled(bool)), calendar, - SLOT(setGridVisible(bool))); - connect(navigationCheckBox, SIGNAL(toggled(bool)), calendar, - SLOT(setNavigationBarVisible(bool))); - connect(horizontalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(horizontalHeaderChanged(int))); - connect(verticalHeaderCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(verticalHeaderChanged(int))); - - QHBoxLayout* checkBoxLayout = new QHBoxLayout; - checkBoxLayout->addWidget(gridCheckBox); - checkBoxLayout->addStretch(); - checkBoxLayout->addWidget(navigationCheckBox); - - QGridLayout* outerLayout = new QGridLayout; - outerLayout->addWidget(localeLabel, 0, 0); - outerLayout->addWidget(localeCombo, 0, 1); - outerLayout->addWidget(firstDayLabel, 1, 0); - outerLayout->addWidget(firstDayCombo, 1, 1); - outerLayout->addWidget(selectionModeLabel, 2, 0); - outerLayout->addWidget(selectionModeCombo, 2, 1); - outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); - outerLayout->addWidget(horizontalHeaderLabel, 4, 0); - outerLayout->addWidget(horizontalHeaderCombo, 4, 1); - outerLayout->addWidget(verticalHeaderLabel, 5, 0); - outerLayout->addWidget(verticalHeaderCombo, 5, 1); - generalOptionsGroupBox->setLayout(outerLayout); - - firstDayChanged(firstDayCombo->currentIndex()); - selectionModeChanged(selectionModeCombo->currentIndex()); - horizontalHeaderChanged(horizontalHeaderCombo->currentIndex()); - verticalHeaderChanged(verticalHeaderCombo->currentIndex()); -} - -void Window::createDatesGroupBox() -{ - datesGroupBox = new QGroupBox(tr("Dates")); - - minimumDateEdit = new QDateEdit; - minimumDateEdit->setDisplayFormat("MMM d yyyy"); - minimumDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - minimumDateEdit->setDate(calendar->minimumDate()); - - minimumDateLabel = new QLabel(tr("&Minimum Date:")); - minimumDateLabel->setBuddy(minimumDateEdit); - - currentDateEdit = new QDateEdit; - currentDateEdit->setDisplayFormat("MMM d yyyy"); - currentDateEdit->setDate(calendar->selectedDate()); - currentDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - - currentDateLabel = new QLabel(tr("&Current Date:")); - currentDateLabel->setBuddy(currentDateEdit); - - maximumDateEdit = new QDateEdit; - maximumDateEdit->setDisplayFormat("MMM d yyyy"); - maximumDateEdit->setDateRange(calendar->minimumDate(), - calendar->maximumDate()); - maximumDateEdit->setDate(calendar->maximumDate()); - - maximumDateLabel = new QLabel(tr("Ma&ximum Date:")); - maximumDateLabel->setBuddy(maximumDateEdit); - - connect(currentDateEdit, SIGNAL(dateChanged(QDate)), calendar, - SLOT(setSelectedDate(QDate))); - connect(calendar, SIGNAL(selectionChanged()), this, - SLOT(selectedDateChanged())); - connect(minimumDateEdit, SIGNAL(dateChanged(QDate)), this, - SLOT(minimumDateChanged(QDate))); - connect(maximumDateEdit, SIGNAL(dateChanged(QDate)), this, - SLOT(maximumDateChanged(QDate))); - - QGridLayout* dateBoxLayout = new QGridLayout; - dateBoxLayout->addWidget(currentDateLabel, 1, 0); - dateBoxLayout->addWidget(currentDateEdit, 1, 1); - dateBoxLayout->addWidget(minimumDateLabel, 0, 0); - dateBoxLayout->addWidget(minimumDateEdit, 0, 1); - dateBoxLayout->addWidget(maximumDateLabel, 2, 0); - dateBoxLayout->addWidget(maximumDateEdit, 2, 1); - dateBoxLayout->setRowStretch(3, 1); - - datesGroupBox->setLayout(dateBoxLayout); -} - -void Window::createTextFormatsGroupBox() -{ - textFormatsGroupBox = new QGroupBox(tr("Text Formats")); - - weekdayColorCombo = createColorComboBox(); - weekdayColorCombo->setCurrentIndex(weekdayColorCombo->findText(tr("Black"))); - - weekdayColorLabel = new QLabel(tr("&Weekday color:")); - weekdayColorLabel->setBuddy(weekdayColorCombo); - - weekendColorCombo = createColorComboBox(); - weekendColorCombo->setCurrentIndex(weekendColorCombo->findText(tr("Red"))); - - weekendColorLabel = new QLabel(tr("Week&end color:")); - weekendColorLabel->setBuddy(weekendColorCombo); - - headerTextFormatCombo = new QComboBox; - headerTextFormatCombo->addItem(tr("Bold")); - headerTextFormatCombo->addItem(tr("Italic")); - headerTextFormatCombo->addItem(tr("Plain")); - - headerTextFormatLabel = new QLabel(tr("&Header text:")); - headerTextFormatLabel->setBuddy(headerTextFormatCombo); - - firstFridayCheckBox = new QCheckBox(tr("&First Friday in blue")); - - mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); - - connect(weekdayColorCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(weekdayFormatChanged())); - connect(weekendColorCombo, SIGNAL(currentIndexChanged(int)), this, - SLOT(weekendFormatChanged())); - connect(headerTextFormatCombo, SIGNAL(currentIndexChanged(QString)), this, - SLOT(reformatHeaders())); - connect(firstFridayCheckBox, SIGNAL(toggled(bool)), this, - SLOT(reformatCalendarPage())); - connect(mayFirstCheckBox, SIGNAL(toggled(bool)), this, - SLOT(reformatCalendarPage())); - - QHBoxLayout* checkBoxLayout = new QHBoxLayout; - checkBoxLayout->addWidget(firstFridayCheckBox); - checkBoxLayout->addStretch(); - checkBoxLayout->addWidget(mayFirstCheckBox); - - QGridLayout* outerLayout = new QGridLayout; - outerLayout->addWidget(weekdayColorLabel, 0, 0); - outerLayout->addWidget(weekdayColorCombo, 0, 1); - outerLayout->addWidget(weekendColorLabel, 1, 0); - outerLayout->addWidget(weekendColorCombo, 1, 1); - outerLayout->addWidget(headerTextFormatLabel, 2, 0); - outerLayout->addWidget(headerTextFormatCombo, 2, 1); - outerLayout->addLayout(checkBoxLayout, 3, 0, 1, 2); - textFormatsGroupBox->setLayout(outerLayout); - - weekdayFormatChanged(); - weekendFormatChanged(); - reformatHeaders(); - reformatCalendarPage(); -} - -QComboBox* Window::createColorComboBox() -{ - QComboBox* comboBox = new QComboBox; - comboBox->addItem(tr("Red"), QColor(Qt::red)); - comboBox->addItem(tr("Blue"), QColor(Qt::blue)); - comboBox->addItem(tr("Black"), QColor(Qt::black)); - comboBox->addItem(tr("Magenta"), QColor(Qt::magenta)); - return comboBox; -} - -//#include "moc_calwidget.cpp" diff --git a/Tests/QtAutogen/complex/calwidget.h b/Tests/QtAutogen/complex/calwidget.h deleted file mode 100644 index 084d959..0000000 --- a/Tests/QtAutogen/complex/calwidget.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef WINDOW_H -#define WINDOW_H - -#include - -class QCalendarWidget; -class QCheckBox; -class QComboBox; -class QDate; -class QDateEdit; -class QGridLayout; -class QGroupBox; -class QLabel; - -namespace Ui { -class Window; -} - -class Window : public QWidget -{ - Q_OBJECT - -public: - Window(); - -private slots: - void localeChanged(int index); - void firstDayChanged(int index); - void selectionModeChanged(int index); - void horizontalHeaderChanged(int index); - void verticalHeaderChanged(int index); - void selectedDateChanged(); - void minimumDateChanged(const QDate& date); - void maximumDateChanged(const QDate& date); - void weekdayFormatChanged(); - void weekendFormatChanged(); - void reformatHeaders(); - void reformatCalendarPage(); - -private: - void createPreviewGroupBox(); - void createGeneralOptionsGroupBox(); - void createDatesGroupBox(); - void createTextFormatsGroupBox(); - QComboBox* createColorComboBox(); - - QGroupBox* previewGroupBox; - QGridLayout* previewLayout; - QCalendarWidget* calendar; - - QGroupBox* generalOptionsGroupBox; - QLabel* localeLabel; - QLabel* firstDayLabel; - QLabel* selectionModeLabel; - QLabel* horizontalHeaderLabel; - QLabel* verticalHeaderLabel; - QComboBox* localeCombo; - QComboBox* firstDayCombo; - QComboBox* selectionModeCombo; - QCheckBox* gridCheckBox; - QCheckBox* navigationCheckBox; - QComboBox* horizontalHeaderCombo; - QComboBox* verticalHeaderCombo; - - QGroupBox* datesGroupBox; - QLabel* currentDateLabel; - QLabel* minimumDateLabel; - QLabel* maximumDateLabel; - QDateEdit* currentDateEdit; - QDateEdit* minimumDateEdit; - QDateEdit* maximumDateEdit; - - QGroupBox* textFormatsGroupBox; - QLabel* weekdayColorLabel; - QLabel* weekendColorLabel; - QLabel* headerTextFormatLabel; - QComboBox* weekdayColorCombo; - QComboBox* weekendColorCombo; - QComboBox* headerTextFormatCombo; - - QCheckBox* firstFridayCheckBox; - QCheckBox* mayFirstCheckBox; - - Ui::Window* ui; -}; - -#endif diff --git a/Tests/QtAutogen/complex/calwidget.ui b/Tests/QtAutogen/complex/calwidget.ui deleted file mode 100644 index 1c245ca..0000000 --- a/Tests/QtAutogen/complex/calwidget.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - Window - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 90 - 180 - 94 - 24 - - - - PushButton - - - - - - diff --git a/Tests/QtAutogen/complex/codeeditor.cpp b/Tests/QtAutogen/complex/codeeditor.cpp deleted file mode 100644 index 0caf8a7..0000000 --- a/Tests/QtAutogen/complex/codeeditor.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include - -#include "codeeditor.h" - -CodeEditor::CodeEditor(QWidget* parent) - : QPlainTextEdit(parent) -{ - lineNumberArea = new LineNumberArea(this); - - connect(this, SIGNAL(blockCountChanged(int)), this, - SLOT(updateLineNumberAreaWidth(int))); - connect(this, SIGNAL(updateRequest(QRect, int)), this, - SLOT(updateLineNumberArea(QRect, int))); - connect(this, SIGNAL(cursorPositionChanged()), this, - SLOT(highlightCurrentLine())); - - updateLineNumberAreaWidth(0); - highlightCurrentLine(); -} - -int CodeEditor::lineNumberAreaWidth() -{ - int digits = 1; - int max = qMax(1, blockCount()); - while (max >= 10) { - max /= 10; - ++digits; - } - - int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits; - - return space; -} - -void CodeEditor::updateLineNumberAreaWidth(int /* newBlockCount */) -{ - setViewportMargins(lineNumberAreaWidth(), 0, 0, 0); -} - -void CodeEditor::updateLineNumberArea(const QRect& rect, int dy) -{ - if (dy) - lineNumberArea->scroll(0, dy); - else - lineNumberArea->update(0, rect.y(), lineNumberArea->width(), - rect.height()); - - if (rect.contains(viewport()->rect())) - updateLineNumberAreaWidth(0); -} - -void CodeEditor::resizeEvent(QResizeEvent* e) -{ - QPlainTextEdit::resizeEvent(e); - - QRect cr = contentsRect(); - lineNumberArea->setGeometry( - QRect(cr.left(), cr.top(), lineNumberAreaWidth(), cr.height())); -} - -void CodeEditor::highlightCurrentLine() -{ - QList extraSelections; - - if (!isReadOnly()) { - QTextEdit::ExtraSelection selection; - - QColor lineColor = QColor(Qt::yellow).lighter(160); - - selection.format.setBackground(lineColor); - selection.format.setProperty(QTextFormat::FullWidthSelection, true); - selection.cursor = textCursor(); - selection.cursor.clearSelection(); - extraSelections.append(selection); - } - - setExtraSelections(extraSelections); -} - -void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event) -{ - QPainter painter(lineNumberArea); - painter.fillRect(event->rect(), Qt::lightGray); - - QTextBlock block = firstVisibleBlock(); - int blockNumber = block.blockNumber(); - int top = - (int)blockBoundingGeometry(block).translated(contentOffset()).top(); - int bottom = top + (int)blockBoundingRect(block).height(); - - while (block.isValid() && top <= event->rect().bottom()) { - if (block.isVisible() && bottom >= event->rect().top()) { - QString number = QString::number(blockNumber + 1); - painter.setPen(Qt::black); - painter.drawText(0, top, lineNumberArea->width(), fontMetrics().height(), - Qt::AlignRight, number); - } - - block = block.next(); - top = bottom; - bottom = top + (int)blockBoundingRect(block).height(); - ++blockNumber; - } -} - -#include "codeeditor.moc" diff --git a/Tests/QtAutogen/complex/codeeditor.h b/Tests/QtAutogen/complex/codeeditor.h deleted file mode 100644 index b410bd4..0000000 --- a/Tests/QtAutogen/complex/codeeditor.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor -** the names of its contributors may be used to endorse or promote -** products derived from this software without specific prior written -** permission. -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CODEEDITOR_H -#define CODEEDITOR_H - -#include -#include - -class QPaintEvent; -class QResizeEvent; -class QSize; -class QWidget; - -class LineNumberArea; - -class CodeEditor : public QPlainTextEdit -{ - Q_OBJECT - -public: - CodeEditor(QWidget* parent = 0); - - void lineNumberAreaPaintEvent(QPaintEvent* event); - int lineNumberAreaWidth(); - -protected: - void resizeEvent(QResizeEvent* event); - -private slots: - void updateLineNumberAreaWidth(int newBlockCount); - void highlightCurrentLine(); - void updateLineNumberArea(const QRect&, int); - -private: - QWidget* lineNumberArea; -}; - -class LineNumberArea : public QWidget -{ -public: - LineNumberArea(CodeEditor* editor) - : QWidget(editor) - { - codeEditor = editor; - } - - QSize sizeHint() const - { - return QSize(codeEditor->lineNumberAreaWidth(), 0); - } - -protected: - void paintEvent(QPaintEvent* event) - { - codeEditor->lineNumberAreaPaintEvent(event); - } - -private: - CodeEditor* codeEditor; -}; - -#endif diff --git a/Tests/QtAutogen/complex/debug_class.cpp b/Tests/QtAutogen/complex/debug_class.cpp deleted file mode 100644 index 46b09e7..0000000 --- a/Tests/QtAutogen/complex/debug_class.cpp +++ /dev/null @@ -1,10 +0,0 @@ - -#include "debug_class.h" -#include "ui_debug_class.h" - -DebugClass::DebugClass(QWidget* parent) - : QWidget(parent) - , ui(new Ui::DebugClass) -{ - ui->setupUi(this); -} diff --git a/Tests/QtAutogen/complex/debug_class.h b/Tests/QtAutogen/complex/debug_class.h deleted file mode 100644 index c02f0ed..0000000 --- a/Tests/QtAutogen/complex/debug_class.h +++ /dev/null @@ -1,19 +0,0 @@ - -#include - -namespace Ui { -class DebugClass; -} - -class DebugClass : public QWidget -{ - Q_OBJECT -public: - explicit DebugClass(QWidget* parent = 0); - -signals: - void someSignal(); - -private: - Ui::DebugClass* ui; -}; diff --git a/Tests/QtAutogen/complex/debug_class.ui b/Tests/QtAutogen/complex/debug_class.ui deleted file mode 100644 index dc2e1ac..0000000 --- a/Tests/QtAutogen/complex/debug_class.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - DebugClass - - - - 0 - 0 - 400 - 300 - - - - DebugClass - - - - - 50 - 20 - 82 - 21 - - - - CheckBox - - - - - - 40 - 70 - 94 - 24 - - - - PushButton - - - - - - diff --git a/Tests/QtAutogen/complex/debug_resource.qrc b/Tests/QtAutogen/complex/debug_resource.qrc deleted file mode 100644 index db98b9b..0000000 --- a/Tests/QtAutogen/complex/debug_resource.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - debug_class.ui - - diff --git a/Tests/QtAutogen/complex/foo.cpp b/Tests/QtAutogen/complex/foo.cpp deleted file mode 100644 index f665eee..0000000 --- a/Tests/QtAutogen/complex/foo.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "foo.h" - -#include - -class FooFoo : public QObject -{ - Q_OBJECT -public: - FooFoo() - : QObject() - { - } -public slots: - int getValue() const { return 12; } -}; - -Foo::Foo() - : QObject() -{ -} - -void Foo::doFoo() -{ - FooFoo ff; - printf("Hello automoc: %d\n", ff.getValue()); -} - -#include "foo.moc" diff --git a/Tests/QtAutogen/complex/foo.h b/Tests/QtAutogen/complex/foo.h deleted file mode 100644 index 3e03fe6..0000000 --- a/Tests/QtAutogen/complex/foo.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef FOO_H -#define FOO_H - -#include - -class Foo -#ifdef FOO - : public QObject -#endif -{ - Q_OBJECT -public: - Foo(); -public slots: - void doFoo(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/gadget.cpp b/Tests/QtAutogen/complex/gadget.cpp deleted file mode 100644 index 23d95fa..0000000 --- a/Tests/QtAutogen/complex/gadget.cpp +++ /dev/null @@ -1,4 +0,0 @@ - -#include "gadget.h" - -#include "moc_gadget.cpp" diff --git a/Tests/QtAutogen/complex/gadget.h b/Tests/QtAutogen/complex/gadget.h deleted file mode 100644 index 3253e31..0000000 --- a/Tests/QtAutogen/complex/gadget.h +++ /dev/null @@ -1,19 +0,0 @@ - -#ifndef GADGET_H -#define GADGET_H - -#include - -class Gadget -{ - Q_GADGET - Q_ENUMS(Type) -public: - enum Type - { - Type0, - Type1 - }; -}; - -#endif diff --git a/Tests/QtAutogen/complex/generated.cpp b/Tests/QtAutogen/complex/generated.cpp deleted file mode 100644 index d514c61..0000000 --- a/Tests/QtAutogen/complex/generated.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -#include "generated.h" - -Generated::Generated(QObject* parent) - : QObject(parent) -{ -} - -#include "moc_generated.cpp" diff --git a/Tests/QtAutogen/complex/generated.h b/Tests/QtAutogen/complex/generated.h deleted file mode 100644 index 62e1607..0000000 --- a/Tests/QtAutogen/complex/generated.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef GENERATED_H -#define GENERATED_H - -#include - -#include "myinterface.h" -#include "myotherinterface.h" - -class Generated : public QObject, MyInterface, MyOtherInterface -{ - Q_OBJECT - Q_INTERFACES(MyInterface MyOtherInterface) -public: - explicit Generated(QObject* parent = 0); -}; - -#endif diff --git a/Tests/QtAutogen/complex/generated.txt.in b/Tests/QtAutogen/complex/generated.txt.in deleted file mode 100644 index 77507bb..0000000 --- a/Tests/QtAutogen/complex/generated.txt.in +++ /dev/null @@ -1 +0,0 @@ -Some generated text file. diff --git a/Tests/QtAutogen/complex/generated_resource.qrc.in b/Tests/QtAutogen/complex/generated_resource.qrc.in deleted file mode 100644 index da5fa62..0000000 --- a/Tests/QtAutogen/complex/generated_resource.qrc.in +++ /dev/null @@ -1,5 +0,0 @@ - - - generated.txt - - diff --git a/Tests/QtAutogen/complex/libC.cpp b/Tests/QtAutogen/complex/libC.cpp deleted file mode 100644 index a3acff1..0000000 --- a/Tests/QtAutogen/complex/libC.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "libC.h" - -LibC::LibC(QObject* parent) - : QObject(parent) -{ -} - -int LibC::foo() -{ - return b.foo(); -} diff --git a/Tests/QtAutogen/complex/libC.h b/Tests/QtAutogen/complex/libC.h deleted file mode 100644 index 3bc2bad..0000000 --- a/Tests/QtAutogen/complex/libC.h +++ /dev/null @@ -1,22 +0,0 @@ - -#ifndef LIBC_H -#define LIBC_H - -#include "libc_export.h" - -#include "libB.h" -#include - -class LIBC_EXPORT LibC : public QObject -{ - Q_OBJECT -public: - explicit LibC(QObject* parent = 0); - - int foo(); - -private: - LibB b; -}; - -#endif diff --git a/Tests/QtAutogen/complex/main.cpp b/Tests/QtAutogen/complex/main.cpp deleted file mode 100644 index d557c70..0000000 --- a/Tests/QtAutogen/complex/main.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). - ** All rights reserved. - ** Contact: Nokia Corporation (qt-info@nokia.com) - ** - ** This file is part of the examples of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** You may use this file under the terms of the BSD license as follows: - ** - ** "Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions are - ** met: - ** * Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** * Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in - ** the documentation and/or other materials provided with the - ** distribution. - ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor - ** the names of its contributors may be used to endorse or promote - ** products derived from this software without specific prior written - ** permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." - ** $QT_END_LICENSE$ - ** - ****************************************************************************/ - -#include -#include - -#include "abc.h" -#include "blub.h" -#include "calwidget.h" -#include "codeeditor.h" -#include "foo.h" -#include "libC.h" -#include "resourcetester.h" -#include "sub/bar.h" -#include "xyz.h" -#include "yaf.h" -#ifdef TEST_DEBUG_CLASS -#include "debug_class.h" -#include -#endif - -int main(int argv, char** args) -{ - QCoreApplication app(argv, args); - - Foo foo; - foo.doFoo(); - - Blub b; - b.blubber(); - - Bar bar; - bar.doBar(); - - Abc abc; - abc.doAbc(); - - Xyz xyz; - xyz.doXyz(); - - Yaf yaf; - yaf.doYaf(); - - LibC lc; - lc.foo(); - - ResourceTester rt; - - QTimer::singleShot(0, &rt, SLOT(doTest())); - -#ifdef TEST_DEBUG_CLASS - std::cout << DebugClass::staticMetaObject.className() << std::endl; -#endif - - return app.exec(); -} diff --git a/Tests/QtAutogen/complex/multiplewidgets.cpp b/Tests/QtAutogen/complex/multiplewidgets.cpp deleted file mode 100644 index fda36ea..0000000 --- a/Tests/QtAutogen/complex/multiplewidgets.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -#include "multiplewidgets.h" - -#include "ui_widget1.h" -#include "ui_widget2.h" - -Widget1::Widget1(QWidget* parent) - : QWidget(parent) - , ui(new Ui::Widget1) -{ - ui->setupUi(this); -} - -Widget2::Widget2(QWidget* parent) - : QWidget(parent) - , ui(new Ui::Widget2) -{ - ui->setupUi(this); -} diff --git a/Tests/QtAutogen/complex/multiplewidgets.h b/Tests/QtAutogen/complex/multiplewidgets.h deleted file mode 100644 index a4d0a50..0000000 --- a/Tests/QtAutogen/complex/multiplewidgets.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef MULTIPLEWIDGETS_H -#define MULTIPLEWIDGETS_H - -#include - -namespace Ui { -class Widget1; -} - -class Widget1 : public QWidget -{ - Q_OBJECT -public: - Widget1(QWidget* parent = 0); - -private: - Ui::Widget1* ui; -}; - -namespace Ui { -class Widget2; -} - -class Widget2 : public QWidget -{ - Q_OBJECT -public: - Widget2(QWidget* parent = 0); - -private: - Ui::Widget2* ui; -}; - -#endif diff --git a/Tests/QtAutogen/complex/myinterface.h.in b/Tests/QtAutogen/complex/myinterface.h.in deleted file mode 100644 index c6c0ba1..0000000 --- a/Tests/QtAutogen/complex/myinterface.h.in +++ /dev/null @@ -1,14 +0,0 @@ - -#ifndef MYINTERFACE_H -#define MYINTERFACE_H - -#include - -class MyInterface -{ - -}; - -Q_DECLARE_INTERFACE(MyInterface, "org.cmake.example.MyInterface") - -#endif diff --git a/Tests/QtAutogen/complex/myotherinterface.h.in b/Tests/QtAutogen/complex/myotherinterface.h.in deleted file mode 100644 index d21e7af..0000000 --- a/Tests/QtAutogen/complex/myotherinterface.h.in +++ /dev/null @@ -1,14 +0,0 @@ - -#ifndef MYOTHERINTERFACE_H -#define MYOTHERINTERFACE_H - -#include - -class MyOtherInterface -{ - -}; - -Q_DECLARE_INTERFACE(MyOtherInterface, "org.cmake.example.MyOtherInterface") - -#endif diff --git a/Tests/QtAutogen/complex/private_slot.cpp b/Tests/QtAutogen/complex/private_slot.cpp deleted file mode 100644 index ab1682a..0000000 --- a/Tests/QtAutogen/complex/private_slot.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -#include "private_slot.h" - -class PrivateSlotPrivate -{ -public: - void privateSlot() {} -}; - -PrivateSlot::PrivateSlot(QObject* parent) - : QObject(parent) - , d(new PrivateSlotPrivate) -{ -} - -#include "private_slot.moc" diff --git a/Tests/QtAutogen/complex/private_slot.h b/Tests/QtAutogen/complex/private_slot.h deleted file mode 100644 index 8041eb2..0000000 --- a/Tests/QtAutogen/complex/private_slot.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef PRIVATE_SLOT_H -#define PRIVATE_SLOT_H - -#include - -class PrivateSlotPrivate; - -class PrivateSlot : public QObject -{ - Q_OBJECT -public: - PrivateSlot(QObject* parent = 0); - -private: - PrivateSlotPrivate* const d; - Q_PRIVATE_SLOT(d, void privateSlot()) -}; - -#endif diff --git a/Tests/QtAutogen/complex/resourcetester.cpp b/Tests/QtAutogen/complex/resourcetester.cpp deleted file mode 100644 index 4ecb6b4..0000000 --- a/Tests/QtAutogen/complex/resourcetester.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -#include "resourcetester.h" - -#include -#include -#include -#include - -ResourceTester::ResourceTester(QObject* parent) - : QObject(parent) -{ -} - -void ResourceTester::doTest() -{ - if (!QFile::exists(":/CMakeLists.txt")) - qApp->exit(EXIT_FAILURE); - if (!QFile::exists(":/main.cpp")) - qApp->exit(EXIT_FAILURE); -#ifdef TEST_DEBUG_CLASS - if (!QFile::exists(":/debug_class.ui")) - qApp->exit(EXIT_FAILURE); -#endif - - QTimer::singleShot(0, qApp, SLOT(quit())); -} diff --git a/Tests/QtAutogen/complex/resourcetester.h b/Tests/QtAutogen/complex/resourcetester.h deleted file mode 100644 index dbdb3ad..0000000 --- a/Tests/QtAutogen/complex/resourcetester.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef RESOURCE_TESTER_H -#define RESOURCE_TESTER_H - -#include - -class ResourceTester : public QObject -{ - Q_OBJECT -public: - explicit ResourceTester(QObject* parent = 0); - -private slots: - void doTest(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/second_resource.qrc b/Tests/QtAutogen/complex/second_resource.qrc deleted file mode 100644 index 27bfb14..0000000 --- a/Tests/QtAutogen/complex/second_resource.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - main.cpp - - diff --git a/Tests/QtAutogen/complex/second_widget.cpp b/Tests/QtAutogen/complex/second_widget.cpp deleted file mode 100644 index c575f10..0000000 --- a/Tests/QtAutogen/complex/second_widget.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -#include "second_widget.h" -#include "ui_second_widget.h" - -SecondWidget::SecondWidget(QWidget* parent) - : QWidget(parent) - , ui(new Ui::SecondWidget) -{ - ui->setupUi(this); -} - -SecondWidget::~SecondWidget() -{ - delete ui; -} diff --git a/Tests/QtAutogen/complex/second_widget.h b/Tests/QtAutogen/complex/second_widget.h deleted file mode 100644 index c7929c4..0000000 --- a/Tests/QtAutogen/complex/second_widget.h +++ /dev/null @@ -1,18 +0,0 @@ - -#include - -namespace Ui { -class SecondWidget; -} - -class SecondWidget : public QWidget -{ - Q_OBJECT -public: - explicit SecondWidget(QWidget* parent = 0); - - ~SecondWidget(); - -private: - Ui::SecondWidget* ui; -}; diff --git a/Tests/QtAutogen/complex/second_widget.ui b/Tests/QtAutogen/complex/second_widget.ui deleted file mode 100644 index 4effa58..0000000 --- a/Tests/QtAutogen/complex/second_widget.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - SecondWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 80 - 20 - 94 - 24 - - - - PushButton - - - - - - diff --git a/Tests/QtAutogen/complex/sub/bar.h b/Tests/QtAutogen/complex/sub/bar.h deleted file mode 100644 index e4093f6..0000000 --- a/Tests/QtAutogen/complex/sub/bar.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef BAR_H -#define BAR_H - -#include - -class Bar : public QObject -{ - Q_OBJECT -public: - Bar(); -public slots: - void doBar(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/targetObjectsTest.cpp b/Tests/QtAutogen/complex/targetObjectsTest.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/QtAutogen/complex/targetObjectsTest.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/QtAutogen/complex/test.qrc b/Tests/QtAutogen/complex/test.qrc deleted file mode 100644 index c3d4e3c..0000000 --- a/Tests/QtAutogen/complex/test.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - CMakeLists.txt - - diff --git a/Tests/QtAutogen/complex/widget1.ui b/Tests/QtAutogen/complex/widget1.ui deleted file mode 100644 index 8fce81a..0000000 --- a/Tests/QtAutogen/complex/widget1.ui +++ /dev/null @@ -1,45 +0,0 @@ - - - Widget1 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 140 - 80 - 80 - 23 - - - - PushButton - - - - - - 190 - 170 - 80 - 23 - - - - PushButton - - - - - - diff --git a/Tests/QtAutogen/complex/widget2.ui b/Tests/QtAutogen/complex/widget2.ui deleted file mode 100644 index 1f411b9..0000000 --- a/Tests/QtAutogen/complex/widget2.ui +++ /dev/null @@ -1,29 +0,0 @@ - - - Widget2 - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 20 - 20 - 256 - 192 - - - - - - - diff --git a/Tests/QtAutogen/complex/xyz.cpp b/Tests/QtAutogen/complex/xyz.cpp deleted file mode 100644 index e46c9d3..0000000 --- a/Tests/QtAutogen/complex/xyz.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "xyz.h" - -#include - -Xyz::Xyz() - : QObject() -{ -} - -void Xyz::doXyz() -{ - printf("This is xyz !\n"); -} diff --git a/Tests/QtAutogen/complex/xyz.h b/Tests/QtAutogen/complex/xyz.h deleted file mode 100644 index 8b813fd..0000000 --- a/Tests/QtAutogen/complex/xyz.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef XYZ_H -#define XYZ_H - -#include - -class Xyz : public QObject -{ - Q_OBJECT -public: - Xyz(); -public slots: - void doXyz(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/yaf.cpp b/Tests/QtAutogen/complex/yaf.cpp deleted file mode 100644 index 70e26aa..0000000 --- a/Tests/QtAutogen/complex/yaf.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#include "yaf.h" -#include "yaf_p.h" - -#include - -Yaf::Yaf() -{ -} - -void Yaf::doYaf() -{ - YafP yafP; - yafP.doYafP(); -} - -// check that including a moc file from a private header the wrong way works: -#include "yaf_p.moc" diff --git a/Tests/QtAutogen/complex/yaf.h b/Tests/QtAutogen/complex/yaf.h deleted file mode 100644 index f271061..0000000 --- a/Tests/QtAutogen/complex/yaf.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef YAF_H -#define YAF_H - -class Yaf -{ -public: - Yaf(); - -public: - void doYaf(); -}; - -#endif diff --git a/Tests/QtAutogen/complex/yaf_p.h b/Tests/QtAutogen/complex/yaf_p.h deleted file mode 100644 index ea5eed6..0000000 --- a/Tests/QtAutogen/complex/yaf_p.h +++ /dev/null @@ -1,19 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing for details. */ -#ifndef YAF_P_H -#define YAF_P_H - -#include - -#include - -class YafP : public QObject -{ - Q_OBJECT -public: - YafP() {} -public slots: - void doYafP() { printf("I am yet another file !\n"); } -}; - -#endif diff --git a/Tests/QtAutogen/defines_test/CMakeLists.txt b/Tests/QtAutogen/defines_test/CMakeLists.txt deleted file mode 100644 index 9ee9a22..0000000 --- a/Tests/QtAutogen/defines_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - -add_executable(defines_test defines_test.cpp) -set_target_properties(defines_test PROPERTIES AUTOMOC TRUE) -target_link_libraries(defines_test Qt4::QtGui) diff --git a/Tests/QtAutogen/defines_test/defines_test.cpp b/Tests/QtAutogen/defines_test/defines_test.cpp deleted file mode 100644 index cf4e9cb..0000000 --- a/Tests/QtAutogen/defines_test/defines_test.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -#include - -#ifdef QT_GUI_LIB -#include - -class SomeDocument : public QTextDocument -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -#ifdef QT_CORE_LIB -class SomeObject : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -int main(int argc, char** argv) -{ -#ifdef QT_CORE_LIB - QMetaObject sosmo = SomeObject::staticMetaObject; -#endif -#ifdef QT_GUI_LIB - QMetaObject sdsmo = SomeDocument::staticMetaObject; -#endif - - return 0; -} - -#include "defines_test.moc" -- cgit v0.12 From 54b4ff2aee015768a990cb3fccb79f8e87b38a19 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 9 Dec 2017 13:06:58 +0100 Subject: Autogen: Tests: Separate RerunMocBasic test --- Tests/QtAutogen/CommonTests.cmake | 2 + Tests/QtAutogen/RerunMocBasic/CMakeLists.txt | 65 ++++++++++++++++++++++ .../RerunMocBasic/MocBasic/CMakeLists.txt | 24 ++++++++ Tests/QtAutogen/RerunMocBasic/MocBasic/input.txt | 1 + Tests/QtAutogen/RerunMocBasic/MocBasic/main.cpp.in | 23 ++++++++ Tests/QtAutogen/RerunMocBasic/MocBasic/res1.qrc | 5 ++ Tests/QtAutogen/RerunMocBasic/MocBasic/test1a.h.in | 8 +++ Tests/QtAutogen/RerunMocBasic/MocBasic/test1b.h.in | 7 +++ Tests/QtAutogen/RerunMocBasic/dummy.cpp | 5 ++ Tests/QtAutogenRerun/CMakeLists.txt | 5 +- Tests/QtAutogenRerun/mocRerun.cmake | 60 -------------------- Tests/QtAutogenRerun/mocRerun/CMakeLists.txt | 33 ----------- Tests/QtAutogenRerun/mocRerun/input.txt | 1 - Tests/QtAutogenRerun/mocRerun/main.cpp.in | 18 ------ Tests/QtAutogenRerun/mocRerun/res1.qrc | 5 -- Tests/QtAutogenRerun/mocRerun/test1a.h.in | 8 --- Tests/QtAutogenRerun/mocRerun/test1b.h.in | 7 --- 17 files changed, 141 insertions(+), 136 deletions(-) create mode 100644 Tests/QtAutogen/RerunMocBasic/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/input.txt create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/main.cpp.in create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/res1.qrc create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/test1a.h.in create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/test1b.h.in create mode 100644 Tests/QtAutogen/RerunMocBasic/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/mocRerun.cmake delete mode 100644 Tests/QtAutogenRerun/mocRerun/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/mocRerun/input.txt delete mode 100644 Tests/QtAutogenRerun/mocRerun/main.cpp.in delete mode 100644 Tests/QtAutogenRerun/mocRerun/res1.qrc delete mode 100644 Tests/QtAutogenRerun/mocRerun/test1a.h.in delete mode 100644 Tests/QtAutogenRerun/mocRerun/test1b.h.in diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 6921495..94413a3 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -31,3 +31,5 @@ endif() ADD_AUTOGEN_TEST(SameName sameName) ADD_AUTOGEN_TEST(StaticLibraryCycle slc) ADD_AUTOGEN_TEST(Complex QtAutogen) +# Rerun tests +ADD_AUTOGEN_TEST(RerunMocBasic) diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt new file mode 100644 index 0000000..0bb0339 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunMocBasic) +include("../AutogenTest.cmake") + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +set(timeformat "%Y%j%H%M%S") +set(mocBasicSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocBasic") +set(mocBasicBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocBasic") + +# Initial build +configure_file("${mocBasicSrcDir}/test1a.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +try_compile(MOC_RERUN + "${mocBasicBinDir}" + "${mocBasicSrcDir}" + MocBasic + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(SEND_ERROR "Initial build of mocBasic failed. Output: ${output}") +endif() +# Get name of the output binary +file(STRINGS "${mocBasicBinDir}/mocBasic.txt" mocBasicList ENCODING UTF-8) +list(GET mocBasicList 0 mocBasicBin) + +message("Changing the header content for a MOC rerun") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${mocBasicBin}" timeBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change header file content and rebuild +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +configure_file("${mocBasicSrcDir}/test1b.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result ) +if (result) + message(SEND_ERROR "Second build of mocBasic failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${mocBasicBin}" timeAfter "${timeformat}") +# - Test if timestamps changed +if (NOT timeAfter GREATER timeBefore) + message(SEND_ERROR "File (${mocBasicBin}) should have changed!") +endif() + + +message("Changing nothing for a MOC rerun") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${mocBasicBin}" timeBefore "${timeformat}") +# - Ensure that the timestamp would change +# - Change nothing +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result ) +if (result) + message(SEND_ERROR "Third build of mocBasic failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${mocBasicBin}" timeAfter "${timeformat}") +# - Test if timestamps changed +if (timeAfter GREATER timeBefore) + message(SEND_ERROR "File (${mocBasicBin}) should not have changed!") +endif() diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt new file mode 100644 index 0000000..cec60a4 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.10) +project(MocBasic) +include("../../AutogenTest.cmake") + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +# Generated source file +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/main.cpp + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp +) + +add_executable(mocBasic + ${CMAKE_CURRENT_BINARY_DIR}/test1.h + ${CMAKE_CURRENT_BINARY_DIR}/main.cpp + res1.qrc +) +target_include_directories(mocBasic PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +target_link_libraries(mocBasic ${QT_QTCORE_TARGET}) +# Write target name to text file +add_custom_command(TARGET mocBasic POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$" > mocBasic.txt +) diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/input.txt b/Tests/QtAutogen/RerunMocBasic/MocBasic/input.txt new file mode 100644 index 0000000..da62762 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/input.txt @@ -0,0 +1 @@ +Res1 input. diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/main.cpp.in b/Tests/QtAutogen/RerunMocBasic/MocBasic/main.cpp.in new file mode 100644 index 0000000..9d7ea37 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/main.cpp.in @@ -0,0 +1,23 @@ +#include "test1.h" + +extern int qInitResources_res1(); + +class Test2 : public QObject +{ + Q_OBJECT +public slots: + void onTst1() {} +}; + +int main() +{ + // Fails to link if the rcc generated symbol is not present. + qInitResources_res1(); + + Test1 test1; + Test2 test2; + + return 0; +} + +#include "main.moc" diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/res1.qrc b/Tests/QtAutogen/RerunMocBasic/MocBasic/res1.qrc new file mode 100644 index 0000000..fb804b5 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/res1.qrc @@ -0,0 +1,5 @@ + + + input.txt + + diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/test1a.h.in b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1a.h.in new file mode 100644 index 0000000..a335046 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1a.h.in @@ -0,0 +1,8 @@ +#include +class Test1 : public QObject +{ + Q_OBJECT +public slots: + void onTst1() {} + void onTst2() {} +}; diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/test1b.h.in b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1b.h.in new file mode 100644 index 0000000..6128eeb --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1b.h.in @@ -0,0 +1,7 @@ +#include +class Test1 : public QObject +{ + Q_OBJECT +public slots: + void onTst1() {} +}; diff --git a/Tests/QtAutogen/RerunMocBasic/dummy.cpp b/Tests/QtAutogen/RerunMocBasic/dummy.cpp new file mode 100644 index 0000000..4837a76 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt index e72c191..746ba4a 100644 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ b/Tests/QtAutogenRerun/CMakeLists.txt @@ -6,7 +6,7 @@ project(QtAutogenRerun) if(QT_QMAKE_EXECUTABLE) get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) - set(CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) + list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) endif() if (QT_TEST_VERSION STREQUAL 4) @@ -40,9 +40,6 @@ endif() add_executable(dummy dummy.cpp) # -- Test -include("mocRerun.cmake") - -# -- Test # Tests Q_PLUGIN_METADATA json file change detection if (NOT QT_TEST_VERSION STREQUAL 4) include("mocPlugin.cmake") diff --git a/Tests/QtAutogenRerun/mocRerun.cmake b/Tests/QtAutogenRerun/mocRerun.cmake deleted file mode 100644 index a92912b..0000000 --- a/Tests/QtAutogenRerun/mocRerun.cmake +++ /dev/null @@ -1,60 +0,0 @@ - -set(timeformat "%Y%j%H%M%S") -set(mocRerunSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun") -set(mocRerunBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocRerun") - -# Initial build -configure_file("${mocRerunSrcDir}/test1a.h.in" "${mocRerunBinDir}/test1.h" COPYONLY) -try_compile(MOC_RERUN - "${mocRerunBinDir}" - "${mocRerunSrcDir}" - mocRerun - CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" - "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" - OUTPUT_VARIABLE output -) -if (NOT MOC_RERUN) - message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}") -endif() -# Get name of the output binary -file(STRINGS "${mocRerunBinDir}/mocRerun.txt" mocRerunList ENCODING UTF-8) -list(GET mocRerunList 0 mocRerunBin) - -message("Changing the header content for a MOC rerun") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change header file content and rebuild -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file("${mocRerunSrcDir}/test1b.h.in" "${mocRerunBinDir}/test1.h" COPYONLY) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result ) -if (result) - message(SEND_ERROR "Second build of mocRerun failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}") -# - Test if timestamps changed -if (NOT timeAfter GREATER timeBefore) - message(SEND_ERROR "File (${mocRerunBin}) should have changed!") -endif() - - -message("Changing nothing for a MOC rerun") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${mocRerunBin}" timeBefore "${timeformat}") -# - Ensure that the timestamp would change -# - Change nothing -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocRerunBinDir}" RESULT_VARIABLE result ) -if (result) - message(SEND_ERROR "Third build of mocRerun failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${mocRerunBin}" timeAfter "${timeformat}") -# - Test if timestamps changed -if (timeAfter GREATER timeBefore) - message(SEND_ERROR "File (${mocRerunBin}) should not have changed!") -endif() diff --git a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt b/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt deleted file mode 100644 index bafd9cf..0000000 --- a/Tests/QtAutogenRerun/mocRerun/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(mocRerun CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) - -# Generated source file -add_custom_command(OUTPUT main.cpp - COMMAND ${CMAKE_COMMAND} -E sleep 2 - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/main.cpp) - -add_executable(mocRerun - ${CMAKE_CURRENT_BINARY_DIR}/test1.h - ${CMAKE_CURRENT_BINARY_DIR}/main.cpp - res1.qrc) -target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -target_link_libraries(mocRerun ${QT_CORE_TARGET}) -# Write target name to text file -add_custom_command(TARGET mocRerun POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$" > mocRerun.txt) diff --git a/Tests/QtAutogenRerun/mocRerun/input.txt b/Tests/QtAutogenRerun/mocRerun/input.txt deleted file mode 100644 index da62762..0000000 --- a/Tests/QtAutogenRerun/mocRerun/input.txt +++ /dev/null @@ -1 +0,0 @@ -Res1 input. diff --git a/Tests/QtAutogenRerun/mocRerun/main.cpp.in b/Tests/QtAutogenRerun/mocRerun/main.cpp.in deleted file mode 100644 index b37ff61..0000000 --- a/Tests/QtAutogenRerun/mocRerun/main.cpp.in +++ /dev/null @@ -1,18 +0,0 @@ -#include "test1.h" - -class Test2 : public QObject -{ - Q_OBJECT -public slots: - void onTst1() {} -}; - -int main() -{ - Test1 test1; - Test2 test2; - - return 0; -} - -#include "main.moc" diff --git a/Tests/QtAutogenRerun/mocRerun/res1.qrc b/Tests/QtAutogenRerun/mocRerun/res1.qrc deleted file mode 100644 index fb804b5..0000000 --- a/Tests/QtAutogenRerun/mocRerun/res1.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - input.txt - - diff --git a/Tests/QtAutogenRerun/mocRerun/test1a.h.in b/Tests/QtAutogenRerun/mocRerun/test1a.h.in deleted file mode 100644 index a335046..0000000 --- a/Tests/QtAutogenRerun/mocRerun/test1a.h.in +++ /dev/null @@ -1,8 +0,0 @@ -#include -class Test1 : public QObject -{ - Q_OBJECT -public slots: - void onTst1() {} - void onTst2() {} -}; diff --git a/Tests/QtAutogenRerun/mocRerun/test1b.h.in b/Tests/QtAutogenRerun/mocRerun/test1b.h.in deleted file mode 100644 index 6128eeb..0000000 --- a/Tests/QtAutogenRerun/mocRerun/test1b.h.in +++ /dev/null @@ -1,7 +0,0 @@ -#include -class Test1 : public QObject -{ - Q_OBJECT -public slots: - void onTst1() {} -}; -- cgit v0.12 From e9fcd1545facf6300181db843260008e1069c7b4 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 9 Dec 2017 13:20:58 +0100 Subject: Autogen: Tests: Separate RerunMocPlugin test --- Tests/QtAutogen/CommonTests.cmake | 3 + Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt | 105 +++++++++++++++++++++ .../RerunMocPlugin/MocPlugin/CMakeLists.txt | 31 ++++++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp | 6 ++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp | 17 ++++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json | 1 + .../RerunMocPlugin/MocPlugin/StyleA_Custom.json | 1 + .../QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp | 6 ++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp | 17 ++++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp | 6 ++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp | 17 ++++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp | 6 ++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp | 17 ++++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp | 9 ++ .../QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp | 10 ++ .../RerunMocPlugin/MocPlugin/StyleEInclude.hpp | 17 ++++ .../RerunMocPlugin/MocPlugin/UtilityMacros.hpp | 7 ++ .../RerunMocPlugin/MocPlugin/jsonIn/StyleB.json | 1 + .../MocPlugin/jsonIn/StyleB_Custom.json | 1 + .../RerunMocPlugin/MocPlugin/jsonIn/StyleC.json | 1 + .../RerunMocPlugin/MocPlugin/jsonIn/StyleD.json | 1 + .../RerunMocPlugin/MocPlugin/jsonIn/StyleE.json | 1 + Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp | 6 ++ Tests/QtAutogen/RerunMocPlugin/dummy.cpp | 5 + Tests/QtAutogenRerun/CMakeLists.txt | 6 -- Tests/QtAutogenRerun/mocPlugin.cmake | 96 ------------------- Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt | 35 ------- Tests/QtAutogenRerun/mocPlugin/StyleA.cpp | 6 -- Tests/QtAutogenRerun/mocPlugin/StyleA.hpp | 17 ---- Tests/QtAutogenRerun/mocPlugin/StyleA.json | 1 - Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json | 1 - Tests/QtAutogenRerun/mocPlugin/StyleB.cpp | 6 -- Tests/QtAutogenRerun/mocPlugin/StyleB.hpp | 17 ---- Tests/QtAutogenRerun/mocPlugin/StyleC.cpp | 6 -- Tests/QtAutogenRerun/mocPlugin/StyleC.hpp | 17 ---- Tests/QtAutogenRerun/mocPlugin/StyleD.cpp | 6 -- Tests/QtAutogenRerun/mocPlugin/StyleD.hpp | 17 ---- Tests/QtAutogenRerun/mocPlugin/StyleE.cpp | 9 -- Tests/QtAutogenRerun/mocPlugin/StyleE.hpp | 10 -- Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp | 17 ---- Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp | 7 -- Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json | 1 - .../mocPlugin/jsonIn/StyleB_Custom.json | 1 - Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json | 1 - Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json | 1 - Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json | 1 - Tests/QtAutogenRerun/mocPlugin/main.cpp | 6 -- 47 files changed, 292 insertions(+), 285 deletions(-) create mode 100644 Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json create mode 100644 Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp create mode 100644 Tests/QtAutogen/RerunMocPlugin/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin.cmake delete mode 100644 Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleA.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleA.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleA.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleB.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleB.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleC.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleC.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleD.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleD.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleE.cpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleE.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp delete mode 100644 Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json delete mode 100644 Tests/QtAutogenRerun/mocPlugin/main.cpp diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 94413a3..b03c282 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -33,3 +33,6 @@ ADD_AUTOGEN_TEST(StaticLibraryCycle slc) ADD_AUTOGEN_TEST(Complex QtAutogen) # Rerun tests ADD_AUTOGEN_TEST(RerunMocBasic) +if(NOT QT_TEST_VERSION STREQUAL 4) + ADD_AUTOGEN_TEST(RerunMocPlugin) +endif() diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt new file mode 100644 index 0000000..076de8b --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -0,0 +1,105 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunMocPlugin) +include("../AutogenTest.cmake") + +# Tests Q_PLUGIN_METADATA and CMAKE_AUTOMOC_DEPEND_FILTERS +# json file change detection + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +# Utility variables +set(timeformat "%Y%j%H%M%S") +set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocPlugin") +set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocPlugin") + +# Initial buid +try_compile(MOC_PLUGIN + "${mocPlugBinDir}" + "${mocPlugSrcDir}" + MocPlugin + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT MOC_PLUGIN) + message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}") +endif() + +find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) +find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) +find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) +find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) +find_library(plEFile "PlugE" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) + +# - Ensure that the timestamp will change. +# - Change the json files referenced by Q_PLUGIN_METADATA +# - Rebuild +file(TIMESTAMP "${plAFile}" plABefore "${timeformat}") +file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}") +file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") +file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") +file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}") + +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json") +configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json") +configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/StyleE.json") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") + +file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}") +file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}") +file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") +file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") +file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}") + +if (plAAfter GREATER plABefore) + message(SEND_ERROR "file (${plAFile}) should not have changed!") +endif() +if (plBAfter GREATER plBBefore) + message(SEND_ERROR "file (${plBFile}) should not have changed!") +endif() +if (NOT plCAfter GREATER plCBefore) + message(SEND_ERROR "file (${plCFile}) should have changed!") +endif() +if (NOT plDAfter GREATER plDBefore) + message(SEND_ERROR "file (${plDFile}) should have changed!") +endif() +if (NOT plEAfter GREATER plEBefore) + # There's a bug in Ninja on Windows + # https://gitlab.kitware.com/cmake/cmake/issues/16776 + if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) + message(SEND_ERROR "file (${plEFile}) should have changed!") + endif() +endif() + +# - Ensure that the timestamp will change. +# - Change the json files referenced by A_CUSTOM_MACRO +# - Rebuild +file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") +file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") +file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}") + +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json") +configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json") +configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleE_Custom.json") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") + +file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") +file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") +file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}") + +if (NOT plCAfter GREATER plCBefore) + message(SEND_ERROR "file (${plCFile}) should have changed!") +endif() +if (NOT plDAfter GREATER plDBefore) + message(SEND_ERROR "file (${plDFile}) should have changed!") +endif() +if (NOT plEAfter GREATER plEBefore) + # There's a bug in Ninja on Windows + # https://gitlab.kitware.com/cmake/cmake/issues/16776 + if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) + message(SEND_ERROR "file (${plEFile}) should have changed!") + endif() +endif() diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt new file mode 100644 index 0000000..bc0085f --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) +project(MocPlugin) +include("../../AutogenTest.cmake") + +if (NOT QT_TEST_VERSION STREQUAL 5) + message(SEND_ERROR "Invalid Qt version specified.") +endif() + +set(CMAKE_AUTOMOC_DEPEND_FILTERS + "A_CUSTOM_MACRO" + "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\"" +) + +configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json) +configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json) +configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json) +configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json) +configure_file(jsonIn/StyleE.json jsonFiles/StyleE.json) +configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json) + +# Enable AUTOMOC +set(CMAKE_AUTOMOC TRUE) + +include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") +link_libraries(Qt5::Widgets) + +add_library(PlugA STATIC StyleA.cpp) +add_library(PlugB STATIC StyleB.cpp) +add_library(PlugC STATIC StyleC.cpp) +add_library(PlugD STATIC StyleD.cpp) +add_library(PlugE STATIC StyleE.cpp) diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp new file mode 100644 index 0000000..b5e8753 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.cpp @@ -0,0 +1,6 @@ +#include "StyleA.hpp" + +QStyle* StyleA::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp new file mode 100644 index 0000000..35158a4 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEA_HPP +#define STYLEA_HPP + +#include "UtilityMacros.hpp" +#include + +class StyleA : public QStylePlugin +{ + Q_OBJECT + // Json file in source local directory + Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json") + A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json new file mode 100644 index 0000000..cc33953 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json new file mode 100644 index 0000000..cc33953 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleA_Custom.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp new file mode 100644 index 0000000..17d4400 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.cpp @@ -0,0 +1,6 @@ +#include "StyleB.hpp" + +QStyle* StyleB::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp new file mode 100644 index 0000000..15b79c5 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleB.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEB_HPP +#define STYLEB_HPP + +#include "UtilityMacros.hpp" +#include + +class StyleB : public QStylePlugin +{ + Q_OBJECT + // Json file in source local subdirectory + Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json") + A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp new file mode 100644 index 0000000..37e7564 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.cpp @@ -0,0 +1,6 @@ +#include "StyleC.hpp" + +QStyle* StyleC::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp new file mode 100644 index 0000000..b0a4115 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleC.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEC_HPP +#define STYLEC_HPP + +#include "UtilityMacros.hpp" +#include + +class StyleC : public QStylePlugin +{ + Q_OBJECT + // Json file in global root directory + Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json") + A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp new file mode 100644 index 0000000..7e4b121 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.cpp @@ -0,0 +1,6 @@ +#include "StyleD.hpp" + +QStyle* StyleD::create(const QString& key) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp new file mode 100644 index 0000000..9696aaa --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleD.hpp @@ -0,0 +1,17 @@ +#ifndef STYLED_HPP +#define STYLED_HPP + +#include "UtilityMacros.hpp" +#include + +class StyleD : public QStylePlugin +{ + Q_OBJECT + // Json file in global sub director + Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json") + A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp new file mode 100644 index 0000000..3448319 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.cpp @@ -0,0 +1,9 @@ +#include "StyleE.hpp" + +QStyle* StyleE::create(const QString& key) +{ + return 0; +} + +// AUTOMOC the StyleEInclude.hpp header +#include "moc_StyleEInclude.cpp" diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp new file mode 100644 index 0000000..a069034 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleE.hpp @@ -0,0 +1,10 @@ +#ifndef STYLEE_HPP +#define STYLEE_HPP + +// The included file is not in the sources list and won't be detected by +// AUTOMOC source file with the same base name. +// It is registered to AUTOMOCed via a moc_.cpp include in StyleE.cpp +// though. +#include "StyleEInclude.hpp" + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp new file mode 100644 index 0000000..f9734db --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/StyleEInclude.hpp @@ -0,0 +1,17 @@ +#ifndef STYLEE_INCLUDE_HPP +#define STYLEE_INCLUDE_HPP + +#include "UtilityMacros.hpp" +#include + +class StyleE : public QStylePlugin +{ + Q_OBJECT + // Json files in global root directory + Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json") + A_CUSTOM_MACRO(SomeArg, "StyleE_Custom.json", AnotherArg) +public: + QStyle* create(const QString& key); +}; + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp new file mode 100644 index 0000000..53a4284 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/UtilityMacros.hpp @@ -0,0 +1,7 @@ +#ifndef UTILITYMACROS_HPP +#define UTILITYMACROS_HPP + +// Empty test macro definition +#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations) + +#endif diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json new file mode 100644 index 0000000..cd155dc --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB.json @@ -0,0 +1 @@ +{ "Keys": [ "Red", "Green" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json new file mode 100644 index 0000000..129cac4 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleB_Custom.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "StarbusterB" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json new file mode 100644 index 0000000..119aaa4 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleC.json @@ -0,0 +1 @@ +{ "Keys": [ "Boat", "Ship" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json new file mode 100644 index 0000000..732c547 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleD.json @@ -0,0 +1 @@ +{ "Keys": [ "Bike", "Car" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json new file mode 100644 index 0000000..5412c94 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/jsonIn/StyleE.json @@ -0,0 +1 @@ +{ "Keys": [ "Floor", "Ceiling" ] } diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp new file mode 100644 index 0000000..3ba2ddc --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/main.cpp @@ -0,0 +1,6 @@ +#include "StyleA.hpp" + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/dummy.cpp b/Tests/QtAutogen/RerunMocPlugin/dummy.cpp new file mode 100644 index 0000000..4837a76 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt index 746ba4a..9f1ee28 100644 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ b/Tests/QtAutogenRerun/CMakeLists.txt @@ -40,10 +40,4 @@ endif() add_executable(dummy dummy.cpp) # -- Test -# Tests Q_PLUGIN_METADATA json file change detection -if (NOT QT_TEST_VERSION STREQUAL 4) - include("mocPlugin.cmake") -endif() - -# -- Test include("rccDepends.cmake") diff --git a/Tests/QtAutogenRerun/mocPlugin.cmake b/Tests/QtAutogenRerun/mocPlugin.cmake deleted file mode 100644 index 7ad5ccb..0000000 --- a/Tests/QtAutogenRerun/mocPlugin.cmake +++ /dev/null @@ -1,96 +0,0 @@ - -# Utility variables -set(timeformat "%Y%j%H%M%S") -set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin") -set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") - -# Initial buid -try_compile(MOC_PLUGIN - "${mocPlugBinDir}" - "${mocPlugSrcDir}" - mocPlugin - CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" - OUTPUT_VARIABLE output -) -if (NOT MOC_PLUGIN) - message(SEND_ERROR "Initial build of mocPlugin failed. Output: ${output}") -endif() - -find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) -find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) -find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) -find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) -find_library(plEFile "PlugE" PATHS "${mocPlugBinDir}/Debug" "${mocPlugBinDir}" NO_DEFAULT_PATH) - -# - Ensure that the timestamp will change. -# - Change the json files referenced by Q_PLUGIN_METADATA -# - Rebuild -file(TIMESTAMP "${plAFile}" plABefore "${timeformat}") -file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}") -file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") -file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") -file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}") - -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json") -configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.json") -configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/StyleE.json") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") - -file(TIMESTAMP "${plAFile}" plAAfter "${timeformat}") -file(TIMESTAMP "${plBFile}" plBAfter "${timeformat}") -file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") -file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") -file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}") - -if (plAAfter GREATER plABefore) - message(SEND_ERROR "file (${plAFile}) should not have changed!") -endif() -if (plBAfter GREATER plBBefore) - message(SEND_ERROR "file (${plBFile}) should not have changed!") -endif() -if (NOT plCAfter GREATER plCBefore) - message(SEND_ERROR "file (${plCFile}) should have changed!") -endif() -if (NOT plDAfter GREATER plDBefore) - message(SEND_ERROR "file (${plDFile}) should have changed!") -endif() -if (NOT plEAfter GREATER plEBefore) - # There's a bug in Ninja on Windows - # https://gitlab.kitware.com/cmake/cmake/issues/16776 - if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) - message(SEND_ERROR "file (${plEFile}) should have changed!") - endif() -endif() - -# - Ensure that the timestamp will change. -# - Change the json files referenced by A_CUSTOM_MACRO -# - Rebuild -file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}") -file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}") -file(TIMESTAMP "${plEFile}" plEBefore "${timeformat}") - -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file("${mocPlugSrcDir}/jsonIn/StyleE.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json") -configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json") -configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleE_Custom.json") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}") - -file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}") -file(TIMESTAMP "${plDFile}" plDAfter "${timeformat}") -file(TIMESTAMP "${plEFile}" plEAfter "${timeformat}") - -if (NOT plCAfter GREATER plCBefore) - message(SEND_ERROR "file (${plCFile}) should have changed!") -endif() -if (NOT plDAfter GREATER plDBefore) - message(SEND_ERROR "file (${plDFile}) should have changed!") -endif() -if (NOT plEAfter GREATER plEBefore) - # There's a bug in Ninja on Windows - # https://gitlab.kitware.com/cmake/cmake/issues/16776 - if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) - message(SEND_ERROR "file (${plEFile}) should have changed!") - endif() -endif() diff --git a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt b/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt deleted file mode 100644 index b7cc5e9..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(mocPlugin CXX) - -set(CMAKE_AUTOMOC_DEPEND_FILTERS - "A_CUSTOM_MACRO" - "[\n][ \t]*A_CUSTOM_MACRO[ \t\r\n]*\\([^,]+,[ \t\r\n]*\"([^\"]+)\"" - ) - -if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") -endif() -find_package(Qt5Widgets REQUIRED) - -if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) -endif() - -configure_file(jsonIn/StyleC.json jsonFiles/StyleC.json) -configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json) -configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json) -configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_Custom.json) -configure_file(jsonIn/StyleE.json jsonFiles/StyleE.json) -configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json) - -# Enable automoc -set(CMAKE_AUTOMOC TRUE) - -include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") -link_libraries(Qt5::Widgets) - -add_library(PlugA STATIC StyleA.cpp) -add_library(PlugB STATIC StyleB.cpp) -add_library(PlugC STATIC StyleC.cpp) -add_library(PlugD STATIC StyleD.cpp) -add_library(PlugE STATIC StyleE.cpp) diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp deleted file mode 100644 index b5e8753..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleA.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "StyleA.hpp" - -QStyle* StyleA::create(const QString& key) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp deleted file mode 100644 index 35158a4..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleA.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef STYLEA_HPP -#define STYLEA_HPP - -#include "UtilityMacros.hpp" -#include - -class StyleA : public QStylePlugin -{ - Q_OBJECT - // Json file in source local directory - Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json") - A_CUSTOM_MACRO(SomeArg, "StyleA_Custom.json", AnotherArg) -public: - QStyle* create(const QString& key); -}; - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA.json b/Tests/QtAutogenRerun/mocPlugin/StyleA.json deleted file mode 100644 index cc33953..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleA.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json b/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json deleted file mode 100644 index cc33953..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleA_Custom.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Rocket", "Starbuster" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp deleted file mode 100644 index 17d4400..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleB.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "StyleB.hpp" - -QStyle* StyleB::create(const QString& key) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp deleted file mode 100644 index 15b79c5..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleB.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef STYLEB_HPP -#define STYLEB_HPP - -#include "UtilityMacros.hpp" -#include - -class StyleB : public QStylePlugin -{ - Q_OBJECT - // Json file in source local subdirectory - Q_PLUGIN_METADATA(IID "org.styles.B" FILE "jsonIn/StyleB.json") - A_CUSTOM_MACRO(SomeArg, "jsonIn/StyleB_Custom.json", AnotherArg) -public: - QStyle* create(const QString& key); -}; - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp deleted file mode 100644 index 37e7564..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleC.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "StyleC.hpp" - -QStyle* StyleC::create(const QString& key) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp deleted file mode 100644 index b0a4115..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleC.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef STYLEC_HPP -#define STYLEC_HPP - -#include "UtilityMacros.hpp" -#include - -class StyleC : public QStylePlugin -{ - Q_OBJECT - // Json file in global root directory - Q_PLUGIN_METADATA(IID "org.styles.C" FILE "StyleC.json") - A_CUSTOM_MACRO(SomeArg, "StyleC_Custom.json", AnotherArg) -public: - QStyle* create(const QString& key); -}; - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp deleted file mode 100644 index 7e4b121..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleD.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "StyleD.hpp" - -QStyle* StyleD::create(const QString& key) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp deleted file mode 100644 index 9696aaa..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleD.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef STYLED_HPP -#define STYLED_HPP - -#include "UtilityMacros.hpp" -#include - -class StyleD : public QStylePlugin -{ - Q_OBJECT - // Json file in global sub director - Q_PLUGIN_METADATA(IID "org.styles.D" FILE "sub/StyleD.json") - A_CUSTOM_MACRO(SomeArg, "sub/StyleD_Custom.json", AnotherArg) -public: - QStyle* create(const QString& key); -}; - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp deleted file mode 100644 index 3448319..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleE.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "StyleE.hpp" - -QStyle* StyleE::create(const QString& key) -{ - return 0; -} - -// AUTOMOC the StyleEInclude.hpp header -#include "moc_StyleEInclude.cpp" diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp deleted file mode 100644 index a069034..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleE.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef STYLEE_HPP -#define STYLEE_HPP - -// The included file is not in the sources list and won't be detected by -// AUTOMOC source file with the same base name. -// It is registered to AUTOMOCed via a moc_.cpp include in StyleE.cpp -// though. -#include "StyleEInclude.hpp" - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp b/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp deleted file mode 100644 index f9734db..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/StyleEInclude.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef STYLEE_INCLUDE_HPP -#define STYLEE_INCLUDE_HPP - -#include "UtilityMacros.hpp" -#include - -class StyleE : public QStylePlugin -{ - Q_OBJECT - // Json files in global root directory - Q_PLUGIN_METADATA(IID "org.styles.E" FILE "StyleE.json") - A_CUSTOM_MACRO(SomeArg, "StyleE_Custom.json", AnotherArg) -public: - QStyle* create(const QString& key); -}; - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp b/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp deleted file mode 100644 index 53a4284..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/UtilityMacros.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef UTILITYMACROS_HPP -#define UTILITYMACROS_HPP - -// Empty test macro definition -#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations) - -#endif diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json deleted file mode 100644 index cd155dc..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Red", "Green" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json deleted file mode 100644 index 129cac4..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleB_Custom.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Rocket", "StarbusterB" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json deleted file mode 100644 index 119aaa4..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleC.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Boat", "Ship" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json deleted file mode 100644 index 732c547..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleD.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Bike", "Car" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json b/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json deleted file mode 100644 index 5412c94..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/jsonIn/StyleE.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "Floor", "Ceiling" ] } diff --git a/Tests/QtAutogenRerun/mocPlugin/main.cpp b/Tests/QtAutogenRerun/mocPlugin/main.cpp deleted file mode 100644 index 3ba2ddc..0000000 --- a/Tests/QtAutogenRerun/mocPlugin/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "StyleA.hpp" - -int main(int argv, char** args) -{ - return 0; -} -- cgit v0.12 From b1504f9f97849777f4690565f8b5879372e7dd51 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 9 Dec 2017 13:30:54 +0100 Subject: Autogen: Tests: Separate RerunRccDepends test --- Tests/CMakeLists.txt | 30 ----- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/RerunRccDepends/CMakeLists.txt | 139 +++++++++++++++++++++ .../RerunRccDepends/RccDepends/CMakeLists.txt | 33 +++++ .../QtAutogen/RerunRccDepends/RccDepends/main.cpp | 5 + .../RerunRccDepends/RccDepends/resGen/input.txt.in | 1 + .../RccDepends/resGen/inputAdded.txt.in | 1 + .../RerunRccDepends/RccDepends/resGenA.qrc.in | 5 + .../RerunRccDepends/RccDepends/resGenB.qrc.in | 6 + .../RccDepends/resPlain/input.txt.in | 1 + .../RccDepends/resPlain/inputAdded.txt.in | 1 + .../RerunRccDepends/RccDepends/resPlainA.qrc.in | 5 + .../RerunRccDepends/RccDepends/resPlainB.qrc.in | 6 + Tests/QtAutogen/RerunRccDepends/dummy.cpp | 5 + Tests/QtAutogenRerun/CMakeLists.txt | 43 ------- Tests/QtAutogenRerun/defines_test/CMakeLists.txt | 4 - Tests/QtAutogenRerun/defines_test/defines_test.cpp | 38 ------ Tests/QtAutogenRerun/dummy.cpp | 5 - Tests/QtAutogenRerun/rccDepends.cmake | 131 ------------------- Tests/QtAutogenRerun/rccDepends/CMakeLists.txt | 41 ------ Tests/QtAutogenRerun/rccDepends/main.cpp | 5 - .../QtAutogenRerun/rccDepends/resGen/input.txt.in | 1 - .../rccDepends/resGen/inputAdded.txt.in | 1 - Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in | 5 - Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in | 6 - .../rccDepends/resPlain/input.txt.in | 1 - .../rccDepends/resPlain/inputAdded.txt.in | 1 - Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in | 5 - Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in | 6 - 29 files changed, 209 insertions(+), 323 deletions(-) create mode 100644 Tests/QtAutogen/RerunRccDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in create mode 100644 Tests/QtAutogen/RerunRccDepends/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/defines_test/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/defines_test/defines_test.cpp delete mode 100644 Tests/QtAutogenRerun/dummy.cpp delete mode 100644 Tests/QtAutogenRerun/rccDepends.cmake delete mode 100644 Tests/QtAutogenRerun/rccDepends/CMakeLists.txt delete mode 100644 Tests/QtAutogenRerun/rccDepends/main.cpp delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in delete mode 100644 Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index b0bf887..46dc224 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1263,21 +1263,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) - add_test(NAME Qt5AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=5 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutogenRerun") - add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" @@ -1295,21 +1280,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release if(QT4_WORKS AND QT_QTGUI_FOUND) add_subdirectory(Qt4Autogen) - add_test(NAME Qt4AutogenRerun COMMAND ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutogenRerun" - "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - ${build_generator_args} - --build-project QtAutogenRerun - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - ${QtAutogen_BUILD_OPTIONS} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutogenRerun") - add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index b03c282..5746ab5 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -36,3 +36,4 @@ ADD_AUTOGEN_TEST(RerunMocBasic) if(NOT QT_TEST_VERSION STREQUAL 4) ADD_AUTOGEN_TEST(RerunMocPlugin) endif() +ADD_AUTOGEN_TEST(RerunRccDepends) diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt new file mode 100644 index 0000000..2e6a5bd --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -0,0 +1,139 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunRccDepends) +include("../AutogenTest.cmake") + +# Tests rcc rebuilding when a resource file changes + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +# When a .qrc or a file listed in a .qrc file changes, +# the target must be rebuilt +set(timeformat "%Y%j%H%M%S") +set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccDepends") +set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccDepends") + +# Initial build +configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) +try_compile(RCC_DEPENDS + "${rccDepBD}" + "${rccDepSD}" + RccDepends + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}") +endif() + +# Get name of the output binaries +file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8) +file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8) +list(GET targetListPlain 0 rccDepBinPlain) +list(GET targetListGen 0 rccDepBinGen) +message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}") +message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}") + + +message("Changing a resource files listed in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change a resource files listed in the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Second build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing a the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Third build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing a newly added resource files listed in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change a newly added resource files listed in the .qrc file +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt") +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fourth build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (NOT rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") +endif() +if (NOT rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") +endif() + + +message("Changing nothing in the .qrc file") +# - Acquire binary timestamps before the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") +# - Ensure that the timestamp will change +# - Change nothing +# - Rebuild +execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Fifth build of rccDepends failed.") +endif() +# - Acquire binary timestamps after the build +file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") +file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") +# - Test if timestamps changed +if (rdPlainAfter GREATER rdPlainBefore) + message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!") +endif() +if (rdGenAfter GREATER rdGenBefore) + message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!") +endif() diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt new file mode 100644 index 0000000..0507e61 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.10) +project(RccDepends) +include("../../AutogenTest.cmake") + +# Enable AUTORCC for all targets +set(CMAKE_AUTORCC ON) + +# Initial resource files setup +configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY) +configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY) +configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) +configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) + +# Generated qrc file with dependency +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc +) + +# Target that uses a plain .qrc file +add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) +target_link_libraries(rccDependsPlain ${QT_QTCORE_TARGET}) +add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$" > targetPlain.txt +) + +# Target that uses a GENERATED .qrc file +add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) +target_link_libraries(rccDependsGen ${QT_QTCORE_TARGET}) +add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND + ${CMAKE_COMMAND} -E echo "$" > targetGen.txt +) diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp new file mode 100644 index 0000000..766b775 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in new file mode 100644 index 0000000..4f24589 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/input.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in new file mode 100644 index 0000000..4f24589 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGen/inputAdded.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in new file mode 100644 index 0000000..c131a34 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenA.qrc.in @@ -0,0 +1,5 @@ + + + resGen/input.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in new file mode 100644 index 0000000..8c7e643 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resGenB.qrc.in @@ -0,0 +1,6 @@ + + + resGen/input.txt + resGen/inputAdded.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in new file mode 100644 index 0000000..a5e407a --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/input.txt.in @@ -0,0 +1 @@ +Plaint resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in new file mode 100644 index 0000000..a5e407a --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlain/inputAdded.txt.in @@ -0,0 +1 @@ +Plaint resource input. diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in new file mode 100644 index 0000000..c135d85 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainA.qrc.in @@ -0,0 +1,5 @@ + + + resPlain/input.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in new file mode 100644 index 0000000..186b653 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/resPlainB.qrc.in @@ -0,0 +1,6 @@ + + + resPlain/input.txt + resPlain/inputAdded.txt + + diff --git a/Tests/QtAutogen/RerunRccDepends/dummy.cpp b/Tests/QtAutogen/RerunRccDepends/dummy.cpp new file mode 100644 index 0000000..4837a76 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogenRerun/CMakeLists.txt b/Tests/QtAutogenRerun/CMakeLists.txt deleted file mode 100644 index 9f1ee28..0000000 --- a/Tests/QtAutogenRerun/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -cmake_policy(SET CMP0071 NEW) -project(QtAutogenRerun) - -# Tell find_package(Qt5) where to find Qt. -if(QT_QMAKE_EXECUTABLE) - get_filename_component(Qt_BIN_DIR "${QT_QMAKE_EXECUTABLE}" PATH) - get_filename_component(Qt_PREFIX_DIR "${Qt_BIN_DIR}" PATH) - list(APPEND CMAKE_PREFIX_PATH ${Qt_PREFIX_DIR}) -endif() - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - - # Include this directory before using the UseQt4 file. - add_subdirectory(defines_test) - - include(UseQt4) - - set(QT_QTCORE_TARGET Qt4::QtCore) - -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - find_package(Qt5Widgets REQUIRED) - - set(QT_QTCORE_TARGET Qt5::Core) - - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - set(QT_LIBRARIES Qt5::Widgets) - - if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) - add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) - endif() - -endif() - -# Dummy executable to generate clean target -add_executable(dummy dummy.cpp) - -# -- Test -include("rccDepends.cmake") diff --git a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt b/Tests/QtAutogenRerun/defines_test/CMakeLists.txt deleted file mode 100644 index 9ee9a22..0000000 --- a/Tests/QtAutogenRerun/defines_test/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ - -add_executable(defines_test defines_test.cpp) -set_target_properties(defines_test PROPERTIES AUTOMOC TRUE) -target_link_libraries(defines_test Qt4::QtGui) diff --git a/Tests/QtAutogenRerun/defines_test/defines_test.cpp b/Tests/QtAutogenRerun/defines_test/defines_test.cpp deleted file mode 100644 index cf4e9cb..0000000 --- a/Tests/QtAutogenRerun/defines_test/defines_test.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -#include - -#ifdef QT_GUI_LIB -#include - -class SomeDocument : public QTextDocument -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -#ifdef QT_CORE_LIB -class SomeObject : public QObject -{ - Q_OBJECT - -Q_SIGNALS: - void someSig(); -}; -#endif - -int main(int argc, char** argv) -{ -#ifdef QT_CORE_LIB - QMetaObject sosmo = SomeObject::staticMetaObject; -#endif -#ifdef QT_GUI_LIB - QMetaObject sdsmo = SomeDocument::staticMetaObject; -#endif - - return 0; -} - -#include "defines_test.moc" diff --git a/Tests/QtAutogenRerun/dummy.cpp b/Tests/QtAutogenRerun/dummy.cpp deleted file mode 100644 index 4837a76..0000000 --- a/Tests/QtAutogenRerun/dummy.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main(int argv, char** args) -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/rccDepends.cmake b/Tests/QtAutogenRerun/rccDepends.cmake deleted file mode 100644 index 68e1482..0000000 --- a/Tests/QtAutogenRerun/rccDepends.cmake +++ /dev/null @@ -1,131 +0,0 @@ -# When a .qrc or a file listed in a .qrc file changes, -# the target must be rebuilt -set(timeformat "%Y%j%H%M%S") -set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends") -set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/rccDepends") - -# Initial build -configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) -configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) -try_compile(RCC_DEPENDS - "${rccDepBD}" - "${rccDepSD}" - rccDepends - CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" - "-DQT_TEST_VERSION=${QT_TEST_VERSION}" - "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" - OUTPUT_VARIABLE output -) -if (NOT RCC_DEPENDS) - message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}") -endif() - -# Get name of the output binaries -file(STRINGS "${rccDepBD}/targetPlain.txt" targetListPlain ENCODING UTF-8) -file(STRINGS "${rccDepBD}/targetGen.txt" targetListGen ENCODING UTF-8) -list(GET targetListPlain 0 rccDepBinPlain) -list(GET targetListGen 0 rccDepBinGen) -message("Target that uses a plain .qrc file is:\n ${rccDepBinPlain}") -message("Target that uses a GENERATED .qrc file is:\n ${rccDepBinGen}") - - -message("Changing a resource files listed in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change a resource files listed in the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/input.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/input.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Second build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing a the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) -configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Third build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing a newly added resource files listed in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change a newly added resource files listed in the .qrc file -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resPlain/inputAdded.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${rccDepBD}/resGen/inputAdded.txt") -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Fourth build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (NOT rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should have changed!") -endif() -if (NOT rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should have changed!") -endif() - - -message("Changing nothing in the .qrc file") -# - Acquire binary timestamps before the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainBefore "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenBefore "${timeformat}") -# - Ensure that the timestamp will change -# - Change nothing -# - Rebuild -execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) -execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${rccDepBD}" RESULT_VARIABLE result) -if (result) - message(SEND_ERROR "Fifth build of rccDepends failed.") -endif() -# - Acquire binary timestamps after the build -file(TIMESTAMP "${rccDepBinPlain}" rdPlainAfter "${timeformat}") -file(TIMESTAMP "${rccDepBinGen}" rdGenAfter "${timeformat}") -# - Test if timestamps changed -if (rdPlainAfter GREATER rdPlainBefore) - message(SEND_ERROR "Plain .qrc binary ${rccDepBinPlain}) should NOT have changed!") -endif() -if (rdGenAfter GREATER rdGenBefore) - message(SEND_ERROR "GENERATED .qrc binary ${rccDepBinGen} should NOT have changed!") -endif() diff --git a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt b/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt deleted file mode 100644 index 291592e..0000000 --- a/Tests/QtAutogenRerun/rccDepends/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(rccDepends CXX) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - set(QT_CORE_TARGET Qt4::QtCore) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - - find_package(Qt5Core REQUIRED) - set(QT_CORE_TARGET Qt5::Core) -endif() - -# Enable AUTORCC for all targets -set(CMAKE_AUTORCC ON) - -# Initial resource files setup -configure_file(resPlain/input.txt.in resPlain/input.txt COPYONLY) -configure_file(resPlain/input.txt.in resPlain/inputAdded.txt COPYONLY) -configure_file(resGen/input.txt.in resGen/input.txt COPYONLY) -configure_file(resGen/input.txt.in resGen/inputAdded.txt COPYONLY) - -# Generated qrc file with dependency -add_custom_command(OUTPUT resGen.qrc - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in - COMMAND ${CMAKE_COMMAND} -E sleep 2 - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc) - -# Target that uses a plain .qrc file -add_executable(rccDependsPlain main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resPlain.qrc) -target_link_libraries(rccDependsPlain ${QT_CORE_TARGET}) -add_custom_command(TARGET rccDependsPlain POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$" > targetPlain.txt) - -# Target that uses a GENERATED .qrc file -add_executable(rccDependsGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) -target_link_libraries(rccDependsGen ${QT_CORE_TARGET}) -add_custom_command(TARGET rccDependsGen POST_BUILD COMMAND - ${CMAKE_COMMAND} -E echo "$" > targetGen.txt) diff --git a/Tests/QtAutogenRerun/rccDepends/main.cpp b/Tests/QtAutogenRerun/rccDepends/main.cpp deleted file mode 100644 index 766b775..0000000 --- a/Tests/QtAutogenRerun/rccDepends/main.cpp +++ /dev/null @@ -1,5 +0,0 @@ - -int main() -{ - return 0; -} diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in deleted file mode 100644 index 4f24589..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGen/input.txt.in +++ /dev/null @@ -1 +0,0 @@ -Generated resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in deleted file mode 100644 index 4f24589..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGen/inputAdded.txt.in +++ /dev/null @@ -1 +0,0 @@ -Generated resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in deleted file mode 100644 index c131a34..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGenA.qrc.in +++ /dev/null @@ -1,5 +0,0 @@ - - - resGen/input.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in deleted file mode 100644 index 8c7e643..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resGenB.qrc.in +++ /dev/null @@ -1,6 +0,0 @@ - - - resGen/input.txt - resGen/inputAdded.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in deleted file mode 100644 index a5e407a..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/input.txt.in +++ /dev/null @@ -1 +0,0 @@ -Plaint resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in b/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in deleted file mode 100644 index a5e407a..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlain/inputAdded.txt.in +++ /dev/null @@ -1 +0,0 @@ -Plaint resource input. diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in deleted file mode 100644 index c135d85..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlainA.qrc.in +++ /dev/null @@ -1,5 +0,0 @@ - - - resPlain/input.txt - - diff --git a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in b/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in deleted file mode 100644 index 186b653..0000000 --- a/Tests/QtAutogenRerun/rccDepends/resPlainB.qrc.in +++ /dev/null @@ -1,6 +0,0 @@ - - - resPlain/input.txt - resPlain/inputAdded.txt - - -- cgit v0.12 From 540d08f4858ddbb8d0356f77f878b9fbb7af8f80 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Sat, 9 Dec 2017 13:50:12 +0100 Subject: Autogen: Tests: Move QtAutoUicInterface test to QtAutogen/UicInterface --- Tests/CMakeLists.txt | 41 ------------ Tests/QtAutoUicInterface/CMakeLists.txt | 76 ----------------------- Tests/QtAutoUicInterface/klocalizedstring.cpp | 12 ---- Tests/QtAutoUicInterface/klocalizedstring.h | 17 ----- Tests/QtAutoUicInterface/libwidget.cpp | 14 ----- Tests/QtAutoUicInterface/libwidget.h | 25 -------- Tests/QtAutoUicInterface/libwidget.ui | 32 ---------- Tests/QtAutoUicInterface/main.cpp | 67 -------------------- Tests/QtAutoUicInterface/mywidget.cpp | 14 ----- Tests/QtAutoUicInterface/mywidget.h | 25 -------- Tests/QtAutoUicInterface/mywidget.ui | 32 ---------- Tests/QtAutogen/CommonTests.cmake | 1 + Tests/QtAutogen/UicInterface/CMakeLists.txt | 58 +++++++++++++++++ Tests/QtAutogen/UicInterface/klocalizedstring.cpp | 12 ++++ Tests/QtAutogen/UicInterface/klocalizedstring.h | 17 +++++ Tests/QtAutogen/UicInterface/libwidget.cpp | 14 +++++ Tests/QtAutogen/UicInterface/libwidget.h | 25 ++++++++ Tests/QtAutogen/UicInterface/libwidget.ui | 32 ++++++++++ Tests/QtAutogen/UicInterface/main.cpp | 67 ++++++++++++++++++++ Tests/QtAutogen/UicInterface/mywidget.cpp | 14 +++++ Tests/QtAutogen/UicInterface/mywidget.h | 25 ++++++++ Tests/QtAutogen/UicInterface/mywidget.ui | 32 ++++++++++ 22 files changed, 297 insertions(+), 355 deletions(-) delete mode 100644 Tests/QtAutoUicInterface/CMakeLists.txt delete mode 100644 Tests/QtAutoUicInterface/klocalizedstring.cpp delete mode 100644 Tests/QtAutoUicInterface/klocalizedstring.h delete mode 100644 Tests/QtAutoUicInterface/libwidget.cpp delete mode 100644 Tests/QtAutoUicInterface/libwidget.h delete mode 100644 Tests/QtAutoUicInterface/libwidget.ui delete mode 100644 Tests/QtAutoUicInterface/main.cpp delete mode 100644 Tests/QtAutoUicInterface/mywidget.cpp delete mode 100644 Tests/QtAutoUicInterface/mywidget.h delete mode 100644 Tests/QtAutoUicInterface/mywidget.ui create mode 100644 Tests/QtAutogen/UicInterface/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicInterface/klocalizedstring.cpp create mode 100644 Tests/QtAutogen/UicInterface/klocalizedstring.h create mode 100644 Tests/QtAutogen/UicInterface/libwidget.cpp create mode 100644 Tests/QtAutogen/UicInterface/libwidget.h create mode 100644 Tests/QtAutogen/UicInterface/libwidget.ui create mode 100644 Tests/QtAutogen/UicInterface/main.cpp create mode 100644 Tests/QtAutogen/UicInterface/mywidget.cpp create mode 100644 Tests/QtAutogen/UicInterface/mywidget.h create mode 100644 Tests/QtAutogen/UicInterface/mywidget.ui diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 46dc224..5d8c2fe 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1242,18 +1242,6 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") - # On Windows there is no RPATH, so while Qt might be available for building, - # the required dlls may not be in the PATH, so we can't run the executables - # on that platform. - if(WIN32) - set(run_autouic_test ${CMAKE_CTEST_COMMAND} -V) - else() - set(run_autouic_test QtAutoUicInterface) - endif() - if(NOT CMAKE_CONFIGURATION_TYPES) - set(QtAutogen_BUILD_OPTIONS -DCMAKE_BUILD_TYPE=$) - endif() - if(NOT DEFINED CMake_TEST_Qt5) set(CMake_TEST_Qt5 1) endif() @@ -1262,39 +1250,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release endif() if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) - - add_test(Qt5AutoUicInterface ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" - "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" - ${build_generator_args} - --build-project QtAutoUicInterface - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} -DQT_TEST_VERSION=5 - --test-command ${run_autouic_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt5AutoUicInterface") endif() if(QT4_WORKS AND QT_QTGUI_FOUND) add_subdirectory(Qt4Autogen) - add_test(Qt4AutoUicInterface ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Tests/QtAutoUicInterface" - "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" - ${build_generator_args} - --build-project QtAutoUicInterface - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface" - --force-new-ctest-process - --build-options ${build_options} - -DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE} - -DQT_TEST_VERSION=4 - --test-command ${run_autouic_test} - ) - list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Qt4AutoUicInterface") - add_test(Qt4Targets ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/Qt4Targets" diff --git a/Tests/QtAutoUicInterface/CMakeLists.txt b/Tests/QtAutoUicInterface/CMakeLists.txt deleted file mode 100644 index a5c2d99..0000000 --- a/Tests/QtAutoUicInterface/CMakeLists.txt +++ /dev/null @@ -1,76 +0,0 @@ - -cmake_minimum_required(VERSION 3.7) - -project(QtAutoUicInterface) - -if (QT_TEST_VERSION STREQUAL 4) - find_package(Qt4 REQUIRED) - - include(UseQt4) - - set(QT_CORE_TARGET Qt4::QtCore) - set(QT_GUI_TARGET Qt4::QtGui) -else() - if (NOT QT_TEST_VERSION STREQUAL 5) - message(SEND_ERROR "Invalid Qt version specified.") - endif() - find_package(Qt5Widgets REQUIRED) - - set(QT_CORE_TARGET Qt5::Core) - set(QT_GUI_TARGET Qt5::Widgets) -endif() - -set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) - -# BEGIN Upstream - -set(CMAKE_VERBOSE_MAKEFILE ON) - -add_library(KI18n klocalizedstring.cpp) -target_link_libraries(KI18n ${QT_CORE_TARGET}) - -set(autouic_options - -tr tr2$<$>>:x>i18n -) -if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0) - list(APPEND autouic_options -include klocalizedstring.h) -endif() - -set_property(TARGET KI18n APPEND PROPERTY - INTERFACE_AUTOUIC_OPTIONS ${autouic_options} -) - -set(domainProp $) -set(nameLower $>>) -set(domain_logic - $<$:${domainProp}>$<$>:${nameLower}> -) -set_property(TARGET KI18n APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS "TRANSLATION_DOMAIN=${domain_logic}" -) - -# END upstream - -get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(_GENERATOR_IS_MULTI_CONFIG) -set(INC_DIR "include_$" ) -else() -set(INC_DIR "include" ) -endif() - -add_library(LibWidget libwidget.cpp) -target_link_libraries(LibWidget KI18n ${QT_GUI_TARGET}) -set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON) -set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain) - -add_library(MyWidget mywidget.cpp) -target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET}) - -add_executable(QtAutoUicInterface main.cpp) -target_compile_definitions(QtAutoUicInterface - PRIVATE - UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/${INC_DIR}/ui_libwidget.h" - UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/${INC_DIR}/ui_mywidget.h" -) diff --git a/Tests/QtAutoUicInterface/klocalizedstring.cpp b/Tests/QtAutoUicInterface/klocalizedstring.cpp deleted file mode 100644 index b629cd1..0000000 --- a/Tests/QtAutoUicInterface/klocalizedstring.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -#include "klocalizedstring.h" - -QString tr2xi18n(const char* text, const char*) -{ - return QLatin1String("TranslatedX") + QString::fromLatin1(text); -} - -QString tr2i18n(const char* text, const char*) -{ - return QLatin1String("Translated") + QString::fromLatin1(text); -} diff --git a/Tests/QtAutoUicInterface/klocalizedstring.h b/Tests/QtAutoUicInterface/klocalizedstring.h deleted file mode 100644 index 6129599..0000000 --- a/Tests/QtAutoUicInterface/klocalizedstring.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef KLOCALIZEDSTRING_H -#define KLOCALIZEDSTRING_H - -#include - -#ifdef _WIN32 -__declspec(dllexport) -#endif - QString tr2xi18n(const char* text, const char* comment = 0); - -#ifdef _WIN32 -__declspec(dllexport) -#endif - QString tr2i18n(const char* text, const char* comment = 0); - -#endif diff --git a/Tests/QtAutoUicInterface/libwidget.cpp b/Tests/QtAutoUicInterface/libwidget.cpp deleted file mode 100644 index 008c22a..0000000 --- a/Tests/QtAutoUicInterface/libwidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -#include "libwidget.h" - -LibWidget::LibWidget(QWidget* parent) - : QWidget(parent) - , ui(new Ui::LibWidget) -{ - ui->setupUi(this); -} - -LibWidget::~LibWidget() -{ - delete ui; -} diff --git a/Tests/QtAutoUicInterface/libwidget.h b/Tests/QtAutoUicInterface/libwidget.h deleted file mode 100644 index b6f3e82..0000000 --- a/Tests/QtAutoUicInterface/libwidget.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef LIBWIDGET_H -#define LIBWIDGET_H - -#include -#include - -#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) -#include -#endif - -#include "ui_libwidget.h" - -class LibWidget : public QWidget -{ - Q_OBJECT -public: - explicit LibWidget(QWidget* parent = 0); - ~LibWidget(); - -private: - Ui::LibWidget* ui; -}; - -#endif diff --git a/Tests/QtAutoUicInterface/libwidget.ui b/Tests/QtAutoUicInterface/libwidget.ui deleted file mode 100644 index 897371e..0000000 --- a/Tests/QtAutoUicInterface/libwidget.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - LibWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 180 - 60 - 57 - 15 - - - - LibLabel - - - - - - diff --git a/Tests/QtAutoUicInterface/main.cpp b/Tests/QtAutoUicInterface/main.cpp deleted file mode 100644 index 68bd843..0000000 --- a/Tests/QtAutoUicInterface/main.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -#include -#include -#include - -int main(int argc, char** argv) -{ - std::ifstream f; - f.open(UI_LIBWIDGET_H); - if (!f.is_open()) { - std::cout << "Could not open \"" UI_LIBWIDGET_H "\"." << std::endl; - return -1; - } - - { - bool gotTr2i18n = false; - - while (!f.eof()) { - std::string output; - getline(f, output); - if (!gotTr2i18n) { - gotTr2i18n = output.find("tr2i18n") != std::string::npos; - } - if (output.find("tr2xi18n") != std::string::npos) { - std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." - << std::endl; - return -1; - } - } - - if (!gotTr2i18n) { - std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl; - return -1; - } - } - - f.close(); - f.open(UI_MYWIDGET_H); - if (!f.is_open()) { - std::cout << "Could not open \"" UI_MYWIDGET_H "\"." << std::endl; - return -1; - } - - { - bool gotTr2xi18n = false; - - while (!f.eof()) { - std::string output; - getline(f, output); - if (!gotTr2xi18n) { - gotTr2xi18n = output.find("tr2xi18n") != std::string::npos; - } - if (output.find("tr2i18n") != std::string::npos) { - std::cout << "ui_mywidget,h uses tr2i18n, though it should not." - << std::endl; - return -1; - } - } - if (!gotTr2xi18n) { - std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl; - return -1; - } - } - f.close(); - - return 0; -} diff --git a/Tests/QtAutoUicInterface/mywidget.cpp b/Tests/QtAutoUicInterface/mywidget.cpp deleted file mode 100644 index 7cf1a13..0000000 --- a/Tests/QtAutoUicInterface/mywidget.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -#include "mywidget.h" - -MyWidget::MyWidget(QWidget* parent) - : QWidget(parent) - , ui(new Ui::MyWidget) -{ - ui->setupUi(this); -} - -MyWidget::~MyWidget() -{ - delete ui; -} diff --git a/Tests/QtAutoUicInterface/mywidget.h b/Tests/QtAutoUicInterface/mywidget.h deleted file mode 100644 index c23e55d..0000000 --- a/Tests/QtAutoUicInterface/mywidget.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef MYWIDGET_H -#define MYWIDGET_H - -#include -#include - -#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) -#include -#endif - -#include "ui_mywidget.h" - -class MyWidget : public QWidget -{ - Q_OBJECT -public: - explicit MyWidget(QWidget* parent = 0); - ~MyWidget(); - -private: - Ui::MyWidget* ui; -}; - -#endif diff --git a/Tests/QtAutoUicInterface/mywidget.ui b/Tests/QtAutoUicInterface/mywidget.ui deleted file mode 100644 index b2b9cc5..0000000 --- a/Tests/QtAutoUicInterface/mywidget.ui +++ /dev/null @@ -1,32 +0,0 @@ - - - MyWidget - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - 110 - 40 - 81 - 23 - - - - Special button - - - - - - diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 5746ab5..c56780e 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -24,6 +24,7 @@ if(QT_TEST_ALLOW_QT_MACROS) ADD_AUTOGEN_TEST(MocCMP0071) endif() ADD_AUTOGEN_TEST(UicInclude uicInclude) +ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) ADD_AUTOGEN_TEST(ObjectLibrary someProgram) if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4)) ADD_AUTOGEN_TEST(MacOsFW) diff --git a/Tests/QtAutogen/UicInterface/CMakeLists.txt b/Tests/QtAutogen/UicInterface/CMakeLists.txt new file mode 100644 index 0000000..a216aff --- /dev/null +++ b/Tests/QtAutogen/UicInterface/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.10) +project(UicInterface) +include("../AutogenTest.cmake") + +set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) + +# BEGIN Upstream + +set(CMAKE_VERBOSE_MAKEFILE ON) + +add_library(KI18n klocalizedstring.cpp) +target_link_libraries(KI18n ${QT_QTCORE_TARGET}) + +set(autouic_options + -tr tr2$<$>>:x>i18n +) +if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0) + list(APPEND autouic_options -include klocalizedstring.h) +endif() + +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_AUTOUIC_OPTIONS ${autouic_options} +) + +set(domainProp $) +set(nameLower $>>) +set(domain_logic + $<$:${domainProp}>$<$>:${nameLower}> +) +set_property(TARGET KI18n APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS "TRANSLATION_DOMAIN=${domain_logic}" +) + +# END upstream + +get_property(_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_GENERATOR_IS_MULTI_CONFIG) +set(INC_DIR "include_$" ) +else() +set(INC_DIR "include" ) +endif() + +add_library(LibWidget libwidget.cpp) +target_link_libraries(LibWidget KI18n ${QT_QTGUI_TARGET}) +set_property(TARGET LibWidget PROPERTY NO_KUIT_SEMANTIC ON) +set_property(TARGET LibWidget PROPERTY TRANSLATION_DOMAIN customdomain) + +add_library(MyWidget mywidget.cpp) +target_link_libraries(MyWidget KI18n ${QT_QTGUI_TARGET}) + +add_executable(QtAutoUicInterface main.cpp) +target_compile_definitions(QtAutoUicInterface + PRIVATE + UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/${INC_DIR}/ui_libwidget.h" + UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/${INC_DIR}/ui_mywidget.h" +) diff --git a/Tests/QtAutogen/UicInterface/klocalizedstring.cpp b/Tests/QtAutogen/UicInterface/klocalizedstring.cpp new file mode 100644 index 0000000..b629cd1 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/klocalizedstring.cpp @@ -0,0 +1,12 @@ + +#include "klocalizedstring.h" + +QString tr2xi18n(const char* text, const char*) +{ + return QLatin1String("TranslatedX") + QString::fromLatin1(text); +} + +QString tr2i18n(const char* text, const char*) +{ + return QLatin1String("Translated") + QString::fromLatin1(text); +} diff --git a/Tests/QtAutogen/UicInterface/klocalizedstring.h b/Tests/QtAutogen/UicInterface/klocalizedstring.h new file mode 100644 index 0000000..6129599 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/klocalizedstring.h @@ -0,0 +1,17 @@ + +#ifndef KLOCALIZEDSTRING_H +#define KLOCALIZEDSTRING_H + +#include + +#ifdef _WIN32 +__declspec(dllexport) +#endif + QString tr2xi18n(const char* text, const char* comment = 0); + +#ifdef _WIN32 +__declspec(dllexport) +#endif + QString tr2i18n(const char* text, const char* comment = 0); + +#endif diff --git a/Tests/QtAutogen/UicInterface/libwidget.cpp b/Tests/QtAutogen/UicInterface/libwidget.cpp new file mode 100644 index 0000000..008c22a --- /dev/null +++ b/Tests/QtAutogen/UicInterface/libwidget.cpp @@ -0,0 +1,14 @@ + +#include "libwidget.h" + +LibWidget::LibWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::LibWidget) +{ + ui->setupUi(this); +} + +LibWidget::~LibWidget() +{ + delete ui; +} diff --git a/Tests/QtAutogen/UicInterface/libwidget.h b/Tests/QtAutogen/UicInterface/libwidget.h new file mode 100644 index 0000000..b6f3e82 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/libwidget.h @@ -0,0 +1,25 @@ + +#ifndef LIBWIDGET_H +#define LIBWIDGET_H + +#include +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) +#include +#endif + +#include "ui_libwidget.h" + +class LibWidget : public QWidget +{ + Q_OBJECT +public: + explicit LibWidget(QWidget* parent = 0); + ~LibWidget(); + +private: + Ui::LibWidget* ui; +}; + +#endif diff --git a/Tests/QtAutogen/UicInterface/libwidget.ui b/Tests/QtAutogen/UicInterface/libwidget.ui new file mode 100644 index 0000000..897371e --- /dev/null +++ b/Tests/QtAutogen/UicInterface/libwidget.ui @@ -0,0 +1,32 @@ + + + LibWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 180 + 60 + 57 + 15 + + + + LibLabel + + + + + + diff --git a/Tests/QtAutogen/UicInterface/main.cpp b/Tests/QtAutogen/UicInterface/main.cpp new file mode 100644 index 0000000..68bd843 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/main.cpp @@ -0,0 +1,67 @@ + +#include +#include +#include + +int main(int argc, char** argv) +{ + std::ifstream f; + f.open(UI_LIBWIDGET_H); + if (!f.is_open()) { + std::cout << "Could not open \"" UI_LIBWIDGET_H "\"." << std::endl; + return -1; + } + + { + bool gotTr2i18n = false; + + while (!f.eof()) { + std::string output; + getline(f, output); + if (!gotTr2i18n) { + gotTr2i18n = output.find("tr2i18n") != std::string::npos; + } + if (output.find("tr2xi18n") != std::string::npos) { + std::cout << "ui_libwidget,h uses tr2xi18n, though it should not." + << std::endl; + return -1; + } + } + + if (!gotTr2i18n) { + std::cout << "Did not find tr2i18n in ui_libwidget.h" << std::endl; + return -1; + } + } + + f.close(); + f.open(UI_MYWIDGET_H); + if (!f.is_open()) { + std::cout << "Could not open \"" UI_MYWIDGET_H "\"." << std::endl; + return -1; + } + + { + bool gotTr2xi18n = false; + + while (!f.eof()) { + std::string output; + getline(f, output); + if (!gotTr2xi18n) { + gotTr2xi18n = output.find("tr2xi18n") != std::string::npos; + } + if (output.find("tr2i18n") != std::string::npos) { + std::cout << "ui_mywidget,h uses tr2i18n, though it should not." + << std::endl; + return -1; + } + } + if (!gotTr2xi18n) { + std::cout << "Did not find tr2xi18n in ui_mywidget.h" << std::endl; + return -1; + } + } + f.close(); + + return 0; +} diff --git a/Tests/QtAutogen/UicInterface/mywidget.cpp b/Tests/QtAutogen/UicInterface/mywidget.cpp new file mode 100644 index 0000000..7cf1a13 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/mywidget.cpp @@ -0,0 +1,14 @@ + +#include "mywidget.h" + +MyWidget::MyWidget(QWidget* parent) + : QWidget(parent) + , ui(new Ui::MyWidget) +{ + ui->setupUi(this); +} + +MyWidget::~MyWidget() +{ + delete ui; +} diff --git a/Tests/QtAutogen/UicInterface/mywidget.h b/Tests/QtAutogen/UicInterface/mywidget.h new file mode 100644 index 0000000..c23e55d --- /dev/null +++ b/Tests/QtAutogen/UicInterface/mywidget.h @@ -0,0 +1,25 @@ + +#ifndef MYWIDGET_H +#define MYWIDGET_H + +#include +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) +#include +#endif + +#include "ui_mywidget.h" + +class MyWidget : public QWidget +{ + Q_OBJECT +public: + explicit MyWidget(QWidget* parent = 0); + ~MyWidget(); + +private: + Ui::MyWidget* ui; +}; + +#endif diff --git a/Tests/QtAutogen/UicInterface/mywidget.ui b/Tests/QtAutogen/UicInterface/mywidget.ui new file mode 100644 index 0000000..b2b9cc5 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/mywidget.ui @@ -0,0 +1,32 @@ + + + MyWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 110 + 40 + 81 + 23 + + + + Special button + + + + + + -- cgit v0.12