diff options
Diffstat (limited to 'Tests')
36 files changed, 575 insertions, 13 deletions
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 4b90ad8..260331b 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,13 +80,14 @@ 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_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + "-DQT_TEST_VERSION=${QT_TEST_VERSION}" "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" OUTPUT_VARIABLE output ) @@ -115,13 +116,14 @@ if (NOT file1_step1 GREATER file1_before) message(SEND_ERROR "file1 (${qrc_file1}) should have changed in the first 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_FLAGS "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + "-DQT_TEST_VERSION=${QT_TEST_VERSION}" "-DCMAKE_PREFIX_PATH=${Qt_PREFIX_DIR}" OUTPUT_VARIABLE output ) @@ -139,7 +141,7 @@ if (automoc_rerun_result) message(SEND_ERROR "Second build of automoc_rerun failed.") 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 +163,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 +183,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 +204,73 @@ 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 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(mocPluginBinDir "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin") + find_library(style_a_file "PluginStyleA" "${mocPluginBinDir}") + find_library(style_b_file "PluginStyleB" "${mocPluginBinDir}") + find_library(style_c_file "PluginStyleC" "${mocPluginBinDir}") + find_library(style_d_file "PluginStyleD" "${mocPluginBinDir}") + + file(TIMESTAMP "${style_a_file}" style_a_before "${timeformat}") + file(TIMESTAMP "${style_b_file}" style_b_before "${timeformat}") + file(TIMESTAMP "${style_c_file}" style_c_before "${timeformat}") + file(TIMESTAMP "${style_d_file}" style_d_before "${timeformat}") + + # Ensure that the timestamp will change and touch the json files + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) + execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/StyleC.json") + execute_process(COMMAND "${CMAKE_COMMAND}" -E touch "${mocPluginBinDir}/jsonFiles/sub/StyleD.json") + + execute_process(COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mocPlugin" + ) + + file(TIMESTAMP "${style_a_file}" style_a_after "${timeformat}") + file(TIMESTAMP "${style_b_file}" style_b_after "${timeformat}") + file(TIMESTAMP "${style_c_file}" style_c_after "${timeformat}") + file(TIMESTAMP "${style_d_file}" style_d_after "${timeformat}") + + if (style_a_after GREATER style_a_before) + message(SEND_ERROR "file (${style_a_file}) should not have changed!") + endif() + if (style_b_after GREATER style_b_before) + message(SEND_ERROR "file (${style_b_file}) should not have changed!") + endif() + if (NOT style_c_after GREATER style_c_before) + message(SEND_ERROR "file (${style_c_file}) should have changed!") + endif() + if (NOT style_d_after GREATER style_d_before) + message(SEND_ERROR "file (${style_d_file}) should have changed!") + endif() +endif() + +# -- Test # Complex test case add_subdirectory(complex) 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..eed7d39 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.8) + +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 @ONLY) +configure_file(jsonIn/StyleD.json jsonFiles/sub/StyleD.json @ONLY) + +# Enable automoc +set(CMAKE_AUTOMOC TRUE) + +include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles") +link_libraries(Qt5::Widgets) + +add_library(PluginStyleA MODULE StyleA.cpp) +add_library(PluginStyleB MODULE StyleB.cpp) +add_library(PluginStyleC MODULE StyleC.cpp) +add_library(PluginStyleD MODULE StyleD.cpp) +add_library(PluginStyleE MODULE 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..b105b02 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/StyleA.hpp @@ -0,0 +1,15 @@ +#ifndef STYLEA_HPP +#define STYLEA_HPP + +#include <QStylePlugin> + +class StyleA : public QStylePlugin +{ + Q_OBJECT + // Json file in local directory + Q_PLUGIN_METADATA(IID "org.styles.A" FILE "StyleA.json") +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/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..ba89127 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/StyleB.hpp @@ -0,0 +1,15 @@ +#ifndef STYLEB_HPP +#define STYLEB_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") +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..9f71d75 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/StyleC.hpp @@ -0,0 +1,15 @@ +#ifndef STYLEC_HPP +#define STYLEC_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") +public: + QStyle* create(const QString& key); +}; + +#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..e58444d --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/StyleD.hpp @@ -0,0 +1,15 @@ +#ifndef STYLED_HPP +#define STYLED_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") +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..80e0b79 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/StyleE.hpp @@ -0,0 +1,15 @@ +#ifndef STYLEE_HPP +#define STYLEE_HPP + +#include <QStylePlugin> + +class StyleE : public QStylePlugin +{ + Q_OBJECT + // No Json file + Q_PLUGIN_METADATA(IID "org.styles.E") +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/StyleC.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json new file mode 100644 index 0000000..bf17580 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleC.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "StarbusterC" ] } diff --git a/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json new file mode 100644 index 0000000..f7fcc19 --- /dev/null +++ b/Tests/QtAutogen/mocPlugin/jsonIn/StyleD.json @@ -0,0 +1 @@ +{ "Keys": [ "Rocket", "StarbusterD" ] } 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/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" ) |