summaryrefslogtreecommitdiffstats
path: root/Tests/QtAutogen
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/QtAutogen')
-rw-r--r--Tests/QtAutogen/CMakeLists.txt196
-rw-r--r--Tests/QtAutogen/automoc_rerun/CMakeLists.txt27
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.cpp5
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.h.in18
-rw-r--r--Tests/QtAutogen/automoc_rerun/test1.h.in27
-rw-r--r--Tests/QtAutogen/autorcc_depends/CMakeLists.txt27
-rw-r--r--Tests/QtAutogen/mocDepends/CMakeLists.txt45
-rw-r--r--Tests/QtAutogen/mocDepends/invalid.hpp.in1
-rw-r--r--Tests/QtAutogen/mocDepends/object.hpp.in14
-rw-r--r--Tests/QtAutogen/mocDepends/simpleLib.cpp.in9
-rw-r--r--Tests/QtAutogen/mocDepends/simpleLib.hpp.in11
-rw-r--r--Tests/QtAutogen/mocDepends/test1.cpp9
-rw-r--r--Tests/QtAutogen/mocDepends/test2.cpp10
-rw-r--r--Tests/QtAutogen/mocDepends/test2.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.cpp24
-rw-r--r--Tests/QtAutogen/mocInclude/ObjA.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.cpp25
-rw-r--r--Tests/QtAutogen/mocInclude/ObjB.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjC.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.cpp26
-rw-r--r--Tests/QtAutogen/mocInclude/ObjD.hpp13
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subA/SubObjA.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subB/SubObjB.hpp16
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.cpp27
-rw-r--r--Tests/QtAutogen/mocInclude/subC/SubObjC.hpp16
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt18
-rw-r--r--Tests/QtAutogen/mocIncludeRelaxed/main.cpp14
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt18
-rw-r--r--Tests/QtAutogen/mocIncludeStrict/main.cpp14
-rw-r--r--Tests/QtAutogen/mocPlugin/CMakeLists.txt32
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleA_Custom.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleB.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleC.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleCommon.hpp7
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleD.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.cpp6
-rw-r--r--Tests/QtAutogen/mocPlugin/StyleE.hpp17
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json1
-rw-r--r--Tests/QtAutogen/mocPlugin/main.cpp6
-rw-r--r--Tests/QtAutogen/mocRerun/CMakeLists.txt35
-rw-r--r--Tests/QtAutogen/mocRerun/input.txt (renamed from Tests/QtAutogen/automoc_rerun/input.txt)0
-rw-r--r--Tests/QtAutogen/mocRerun/main.cpp.in18
-rw-r--r--Tests/QtAutogen/mocRerun/res1.qrc (renamed from Tests/QtAutogen/automoc_rerun/res1.qrc)0
-rw-r--r--Tests/QtAutogen/mocRerun/test1a.h.in8
-rw-r--r--Tests/QtAutogen/mocRerun/test1b.h.in7
-rw-r--r--Tests/QtAutogen/rccDepends/CMakeLists.txt36
-rw-r--r--Tests/QtAutogen/rccDepends/main.cpp (renamed from Tests/QtAutogen/autorcc_depends/test_res1.cpp)0
-rw-r--r--Tests/QtAutogen/rccDepends/res/input1.txt.in (renamed from Tests/QtAutogen/autorcc_depends/res1/input.txt.in)0
-rw-r--r--Tests/QtAutogen/rccDepends/res/input2.txt.in1
-rw-r--r--Tests/QtAutogen/rccDepends/res1.qrc.in (renamed from Tests/QtAutogen/autorcc_depends/res1.qrc.in)0
-rw-r--r--Tests/QtAutogen/rccDepends/res2.qrc.in5
-rw-r--r--Tests/QtAutogen/sameName/CMakeLists.txt11
-rw-r--r--Tests/QtAutogen/uicInclude/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/uicInclude/PageC.ui24
-rw-r--r--Tests/QtAutogen/uicInclude/dirA/PageA.ui24
-rw-r--r--Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui24
-rw-r--r--Tests/QtAutogen/uicInclude/main.cpp10
-rw-r--r--Tests/QtAutogen/uicInclude/main.hpp6
70 files changed, 1001 insertions, 113 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 4b90ad8..86af746 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -46,26 +46,26 @@ endif()
get_property(QT_COMPILE_FEATURES TARGET ${QT_QTCORE_TARGET} PROPERTY INTERFACE_COMPILE_FEATURES)
-# -- Test: AUTORCC
+# -- 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: AUTORCC
+# -- 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: AUTOUIC
+# -- Test
# UIC only
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})
-# -- Test: AUTOMOC, AUTORCC
+# -- 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
@@ -80,66 +80,98 @@ set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)
target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES})
target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES})
-# -- Test: AUTORCC
+# -- Test
# When a file listed in a .qrc file changes the target must be rebuilt
try_compile(RCC_DEPENDS
- "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends"
- "${CMAKE_CURRENT_SOURCE_DIR}/autorcc_depends"
- autorcc_depends
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "${CMAKE_CURRENT_BINARY_DIR}/rccDepends"
+ "${CMAKE_CURRENT_SOURCE_DIR}/rccDepends"
+ 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 autorcc_depends failed. Output: ${output}")
+ message(SEND_ERROR "Initial build of rccDepends failed. Output: ${output}")
endif()
-file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/info_file.txt" qrc_files)
-
-list(GET qrc_files 0 qrc_file1)
-
+# Get name and timestamp of the output binary
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/target1.txt" target1List)
+list(GET target1List 0 binFile)
set(timeformat "%Y%j%H%M%S")
+file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
-file(TIMESTAMP "${qrc_file1}" file1_before "${timeformat}")
-
+# Touch first qrc input file and rebuild
execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
-execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends/res1/input.txt")
-
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/res1/input.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/autorcc_depends"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rccDepends"
+ RESULT_VARIABLE rccDepends_result
)
+if (rccDepends_result)
+ message(SEND_ERROR "Second build of rccDepends failed.")
+endif()
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
+endif()
-file(TIMESTAMP "${qrc_file1}" file1_step1 "${timeformat}")
-
-if (NOT file1_step1 GREATER file1_before)
- message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first step!")
+# Touch second qrc input file and rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) # Ensure that the timestamp will change.
+execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/rccDepends/res2/input.txt")
+execute_process(COMMAND "${CMAKE_COMMAND}" --build .
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/rccDepends"
+ RESULT_VARIABLE rccDepends_result
+)
+if (rccDepends_result)
+ message(SEND_ERROR "Third build of rccDepends failed.")
+endif()
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep2 "${timeformat}")
+if (NOT timeStep2 GREATER timeStep1)
+ message(SEND_ERROR "File (${binFile}) should have changed in the second step!")
endif()
-# -- Test: AUTOMOC
+# -- Test
# Ensure a repeated build succeeds when a header containing a QObject changes
try_compile(MOC_RERUN
- "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun"
- "${CMAKE_CURRENT_SOURCE_DIR}/automoc_rerun"
- automoc_rerun
- CMAKE_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
+ "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mocRerun"
+ 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 automoc_rerun failed. Output: ${output}")
+ message(SEND_ERROR "Initial build of mocRerun failed. Output: ${output}")
endif()
-configure_file(automoc_rerun/test1.h.in2 automoc_rerun/test1.h COPYONLY)
+# Get name and timestamp of the output binary
+file(STRINGS "${CMAKE_CURRENT_BINARY_DIR}/mocRerun/target1.txt" target1List)
+list(GET target1List 0 binFile)
+set(timeformat "%Y%j%H%M%S")
+file(TIMESTAMP "${binFile}" timeBegin "${timeformat}")
+# Change file content and rebuild
+execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+configure_file(mocRerun/test1b.h.in mocRerun/test1.h COPYONLY)
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
- WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/automoc_rerun"
- RESULT_VARIABLE automoc_rerun_result
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocRerun"
+ RESULT_VARIABLE mocRerun_result
)
-if (automoc_rerun_result)
- message(SEND_ERROR "Second build of automoc_rerun failed.")
+if (mocRerun_result)
+ message(SEND_ERROR "Second build of mocRerun failed.")
+endif()
+
+# Compare timestamps
+file(TIMESTAMP "${binFile}" timeStep1 "${timeformat}")
+if (NOT timeStep1 GREATER timeBegin)
+ message(SEND_ERROR "File (${binFile}) should have changed in the first step!")
endif()
-# -- Test: AUTOMOC, SKIP_AUTOMOC
+# -- Test
# Test for SKIP_AUTOMOC and SKIP_AUTOGEN on an AUTOMOC enabled target
qtx_wrap_cpp(skipMocWrapMoc
skipSource/qItemA.hpp
@@ -161,7 +193,7 @@ set_property(TARGET skipMocB PROPERTY AUTOMOC ON)
set_property(TARGET skipMocB PROPERTY AUTOUIC ON)
target_link_libraries(skipMocB ${QT_LIBRARIES})
-# -- Test: AUTOUIC, SKIP_AUTOUIC
+# -- Test
# Test for SKIP_AUTOUIC and SKIP_AUTOGEN on an AUTOUIC enabled target
set(skipUicSources
skipUic.cpp
@@ -181,7 +213,7 @@ set_property(TARGET skipUicB PROPERTY AUTOUIC ON)
set_property(TARGET skipUicB PROPERTY AUTOMOC ON)
target_link_libraries(skipUicB ${QT_LIBRARIES})
-# -- Test: AUTORCC, SKIP_AUTORCC
+# -- Test
# Test for SKIP_AUTORCC and SKIP_AUTOGEN on an AUTORCC enabled target
set(skipRccSources
skipRcc.cpp
@@ -202,10 +234,96 @@ set_property(TARGET skipRccB PROPERTY AUTOUIC ON)
set_property(TARGET skipRccB PROPERTY AUTOMOC ON)
target_link_libraries(skipRccB ${QT_LIBRARIES})
-# -- Test: AUTOMOC AUTORCC
+# -- Test
# Source files with the same basename in different subdirectories
add_subdirectory(sameName)
-# -- Test: AUTOMOC AUTORCC AUTOUIC
+# -- Test
+# Tests AUTOMOC with generated sources
+add_subdirectory(mocDepends)
+
+# -- Test
+# Tests various include moc patterns
+add_subdirectory(mocIncludeStrict)
+
+# -- Test
+# Tests various include moc patterns
+add_subdirectory(mocIncludeRelaxed)
+
+# -- Test
+# Tests Q_PLUGIN_METADATA json file change detection
+if (NOT QT_TEST_VERSION STREQUAL 4)
+ try_compile(MOC_PLUGIN
+ "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin"
+ "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin"
+ 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()
+
+ set(timeformat "%Y%j%H%M%S")
+ set(mocPlugSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/mocPlugin")
+ set(mocPlugBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin")
+ find_library(plAFile "PlugA" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plBFile "PlugB" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plCFile "PlugC" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
+ find_library(plDFile "PlugD" PATHS "${mocPlugBinDir}" NO_DEFAULT_PATH)
+
+ file(TIMESTAMP "${plAFile}" plABefore "${timeformat}")
+ file(TIMESTAMP "${plBFile}" plBBefore "${timeformat}")
+ file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+
+ # Ensure that the timestamp will change and change the json files
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC.json")
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD.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}")
+
+ 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()
+
+ # Test custom macro
+ file(TIMESTAMP "${plCFile}" plCBefore "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDBefore "${timeformat}")
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1)
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleD.json" "${mocPlugBinDir}/jsonFiles/StyleC_Custom.json")
+ configure_file("${mocPlugSrcDir}/jsonIn/StyleC.json" "${mocPlugBinDir}/jsonFiles/sub/StyleD_Custom.json")
+ execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}")
+ file(TIMESTAMP "${plCFile}" plCAfter "${timeformat}")
+ file(TIMESTAMP "${plDFile}" plDAfter "${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()
+
+endif()
+
+# -- Test
+# Tests various .ui include directories
+add_subdirectory(uicInclude)
+
+# -- Test
# Complex test case
add_subdirectory(complex)
diff --git a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt b/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
deleted file mode 100644
index 92a682b..0000000
--- a/Tests/QtAutogen/automoc_rerun/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-project(automoc_rerun 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)
-
-configure_file(test1.h.in1 test1.h COPYONLY)
-
-add_executable(test1
- ${CMAKE_CURRENT_BINARY_DIR}/test1.h
- test1.cpp
- res1.qrc
- )
-target_include_directories(test1 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(test1 ${QT_CORE_TARGET})
diff --git a/Tests/QtAutogen/automoc_rerun/test1.cpp b/Tests/QtAutogen/automoc_rerun/test1.cpp
deleted file mode 100644
index 4316a91..0000000
--- a/Tests/QtAutogen/automoc_rerun/test1.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "test1.h"
-int main()
-{
- return 0;
-}
diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in1 b/Tests/QtAutogen/automoc_rerun/test1.h.in1
deleted file mode 100644
index fee2c09..0000000
--- a/Tests/QtAutogen/automoc_rerun/test1.h.in1
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <QObject>
-class test1 : public QObject
-{
- Q_OBJECT
- public slots:
- void onTst1() {}
- void onTst2() {}
-};
diff --git a/Tests/QtAutogen/automoc_rerun/test1.h.in2 b/Tests/QtAutogen/automoc_rerun/test1.h.in2
deleted file mode 100644
index 6531d10..0000000
--- a/Tests/QtAutogen/automoc_rerun/test1.h.in2
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <QObject>
-class test1 : public QObject
-{
- Q_OBJECT
- public slots:
- void onTst1() {}
-};
diff --git a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt b/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
deleted file mode 100644
index 7b51e11..0000000
--- a/Tests/QtAutogen/autorcc_depends/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-cmake_minimum_required(VERSION 3.7)
-project(autorcc_depends)
-
-set(CMAKE_AUTORCC ON)
-
-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()
-
-configure_file(res1.qrc.in res1.qrc @ONLY)
-configure_file(res1/input.txt.in res1/input.txt @ONLY)
-
-add_executable(test_res1
- test_res1.cpp
- ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
-)
-target_link_libraries(test_res1 ${QT_CORE_TARGET})
-add_custom_command(TARGET test_res1 POST_BUILD COMMAND
- ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:test_res1>" > info_file.txt)
diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt
new file mode 100644
index 0000000..8bd72eb
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 3.7)
+project(mocDepends)
+
+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})
+
+# -- Test 1 using generated header
+# This tests the dependency of AUTOMOC of mocDepends1 to the generated object.hpp
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/invalid.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
+ COMMAND ${CMAKE_COMMAND} -E sleep 3
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/object.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
+ )
+
+add_executable(mocDepends1 test1.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/object.hpp
+)
+target_link_libraries(mocDepends1 ${QT_CORE_TARGET})
+set_target_properties(mocDepends1 PROPERTIES AUTOMOC TRUE)
+
+# -- Test 2 using generated library
+# This tests the dependency of AUTOMOC of mocDepends2 to the
+# generated simpleLib.hpp which belongs to a linked library of mocDepends2
+add_custom_command(OUTPUT simpleLib.hpp simpleLib.cpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/invalid.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.hpp
+ COMMAND ${CMAKE_COMMAND} -E sleep 3
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/simpleLib.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.hpp
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/simpleLib.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/simpleLib.cpp
+ )
+add_library(SimpleLib STATIC simpleLib.hpp simpleLib.cpp)
+
+add_executable(mocDepends2 test2.cpp )
+target_link_libraries(mocDepends2 SimpleLib ${QT_CORE_TARGET})
+set_target_properties(mocDepends2 PROPERTIES AUTOMOC TRUE)
diff --git a/Tests/QtAutogen/mocDepends/invalid.hpp.in b/Tests/QtAutogen/mocDepends/invalid.hpp.in
new file mode 100644
index 0000000..854d9a1
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/invalid.hpp.in
@@ -0,0 +1 @@
+#ifndef
diff --git a/Tests/QtAutogen/mocDepends/object.hpp.in b/Tests/QtAutogen/mocDepends/object.hpp.in
new file mode 100644
index 0000000..f364f7c
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/object.hpp.in
@@ -0,0 +1,14 @@
+#ifndef OBJECT_HPP
+#define OBJECT_HPP
+
+#include <QObject>
+
+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..758f1f6
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/simpleLib.hpp.in
@@ -0,0 +1,11 @@
+#ifndef SIMPLE_LIB_H
+#define SIMPLE_LIB_H
+
+class SimpleLib
+{
+public:
+ SimpleLib();
+ ~SimpleLib();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocDepends/test1.cpp b/Tests/QtAutogen/mocDepends/test1.cpp
new file mode 100644
index 0000000..92c259c
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/test1.cpp
@@ -0,0 +1,9 @@
+
+#include "object.hpp"
+
+int main()
+{
+ Object obj;
+
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocDepends/test2.cpp b/Tests/QtAutogen/mocDepends/test2.cpp
new file mode 100644
index 0000000..155b19b
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/test2.cpp
@@ -0,0 +1,10 @@
+
+#include "test2.hpp"
+
+int main()
+{
+ SimpleLib obj;
+ LObject lobject;
+
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocDepends/test2.hpp b/Tests/QtAutogen/mocDepends/test2.hpp
new file mode 100644
index 0000000..0125f07
--- /dev/null
+++ b/Tests/QtAutogen/mocDepends/test2.hpp
@@ -0,0 +1,16 @@
+#ifndef TEST2_HPP
+#define TEST2_HPP
+
+#include "simpleLib.hpp"
+#include <QObject>
+
+// 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/mocInclude/ObjA.cpp b/Tests/QtAutogen/mocInclude/ObjA.cpp
new file mode 100644
index 0000000..1b0311d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjA.cpp
@@ -0,0 +1,24 @@
+#include "ObjA.hpp"
+
+class SubObjA : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjA() {}
+ ~SubObjA() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjA::aSlot()
+{
+}
+
+void ObjA::go()
+{
+ SubObjA subObj;
+}
+
+#include "ObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/ObjA.hpp b/Tests/QtAutogen/mocInclude/ObjA.hpp
new file mode 100644
index 0000000..281e90d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjA.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJA_HPP
+#define OBJA_HPP
+
+#include <QObject>
+
+class ObjA : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjB.cpp b/Tests/QtAutogen/mocInclude/ObjB.cpp
new file mode 100644
index 0000000..5ff315d
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjB.cpp
@@ -0,0 +1,25 @@
+#include "ObjB.hpp"
+
+class SubObjB : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjB() {}
+ ~SubObjB() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjB::aSlot()
+{
+}
+
+void ObjB::go()
+{
+ SubObjB subObj;
+}
+
+#include "ObjB.moc"
+#include "moc_ObjB.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjB.hpp b/Tests/QtAutogen/mocInclude/ObjB.hpp
new file mode 100644
index 0000000..94f3d49
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjB.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJB_HPP
+#define OBJB_HPP
+
+#include <QObject>
+
+class ObjB : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjC.cpp b/Tests/QtAutogen/mocInclude/ObjC.cpp
new file mode 100644
index 0000000..8ca34cb
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjC.cpp
@@ -0,0 +1,26 @@
+#include "ObjC.hpp"
+
+class SubObjC : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjC() {}
+ ~SubObjC() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjC::aSlot()
+{
+}
+
+void ObjC::go()
+{
+ SubObjC subObj;
+}
+
+#include "ObjC.moc"
+// Not the own header
+#include "moc_ObjD.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjC.hpp b/Tests/QtAutogen/mocInclude/ObjC.hpp
new file mode 100644
index 0000000..a8e98eb
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjC.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJC_HPP
+#define OBJC_HPP
+
+#include <QObject>
+
+class ObjC : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/ObjD.cpp b/Tests/QtAutogen/mocInclude/ObjD.cpp
new file mode 100644
index 0000000..c18aec1
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjD.cpp
@@ -0,0 +1,26 @@
+#include "ObjD.hpp"
+
+class SubObjD : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjD() {}
+ ~SubObjD() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjD::aSlot()
+{
+}
+
+void ObjD::go()
+{
+ SubObjD subObj;
+}
+
+#include "ObjD.moc"
+// Header in subdirectory
+#include "subA/moc_SubObjA.cpp"
diff --git a/Tests/QtAutogen/mocInclude/ObjD.hpp b/Tests/QtAutogen/mocInclude/ObjD.hpp
new file mode 100644
index 0000000..b6ee098
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/ObjD.hpp
@@ -0,0 +1,13 @@
+#ifndef OBJD_HPP
+#define OBJD_HPP
+
+#include <QObject>
+
+class ObjD : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
new file mode 100644
index 0000000..a05f6e3
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subA/SubObjA.cpp
@@ -0,0 +1,27 @@
+#include "SubObjA.hpp"
+
+namespace subA {
+
+class SubObjA : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjA() {}
+ ~SubObjA() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjA::aSlot()
+{
+}
+
+void ObjA::go()
+{
+ SubObjA subObj;
+}
+}
+
+#include "SubObjA.moc"
diff --git a/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp b/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
new file mode 100644
index 0000000..31a18b6
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subA/SubObjA.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJA_HPP
+#define SUBOBJA_HPP
+
+#include <QObject>
+
+namespace subA {
+
+class ObjA : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
new file mode 100644
index 0000000..1e77639
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subB/SubObjB.cpp
@@ -0,0 +1,27 @@
+#include "SubObjB.hpp"
+
+namespace subB {
+
+class SubObjB : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjB() {}
+ ~SubObjB() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjB::aSlot()
+{
+}
+
+void ObjB::go()
+{
+ SubObjB subObj;
+}
+}
+
+#include "SubObjB.moc"
diff --git a/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp b/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
new file mode 100644
index 0000000..3f29fa2
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subB/SubObjB.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJB_HPP
+#define SUBOBJB_HPP
+
+#include <QObject>
+
+namespace subB {
+
+class ObjB : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
new file mode 100644
index 0000000..c2d94ef
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subC/SubObjC.cpp
@@ -0,0 +1,27 @@
+#include "SubObjC.hpp"
+
+namespace subC {
+
+class SubObjC : public QObject
+{
+ Q_OBJECT
+
+public:
+ SubObjC() {}
+ ~SubObjC() {}
+
+ Q_SLOT
+ void aSlot();
+};
+
+void SubObjC::aSlot()
+{
+}
+
+void ObjC::go()
+{
+ SubObjC subObj;
+}
+}
+
+#include "SubObjC.moc"
diff --git a/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp b/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
new file mode 100644
index 0000000..dc251fd
--- /dev/null
+++ b/Tests/QtAutogen/mocInclude/subC/SubObjC.hpp
@@ -0,0 +1,16 @@
+#ifndef SUBOBJC_HPP
+#define SUBOBJC_HPP
+
+#include <QObject>
+
+namespace subC {
+
+class ObjC : public QObject
+{
+ Q_OBJECT
+ Q_SLOT
+ void go();
+};
+}
+
+#endif
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
new file mode 100644
index 0000000..6a0829d
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Test moc include patterns
+
+set(CMAKE_AUTOMOC_RELAXED_MODE TRUE)
+
+include_directories("../mocInclude")
+
+add_executable(mocIncludeRelaxed
+ ../mocInclude/ObjA.cpp
+ ../mocInclude/ObjB.cpp
+ ../mocInclude/ObjC.cpp
+ ../mocInclude/ObjD.cpp
+ ../mocInclude/subA/SubObjA.cpp
+ ../mocInclude/subB/SubObjB.cpp
+ ../mocInclude/subC/SubObjC.cpp
+ main.cpp
+)
+target_link_libraries(mocIncludeRelaxed ${QT_LIBRARIES})
+set_target_properties(mocIncludeRelaxed PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocIncludeRelaxed/main.cpp b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
new file mode 100644
index 0000000..142d59e
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeRelaxed/main.cpp
@@ -0,0 +1,14 @@
+#include "ObjA.hpp"
+#include "ObjB.hpp"
+#include "ObjC.hpp"
+
+int main(int argv, char** args)
+{
+ ObjA objA;
+ ObjB objB;
+ ObjC objC;
+ return 0;
+}
+
+// Header in global subdirectory
+#include "subB/moc_SubObjB.cpp"
diff --git a/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
new file mode 100644
index 0000000..22e93a8
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeStrict/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Test moc include patterns
+
+set(CMAKE_AUTOMOC_RELAXED_MODE FALSE)
+
+include_directories("../mocInclude")
+
+add_executable(mocIncludeStrict
+ ../mocInclude/ObjA.cpp
+ ../mocInclude/ObjB.cpp
+ ../mocInclude/ObjC.cpp
+ ../mocInclude/ObjD.cpp
+ ../mocInclude/subA/SubObjA.cpp
+ ../mocInclude/subB/SubObjB.cpp
+ ../mocInclude/subC/SubObjC.cpp
+ main.cpp
+)
+target_link_libraries(mocIncludeStrict ${QT_LIBRARIES})
+set_target_properties(mocIncludeStrict PROPERTIES AUTOMOC ON)
diff --git a/Tests/QtAutogen/mocIncludeStrict/main.cpp b/Tests/QtAutogen/mocIncludeStrict/main.cpp
new file mode 100644
index 0000000..142d59e
--- /dev/null
+++ b/Tests/QtAutogen/mocIncludeStrict/main.cpp
@@ -0,0 +1,14 @@
+#include "ObjA.hpp"
+#include "ObjB.hpp"
+#include "ObjC.hpp"
+
+int main(int argv, char** args)
+{
+ ObjA objA;
+ ObjB objB;
+ ObjC objC;
+ return 0;
+}
+
+// Header in global subdirectory
+#include "subB/moc_SubObjB.cpp"
diff --git a/Tests/QtAutogen/mocPlugin/CMakeLists.txt b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
new file mode 100644
index 0000000..4843c21
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/CMakeLists.txt
@@ -0,0 +1,32 @@
+cmake_minimum_required(VERSION 3.8)
+
+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/StyleD.json jsonFiles/sub/StyleD.json)
+configure_file(jsonIn/StyleC.json jsonFiles/StyleC_Custom.json)
+configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD_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/mocPlugin/StyleA.cpp b/Tests/QtAutogen/mocPlugin/StyleA.cpp
new file mode 100644
index 0000000..b5e8753
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+QStyle* StyleA::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleA.hpp b/Tests/QtAutogen/mocPlugin/StyleA.hpp
new file mode 100644
index 0000000..1b6154d
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEA_HPP
+#define STYLEA_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleA : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in 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/mocPlugin/StyleA.json b/Tests/QtAutogen/mocPlugin/StyleA.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleA_Custom.json b/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
new file mode 100644
index 0000000..cc33953
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleA_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "Starbuster" ] }
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.cpp b/Tests/QtAutogen/mocPlugin/StyleB.cpp
new file mode 100644
index 0000000..17d4400
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleB.cpp
@@ -0,0 +1,6 @@
+#include "StyleB.hpp"
+
+QStyle* StyleB::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleB.hpp b/Tests/QtAutogen/mocPlugin/StyleB.hpp
new file mode 100644
index 0000000..163c9b2
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleB.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEB_HPP
+#define STYLEB_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleB : public QStylePlugin
+{
+ Q_OBJECT
+ // Json file in 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/mocPlugin/StyleC.cpp b/Tests/QtAutogen/mocPlugin/StyleC.cpp
new file mode 100644
index 0000000..37e7564
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleC.cpp
@@ -0,0 +1,6 @@
+#include "StyleC.hpp"
+
+QStyle* StyleC::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleC.hpp b/Tests/QtAutogen/mocPlugin/StyleC.hpp
new file mode 100644
index 0000000..52a887a
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleC.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEC_HPP
+#define STYLEC_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+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/mocPlugin/StyleCommon.hpp b/Tests/QtAutogen/mocPlugin/StyleCommon.hpp
new file mode 100644
index 0000000..f1a7ec6
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleCommon.hpp
@@ -0,0 +1,7 @@
+#ifndef STYLECOMMON_HPP
+#define STYLECOMMON_HPP
+
+// Empty test macro definition
+#define A_CUSTOM_MACRO(name, jsonFile, pluginRegistrations)
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.cpp b/Tests/QtAutogen/mocPlugin/StyleD.cpp
new file mode 100644
index 0000000..7e4b121
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleD.cpp
@@ -0,0 +1,6 @@
+#include "StyleD.hpp"
+
+QStyle* StyleD::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleD.hpp b/Tests/QtAutogen/mocPlugin/StyleD.hpp
new file mode 100644
index 0000000..df8a439
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleD.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLED_HPP
+#define STYLED_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+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/mocPlugin/StyleE.cpp b/Tests/QtAutogen/mocPlugin/StyleE.cpp
new file mode 100644
index 0000000..8fc9a7f
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleE.cpp
@@ -0,0 +1,6 @@
+#include "StyleE.hpp"
+
+QStyle* StyleE::create(const QString& key)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocPlugin/StyleE.hpp b/Tests/QtAutogen/mocPlugin/StyleE.hpp
new file mode 100644
index 0000000..e7915a8
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/StyleE.hpp
@@ -0,0 +1,17 @@
+#ifndef STYLEE_HPP
+#define STYLEE_HPP
+
+#include "StyleCommon.hpp"
+#include <QStylePlugin>
+
+class StyleE : public QStylePlugin
+{
+ Q_OBJECT
+ // No Json file
+ Q_PLUGIN_METADATA(IID "org.styles.E")
+ A_CUSTOM_MACRO(SomeArg, InvalidFileArg, AnotherArg)
+public:
+ QStyle* create(const QString& key);
+};
+
+#endif
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
new file mode 100644
index 0000000..129cac4
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleB_Custom.json
@@ -0,0 +1 @@
+{ "Keys": [ "Rocket", "StarbusterB" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
new file mode 100644
index 0000000..119aaa4
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json
@@ -0,0 +1 @@
+{ "Keys": [ "Boat", "Ship" ] }
diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
new file mode 100644
index 0000000..732c547
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json
@@ -0,0 +1 @@
+{ "Keys": [ "Bike", "Car" ] }
diff --git a/Tests/QtAutogen/mocPlugin/main.cpp b/Tests/QtAutogen/mocPlugin/main.cpp
new file mode 100644
index 0000000..3ba2ddc
--- /dev/null
+++ b/Tests/QtAutogen/mocPlugin/main.cpp
@@ -0,0 +1,6 @@
+#include "StyleA.hpp"
+
+int main(int argv, char** args)
+{
+ return 0;
+}
diff --git a/Tests/QtAutogen/mocRerun/CMakeLists.txt b/Tests/QtAutogen/mocRerun/CMakeLists.txt
new file mode 100644
index 0000000..6689f50
--- /dev/null
+++ b/Tests/QtAutogen/mocRerun/CMakeLists.txt
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 3.7)
+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)
+
+configure_file(test1a.h.in test1.h COPYONLY)
+# Generated source file
+add_custom_command(OUTPUT main.cpp
+ COMMAND ${CMAKE_COMMAND} -E sleep 3
+ 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 "$<TARGET_FILE:mocRerun>" > target1.txt)
diff --git a/Tests/QtAutogen/automoc_rerun/input.txt b/Tests/QtAutogen/mocRerun/input.txt
index da62762..da62762 100644
--- a/Tests/QtAutogen/automoc_rerun/input.txt
+++ b/Tests/QtAutogen/mocRerun/input.txt
diff --git a/Tests/QtAutogen/mocRerun/main.cpp.in b/Tests/QtAutogen/mocRerun/main.cpp.in
new file mode 100644
index 0000000..b37ff61
--- /dev/null
+++ b/Tests/QtAutogen/mocRerun/main.cpp.in
@@ -0,0 +1,18 @@
+#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/QtAutogen/automoc_rerun/res1.qrc b/Tests/QtAutogen/mocRerun/res1.qrc
index fb804b5..fb804b5 100644
--- a/Tests/QtAutogen/automoc_rerun/res1.qrc
+++ b/Tests/QtAutogen/mocRerun/res1.qrc
diff --git a/Tests/QtAutogen/mocRerun/test1a.h.in b/Tests/QtAutogen/mocRerun/test1a.h.in
new file mode 100644
index 0000000..a335046
--- /dev/null
+++ b/Tests/QtAutogen/mocRerun/test1a.h.in
@@ -0,0 +1,8 @@
+#include <QObject>
+class Test1 : public QObject
+{
+ Q_OBJECT
+public slots:
+ void onTst1() {}
+ void onTst2() {}
+};
diff --git a/Tests/QtAutogen/mocRerun/test1b.h.in b/Tests/QtAutogen/mocRerun/test1b.h.in
new file mode 100644
index 0000000..6128eeb
--- /dev/null
+++ b/Tests/QtAutogen/mocRerun/test1b.h.in
@@ -0,0 +1,7 @@
+#include <QObject>
+class Test1 : public QObject
+{
+ Q_OBJECT
+public slots:
+ void onTst1() {}
+};
diff --git a/Tests/QtAutogen/rccDepends/CMakeLists.txt b/Tests/QtAutogen/rccDepends/CMakeLists.txt
new file mode 100644
index 0000000..de98573
--- /dev/null
+++ b/Tests/QtAutogen/rccDepends/CMakeLists.txt
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 3.7)
+project(rccDepends)
+
+set(CMAKE_AUTORCC ON)
+
+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()
+
+configure_file(res/input1.txt.in res1/input.txt @ONLY)
+configure_file(res/input2.txt.in res2/input.txt @ONLY)
+# Configure time generated qrc file
+configure_file(res1.qrc.in res1.qrc @ONLY)
+# Dependency generated qrc file
+add_custom_command(OUTPUT res2.qrc
+ COMMAND ${CMAKE_COMMAND} -E sleep 3
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/res2.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
+ )
+
+
+add_executable(rccDepends
+ main.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/res1.qrc
+ ${CMAKE_CURRENT_BINARY_DIR}/res2.qrc
+)
+target_link_libraries(rccDepends ${QT_CORE_TARGET})
+add_custom_command(TARGET rccDepends POST_BUILD COMMAND
+ ${CMAKE_COMMAND} -E echo "$<TARGET_FILE:rccDepends>" > target1.txt)
diff --git a/Tests/QtAutogen/autorcc_depends/test_res1.cpp b/Tests/QtAutogen/rccDepends/main.cpp
index 766b775..766b775 100644
--- a/Tests/QtAutogen/autorcc_depends/test_res1.cpp
+++ b/Tests/QtAutogen/rccDepends/main.cpp
diff --git a/Tests/QtAutogen/autorcc_depends/res1/input.txt.in b/Tests/QtAutogen/rccDepends/res/input1.txt.in
index da62762..da62762 100644
--- a/Tests/QtAutogen/autorcc_depends/res1/input.txt.in
+++ b/Tests/QtAutogen/rccDepends/res/input1.txt.in
diff --git a/Tests/QtAutogen/rccDepends/res/input2.txt.in b/Tests/QtAutogen/rccDepends/res/input2.txt.in
new file mode 100644
index 0000000..08e14b7
--- /dev/null
+++ b/Tests/QtAutogen/rccDepends/res/input2.txt.in
@@ -0,0 +1 @@
+Res2 input.
diff --git a/Tests/QtAutogen/autorcc_depends/res1.qrc.in b/Tests/QtAutogen/rccDepends/res1.qrc.in
index 2a5417b..2a5417b 100644
--- a/Tests/QtAutogen/autorcc_depends/res1.qrc.in
+++ b/Tests/QtAutogen/rccDepends/res1.qrc.in
diff --git a/Tests/QtAutogen/rccDepends/res2.qrc.in b/Tests/QtAutogen/rccDepends/res2.qrc.in
new file mode 100644
index 0000000..18b916a
--- /dev/null
+++ b/Tests/QtAutogen/rccDepends/res2.qrc.in
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>res2/input.txt</file>
+ </qresource>
+</RCC>
diff --git a/Tests/QtAutogen/sameName/CMakeLists.txt b/Tests/QtAutogen/sameName/CMakeLists.txt
index 9e47a3e..4d2dcd9 100644
--- a/Tests/QtAutogen/sameName/CMakeLists.txt
+++ b/Tests/QtAutogen/sameName/CMakeLists.txt
@@ -18,3 +18,14 @@ add_executable(sameName
)
target_link_libraries(sameName ${QT_LIBRARIES})
set_target_properties(sameName PROPERTIES AUTOMOC 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/uicInclude/CMakeLists.txt b/Tests/QtAutogen/uicInclude/CMakeLists.txt
new file mode 100644
index 0000000..f62ebb0
--- /dev/null
+++ b/Tests/QtAutogen/uicInclude/CMakeLists.txt
@@ -0,0 +1,8 @@
+# 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
new file mode 100644
index 0000000..bb2fb5e
--- /dev/null
+++ b/Tests/QtAutogen/uicInclude/PageC.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PageC</class>
+ <widget class="QWidget" name="PageC">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PageA</class>
+ <widget class="QWidget" name="PageA">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui b/Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui
new file mode 100644
index 0000000..fa6dfa6
--- /dev/null
+++ b/Tests/QtAutogen/uicInclude/dirB/sub/PageB.ui
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PageB</class>
+ <widget class="QWidget" name="PageB">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/QtAutogen/uicInclude/main.cpp b/Tests/QtAutogen/uicInclude/main.cpp
new file mode 100644
index 0000000..4ca66a7
--- /dev/null
+++ b/Tests/QtAutogen/uicInclude/main.cpp
@@ -0,0 +1,10 @@
+
+#include "main.hpp"
+
+int main(int argv, char** args)
+{
+ return 0;
+}
+
+#include "sub/ui_PageB.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