From 2ed89a511a84c595eb24af625bc0bd88f5a3ce21 Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Tue, 28 Jan 2020 13:05:03 +0300 Subject: configure updated Signed-off-by: Slava Barinov --- Tests/QtAutogen/AutogenCoreTest.cmake | 55 +++ Tests/QtAutogen/AutogenGuiTest.cmake | 55 +++ .../AutogenOriginDependsOff/CMakeLists.txt | 71 ++++ .../QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in | 9 + Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp | 28 ++ Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp | 25 ++ .../QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in | 9 + Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp | 9 + Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp | 28 ++ Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp | 25 ++ .../AutogenOriginDependsOff/config.hpp.in | 8 + .../configure_content.cmake | 10 + Tests/QtAutogen/AutogenOriginDependsOff/main.cpp | 15 + .../AutogenOriginDependsOn/CMakeLists.txt | 91 +++++ .../AutogenOriginDependsOn/object_invalid.hpp.in | 1 + .../AutogenOriginDependsOn/object_valid.hpp.in | 14 + .../AutogenOriginDependsOn/simpleLib.cpp.in | 9 + .../AutogenOriginDependsOn/simpleLib.hpp.in | 14 + .../AutogenOriginDependsOn/testGenFile.cpp | 8 + .../AutogenOriginDependsOn/testGenLib.cpp | 12 + .../AutogenOriginDependsOn/testGenLib.hpp | 16 + .../AutogenOriginDependsOn/testGenTarget.cpp | 9 + .../QtAutogen/AutogenTargetDepends/CMakeLists.txt | 54 +++ .../AutogenTargetDepends/object_invalid.hpp.in | 1 + .../AutogenTargetDepends/object_valid.hpp.in | 14 + .../QtAutogen/AutogenTargetDepends/testATDFile.cpp | 9 + .../AutogenTargetDepends/testATDTarget.cpp | 9 + 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 | 85 ++++ 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 | 21 + 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/DefinesTest/CMakeLists.txt | 13 + Tests/QtAutogen/DefinesTest/defines_test.cpp | 38 ++ Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt | 126 ++++++ .../GlobalAutogenTarget/GAT/CMakeLists.txt | 28 ++ Tests/QtAutogen/GlobalAutogenTarget/GAT/data.qrc | 5 + Tests/QtAutogen/GlobalAutogenTarget/GAT/item.cpp | 20 + Tests/QtAutogen/GlobalAutogenTarget/GAT/item.hpp | 15 + Tests/QtAutogen/GlobalAutogenTarget/GAT/main.cpp | 15 + .../GlobalAutogenTarget/GAT/sda/CMakeLists.txt | 2 + .../QtAutogen/GlobalAutogenTarget/GAT/sda/sda.cpp | 6 + .../QtAutogen/GlobalAutogenTarget/GAT/sda/sda.hpp | 6 + .../GlobalAutogenTarget/GAT/sdb/CMakeLists.txt | 5 + .../QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.cpp | 6 + .../QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.hpp | 6 + .../GlobalAutogenTarget/GAT/sdc/CMakeLists.txt | 5 + .../QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.cpp | 6 + .../QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.hpp | 6 + Tests/QtAutogen/GlobalAutogenTarget/GAT/view.ui | 24 ++ Tests/QtAutogen/LowMinimumVersion/CMakeLists.txt | 16 + Tests/QtAutogen/LowMinimumVersion/example.qrc | 5 + Tests/QtAutogen/LowMinimumVersion/item.cpp | 19 + Tests/QtAutogen/LowMinimumVersion/item.hpp | 15 + Tests/QtAutogen/LowMinimumVersion/main.cpp | 10 + Tests/QtAutogen/LowMinimumVersion/someText.txt | 1 + Tests/QtAutogen/LowMinimumVersion/view.ui | 24 ++ 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/ManySources/CMakeLists.txt | 35 ++ Tests/QtAutogen/ManySources/data.qrc.in | 7 + Tests/QtAutogen/ManySources/item.cpp.in | 27 ++ Tests/QtAutogen/ManySources/item.h.in | 15 + Tests/QtAutogen/ManySources/main.cpp.in | 7 + Tests/QtAutogen/ManySources/object.h.in | 15 + Tests/QtAutogen/ManySources/view.ui.in | 24 ++ 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/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 | 14 + Tests/QtAutogen/MocInclude/EObjA_p.hpp | 14 + Tests/QtAutogen/MocInclude/EObjB.cpp | 45 +++ Tests/QtAutogen/MocInclude/EObjB.hpp | 19 + Tests/QtAutogen/MocInclude/EObjB_p.hpp | 14 + Tests/QtAutogen/MocInclude/LObjA.cpp | 39 ++ Tests/QtAutogen/MocInclude/LObjA.hpp | 19 + Tests/QtAutogen/MocInclude/LObjA_p.h | 14 + Tests/QtAutogen/MocInclude/LObjB.cpp | 40 ++ Tests/QtAutogen/MocInclude/LObjB.hpp | 19 + Tests/QtAutogen/MocInclude/LObjB_p.h | 14 + Tests/QtAutogen/MocInclude/ObjA.cpp | 20 + Tests/QtAutogen/MocInclude/ObjA.hpp | 19 + Tests/QtAutogen/MocInclude/ObjA_p.h | 14 + Tests/QtAutogen/MocInclude/ObjB.cpp | 22 ++ Tests/QtAutogen/MocInclude/ObjB.hpp | 19 + Tests/QtAutogen/MocInclude/ObjB_p.h | 14 + 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 | 14 + Tests/QtAutogen/MocInclude/subGlobal/GObj.cpp | 41 ++ Tests/QtAutogen/MocInclude/subGlobal/GObj.hpp | 17 + Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp | 17 + 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/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/MocOnly/CMakeLists.txt | 17 + Tests/QtAutogen/MocOnly/IncA.cpp | 19 + Tests/QtAutogen/MocOnly/IncA.hpp | 15 + Tests/QtAutogen/MocOnly/IncB.cpp | 19 + Tests/QtAutogen/MocOnly/IncB.hpp | 15 + Tests/QtAutogen/MocOnly/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 | 18 + 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/MocOsMacros/CMakeLists.txt | 32 ++ Tests/QtAutogen/MocOsMacros/TestClass.cpp | 82 ++++ Tests/QtAutogen/MocOsMacros/TestClass.hpp | 57 +++ Tests/QtAutogen/MocOsMacros/main.cpp | 32 ++ 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/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/Parallel/CMakeLists.txt | 10 + Tests/QtAutogen/Parallel/aaa/bbb/data.qrc | 6 + Tests/QtAutogen/Parallel/aaa/bbb/item.cpp | 22 ++ Tests/QtAutogen/Parallel/aaa/bbb/item.hpp | 18 + Tests/QtAutogen/Parallel/aaa/data.qrc | 6 + Tests/QtAutogen/Parallel/aaa/item.cpp | 22 ++ Tests/QtAutogen/Parallel/aaa/item.hpp | 18 + Tests/QtAutogen/Parallel/aaa/view.ui | 24 ++ Tests/QtAutogen/Parallel/bbb/aaa/data.qrc | 6 + Tests/QtAutogen/Parallel/bbb/aaa/item.cpp | 22 ++ Tests/QtAutogen/Parallel/bbb/aaa/item.hpp | 18 + Tests/QtAutogen/Parallel/bbb/data.qrc | 6 + Tests/QtAutogen/Parallel/bbb/item.cpp | 23 ++ Tests/QtAutogen/Parallel/bbb/item.hpp | 17 + Tests/QtAutogen/Parallel/bbb/view.ui | 24 ++ Tests/QtAutogen/Parallel/ccc/data.qrc | 6 + Tests/QtAutogen/Parallel/ccc/item.cpp | 25 ++ Tests/QtAutogen/Parallel/ccc/item.hpp | 18 + Tests/QtAutogen/Parallel/ccc/view.ui | 24 ++ Tests/QtAutogen/Parallel/data.qrc | 5 + Tests/QtAutogen/Parallel/item.cpp | 20 + Tests/QtAutogen/Parallel/item.hpp | 15 + Tests/QtAutogen/Parallel/main.cpp | 16 + Tests/QtAutogen/Parallel/parallel.cmake | 24 ++ Tests/QtAutogen/Parallel/view.ui | 24 ++ Tests/QtAutogen/Parallel1/CMakeLists.txt | 10 + Tests/QtAutogen/Parallel2/CMakeLists.txt | 10 + Tests/QtAutogen/Parallel3/CMakeLists.txt | 10 + Tests/QtAutogen/Parallel4/CMakeLists.txt | 10 + Tests/QtAutogen/ParallelAUTO/CMakeLists.txt | 10 + Tests/QtAutogen/RccEmpty/CMakeLists.txt | 8 + Tests/QtAutogen/RccEmpty/rccEmpty.cpp | 9 + Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc | 4 + Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt | 17 + Tests/QtAutogen/RccOffMocLibrary/empty.cpp | 1 + Tests/QtAutogen/RccOffMocLibrary/empty.h | 9 + .../RccOffMocLibrary/not_generated_file.qrc | 5 + Tests/QtAutogen/RccOnly/CMakeLists.txt | 8 + Tests/QtAutogen/RccOnly/rccOnly.cpp | 9 + Tests/QtAutogen/RccOnly/rccOnlyRes.qrc | 5 + 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/RerunMocBasic/CMakeLists.txt | 102 +++++ .../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/QtAutogen/RerunMocPlugin/CMakeLists.txt | 134 +++++++ .../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 + .../QtAutogen/RerunRccConfigChange/CMakeLists.txt | 47 +++ .../RccConfigChange/CMakeLists.txt | 26 ++ .../RerunRccConfigChange/RccConfigChange/main.cpp | 5 + .../RccConfigChange/resGen.qrc.in | 6 + .../RccConfigChange/resGen/input1.txt.in | 1 + .../RccConfigChange/resGen/input2.txt.in | 1 + .../RccConfigChange/resPlain.qrc | 6 + .../RccConfigChange/resPlain/input1.txt | 1 + .../RccConfigChange/resPlain/input2.txt | 1 + Tests/QtAutogen/RerunRccConfigChange/dummy.cpp | 5 + Tests/QtAutogen/RerunRccDepends/CMakeLists.txt | 153 ++++++++ .../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/QtAutogen/SameName/CMakeLists.txt | 43 ++ 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 | 27 ++ Tests/QtAutogen/SameName/object.h | 13 + Tests/QtAutogen/SameName/object.h++ | 13 + Tests/QtAutogen/SameName/object.hpp | 13 + Tests/QtAutogen/SameName/object.hxx | 13 + Tests/QtAutogen/SameName/view.ui | 24 ++ 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/TestMacros.cmake | 61 +++ Tests/QtAutogen/Tests.cmake | 48 +++ 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/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 ++ Tests/QtAutogen/UicNoGui/CMakeLists.txt | 16 + Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt | 3 + Tests/QtAutogen/UicNoGui/MocOnly/main.cpp | 15 + Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt | 2 + Tests/QtAutogen/UicNoGui/NoQt/main.cpp | 4 + Tests/QtAutogen/UicNoGui/main.cpp | 9 + Tests/QtAutogen/UicOnly/CMakeLists.txt | 8 + Tests/QtAutogen/UicOnly/UicOnly.cpp | 18 + Tests/QtAutogen/UicOnly/UicOnly.hpp | 15 + Tests/QtAutogen/UicOnly/main.cpp | 7 + Tests/QtAutogen/UicOnly/uiA.ui | 24 ++ Tests/QtAutogen/UicOnly/uiB.ui | 24 ++ Tests/QtAutogen/UicOnly/uiC.ui | 24 ++ Tests/QtAutogen/UicOnly/uiD.ui | 24 ++ 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 ++ 405 files changed, 8037 insertions(+) create mode 100644 Tests/QtAutogen/AutogenCoreTest.cmake create mode 100644 Tests/QtAutogen/AutogenGuiTest.cmake create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake create mode 100644 Tests/QtAutogen/AutogenOriginDependsOff/main.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp create mode 100644 Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp create mode 100644 Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp 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 create mode 100644 Tests/QtAutogen/DefinesTest/CMakeLists.txt create mode 100644 Tests/QtAutogen/DefinesTest/defines_test.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/data.qrc create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/item.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/item.hpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/main.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/CMakeLists.txt create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.hpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/CMakeLists.txt create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.hpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/CMakeLists.txt create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.cpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.hpp create mode 100644 Tests/QtAutogen/GlobalAutogenTarget/GAT/view.ui create mode 100644 Tests/QtAutogen/LowMinimumVersion/CMakeLists.txt create mode 100644 Tests/QtAutogen/LowMinimumVersion/example.qrc create mode 100644 Tests/QtAutogen/LowMinimumVersion/item.cpp create mode 100644 Tests/QtAutogen/LowMinimumVersion/item.hpp create mode 100644 Tests/QtAutogen/LowMinimumVersion/main.cpp create mode 100644 Tests/QtAutogen/LowMinimumVersion/someText.txt create mode 100644 Tests/QtAutogen/LowMinimumVersion/view.ui 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 create mode 100644 Tests/QtAutogen/ManySources/CMakeLists.txt create mode 100644 Tests/QtAutogen/ManySources/data.qrc.in create mode 100644 Tests/QtAutogen/ManySources/item.cpp.in create mode 100644 Tests/QtAutogen/ManySources/item.h.in create mode 100644 Tests/QtAutogen/ManySources/main.cpp.in create mode 100644 Tests/QtAutogen/ManySources/object.h.in create mode 100644 Tests/QtAutogen/ManySources/view.ui.in 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 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 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 create mode 100644 Tests/QtAutogen/MocOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocOnly/IncA.cpp create mode 100644 Tests/QtAutogen/MocOnly/IncA.hpp create mode 100644 Tests/QtAutogen/MocOnly/IncB.cpp create mode 100644 Tests/QtAutogen/MocOnly/IncB.hpp 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 create mode 100644 Tests/QtAutogen/MocOsMacros/CMakeLists.txt create mode 100644 Tests/QtAutogen/MocOsMacros/TestClass.cpp create mode 100644 Tests/QtAutogen/MocOsMacros/TestClass.hpp create mode 100644 Tests/QtAutogen/MocOsMacros/main.cpp 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 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 create mode 100644 Tests/QtAutogen/Parallel/CMakeLists.txt create mode 100644 Tests/QtAutogen/Parallel/aaa/bbb/data.qrc create mode 100644 Tests/QtAutogen/Parallel/aaa/bbb/item.cpp create mode 100644 Tests/QtAutogen/Parallel/aaa/bbb/item.hpp create mode 100644 Tests/QtAutogen/Parallel/aaa/data.qrc create mode 100644 Tests/QtAutogen/Parallel/aaa/item.cpp create mode 100644 Tests/QtAutogen/Parallel/aaa/item.hpp create mode 100644 Tests/QtAutogen/Parallel/aaa/view.ui create mode 100644 Tests/QtAutogen/Parallel/bbb/aaa/data.qrc create mode 100644 Tests/QtAutogen/Parallel/bbb/aaa/item.cpp create mode 100644 Tests/QtAutogen/Parallel/bbb/aaa/item.hpp create mode 100644 Tests/QtAutogen/Parallel/bbb/data.qrc create mode 100644 Tests/QtAutogen/Parallel/bbb/item.cpp create mode 100644 Tests/QtAutogen/Parallel/bbb/item.hpp create mode 100644 Tests/QtAutogen/Parallel/bbb/view.ui create mode 100644 Tests/QtAutogen/Parallel/ccc/data.qrc create mode 100644 Tests/QtAutogen/Parallel/ccc/item.cpp create mode 100644 Tests/QtAutogen/Parallel/ccc/item.hpp create mode 100644 Tests/QtAutogen/Parallel/ccc/view.ui create mode 100644 Tests/QtAutogen/Parallel/data.qrc create mode 100644 Tests/QtAutogen/Parallel/item.cpp create mode 100644 Tests/QtAutogen/Parallel/item.hpp create mode 100644 Tests/QtAutogen/Parallel/main.cpp create mode 100644 Tests/QtAutogen/Parallel/parallel.cmake create mode 100644 Tests/QtAutogen/Parallel/view.ui create mode 100644 Tests/QtAutogen/Parallel1/CMakeLists.txt create mode 100644 Tests/QtAutogen/Parallel2/CMakeLists.txt create mode 100644 Tests/QtAutogen/Parallel3/CMakeLists.txt create mode 100644 Tests/QtAutogen/Parallel4/CMakeLists.txt create mode 100644 Tests/QtAutogen/ParallelAUTO/CMakeLists.txt 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/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 create mode 100644 Tests/QtAutogen/RccOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/RccOnly/rccOnly.cpp create mode 100644 Tests/QtAutogen/RccOnly/rccOnlyRes.qrc 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 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 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 create mode 100644 Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt create mode 100644 Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt create mode 100644 Tests/QtAutogen/RerunRccConfigChange/dummy.cpp 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 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/object.h create mode 100644 Tests/QtAutogen/SameName/object.h++ create mode 100644 Tests/QtAutogen/SameName/object.hpp create mode 100644 Tests/QtAutogen/SameName/object.hxx create mode 100644 Tests/QtAutogen/SameName/view.ui 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 create mode 100644 Tests/QtAutogen/TestMacros.cmake create mode 100644 Tests/QtAutogen/Tests.cmake 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 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 create mode 100644 Tests/QtAutogen/UicNoGui/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/MocOnly/main.cpp create mode 100644 Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicNoGui/NoQt/main.cpp create mode 100644 Tests/QtAutogen/UicNoGui/main.cpp create mode 100644 Tests/QtAutogen/UicOnly/CMakeLists.txt create mode 100644 Tests/QtAutogen/UicOnly/UicOnly.cpp create mode 100644 Tests/QtAutogen/UicOnly/UicOnly.hpp create mode 100644 Tests/QtAutogen/UicOnly/main.cpp create mode 100644 Tests/QtAutogen/UicOnly/uiA.ui create mode 100644 Tests/QtAutogen/UicOnly/uiB.ui create mode 100644 Tests/QtAutogen/UicOnly/uiC.ui create mode 100644 Tests/QtAutogen/UicOnly/uiD.ui 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 (limited to 'Tests/QtAutogen') diff --git a/Tests/QtAutogen/AutogenCoreTest.cmake b/Tests/QtAutogen/AutogenCoreTest.cmake new file mode 100644 index 000000000..580385928 --- /dev/null +++ b/Tests/QtAutogen/AutogenCoreTest.cmake @@ -0,0 +1,55 @@ + +# 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 EQUAL 4) + + find_package(Qt4 REQUIRED QtCore) + include(UseQt4) + + set(QT_QTCORE_TARGET Qt4::QtCore) + + # Qt macros + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + macro(qtx_generate_moc) + qt4_generate_moc(${ARGN}) + endmacro() + +elseif(QT_TEST_VERSION EQUAL 5) + + find_package(Qt5Core REQUIRED) + + set(QT_QTCORE_TARGET Qt5::Core) + set(QT_LIBRARIES Qt5::Core) + + # Include directories + include_directories(${Qt5Core_INCLUDE_DIRS}) + + # Definitions + 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/AutogenGuiTest.cmake b/Tests/QtAutogen/AutogenGuiTest.cmake new file mode 100644 index 000000000..b76d341a4 --- /dev/null +++ b/Tests/QtAutogen/AutogenGuiTest.cmake @@ -0,0 +1,55 @@ + +# 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 EQUAL 4) + + find_package(Qt4 REQUIRED) + include(UseQt4) + + set(QT_QTCORE_TARGET Qt4::QtCore) + + # Qt macros + macro(qtx_wrap_cpp) + qt4_wrap_cpp(${ARGN}) + endmacro() + macro(qtx_generate_moc) + qt4_generate_moc(${ARGN}) + endmacro() + +elseif(QT_TEST_VERSION EQUAL 5) + + find_package(Qt5Widgets REQUIRED) + + set(QT_QTCORE_TARGET Qt5::Core) + set(QT_LIBRARIES Qt5::Widgets) + + # Include directories + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + + # Definitions + 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/AutogenOriginDependsOff/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt new file mode 100644 index 000000000..9e6fe8b34 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required(VERSION 3.11) +project(AutogenOriginDependsOff) +include("../AutogenCoreTest.cmake") + +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CSD}) +include_directories(${CBD}) + +# A GENERATED file ensures there will be an _autogen target in VS +add_custom_command ( + OUTPUT "${CBD}/config.hpp" + COMMAND ${CMAKE_COMMAND} -E copy "${CSD}/config.hpp.in" "${CBD}/config.hpp" + ) + + +# Library "a_mc" provides a header that holds a string with the content of +# mocs_compilation.cpp from a_qt. It therefore must depend on a_qt_autogen. +add_custom_target ( a_mc + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} + "-DMCF=${CBD}/a_qt_autogen/mocs_compilation.cpp" + "-DCF_IN=${CSD}/a_mc.hpp.in" + "-DCF_OUT=${CBD}/a_mc.hpp" + -P ${CSD}/configure_content.cmake + ) +add_dependencies ( a_mc a_qt_autogen ) + +# Library "a_qt" +# - depends on a GENERATED file +# - AUTOMOC enabled +# - depends on a target (a_mc) that depends on a_qt_qutogen +add_library ( a_qt a_qt.cpp "${CBD}/config.hpp" ) +add_dependencies ( a_qt a_mc ) +target_link_libraries ( a_qt ${QT_QTCORE_TARGET}) +set_target_properties ( a_qt PROPERTIES AUTOMOC TRUE) +# Disable AUTOGEN_ORIGIN_DEPENDS to avoid loop dependencies +set_target_properties ( a_qt PROPERTIES AUTOGEN_ORIGIN_DEPENDS OFF) + + +# Library "b_mc" provides a header that holds a string function that returns +# the content of mocs_compilation.cpp from b_qt. +# It therefore must depend on b_qt_autogen. +add_custom_command ( + OUTPUT ${CBD}/b_mc.cpp + DEPENDS b_qt_autogen + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} + "-DMCF=${CBD}/b_qt_autogen/mocs_compilation.cpp" + "-DCF_IN=${CSD}/b_mc.cpp.in" + "-DCF_OUT=${CBD}/b_mc.cpp" + -P ${CSD}/configure_content.cmake + ) +add_library ( b_mc ${CSD}/b_mc.hpp ${CBD}/b_mc.cpp ) + +# Library "b_qt" +# - depends on a GENERATED file +# - AUTOMOC enabled +# - depends on a library (b_mc) that depends on b_qt_qutogen +add_library ( b_qt b_qt.cpp "${CBD}/config.hpp" ) +target_link_libraries ( b_qt b_mc ) +target_link_libraries ( b_qt ${QT_QTCORE_TARGET}) +set_target_properties ( b_qt PROPERTIES AUTOMOC TRUE) +# Disable AUTOGEN_ORIGIN_DEPENDS to avoid loop dependencies +set_target_properties ( b_qt PROPERTIES AUTOGEN_ORIGIN_DEPENDS OFF) + + +# The main target depends on both libraries which depend on the _autogen +# target of the main target. +add_executable ( autogenOriginDependsOff main.cpp ) +target_link_libraries ( autogenOriginDependsOff a_qt b_qt ) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in new file mode 100644 index 000000000..fe71f673d --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_mc.hpp.in @@ -0,0 +1,9 @@ +#ifndef A_MC_HPP +#define A_MC_HPP + +namespace a_mc { + +char const* mocs_compilation = "@MOCS_COMPILATION@"; +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp new file mode 100644 index 000000000..e498969e9 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.cpp @@ -0,0 +1,28 @@ + +#include "a_qt.hpp" +#include + +namespace a_qt { + +/// @brief A source local QObject based class +class Source_QObject : public QObject +{ + Q_OBJECT +public: + Source_QObject() {} + ~Source_QObject() {} + + std::string str; +}; + +std::string mocs_compilation() +{ + // Create and destroy QObject based classes + Header_QObject header_obj; + Source_QObject source_obj; + + return std::string(a_mc::mocs_compilation); +} +} + +#include "a_qt.moc" diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp new file mode 100644 index 000000000..e2387ee11 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/a_qt.hpp @@ -0,0 +1,25 @@ +#ifndef A_QT_HPP +#define A_QT_HPP + +#include +#include +#include + +namespace a_qt { + +/// @brief A header local QObject based class +class Header_QObject : public QObject +{ + Q_OBJECT +public: + Header_QObject() {} + ~Header_QObject() {} + + std::string str; +}; + +/// @brief Function that returns the content of mocs_compilation.cpp +extern std::string mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in new file mode 100644 index 000000000..0f5ec308c --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.cpp.in @@ -0,0 +1,9 @@ +#include + +namespace b_mc { + +char const* mocs_compilation() +{ + return "@MOCS_COMPILATION@"; +} +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp new file mode 100644 index 000000000..043727359 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_mc.hpp @@ -0,0 +1,9 @@ +#ifndef B_MC_HPP +#define B_MC_HPP + +namespace b_mc { + +extern char const* mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp new file mode 100644 index 000000000..f72f6ca9f --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.cpp @@ -0,0 +1,28 @@ + +#include "b_qt.hpp" +#include + +namespace b_qt { + +/// @brief A source local QObject based class +class Source_QObject : public QObject +{ + Q_OBJECT +public: + Source_QObject() {} + ~Source_QObject() {} + + std::string str; +}; + +std::string mocs_compilation() +{ + // Create and destroy QObject based classes + Header_QObject header_obj; + Source_QObject source_obj; + + return std::string(b_mc::mocs_compilation()); +} +} + +#include "b_qt.moc" diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp new file mode 100644 index 000000000..d7f0311a6 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/b_qt.hpp @@ -0,0 +1,25 @@ +#ifndef B_QT_HPP +#define B_QT_HPP + +#include +#include +#include + +namespace b_qt { + +/// @brief A header local QObject based class +class Header_QObject : public QObject +{ + Q_OBJECT +public: + Header_QObject() {} + ~Header_QObject() {} + + std::string str; +}; + +/// @brief Function that returns the content of mocs_compilation.cpp +extern std::string mocs_compilation(); +} + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in new file mode 100644 index 000000000..e415d0855 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/config.hpp.in @@ -0,0 +1,8 @@ +#ifndef CONFIG_HPP +#define CONFIG_HPP + +// Application configuration + +enum dummy { NO_OP }; + +#endif diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake b/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake new file mode 100644 index 000000000..0fc6e638d --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/configure_content.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) + +# Read mocs_compilation.cpp file into variable +file(READ "${MCF}" MOCS_COMPILATION) +string(REPLACE "\\" "\\\\" MOCS_COMPILATION "${MOCS_COMPILATION}" ) +string(REPLACE "\"" "\\\"" MOCS_COMPILATION "${MOCS_COMPILATION}" ) +string(REPLACE "\n" "\"\n\"" MOCS_COMPILATION "${MOCS_COMPILATION}" ) + +# Configure file +configure_file ( "${CF_IN}" "${CF_OUT}" @ONLY ) diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp b/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp new file mode 100644 index 000000000..a3425f14c --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOff/main.cpp @@ -0,0 +1,15 @@ + +#include +#include +#include + +int main() +{ + if (a_qt::mocs_compilation().empty()) { + return -1; + } + if (b_qt::mocs_compilation().empty()) { + return -1; + } + return 0; +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt new file mode 100644 index 000000000..5aabe0e68 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt @@ -0,0 +1,91 @@ +cmake_minimum_required(VERSION 3.10) +project(AutogenOriginDependsOn) +include("../AutogenCoreTest.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) diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in new file mode 100644 index 000000000..854d9a143 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/object_valid.hpp.in new file mode 100644 index 000000000..f364f7c97 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/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/AutogenOriginDependsOn/simpleLib.cpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in new file mode 100644 index 000000000..fa33bd375 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.cpp.in @@ -0,0 +1,9 @@ +#include "simpleLib.hpp" + +SimpleLib::SimpleLib() +{ +} + +SimpleLib::~SimpleLib() +{ +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in b/Tests/QtAutogen/AutogenOriginDependsOn/simpleLib.hpp.in new file mode 100644 index 000000000..b65b0cb4a --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/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/AutogenOriginDependsOn/testGenFile.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp new file mode 100644 index 000000000..7df6e137c --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenFile.cpp @@ -0,0 +1,8 @@ + +#include "GenFile.hpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.cpp new file mode 100644 index 000000000..c14e15958 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/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/AutogenOriginDependsOn/testGenLib.hpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenLib.hpp new file mode 100644 index 000000000..408335bd2 --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/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/AutogenOriginDependsOn/testGenTarget.cpp b/Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp new file mode 100644 index 000000000..911076efd --- /dev/null +++ b/Tests/QtAutogen/AutogenOriginDependsOn/testGenTarget.cpp @@ -0,0 +1,9 @@ + +#include "GenTarget.hpp" +#include "moc_GenTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt new file mode 100644 index 000000000..492b5dbd3 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt @@ -0,0 +1,54 @@ +cmake_minimum_required(VERSION 3.10) +project(AutogenTargetDepends) +include("../AutogenCoreTest.cmake") + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +# -- 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/AutogenTargetDepends/object_invalid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in new file mode 100644 index 000000000..854d9a143 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/object_invalid.hpp.in @@ -0,0 +1 @@ +#ifndef diff --git a/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in b/Tests/QtAutogen/AutogenTargetDepends/object_valid.hpp.in new file mode 100644 index 000000000..f364f7c97 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/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/AutogenTargetDepends/testATDFile.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp new file mode 100644 index 000000000..6bddfcd39 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDFile.cpp @@ -0,0 +1,9 @@ + +#include "ATDFile.hpp" +#include "moc_ATDFile.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp new file mode 100644 index 000000000..831fc2691 --- /dev/null +++ b/Tests/QtAutogen/AutogenTargetDepends/testATDTarget.cpp @@ -0,0 +1,9 @@ + +#include "ATDTarget.hpp" +#include "moc_ATDTarget.cpp" + +int main() +{ + Object obj; + return 0; +} diff --git a/Tests/QtAutogen/Complex/Adir/CMakeLists.txt b/Tests/QtAutogen/Complex/Adir/CMakeLists.txt new file mode 100644 index 000000000..a1c36ffce --- /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 000000000..f79f24af4 --- /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 000000000..c4eb9f7dc --- /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 000000000..d33876308 --- /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 000000000..d3b675333 --- /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 000000000..e4ab788c0 --- /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 000000000..d9fdf5cf4 --- /dev/null +++ b/Tests/QtAutogen/Complex/CMakeLists.txt @@ -0,0 +1,85 @@ +cmake_minimum_required(VERSION 3.10) +project(Complex) +include("../AutogenGuiTest.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" +) + +get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(NOT _isMultiConfig 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 000000000..2929b92ee --- /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 000000000..ec5f4115a --- /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 000000000..be984876c --- /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 000000000..734bd7a8e --- /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 000000000..1c497e00f --- /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 000000000..ff798782b --- /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 000000000..8ce53f14a --- /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 000000000..084d959bd --- /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 000000000..1c245cac9 --- /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 000000000..0caf8a7df --- /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 000000000..b410bd4e6 --- /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 000000000..46b09e705 --- /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 000000000..c02f0ede6 --- /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 000000000..dc2e1ac18 --- /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 000000000..db98b9bc1 --- /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 000000000..f665eee01 --- /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 000000000..3e03fe6bd --- /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 000000000..23d95fa4a --- /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 000000000..3253e31d9 --- /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 000000000..d514c619c --- /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 000000000..cac14dedb --- /dev/null +++ b/Tests/QtAutogen/Complex/generated.h @@ -0,0 +1,21 @@ + +#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 000000000..77507bb8e --- /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 000000000..da5fa6289 --- /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 000000000..a3acff161 --- /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 000000000..3bc2bad54 --- /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 000000000..b5b6ed173 --- /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 000000000..fda36ea92 --- /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 000000000..a4d0a5021 --- /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 000000000..c6c0ba1b6 --- /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 000000000..d21e7af7c --- /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 000000000..ab1682a25 --- /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 000000000..8041eb2ae --- /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 000000000..4ecb6b482 --- /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 000000000..dbdb3ad72 --- /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 000000000..27bfb143b --- /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 000000000..c575f1013 --- /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 000000000..c7929c4b1 --- /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 000000000..4effa589c --- /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 000000000..e4093f61c --- /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 000000000..766b7751b --- /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 000000000..c3d4e3cdb --- /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 000000000..8fce81a9a --- /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 000000000..1f411b9fb --- /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 000000000..e46c9d3ed --- /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 000000000..8b813fd3a --- /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 000000000..70e26aa95 --- /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 000000000..f27106199 --- /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 000000000..ea5eed69c --- /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/DefinesTest/CMakeLists.txt b/Tests/QtAutogen/DefinesTest/CMakeLists.txt new file mode 100644 index 000000000..3761dd842 --- /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 EQUAL 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 000000000..a5336221d --- /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/GlobalAutogenTarget/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt new file mode 100644 index 000000000..81fd8db27 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt @@ -0,0 +1,126 @@ +cmake_minimum_required(VERSION 3.12) +project(GlobalAutogenTarget) +include("../AutogenCoreTest.cmake") + +# This tests +# CMAKE_GLOBAL_AUTOGEN_TARGET, +# CMAKE_GLOBAL_AUTORCC_TARGET, +# CMAKE_GLOBAL_AUTOGEN_TARGET_NAME and +# CMAKE_GLOBAL_AUTORCC_TARGET_NAME +# for the latter two with different values in different subdirectories. + +# Directories +set(GAT_SDIR "${CMAKE_CURRENT_SOURCE_DIR}/GAT") +set(GAT_BDIR "${CMAKE_CURRENT_BINARY_DIR}/GAT") +# Files +set(MCA "sda/sda_autogen/mocs_compilation.cpp") +set(MCB "sdb/sdb_autogen/mocs_compilation.cpp") +set(MCC "sdc/sdc_autogen/mocs_compilation.cpp") +set(MCG "gat_autogen/mocs_compilation.cpp") + +set(DRA "sda/sda_autogen/*qrc_data.cpp") +set(DRB "sdb/sdb_autogen/*qrc_data.cpp") +set(DRC "sdc/sdc_autogen/*qrc_data.cpp") +set(DRG "gat_autogen/*qrc_data.cpp") + +# -- Utility macros +macro(GAT_FIND_FILES VAR NAME) + file(GLOB_RECURSE ${VAR} ${GAT_BDIR}/*${NAME}) +endmacro() + +macro(GAT_FIND_FILE NAME) + GAT_FIND_FILES(LST ${NAME}) + if(LST) + message("Good find ${LST}") + else() + message(SEND_ERROR "Expected to find ${GAT_BDIR}/${NAME}") + endif() + unset(LST) +endmacro() + +macro(GAT_FIND_FILE_NOT NAME) + GAT_FIND_FILES(LST ${NAME}) + if(LST) + message(SEND_ERROR "Not expected to find ${GAT_BDIR}/${NAME}") + else() + message("Good not find ${GAT_BDIR}/${NAME}") + endif() + unset(LST) +endmacro() + +macro(GAT_BUILD_TARGET NAME) + message("___ Building GAT ${NAME} target ___") + execute_process( + COMMAND "${CMAKE_COMMAND}" --build "${GAT_BDIR}" --target ${NAME} + WORKING_DIRECTORY "${GAT_BDIR}" + RESULT_VARIABLE result) + if (result) + message(SEND_ERROR "Building of GAT ${NAME} target failed") + endif() +endmacro() + + +# -- Remove and recreate build directory +file(REMOVE_RECURSE ${GAT_BDIR}) +file(MAKE_DIRECTORY ${GAT_BDIR}) + + +# -- Configure project +message("___ Configuring GAT project ___") +execute_process( + COMMAND "${CMAKE_COMMAND}" "${GAT_SDIR}" + -G "${CMAKE_GENERATOR}" + -A "${CMAKE_GENERATOR_PLATFORM}" + -T "${CMAKE_GENERATOR_TOOLSET}" + "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + WORKING_DIRECTORY "${GAT_BDIR}" + OUTPUT_VARIABLE output + RESULT_VARIABLE result) +if (result) + message(SEND_ERROR "Configuring of GAT project failed") +else() + message("Configuring of GAT project succeeded") + message("${output}") +endif() + + +# -- Build autogen subtargets +GAT_BUILD_TARGET("autogen") +GAT_FIND_FILE("${MCA}") +GAT_FIND_FILE_NOT("${MCB}") +GAT_FIND_FILE_NOT("${MCC}") +GAT_FIND_FILE("${MCG}") + +GAT_BUILD_TARGET("global_autogen_sdb") +GAT_FIND_FILE("${MCA}") +GAT_FIND_FILE("${MCB}") +GAT_FIND_FILE_NOT("${MCC}") +GAT_FIND_FILE("${MCG}") + +GAT_BUILD_TARGET("all_autogen") +GAT_FIND_FILE("${MCA}") +GAT_FIND_FILE("${MCB}") +GAT_FIND_FILE("${MCC}") +GAT_FIND_FILE("${MCG}") + + +# -- Build autorcc subtargets +GAT_BUILD_TARGET("autorcc") +GAT_FIND_FILE("${DRA}") +GAT_FIND_FILE_NOT("${DRB}") +GAT_FIND_FILE_NOT("${DRC}") +GAT_FIND_FILE("${DRG}") + +GAT_BUILD_TARGET("global_autorcc_sdb") +GAT_FIND_FILE("${DRA}") +GAT_FIND_FILE("${DRB}") +GAT_FIND_FILE_NOT("${DRC}") +GAT_FIND_FILE("${DRG}") + +GAT_BUILD_TARGET("all_autorcc") +GAT_FIND_FILE("${DRA}") +GAT_FIND_FILE("${DRB}") +GAT_FIND_FILE("${DRC}") +GAT_FIND_FILE("${DRG}") diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt new file mode 100644 index 000000000..3925197fe --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.12) +project(GAT) +include("../../AutogenCoreTest.cmake") + +# Include directories +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +# Enable AUTOMOC/UIC/RCC +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) +# Disable ORIGN_DEPENDS and enable AUTOGEN global targets +set(CMAKE_AUTOGEN_ORIGIN_DEPENDS OFF) +set(CMAKE_GLOBAL_AUTOGEN_TARGET ON) +set(CMAKE_GLOBAL_AUTORCC_TARGET ON) + +add_subdirectory(sda) +add_subdirectory(sdb) +add_subdirectory(sdc) + +# Add custom target that depends on all autogen/autorcc targets +add_custom_target(all_autogen DEPENDS autogen global_autogen_sdb global_autogen_sdc) +add_custom_target(all_autorcc DEPENDS autorcc global_autorcc_sdb global_autorcc_sdc) + +# Main target +add_executable(gat data.qrc item.cpp main.cpp) +target_link_libraries(gat ${QT_LIBRARIES}) +target_link_libraries(gat sda sdb sdc) diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/data.qrc b/Tests/QtAutogen/GlobalAutogenTarget/GAT/data.qrc new file mode 100644 index 000000000..68d02c9eb --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/data.qrc @@ -0,0 +1,5 @@ + + + item.cpp + + diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/item.cpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/item.cpp new file mode 100644 index 000000000..3d1fbe7cf --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/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/GlobalAutogenTarget/GAT/item.hpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/item.hpp new file mode 100644 index 000000000..75e83f483 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/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/GlobalAutogenTarget/GAT/main.cpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/main.cpp new file mode 100644 index 000000000..79c00b407 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/main.cpp @@ -0,0 +1,15 @@ +#include "item.hpp" +#include "sda/sda.hpp" +#include "sdb/sdb.hpp" +#include "sdc/sdc.hpp" + +int main(int argv, char** args) +{ + // Object instances + Item item; + // Library calls + sda(); + sdb(); + sdc(); + return 0; +} diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/CMakeLists.txt new file mode 100644 index 000000000..795e91e97 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(sda ../item.cpp ../data.qrc sda.cpp) +target_link_libraries(sda ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.cpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.cpp new file mode 100644 index 000000000..ec4dec88a --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.cpp @@ -0,0 +1,6 @@ +#include + +void sda() +{ + Item item; +} diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.hpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.hpp new file mode 100644 index 000000000..89ac744b3 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sda/sda.hpp @@ -0,0 +1,6 @@ +#ifndef SDA_HPP +#define SDA_HPP + +void sda(); + +#endif diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/CMakeLists.txt new file mode 100644 index 000000000..5c686fec4 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/CMakeLists.txt @@ -0,0 +1,5 @@ +set(CMAKE_GLOBAL_AUTOGEN_TARGET_NAME "global_autogen_sdb") +set(CMAKE_GLOBAL_AUTORCC_TARGET_NAME "global_autorcc_sdb") + +add_library(sdb ../item.cpp ../data.qrc sdb.cpp) +target_link_libraries(sdb ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.cpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.cpp new file mode 100644 index 000000000..e32c46709 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.cpp @@ -0,0 +1,6 @@ +#include + +void sdb() +{ + Item item; +} diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.hpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.hpp new file mode 100644 index 000000000..a5b0f62f9 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdb/sdb.hpp @@ -0,0 +1,6 @@ +#ifndef SDB_HPP +#define SDB_HPP + +void sdb(); + +#endif diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/CMakeLists.txt new file mode 100644 index 000000000..2698bda6b --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/CMakeLists.txt @@ -0,0 +1,5 @@ +set(CMAKE_GLOBAL_AUTOGEN_TARGET_NAME "global_autogen_sdc") +set(CMAKE_GLOBAL_AUTORCC_TARGET_NAME "global_autorcc_sdc") + +add_library(sdc ../item.cpp ../data.qrc sdc.cpp) +target_link_libraries(sdc ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.cpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.cpp new file mode 100644 index 000000000..a97cd4276 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.cpp @@ -0,0 +1,6 @@ +#include + +void sdc() +{ + Item item; +} diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.hpp b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.hpp new file mode 100644 index 000000000..7e9217902 --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/sdc/sdc.hpp @@ -0,0 +1,6 @@ +#ifndef SDC_HPP +#define SDC_HPP + +void sdc(); + +#endif diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/view.ui b/Tests/QtAutogen/GlobalAutogenTarget/GAT/view.ui new file mode 100644 index 000000000..2ffe7344c --- /dev/null +++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/view.ui @@ -0,0 +1,24 @@ + + + View + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/LowMinimumVersion/CMakeLists.txt b/Tests/QtAutogen/LowMinimumVersion/CMakeLists.txt new file mode 100644 index 000000000..e1af3d863 --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/CMakeLists.txt @@ -0,0 +1,16 @@ +# Use a low minimum version +cmake_minimum_required(VERSION 3.0) +project(LowMinimumVersion) +include("../AutogenGuiTest.cmake") + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) +add_executable(lowMinimumVersion + main.cpp + item.hpp + item.cpp + view.ui + someText.txt + example.qrc) +target_link_libraries(lowMinimumVersion ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/LowMinimumVersion/example.qrc b/Tests/QtAutogen/LowMinimumVersion/example.qrc new file mode 100644 index 000000000..551ecc815 --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/example.qrc @@ -0,0 +1,5 @@ + + + someText.txt + + diff --git a/Tests/QtAutogen/LowMinimumVersion/item.cpp b/Tests/QtAutogen/LowMinimumVersion/item.cpp new file mode 100644 index 000000000..e2f19b204 --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/item.cpp @@ -0,0 +1,19 @@ +#include "item.hpp" +#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/LowMinimumVersion/item.hpp b/Tests/QtAutogen/LowMinimumVersion/item.hpp new file mode 100644 index 000000000..01255d480 --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/item.hpp @@ -0,0 +1,15 @@ +#ifndef ITEM_HPP +#define ITEM_HPP + +#include + +class Item : public QObject +{ + Q_OBJECT + +public: + Q_SLOT + void go(); +}; + +#endif diff --git a/Tests/QtAutogen/LowMinimumVersion/main.cpp b/Tests/QtAutogen/LowMinimumVersion/main.cpp new file mode 100644 index 000000000..9f225a4aa --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/main.cpp @@ -0,0 +1,10 @@ +#include "item.hpp" + +int main(int argc, char* argv[]) +{ + Q_INIT_RESOURCE(example); + Item item; + item.go(); + + return 0; +} diff --git a/Tests/QtAutogen/LowMinimumVersion/someText.txt b/Tests/QtAutogen/LowMinimumVersion/someText.txt new file mode 100644 index 000000000..750dae3a1 --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/someText.txt @@ -0,0 +1 @@ +Hello world, you're an interesting place. diff --git a/Tests/QtAutogen/LowMinimumVersion/view.ui b/Tests/QtAutogen/LowMinimumVersion/view.ui new file mode 100644 index 000000000..2ffe7344c --- /dev/null +++ b/Tests/QtAutogen/LowMinimumVersion/view.ui @@ -0,0 +1,24 @@ + + + View + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/MacOsFW/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/CMakeLists.txt new file mode 100644 index 000000000..c08efc47a --- /dev/null +++ b/Tests/QtAutogen/MacOsFW/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.10) +project(MacOsFW) +include("../AutogenGuiTest.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 000000000..a02be00c5 --- /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 000000000..881a8c9b6 --- /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 000000000..e66e0ea6c --- /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 000000000..521c18450 --- /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 000000000..3476d6176 --- /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 000000000..1fe8dae65 --- /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/ManySources/CMakeLists.txt b/Tests/QtAutogen/ManySources/CMakeLists.txt new file mode 100644 index 000000000..df8a2a662 --- /dev/null +++ b/Tests/QtAutogen/ManySources/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.10) +project(ManySources) +include("../AutogenGuiTest.cmake") + +# Test AUTOMOC and AUTOUIC on many source files to stress the concurrent +# parsing and processing framework. + +set(CSD ${CMAKE_CURRENT_SOURCE_DIR}) +set(CBD ${CMAKE_CURRENT_BINARY_DIR}) + +set(SRCS main.cpp) +set(MAIN_INCLUDES "\n// Item includes\n") +set(MAIN_ITEMS "\n// Items\n") + +set(NUM 24) +foreach(III RANGE 1 ${NUM}) + configure_file(${CSD}/object.h.in ${CBD}/object_${III}.h) + configure_file(${CSD}/item.h.in ${CBD}/item_${III}.h) + configure_file(${CSD}/item.cpp.in ${CBD}/item_${III}.cpp) + configure_file(${CSD}/view.ui.in ${CBD}/view_${III}.ui) + configure_file(${CSD}/data.qrc.in ${CBD}/data_${III}.qrc) + + list(APPEND SRCS ${CBD}/item_${III}.cpp) + list(APPEND SRCS ${CBD}/data_${III}.qrc) + + string(APPEND MAIN_INCLUDES "#include \"item_${III}.h\"\n") + string(APPEND MAIN_ITEMS "Item_${III} item_${III};\n") + string(APPEND MAIN_ITEMS "item_${III}.TheSlot();\n") +endforeach() + +configure_file(${CSD}/main.cpp.in ${CBD}/main.cpp) + +add_executable(manySources ${SRCS} ${CBD}/main.cpp) +target_link_libraries(manySources ${QT_LIBRARIES}) +set_target_properties(manySources PROPERTIES AUTOMOC 1 AUTOUIC 1 AUTORCC 1) diff --git a/Tests/QtAutogen/ManySources/data.qrc.in b/Tests/QtAutogen/ManySources/data.qrc.in new file mode 100644 index 000000000..870d48631 --- /dev/null +++ b/Tests/QtAutogen/ManySources/data.qrc.in @@ -0,0 +1,7 @@ + + + object_@III@.h + item_@III@.h + item_@III@.cpp + + diff --git a/Tests/QtAutogen/ManySources/item.cpp.in b/Tests/QtAutogen/ManySources/item.cpp.in new file mode 100644 index 000000000..c34ad16d0 --- /dev/null +++ b/Tests/QtAutogen/ManySources/item.cpp.in @@ -0,0 +1,27 @@ +#include "item_@III@.h" +#include "object_@III@.h" +// AUTOUIC include +#include + +class LocalObject_@III@ : public QObject +{ + Q_OBJECT; + +public: + LocalObject_@III@() = default; + ~LocalObject_@III@() = default; +}; + +void Item_@III@ ::TheSlot() +{ + LocalObject_@III@ localObject; + Object_@III@ obj; + obj.ObjectSlot(); + + Ui_View_@III@ ui_view; +} + +// AUTOMOC includes +#include "item_@III@.moc" +#include "moc_item_@III@.cpp" +#include "moc_object_@III@.cpp" diff --git a/Tests/QtAutogen/ManySources/item.h.in b/Tests/QtAutogen/ManySources/item.h.in new file mode 100644 index 000000000..67ad79435 --- /dev/null +++ b/Tests/QtAutogen/ManySources/item.h.in @@ -0,0 +1,15 @@ +#ifndef ITEM_@III@HPP +#define ITEM_@III@HPP + +#include + +class Item_@III@ : public QObject +{ + Q_OBJECT + +public: + Q_SLOT + void TheSlot(); +}; + +#endif diff --git a/Tests/QtAutogen/ManySources/main.cpp.in b/Tests/QtAutogen/ManySources/main.cpp.in new file mode 100644 index 000000000..e1dda40b7 --- /dev/null +++ b/Tests/QtAutogen/ManySources/main.cpp.in @@ -0,0 +1,7 @@ +@MAIN_INCLUDES@ + +int main(int argv, char** args) +{ + @MAIN_ITEMS@ + return 0; +} diff --git a/Tests/QtAutogen/ManySources/object.h.in b/Tests/QtAutogen/ManySources/object.h.in new file mode 100644 index 000000000..a747cbcfa --- /dev/null +++ b/Tests/QtAutogen/ManySources/object.h.in @@ -0,0 +1,15 @@ +#ifndef OBJECT_@III@H +#define OBJECT_@III@H + +#include + +class Object_@III@ : public QObject +{ + Q_OBJECT + +public: + Q_SLOT + void ObjectSlot(){}; +}; + +#endif diff --git a/Tests/QtAutogen/ManySources/view.ui.in b/Tests/QtAutogen/ManySources/view.ui.in new file mode 100644 index 000000000..6901fe3de --- /dev/null +++ b/Tests/QtAutogen/ManySources/view.ui.in @@ -0,0 +1,24 @@ + + + View_@III@ + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/MocCMP0071/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt new file mode 100644 index 000000000..5c58a8278 --- /dev/null +++ b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.10) +project(MocCMP0071) +include("../AutogenCoreTest.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 000000000..954fe3dc1 --- /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 000000000..68fa06708 --- /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 000000000..1ae50edc9 --- /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 000000000..f064e4793 --- /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 000000000..cb1e5df71 --- /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 000000000..3887840ba --- /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/MocInclude/EObjA.cpp b/Tests/QtAutogen/MocInclude/EObjA.cpp new file mode 100644 index 000000000..7681c29b9 --- /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 000000000..0939ab66d --- /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 000000000..369ca8f77 --- /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 000000000..b10681d59 --- /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 000000000..d8bf2844c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjAExtra_p.hpp @@ -0,0 +1,14 @@ +#ifndef EOBJAEXTRA_P_HPP +#define EOBJAEXTRA_P_HPP + +#include + +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 000000000..9ef5624ab --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjA_p.hpp @@ -0,0 +1,14 @@ +#ifndef EOBJA_P_HPP +#define EOBJA_P_HPP + +#include + +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 000000000..3068c682d --- /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 000000000..6632bdb07 --- /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 000000000..84b1ea270 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/EObjB_p.hpp @@ -0,0 +1,14 @@ +#ifndef EOBJB_P_HPP +#define EOBJB_P_HPP + +#include + +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 000000000..9aae9917f --- /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 000000000..aac670c00 --- /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 000000000..97113d6d1 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjA_p.h @@ -0,0 +1,14 @@ +#ifndef LOBJA_P_HPP +#define LOBJA_P_HPP + +#include + +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 000000000..7485d8fca --- /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 000000000..eb4e58d79 --- /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 000000000..b88f40e5c --- /dev/null +++ b/Tests/QtAutogen/MocInclude/LObjB_p.h @@ -0,0 +1,14 @@ +#ifndef LOBJB_P_HPP +#define LOBJB_P_HPP + +#include + +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 000000000..6f6b90ef1 --- /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 000000000..f16c924aa --- /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 000000000..d944bc637 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjA_p.h @@ -0,0 +1,14 @@ +#ifndef OBJA_P_HPP +#define OBJA_P_HPP + +#include + +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 000000000..a6f2509af --- /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 000000000..2ac8d1700 --- /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 000000000..61ba6042e --- /dev/null +++ b/Tests/QtAutogen/MocInclude/ObjB_p.h @@ -0,0 +1,14 @@ +#ifndef OBJB_P_HPP +#define OBJB_P_HPP + +#include + +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 000000000..7e75bf973 --- /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 000000000..1436abc6c --- /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 000000000..b1cc12ab2 --- /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 000000000..5e396aea8 --- /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 000000000..1e8d397f9 --- /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 000000000..def0f9d96 --- /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 000000000..55dd1c315 --- /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 000000000..08545ac29 --- /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 000000000..00fc4aabe --- /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 000000000..2ca28414d --- /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 000000000..c697866e7 --- /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 000000000..3798d7f52 --- /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 000000000..3231fac96 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subExtra/EObjBExtra_p.hpp @@ -0,0 +1,14 @@ +#ifndef EOBJBEXTRA_P_HPP +#define EOBJBEXTRA_P_HPP + +#include + +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 000000000..6b92f2194 --- /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 000000000..2f9ee8207 --- /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 000000000..4a4375543 --- /dev/null +++ b/Tests/QtAutogen/MocInclude/subGlobal/GObj_p.hpp @@ -0,0 +1,17 @@ +#ifndef GOBJ_P_HPP +#define GOBJ_P_HPP + +#include + +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 000000000..8b4da3453 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeRelaxed/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeRelaxed) +include("../AutogenCoreTest.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 only 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 000000000..5b2c07032 --- /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 000000000..2e2cf6a48 --- /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 000000000..597418773 --- /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 000000000..c56d10f04 --- /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 000000000..d6d0474ad --- /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 000000000..5d6be752f --- /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 000000000..4ba32f54b --- /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 000000000..5552ede4a --- /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 000000000..5a3148dda --- /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 000000000..d0aaebf37 --- /dev/null +++ b/Tests/QtAutogen/MocIncludeStrict/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(MocIncludeStrict) +include("../AutogenCoreTest.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 000000000..5a3148dda --- /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/MocMacroName/CMakeLists.txt b/Tests/QtAutogen/MocMacroName/CMakeLists.txt new file mode 100644 index 000000000..bf13d187d --- /dev/null +++ b/Tests/QtAutogen/MocMacroName/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(MocMacroName) +include("../AutogenCoreTest.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 000000000..93e5bfdc1 --- /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 000000000..d7cb51590 --- /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 000000000..cab792edc --- /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 000000000..800ebf3da --- /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 000000000..aadae1f6d --- /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 000000000..b8b4806c6 --- /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 000000000..6c6bb4088 --- /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 000000000..4b09dd1bc --- /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 000000000..b9bdc126f --- /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 000000000..3b45d042d --- /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/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt new file mode 100644 index 000000000..e109154aa --- /dev/null +++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOnly) +include("../AutogenCoreTest.cmake") + +add_executable(mocOnly + main.cpp + # Test different Q_OBJECT position styles + StyleA.cpp + StyleB.cpp + # Test different moc_/.moc include positions + IncA.cpp + IncB.cpp +) +set_property(TARGET mocOnly PROPERTY AUTOMOC ON) +target_link_libraries(mocOnly ${QT_LIBRARIES}) +# Add compile definitions with unusual characters +target_compile_definitions(mocOnly PUBLIC "TOKEN=\"hello\;\"" ) diff --git a/Tests/QtAutogen/MocOnly/IncA.cpp b/Tests/QtAutogen/MocOnly/IncA.cpp new file mode 100644 index 000000000..94610cd48 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.cpp @@ -0,0 +1,19 @@ +#include "moc_IncA.cpp" +/// AUTOMOC moc_ include on the first line of the file! +#include "IncA.hpp" + +/// @brief Source local QObject +/// +class IncAPrivate : public QObject +{ + Q_OBJECT +public: + IncAPrivate(){}; +}; + +IncA::IncA() +{ + IncAPrivate priv; +} + +#include "IncA.moc" diff --git a/Tests/QtAutogen/MocOnly/IncA.hpp b/Tests/QtAutogen/MocOnly/IncA.hpp new file mode 100644 index 000000000..ecc889f9d --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.hpp @@ -0,0 +1,15 @@ +#ifndef INCA_HPP +#define INCA_HPP + +#include + +/// @brief Test moc include pattern in the source file +/// +class IncA : public QObject +{ + Q_OBJECT +public: + IncA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/IncB.cpp b/Tests/QtAutogen/MocOnly/IncB.cpp new file mode 100644 index 000000000..bd441a978 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.cpp @@ -0,0 +1,19 @@ +#include "IncB.hpp" + +/// @brief Source local QObject +/// +class IncBPrivate : public QObject +{ + Q_OBJECT +public: + IncBPrivate(){}; +}; + +IncB::IncB() +{ + IncBPrivate priv; +} + +/// AUTOMOC moc_ include on the last line of the file! +#include "IncB.moc" +#include "moc_IncB.cpp" diff --git a/Tests/QtAutogen/MocOnly/IncB.hpp b/Tests/QtAutogen/MocOnly/IncB.hpp new file mode 100644 index 000000000..8331ea2b7 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.hpp @@ -0,0 +1,15 @@ +#ifndef INCB_HPP +#define INCB_HPP + +#include + +/// @brief Test moc include pattern in the source file +/// +class IncB : public QObject +{ + Q_OBJECT +public: + IncB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/StyleA.cpp b/Tests/QtAutogen/MocOnly/StyleA.cpp new file mode 100644 index 000000000..ced1dd151 --- /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 000000000..5ba0a8768 --- /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 000000000..bec6c1c36 --- /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 000000000..86abaa8c9 --- /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 000000000..b83b8063b --- /dev/null +++ b/Tests/QtAutogen/MocOnly/main.cpp @@ -0,0 +1,18 @@ +#include "IncA.hpp" +#include "IncB.hpp" +#include "StyleA.hpp" +#include "StyleB.hpp" +#include + +int main(int argv, char** args) +{ + StyleA styleA; + StyleB styleB; + IncA incA; + IncB incB; + + // Test the TOKEN definition passed on the command line + std::string token(TOKEN); + std::cout << "std::string(TOKEN): \"" << token << "\"\n"; + return (token == "hello;") ? 0 : -1; +} diff --git a/Tests/QtAutogen/MocOptions/CMakeLists.txt b/Tests/QtAutogen/MocOptions/CMakeLists.txt new file mode 100644 index 000000000..19ee6587e --- /dev/null +++ b/Tests/QtAutogen/MocOptions/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.10) +project(MocOptions) +include("../AutogenCoreTest.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 000000000..ad109f14c --- /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 000000000..e7a614200 --- /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 000000000..7aeab1a89 --- /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/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt new file mode 100644 index 000000000..b0125f6c3 --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.11) +project(MocOsMacros) +include("../AutogenCoreTest.cmake") + +# Tests if moc processes Q_OS_XXX macros + +message( "Qt5Core_VERSION: ${Qt5Core_VERSION}" ) +message( + "CMAKE_CXX_COMPILER_PREDEFINES_COMMAND: " + ${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND} ) + +# On some platforms (e.g. MAC) Q_OS_XXX requires moc to include moc_predefs.h +# which is supported since Qt 5.8 and requires +# CMAKE_CXX_COMPILER_PREDEFINES_COMMAND to be defined. +if( ( ${Qt5Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND + DEFINED CMAKE_CXX_COMPILER_PREDEFINES_COMMAND +) + message( "Test enabled!" ) + message( + "CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES: " + ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ) + + set(CMAKE_AUTOMOC True) + add_executable(mocOsMacros + main.cpp + TestClass.cpp + TestClass.hpp + ) + target_link_libraries(mocOsMacros PRIVATE ${QT_QTCORE_TARGET}) +else() + message( "Test disabled!" ) +endif() diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.cpp b/Tests/QtAutogen/MocOsMacros/TestClass.cpp new file mode 100644 index 000000000..13f8fd93a --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/TestClass.cpp @@ -0,0 +1,82 @@ +#include "TestClass.hpp" +#include + +void TestClass::open() +{ + std::cout << "open\n"; +} + +// -- Mac +#ifndef Q_OS_MAC +void TestClass::MacNotDef() +{ + std::cout << "MacNotDef\n"; +} +#else +void TestClass::MacNotDefElse() +{ + std::cout << "MacNotDefElse\n"; +} +#endif + +#ifdef Q_OS_MAC +void TestClass::MacDef() +{ + std::cout << "MacDef\n"; +} +#else +void TestClass::MacDefElse() +{ + std::cout << "MacDefElse\n"; +} +#endif + +// -- Unix +#ifndef Q_OS_UNIX +void TestClass::UnixNotDef() +{ + std::cout << "UnixNotDef\n"; +} +#else +void TestClass::UnixNotDefElse() +{ + std::cout << "UnixNotDefElse\n"; +} +#endif + +#ifdef Q_OS_UNIX +void TestClass::UnixDef() +{ + std::cout << "UnixDef\n"; +} +#else +void TestClass::UnixDefElse() +{ + std::cout << "UnixDefElse\n"; +} +#endif + +// -- Windows +#ifndef Q_OS_WIN +void TestClass::WindowsNotDef() +{ + std::cout << "WindowsNotDef\n"; +} +#else +void TestClass::WindowsNotDefElse() +{ + std::cout << "WindowsNotDefElse\n"; +} +#endif + +#ifdef Q_OS_WIN +void TestClass::WindowsDef() +{ + std::cout << "WindowsDef\n"; +} +#else +void TestClass::WindowsDefElse() +{ + std::cout << "WindowsDefElse\n"; +} +#endif diff --git a/Tests/QtAutogen/MocOsMacros/TestClass.hpp b/Tests/QtAutogen/MocOsMacros/TestClass.hpp new file mode 100644 index 000000000..87fd49478 --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/TestClass.hpp @@ -0,0 +1,57 @@ +#ifndef TestClass_hpp +#define TestClass_hpp + +#include +#include +// include qplatformdefs.h for #18669 +#include + +class TestClass : public QObject +{ + Q_OBJECT +public Q_SLOTS: + + // Method named "open" to test if #18669 is fixed + void open(); + +// -- Mac +#ifndef Q_OS_MAC + void MacNotDef(); +#else + void MacNotDefElse(); +#endif + +#ifdef Q_OS_MAC + void MacDef(); +#else + void MacDefElse(); +#endif + +// -- Unix +#ifndef Q_OS_UNIX + void UnixNotDef(); +#else + void UnixNotDefElse(); +#endif + +#ifdef Q_OS_UNIX + void UnixDef(); +#else + void UnixDefElse(); +#endif + +// -- Windows +#ifndef Q_OS_WIN + void WindowsNotDef(); +#else + void WindowsNotDefElse(); +#endif + +#ifdef Q_OS_WIN + void WindowsDef(); +#else + void WindowsDefElse(); +#endif +}; + +#endif /* TestClass_hpp */ diff --git a/Tests/QtAutogen/MocOsMacros/main.cpp b/Tests/QtAutogen/MocOsMacros/main.cpp new file mode 100644 index 000000000..f8eec3cbc --- /dev/null +++ b/Tests/QtAutogen/MocOsMacros/main.cpp @@ -0,0 +1,32 @@ +#include "TestClass.hpp" +#include + +int main() +{ + TestClass a; +#ifdef Q_OS_MAC + a.MacNotDefElse(); + a.MacDef(); +#else + a.MacNotDef(); + a.MacDefElse(); +#endif + +#ifdef Q_OS_UNIX + a.UnixNotDefElse(); + a.UnixDef(); +#else + a.UnixNotDef(); + a.UnixDefElse(); +#endif + +#ifdef Q_OS_WIN + a.WindowsNotDefElse(); + a.WindowsDef(); +#else + a.WindowsNotDef(); + a.WindowsDefElse(); +#endif + + return 0; +} diff --git a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt new file mode 100644 index 000000000..454e896e8 --- /dev/null +++ b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.10) +project(MocSkipSource) +include("../AutogenCoreTest.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 000000000..522c2c758 --- /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 000000000..d295faf3a --- /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 000000000..636e15dfe --- /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 000000000..177591525 --- /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 000000000..622f2829e --- /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 000000000..f06bda269 --- /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 000000000..fe0f4e4da --- /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 000000000..99e0acbed --- /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 000000000..c91533410 --- /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/ObjectLibrary/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt new file mode 100644 index 000000000..ec204e775 --- /dev/null +++ b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +project(ObjectLibrary) +include("../AutogenCoreTest.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 000000000..fe76ac32c --- /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 000000000..4f08fda84 --- /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 000000000..fa5fed941 --- /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 000000000..26e09261c --- /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 000000000..783bb48ce --- /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 000000000..cacf0fdae --- /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/Parallel/CMakeLists.txt b/Tests/QtAutogen/Parallel/CMakeLists.txt new file mode 100644 index 000000000..299bcbfd7 --- /dev/null +++ b/Tests/QtAutogen/Parallel/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(Parallel) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallel ${PARALLEL_SRC}) +set_target_properties(parallel PROPERTIES AUTOGEN_PARALLEL "") +target_link_libraries(parallel ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/Parallel/aaa/bbb/data.qrc b/Tests/QtAutogen/Parallel/aaa/bbb/data.qrc new file mode 100644 index 000000000..0ea353756 --- /dev/null +++ b/Tests/QtAutogen/Parallel/aaa/bbb/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/Parallel/aaa/bbb/item.cpp b/Tests/QtAutogen/Parallel/aaa/bbb/item.cpp new file mode 100644 index 000000000..850206f6b --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/aaa/bbb/item.hpp b/Tests/QtAutogen/Parallel/aaa/bbb/item.hpp new file mode 100644 index 000000000..085504385 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/aaa/data.qrc b/Tests/QtAutogen/Parallel/aaa/data.qrc new file mode 100644 index 000000000..379af60c8 --- /dev/null +++ b/Tests/QtAutogen/Parallel/aaa/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/Parallel/aaa/item.cpp b/Tests/QtAutogen/Parallel/aaa/item.cpp new file mode 100644 index 000000000..e35d3d128 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/aaa/item.hpp b/Tests/QtAutogen/Parallel/aaa/item.hpp new file mode 100644 index 000000000..875f72fdb --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/aaa/view.ui b/Tests/QtAutogen/Parallel/aaa/view.ui new file mode 100644 index 000000000..0f0998006 --- /dev/null +++ b/Tests/QtAutogen/Parallel/aaa/view.ui @@ -0,0 +1,24 @@ + + + ViewAAA + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/Parallel/bbb/aaa/data.qrc b/Tests/QtAutogen/Parallel/bbb/aaa/data.qrc new file mode 100644 index 000000000..da980091a --- /dev/null +++ b/Tests/QtAutogen/Parallel/bbb/aaa/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/Parallel/bbb/aaa/item.cpp b/Tests/QtAutogen/Parallel/bbb/aaa/item.cpp new file mode 100644 index 000000000..7ad01c3ef --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/bbb/aaa/item.hpp b/Tests/QtAutogen/Parallel/bbb/aaa/item.hpp new file mode 100644 index 000000000..be07ca84c --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/bbb/data.qrc b/Tests/QtAutogen/Parallel/bbb/data.qrc new file mode 100644 index 000000000..5b080f5fa --- /dev/null +++ b/Tests/QtAutogen/Parallel/bbb/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/Parallel/bbb/item.cpp b/Tests/QtAutogen/Parallel/bbb/item.cpp new file mode 100644 index 000000000..9ef128ed0 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/bbb/item.hpp b/Tests/QtAutogen/Parallel/bbb/item.hpp new file mode 100644 index 000000000..d39a9d711 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/bbb/view.ui b/Tests/QtAutogen/Parallel/bbb/view.ui new file mode 100644 index 000000000..a8f506e88 --- /dev/null +++ b/Tests/QtAutogen/Parallel/bbb/view.ui @@ -0,0 +1,24 @@ + + + ViewBBB + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/Parallel/ccc/data.qrc b/Tests/QtAutogen/Parallel/ccc/data.qrc new file mode 100644 index 000000000..f934c39b9 --- /dev/null +++ b/Tests/QtAutogen/Parallel/ccc/data.qrc @@ -0,0 +1,6 @@ + + + item.hpp + item.cpp + + diff --git a/Tests/QtAutogen/Parallel/ccc/item.cpp b/Tests/QtAutogen/Parallel/ccc/item.cpp new file mode 100644 index 000000000..ab8a2817b --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/ccc/item.hpp b/Tests/QtAutogen/Parallel/ccc/item.hpp new file mode 100644 index 000000000..20d9dd978 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/ccc/view.ui b/Tests/QtAutogen/Parallel/ccc/view.ui new file mode 100644 index 000000000..7989c6973 --- /dev/null +++ b/Tests/QtAutogen/Parallel/ccc/view.ui @@ -0,0 +1,24 @@ + + + ViewCCC + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/Parallel/data.qrc b/Tests/QtAutogen/Parallel/data.qrc new file mode 100644 index 000000000..4ce0b4ec1 --- /dev/null +++ b/Tests/QtAutogen/Parallel/data.qrc @@ -0,0 +1,5 @@ + + + main.cpp + + diff --git a/Tests/QtAutogen/Parallel/item.cpp b/Tests/QtAutogen/Parallel/item.cpp new file mode 100644 index 000000000..3d1fbe7cf --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/item.hpp b/Tests/QtAutogen/Parallel/item.hpp new file mode 100644 index 000000000..75e83f483 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/main.cpp b/Tests/QtAutogen/Parallel/main.cpp new file mode 100644 index 000000000..a4ffcb350 --- /dev/null +++ b/Tests/QtAutogen/Parallel/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/Parallel/parallel.cmake b/Tests/QtAutogen/Parallel/parallel.cmake new file mode 100644 index 000000000..551bcd82b --- /dev/null +++ b/Tests/QtAutogen/Parallel/parallel.cmake @@ -0,0 +1,24 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + + +set(PBASE ${CMAKE_CURRENT_LIST_DIR}) +set(PARALLEL_SRC + ${PBASE}/aaa/bbb/item.cpp + ${PBASE}/aaa/bbb/data.qrc + ${PBASE}/aaa/item.cpp + ${PBASE}/aaa/data.qrc + + ${PBASE}/bbb/aaa/item.cpp + ${PBASE}/bbb/aaa/data.qrc + ${PBASE}/bbb/item.cpp + ${PBASE}/bbb/data.qrc + + ${PBASE}/ccc/item.cpp + ${PBASE}/ccc/data.qrc + + ${PBASE}/item.cpp + ${PBASE}/data.qrc + ${PBASE}/main.cpp +) diff --git a/Tests/QtAutogen/Parallel/view.ui b/Tests/QtAutogen/Parallel/view.ui new file mode 100644 index 000000000..2ffe7344c --- /dev/null +++ b/Tests/QtAutogen/Parallel/view.ui @@ -0,0 +1,24 @@ + + + View + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/Parallel1/CMakeLists.txt b/Tests/QtAutogen/Parallel1/CMakeLists.txt new file mode 100644 index 000000000..5c7d547df --- /dev/null +++ b/Tests/QtAutogen/Parallel1/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(Parallel1) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallel1 ${PARALLEL_SRC}) +set_target_properties(parallel1 PROPERTIES AUTOGEN_PARALLEL 1) +target_link_libraries(parallel1 ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/Parallel2/CMakeLists.txt b/Tests/QtAutogen/Parallel2/CMakeLists.txt new file mode 100644 index 000000000..668aea4bd --- /dev/null +++ b/Tests/QtAutogen/Parallel2/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(Parallel2) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallel2 ${PARALLEL_SRC}) +set_target_properties(parallel2 PROPERTIES AUTOGEN_PARALLEL 2) +target_link_libraries(parallel2 ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/Parallel3/CMakeLists.txt b/Tests/QtAutogen/Parallel3/CMakeLists.txt new file mode 100644 index 000000000..5c50f5ee5 --- /dev/null +++ b/Tests/QtAutogen/Parallel3/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(Parallel3) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallel3 ${PARALLEL_SRC}) +set_target_properties(parallel3 PROPERTIES AUTOGEN_PARALLEL 3) +target_link_libraries(parallel3 ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/Parallel4/CMakeLists.txt b/Tests/QtAutogen/Parallel4/CMakeLists.txt new file mode 100644 index 000000000..2c40c6a67 --- /dev/null +++ b/Tests/QtAutogen/Parallel4/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(Parallel4) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallel4 ${PARALLEL_SRC}) +set_target_properties(parallel4 PROPERTIES AUTOGEN_PARALLEL 4) +target_link_libraries(parallel4 ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt b/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt new file mode 100644 index 000000000..cddece37a --- /dev/null +++ b/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.10) +project(ParallelAUTO) +include("../AutogenGuiTest.cmake") + +# Test different values for AUTOGEN_PARALLEL +include("../Parallel/parallel.cmake") + +add_executable(parallelAUTO ${PARALLEL_SRC}) +set_target_properties(parallelAUTO PROPERTIES AUTOGEN_PARALLEL "AUTO") +target_link_libraries(parallelAUTO ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/RccEmpty/CMakeLists.txt b/Tests/QtAutogen/RccEmpty/CMakeLists.txt new file mode 100644 index 000000000..a8e2af1b6 --- /dev/null +++ b/Tests/QtAutogen/RccEmpty/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(RccEmpty) +include("../AutogenCoreTest.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 000000000..7f2c52786 --- /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 000000000..4ca9cd583 --- /dev/null +++ b/Tests/QtAutogen/RccEmpty/rccEmptyRes.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt new file mode 100644 index 000000000..61b9601a2 --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.10) +project(RccOffMocLibrary) +include("../AutogenCoreTest.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 000000000..ab32cf6c8 --- /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 000000000..6bdd2ac89 --- /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 000000000..c7698343a --- /dev/null +++ b/Tests/QtAutogen/RccOffMocLibrary/not_generated_file.qrc @@ -0,0 +1,5 @@ + + + abc.cpp + + diff --git a/Tests/QtAutogen/RccOnly/CMakeLists.txt b/Tests/QtAutogen/RccOnly/CMakeLists.txt new file mode 100644 index 000000000..f3776f575 --- /dev/null +++ b/Tests/QtAutogen/RccOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(RccOnly) +include("../AutogenCoreTest.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 000000000..61c7bf4ed --- /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 000000000..555134877 --- /dev/null +++ b/Tests/QtAutogen/RccOnly/rccOnlyRes.qrc @@ -0,0 +1,5 @@ + + + rccOnly.cpp + + diff --git a/Tests/QtAutogen/RccSkipSource/CMakeLists.txt b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt new file mode 100644 index 000000000..42232744f --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) +project(RccSkipSource) +include("../AutogenCoreTest.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 000000000..ec5711088 --- /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 000000000..6cbd9ed18 --- /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 000000000..b32c5896c --- /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 000000000..21a94b0c5 --- /dev/null +++ b/Tests/QtAutogen/RccSkipSource/skipRccGood.qrc @@ -0,0 +1,6 @@ + + + skipRccBad1.qrc + skipRccBad2.qrc + + diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt new file mode 100644 index 000000000..9b32e5951 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -0,0 +1,102 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunMocBasic) +include("../AutogenCoreTest.cmake") + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +# Utility variables +set(timeformat "%Y.%j.%H.%M%S") +set(mocBasicSrcDir "${CMAKE_CURRENT_SOURCE_DIR}/MocBasic") +set(mocBasicBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocBasic") + +# Utility macros +macro(sleep) + message(STATUS "Sleeping for a few seconds.") + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +endmacro() + +macro(acquire_timestamp When) + file(TIMESTAMP "${mocBasicBin}" time${When} "${timeformat}") +endmacro() + +macro(rebuild buildName) + message(STATUS "Starting build ${buildName}.") + execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocBasicBinDir}" RESULT_VARIABLE result) + if (result) + message(FATAL_ERROR "Build ${buildName} failed.") + else() + message(STATUS "Build ${buildName} finished.") + endif() +endmacro() + +macro(require_change) + if (timeAfter VERSION_GREATER timeBefore) + message(STATUS "As expected the file ${mocBasicBin} changed.") + else() + message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} did not change!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n") + endif() +endmacro() + +macro(require_change_not) + if (timeAfter VERSION_GREATER timeBefore) + message(SEND_ERROR "Unexpectedly the file ${mocBasicBin} changed!\nTimestamp pre: ${timeBefore}\nTimestamp aft: ${timeAfter}\n") + else() + message(STATUS "As expected the file ${mocBasicBin} did not change.") + endif() +endmacro() + + +# 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}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT MOC_RERUN) + message(FATAL_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) + +# To avoid a race condition where the binary has the same timestamp +# as a source file and therefore gets rebuild +# - sleep to ensure a timestamp change +# - touch binary to ensure it has a new timestamp +acquire_timestamp(Before) +sleep() +message(STATUS "Touching binary file to ensure a new timestamps") +file(TOUCH_NOCREATE "${mocBasicBin}") +acquire_timestamp(After) +require_change() + + +# - Ensure that the timestamp will change +# - Change header file content +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Changing the header content for a MOC re-run") +configure_file("${mocBasicSrcDir}/test1b.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +sleep() +rebuild(2) +acquire_timestamp(After) +require_change() + + +# - Ensure that the timestamp would change +# - Change nothing +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Changing nothing for no MOC re-run") +rebuild(3) +acquire_timestamp(After) +require_change_not() diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt new file mode 100644 index 000000000..6a9f5507c --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.10) +project(MocBasic) +include("../../AutogenCoreTest.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 000000000..da627624b --- /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 000000000..9d7ea37ae --- /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 000000000..fb804b5ec --- /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 000000000..a335046ba --- /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 000000000..6128eeba1 --- /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 000000000..4837a76b8 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt new file mode 100644 index 000000000..e1951f1d0 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt @@ -0,0 +1,134 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunMocPlugin) +include("../AutogenCoreTest.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") + +# Utility macros +macro(sleep) + message(STATUS "Sleeping for a few seconds.") + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +endmacro() + +macro(rebuild buildName) + message(STATUS "Starting build ${buildName}.") + execute_process(COMMAND "${CMAKE_COMMAND}" --build . WORKING_DIRECTORY "${mocPlugBinDir}" RESULT_VARIABLE result) + if (result) + message(FATAL_ERROR "Build ${buildName} failed.") + else() + message(STATUS "Build ${buildName} finished.") + endif() +endmacro() + +macro(require_change PLG) + if (pl${PLG}After VERSION_GREATER pl${PLG}Before) + message(STATUS "As expected the file ${pl${PLG}File} changed.") + else() + message(SEND_ERROR + "Unexpectedly the file ${pl${PLG}File} did not change!\nTimestamp pre: ${pl${PLG}Before}\nTimestamp aft: ${pl${PLG}After}\n") + endif() +endmacro() + +macro(require_change_not PLG) + if (pl${PLG}After VERSION_GREATER pl${PLG}Before) + message(SEND_ERROR + "Unexpectedly the file ${pl${PLG}File} changed!\nTimestamp pre: ${pl${PLG}Before}\nTimestamp aft: ${pl${PLG}After}\n") + else() + message(STATUS "As expected the file ${pl${PLG}File} did not change.") + endif() +endmacro() + +macro(acquire_timestamps When) + file(TIMESTAMP "${plAFile}" plA${When} "${timeformat}") + file(TIMESTAMP "${plBFile}" plB${When} "${timeformat}") + file(TIMESTAMP "${plCFile}" plC${When} "${timeformat}") + file(TIMESTAMP "${plDFile}" plD${When} "${timeformat}") + file(TIMESTAMP "${plEFile}" plE${When} "${timeformat}") +endmacro() + + +# Initial build +try_compile(MOC_PLUGIN + "${mocPlugBinDir}" + "${mocPlugSrcDir}" + MocPlugin + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT MOC_PLUGIN) + message(FATAL_ERROR "Initial build of mocPlugin failed. Output: ${output}") +endif() + +# Get names of the output binaries +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) + +# To avoid a race condition where the library has the same timestamp +# as a source file and therefore gets rebuild +# - sleep to ensure a timestamp change +# - rebuild library to ensure it has a new timestamp +sleep() +message(STATUS "Rebuilding library files to ensure new timestamps") +rebuild(1) + + +# - Ensure that the timestamp will change. +# - Change the json files referenced by Q_PLUGIN_METADATA +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing json files.") +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") +sleep() +rebuild(2) +acquire_timestamps(After) +# Test changes +require_change_not(A) +require_change_not(B) +require_change(C) +require_change(D) +# There's a bug in Ninja on Windows: +# https://gitlab.kitware.com/cmake/cmake/issues/16776 +if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) + require_change(E) +endif() + + +# - Ensure that the timestamp will change. +# - Change the json files referenced by A_CUSTOM_MACRO +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing json files") +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") +sleep() +rebuild(3) +acquire_timestamps(After) +# Test changes +require_change_not(A) +require_change_not(B) +require_change(C) +require_change(D) +# There's a bug in Ninja on Windows +# https://gitlab.kitware.com/cmake/cmake/issues/16776 +if(NOT ("${CMAKE_GENERATOR}" MATCHES "Ninja")) + require_change(E) +endif() diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt new file mode 100644 index 000000000..506828976 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) +project(MocPlugin) +include("../../AutogenGuiTest.cmake") + +if (QT_TEST_VERSION LESS 5) + message(SEND_ERROR "Qt 5 or higher required.") +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 000000000..b5e87533c --- /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 000000000..35158a4b0 --- /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 000000000..cc3395369 --- /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 000000000..cc3395369 --- /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 000000000..17d440035 --- /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 000000000..15b79c598 --- /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 000000000..37e756487 --- /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 000000000..b0a41150b --- /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 000000000..7e4b121fc --- /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 000000000..9696aaa26 --- /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 000000000..344831969 --- /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 000000000..a0690343d --- /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 000000000..f9734db4d --- /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 000000000..53a4284ee --- /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 000000000..cd155dc0e --- /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 000000000..129cac41f --- /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 000000000..119aaa4b7 --- /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 000000000..732c547ab --- /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 000000000..5412c94f6 --- /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 000000000..3ba2ddc6d --- /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 000000000..4837a76b8 --- /dev/null +++ b/Tests/QtAutogen/RerunMocPlugin/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt new file mode 100644 index 000000000..33c01acbe --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.11.2) +project(RerunRccConfigChange) +include("../AutogenCoreTest.cmake") + +# Tests rcc rebuilding after a configuration change + +# 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(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccConfigChange") +set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccConfigChange") + +# Rebuild macro +macro(rebuild CFG) + message(STATUS "Rebuilding rccConfigChange in ${CFG} configuration.") + execute_process( + COMMAND "${CMAKE_COMMAND}" --build . --config "${CFG}" + WORKING_DIRECTORY "${rccDepBD}" + RESULT_VARIABLE result) + if (result) + message(FATAL_ERROR "${CFG} build of rccConfigChange failed.") + else() + message(STATUS "${CFG} build of rccConfigChange finished.") + endif() +endmacro() + +# Initial build +try_compile(RCC_DEPENDS + "${rccDepBD}" + "${rccDepSD}" + RccConfigChange + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(FATAL_ERROR "Initial build of rccConfigChange failed. Output: ${output}") +endif() + +# Rebuild: Release +rebuild(Release) + +# Rebuild: Debug +rebuild(Debug) diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt new file mode 100644 index 000000000..e2dd0ac38 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.11.2) +project(RccConfigChange) +include("../../AutogenCoreTest.cmake") + +# Enable AUTORCC for all targets +set(CMAKE_AUTORCC ON) + +# Initial resource files setup +configure_file(resGen/input1.txt.in resGen/input1.txt COPYONLY) +configure_file(resGen/input2.txt.in resGen/input2.txt COPYONLY) +configure_file(resGen.qrc.in resGen.qrc COPYONLY) + +# Generated qrc file with dependency +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resGen.qrc.in + COMMAND ${CMAKE_COMMAND} -E sleep 2 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/resGen.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc +) + +# Target that uses a plain .qrc file +add_executable(rccConfigChangePlain main.cpp resPlain.qrc) +target_link_libraries(rccConfigChangePlain ${QT_QTCORE_TARGET}) + +# Target that uses a GENERATED .qrc file +add_executable(rccConfigChangeGen main.cpp ${CMAKE_CURRENT_BINARY_DIR}/resGen.qrc ) +target_link_libraries(rccConfigChangeGen ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp new file mode 100644 index 000000000..766b7751b --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/main.cpp @@ -0,0 +1,5 @@ + +int main() +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in new file mode 100644 index 000000000..967477252 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen.qrc.in @@ -0,0 +1,6 @@ + + + resGen/input1.txt + resGen/input2.txt + + diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in new file mode 100644 index 000000000..4f24589b0 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input1.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in new file mode 100644 index 000000000..4f24589b0 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resGen/input2.txt.in @@ -0,0 +1 @@ +Generated resource input. diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc new file mode 100644 index 000000000..e448726a0 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain.qrc @@ -0,0 +1,6 @@ + + + resPlain/input1.txt + resPlain/input2.txt + + diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt new file mode 100644 index 000000000..03969c6a5 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input1.txt @@ -0,0 +1 @@ +Plain resource input. diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt new file mode 100644 index 000000000..03969c6a5 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/resPlain/input2.txt @@ -0,0 +1 @@ +Plain resource input. diff --git a/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp b/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp new file mode 100644 index 000000000..4837a76b8 --- /dev/null +++ b/Tests/QtAutogen/RerunRccConfigChange/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt new file mode 100644 index 000000000..1301550f2 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt @@ -0,0 +1,153 @@ +cmake_minimum_required(VERSION 3.10) +project(RerunRccDepends) +include("../AutogenCoreTest.cmake") + +# Tests rcc rebuilding when a resource file changes +# When a .qrc or a file listed in a .qrc file changes, +# the target must be rebuilt + +# Dummy executable to generate a clean target +add_executable(dummy dummy.cpp) + +# Utility variables +set(timeformat "%Y.%j.%H.%M%S") +set(rccDepSD "${CMAKE_CURRENT_SOURCE_DIR}/RccDepends") +set(rccDepBD "${CMAKE_CURRENT_BINARY_DIR}/RccDepends") + +# Utility macros +macro(sleep) + message(STATUS "Sleeping for a few seconds.") + execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep 1) +endmacro() + +macro(acquire_timestamps When) + file(TIMESTAMP "${rccDepBinPlain}" rdPlain${When} "${timeformat}") + file(TIMESTAMP "${rccDepBinGenerated}" rdGenerated${When} "${timeformat}") +endmacro() + +macro(rebuild buildName) + message(STATUS "Starting build ${buildName} of rccDepends.") + execute_process( + COMMAND "${CMAKE_COMMAND}" --build . + WORKING_DIRECTORY "${rccDepBD}" + RESULT_VARIABLE result) + if (result) + message(FATAL_ERROR "Build ${buildName} of rccDepends failed.") + else() + message(STATUS "Build ${buildName} of rccDepends finished.") + endif() +endmacro() + +macro(require_change type) + if (rd${type}After VERSION_GREATER rd${type}Before) + message(STATUS "As expected the ${type} .qrc file ${rccDepBin${type}} changed.") + else() + message(SEND_ERROR "Unexpectedly the ${type} .qrc file ${rccDepBin${type}} did not change!\nTimestamp pre: ${rd${type}Before}\nTimestamp aft: ${rd${type}After}\n") + endif() +endmacro() + +macro(require_change_not type) + if (rd${type}After VERSION_GREATER rd${type}Before) + message(SEND_ERROR "Unexpectedly the ${type} .qrc file ${rccDepBin${type}} changed!\nTimestamp pre: ${rd${type}Before}\nTimestamp aft: ${rd${type}After}\n") + else() + message(STATUS "As expected the ${type} .qrc file ${rccDepBin${type}} did not change.") + endif() +endmacro() + + +# Initial configuration +configure_file(${rccDepSD}/resPlainA.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenA.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) + +# Initial build +try_compile(RCC_DEPENDS + "${rccDepBD}" + "${rccDepSD}" + RccDepends + CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}" + "-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}" + "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}" + OUTPUT_VARIABLE output +) +if (NOT RCC_DEPENDS) + message(FATAL_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 rccDepBinGenerated) +message(STATUS "Target that uses a plain .qrc file is:\n ${rccDepBinPlain}") +message(STATUS "Target that uses a GENERATED .qrc file is:\n ${rccDepBinGenerated}") + +# To avoid a race condition where the binary has the same timestamp +# as a source file and therefore gets rebuild +# - sleep to ensure a timestamp change +# - touch binary to ensure it has a new timestamp +acquire_timestamps(Before) +sleep() +message(STATUS "Touching binary files to ensure new timestamps") +file(TOUCH_NOCREATE "${rccDepBinPlain}" "${rccDepBinGenerated}") +acquire_timestamps(After) +require_change(Plain) +require_change(Generated) + + +# - Ensure that the timestamp will change +# - Change a resource files listed in the .qrc file +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing a resource file listed in the .qrc file") +file(TOUCH "${rccDepBD}/resPlain/input.txt" "${rccDepBD}/resGen/input.txt") +sleep() +rebuild(2) +acquire_timestamps(After) +# - Test if timestamps changed +require_change(Plain) +require_change(Generated) + + +# - Ensure that the timestamp will change +# - Change the .qrc file +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing the .qrc file") +configure_file(${rccDepSD}/resPlainB.qrc.in ${rccDepBD}/resPlain.qrc COPYONLY) +configure_file(${rccDepSD}/resGenB.qrc.in ${rccDepBD}/resGen.qrc.in COPYONLY) +sleep() +rebuild(3) +acquire_timestamps(After) +# - Test if timestamps changed +require_change(Plain) +require_change(Generated) + + +# - Ensure that the timestamp will change +# - Change a newly added resource files listed in the .qrc file +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing a newly added resource file listed in the .qrc file") +file(TOUCH "${rccDepBD}/resPlain/inputAdded.txt" "${rccDepBD}/resGen/inputAdded.txt") +sleep() +rebuild(4) +acquire_timestamps(After) +# - Test if timestamps changed +require_change(Plain) +require_change(Generated) + + +# - Ensure that the timestamp will change +# - Change nothing +# - Rebuild +acquire_timestamps(Before) +sleep() +message(STATUS "Changing nothing in the .qrc file") +rebuild(5) +acquire_timestamps(After) +# - Test if timestamps changed +require_change_not(Plain) +require_change_not(Generated) diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt new file mode 100644 index 000000000..150f849b3 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.10) +project(RccDepends) +include("../../AutogenCoreTest.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 000000000..766b7751b --- /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 000000000..4f24589b0 --- /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 000000000..4f24589b0 --- /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 000000000..c131a3460 --- /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 000000000..8c7e64311 --- /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 000000000..a5e407a17 --- /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 000000000..a5e407a17 --- /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 000000000..c135d85b5 --- /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 000000000..186b6535a --- /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 000000000..4837a76b8 --- /dev/null +++ b/Tests/QtAutogen/RerunRccDepends/dummy.cpp @@ -0,0 +1,5 @@ + +int main(int argv, char** args) +{ + return 0; +} diff --git a/Tests/QtAutogen/SameName/CMakeLists.txt b/Tests/QtAutogen/SameName/CMakeLists.txt new file mode 100644 index 000000000..0a80d5eee --- /dev/null +++ b/Tests/QtAutogen/SameName/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.10) +project(SameName) +include("../AutogenGuiTest.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 + object.h + object.h++ + object.hpp + object.hxx + 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 EQUAL 4) + set(rccCompress "-compress") +else() + set(rccCompress "--compress") +endif() +set_target_properties(sameName PROPERTIES AUTORCC_OPTIONS "${rccCompress};1" ) +set_source_files_properties(aaa/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};2" ) +set_source_files_properties(bbb/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};3" ) +set_source_files_properties(ccc/data.qrc PROPERTIES AUTORCC_OPTIONS "${rccCompress};4" ) diff --git a/Tests/QtAutogen/SameName/aaa/bbb/data.qrc b/Tests/QtAutogen/SameName/aaa/bbb/data.qrc new file mode 100644 index 000000000..0ea353756 --- /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 000000000..850206f6b --- /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 000000000..085504385 --- /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 000000000..379af60c8 --- /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 000000000..e35d3d128 --- /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 000000000..875f72fdb --- /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 000000000..0f0998006 --- /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 000000000..da980091a --- /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 000000000..7ad01c3ef --- /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 000000000..be07ca84c --- /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 000000000..5b080f5fa --- /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 000000000..9ef128ed0 --- /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 000000000..d39a9d711 --- /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 000000000..a8f506e88 --- /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 000000000..f934c39b9 --- /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 000000000..ab8a2817b --- /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 000000000..20d9dd978 --- /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 000000000..7989c6973 --- /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 000000000..4ce0b4ec1 --- /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 000000000..3d1fbe7cf --- /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 000000000..75e83f483 --- /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 000000000..92f15cd5f --- /dev/null +++ b/Tests/QtAutogen/SameName/main.cpp @@ -0,0 +1,27 @@ +#include "aaa/bbb/item.hpp" +#include "aaa/item.hpp" +#include "bbb/aaa/item.hpp" +#include "bbb/item.hpp" +#include "ccc/item.hpp" +#include "item.hpp" +#include "object.h" +#include "object.h++" +#include "object.hpp" +#include "object.hxx" + +int main(int argv, char** args) +{ + // Item instances + ::Item item; + ::aaa::Item aaa_item; + ::aaa::bbb::Item aaa_bbb_item; + ::bbb::Item bbb_item; + ::bbb::aaa::Item bbb_aaa_item; + ::ccc::Item ccc_item; + // Object instances + ::Object_h obj_h; + ::Object_hplpl obj_hplpl; + ::Object_hpp obj_hpp; + ::Object_hxx obj_hxx; + return 0; +} diff --git a/Tests/QtAutogen/SameName/object.h b/Tests/QtAutogen/SameName/object.h new file mode 100644 index 000000000..86620941a --- /dev/null +++ b/Tests/QtAutogen/SameName/object.h @@ -0,0 +1,13 @@ +#ifndef OBJECT_H +#define OBJECT_H + +#include + +class Object_h : public QObject +{ + Q_OBJECT + Q_SLOT + void go(){}; +}; + +#endif diff --git a/Tests/QtAutogen/SameName/object.h++ b/Tests/QtAutogen/SameName/object.h++ new file mode 100644 index 000000000..64222b7ec --- /dev/null +++ b/Tests/QtAutogen/SameName/object.h++ @@ -0,0 +1,13 @@ +#ifndef OBJECT_HPLPL +#define OBJECT_HPLPL + +#include + +class Object_hplpl : public QObject +{ + Q_OBJECT + Q_SLOT + void go(){}; +}; + +#endif diff --git a/Tests/QtAutogen/SameName/object.hpp b/Tests/QtAutogen/SameName/object.hpp new file mode 100644 index 000000000..035050ec7 --- /dev/null +++ b/Tests/QtAutogen/SameName/object.hpp @@ -0,0 +1,13 @@ +#ifndef OBJECT_HPP +#define OBJECT_HPP + +#include + +class Object_hpp : public QObject +{ + Q_OBJECT + Q_SLOT + void go(){}; +}; + +#endif diff --git a/Tests/QtAutogen/SameName/object.hxx b/Tests/QtAutogen/SameName/object.hxx new file mode 100644 index 000000000..c3c050f13 --- /dev/null +++ b/Tests/QtAutogen/SameName/object.hxx @@ -0,0 +1,13 @@ +#ifndef OBJECT_HXX +#define OBJECT_HXX + +#include + +class Object_hxx : public QObject +{ + Q_OBJECT + Q_SLOT + void go(){}; +}; + +#endif diff --git a/Tests/QtAutogen/SameName/view.ui b/Tests/QtAutogen/SameName/view.ui new file mode 100644 index 000000000..2ffe7344c --- /dev/null +++ b/Tests/QtAutogen/SameName/view.ui @@ -0,0 +1,24 @@ + + + View + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt new file mode 100644 index 000000000..f3536ba2c --- /dev/null +++ b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.10) +project(StaticLibraryCycle) +include("../AutogenCoreTest.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 000000000..faa52e610 --- /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 000000000..f24398e5e --- /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 000000000..a807d89cf --- /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 000000000..ededbd803 --- /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 000000000..7d427c234 --- /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 000000000..20f3725e9 --- /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 000000000..f5b7fd227 --- /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/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake new file mode 100644 index 000000000..0e2718807 --- /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 _isMultiConfig) # Set in Tests/CMakeLists.txt + list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_BUILD_TYPE=$") +endif() +list(APPEND Autogen_BUILD_OPTIONS + "-DCMAKE_AUTOGEN_VERBOSE=1" + "-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(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) + # 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 EQUAL 4) + 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(QT_TEST_ALLOW_QT_MACROS FALSE) + endif() +endif() diff --git a/Tests/QtAutogen/Tests.cmake b/Tests/QtAutogen/Tests.cmake new file mode 100644 index 000000000..6771828e6 --- /dev/null +++ b/Tests/QtAutogen/Tests.cmake @@ -0,0 +1,48 @@ +# Qt4 and Qt5 tests +ADD_AUTOGEN_TEST(AutogenOriginDependsOff autogenOriginDependsOff) +ADD_AUTOGEN_TEST(AutogenOriginDependsOn) +ADD_AUTOGEN_TEST(AutogenTargetDepends) +ADD_AUTOGEN_TEST(Complex QtAutogen) +ADD_AUTOGEN_TEST(GlobalAutogenTarget) +ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion) +ADD_AUTOGEN_TEST(ManySources manySources) +ADD_AUTOGEN_TEST(MocOnly mocOnly) +ADD_AUTOGEN_TEST(MocOptions mocOptions) +ADD_AUTOGEN_TEST(ObjectLibrary someProgram) +ADD_AUTOGEN_TEST(Parallel parallel) +ADD_AUTOGEN_TEST(Parallel1 parallel1) +ADD_AUTOGEN_TEST(Parallel2 parallel2) +ADD_AUTOGEN_TEST(Parallel3 parallel3) +ADD_AUTOGEN_TEST(Parallel4 parallel4) +ADD_AUTOGEN_TEST(ParallelAUTO parallelAUTO) +ADD_AUTOGEN_TEST(RccEmpty rccEmpty) +ADD_AUTOGEN_TEST(RccOffMocLibrary) +ADD_AUTOGEN_TEST(RccOnly rccOnly) +ADD_AUTOGEN_TEST(RccSkipSource) +ADD_AUTOGEN_TEST(RerunMocBasic) +ADD_AUTOGEN_TEST(RerunRccConfigChange) +ADD_AUTOGEN_TEST(RerunRccDepends) +ADD_AUTOGEN_TEST(SameName sameName) +ADD_AUTOGEN_TEST(StaticLibraryCycle slc) +ADD_AUTOGEN_TEST(UicInclude uicInclude) +ADD_AUTOGEN_TEST(UicInterface QtAutoUicInterface) +ADD_AUTOGEN_TEST(UicNoGui uicNoGui) +ADD_AUTOGEN_TEST(UicOnly uicOnly) +ADD_AUTOGEN_TEST(UicSkipSource) + +if(QT_TEST_ALLOW_QT_MACROS) + ADD_AUTOGEN_TEST(MocCMP0071) + ADD_AUTOGEN_TEST(MocIncludeRelaxed mocIncludeRelaxed) + ADD_AUTOGEN_TEST(MocIncludeStrict mocIncludeStrict) + ADD_AUTOGEN_TEST(MocSkipSource) +endif() + +# Qt5 only tests +if(QT_TEST_VERSION GREATER 4) + ADD_AUTOGEN_TEST(MocMacroName mocMacroName) + ADD_AUTOGEN_TEST(MocOsMacros) + ADD_AUTOGEN_TEST(RerunMocPlugin) + if(APPLE) + ADD_AUTOGEN_TEST(MacOsFW) + endif() +endif() diff --git a/Tests/QtAutogen/UicInclude/CMakeLists.txt b/Tests/QtAutogen/UicInclude/CMakeLists.txt new file mode 100644 index 000000000..929868b52 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.10) +project(UicInclude) +include("../AutogenGuiTest.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 000000000..bb2fb5e6a --- /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 000000000..daab86839 --- /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 000000000..dd8180292 --- /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 000000000..fa6dfa615 --- /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 000000000..2225150b5 --- /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 000000000..873016ec8 --- /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 000000000..c8e760962 --- /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 000000000..58ddc261f --- /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 000000000..0268326b9 --- /dev/null +++ b/Tests/QtAutogen/UicInclude/subC/PageCsub.ui @@ -0,0 +1,24 @@ + + + PageCsub + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicInterface/CMakeLists.txt b/Tests/QtAutogen/UicInterface/CMakeLists.txt new file mode 100644 index 000000000..e0227645b --- /dev/null +++ b/Tests/QtAutogen/UicInterface/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.10) +project(UicInterface) +include("../AutogenGuiTest.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(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(_isMultiConfig) +set(INC_DIR "include_$" ) +else() +set(INC_DIR "include" ) +endif() + +add_library(LibWidget libwidget.cpp) +target_link_libraries(LibWidget KI18n ${QT_LIBRARIES}) +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_LIBRARIES}) + +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 000000000..b629cd176 --- /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 000000000..6129599dc --- /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 000000000..008c22a96 --- /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 000000000..a7ad14f62 --- /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 000000000..897371e4a --- /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 000000000..68bd84363 --- /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 000000000..7cf1a1318 --- /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 000000000..1d31ce7a7 --- /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 000000000..b2b9cc592 --- /dev/null +++ b/Tests/QtAutogen/UicInterface/mywidget.ui @@ -0,0 +1,32 @@ + + + MyWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + 110 + 40 + 81 + 23 + + + + Special button + + + + + + diff --git a/Tests/QtAutogen/UicNoGui/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/CMakeLists.txt new file mode 100644 index 000000000..076299db1 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.13) +project(UicNoGui) +include("../AutogenCoreTest.cmake") + +# This tests creates a target that has AUTOUIC enabled but does not +# link against QtXWidgets. + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +add_subdirectory(MocOnly) +add_subdirectory(NoQt) + +add_executable(uicNoGui main.cpp) +target_link_libraries(uicNoGui mocOnly noQt) diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt new file mode 100644 index 000000000..4fcd75fa0 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/MocOnly/CMakeLists.txt @@ -0,0 +1,3 @@ +# Library uses QtCore only (no Widgets) +add_library(mocOnly main.cpp) +target_link_libraries(mocOnly ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp new file mode 100644 index 000000000..3091845ef --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/MocOnly/main.cpp @@ -0,0 +1,15 @@ +#include + +class LocalObject : public QObject +{ + Q_OBJECT +public: + LocalObject(){}; +}; + +void mocOnly() +{ + LocalObject obj; +} + +#include "main.moc" diff --git a/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt new file mode 100644 index 000000000..f2bf3eec1 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/NoQt/CMakeLists.txt @@ -0,0 +1,2 @@ +# Library doesn't use or link against Qt at all +add_library(noQt main.cpp) diff --git a/Tests/QtAutogen/UicNoGui/NoQt/main.cpp b/Tests/QtAutogen/UicNoGui/NoQt/main.cpp new file mode 100644 index 000000000..0052cc864 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/NoQt/main.cpp @@ -0,0 +1,4 @@ + +void noQt() +{ +} diff --git a/Tests/QtAutogen/UicNoGui/main.cpp b/Tests/QtAutogen/UicNoGui/main.cpp new file mode 100644 index 000000000..e90c60aa5 --- /dev/null +++ b/Tests/QtAutogen/UicNoGui/main.cpp @@ -0,0 +1,9 @@ +extern void mocOnly(); +extern void noQt(); + +int main(int argc, char* argv[]) +{ + mocOnly(); + noQt(); + return 0; +} diff --git a/Tests/QtAutogen/UicOnly/CMakeLists.txt b/Tests/QtAutogen/UicOnly/CMakeLists.txt new file mode 100644 index 000000000..b16325438 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) +project(UicOnly) +include("../AutogenGuiTest.cmake") + +# Test AUTOUIC being enabled only +add_executable(uicOnly main.cpp UicOnly.cpp) +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 000000000..8eee6d213 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/UicOnly.cpp @@ -0,0 +1,18 @@ +#include "ui_uiC.h" +#include "ui_uiD.h" +// AUTOUIC includes on the first two lines of a source file +#include "UicOnly.hpp" + +UicOnly::UicOnly() + : uiA(new Ui::UiA) + , uiB(new Ui::UiB) +{ + Ui::UiC uiC; + Ui::UiD uiD; +} + +UicOnly::~UicOnly() +{ + delete uiB; + delete uiA; +} diff --git a/Tests/QtAutogen/UicOnly/UicOnly.hpp b/Tests/QtAutogen/UicOnly/UicOnly.hpp new file mode 100644 index 000000000..24e1e0b94 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/UicOnly.hpp @@ -0,0 +1,15 @@ +#include "ui_uiA.h" +#include "ui_uiB.h" +// AUTOUIC includes on the first two lines of a header file +#include + +class UicOnly : public QObject +{ +public: + UicOnly(); + ~UicOnly(); + +private: + Ui::UiA* uiA; + Ui::UiB* uiB; +}; diff --git a/Tests/QtAutogen/UicOnly/main.cpp b/Tests/QtAutogen/UicOnly/main.cpp new file mode 100644 index 000000000..bdd242ec2 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/main.cpp @@ -0,0 +1,7 @@ +#include "UicOnly.hpp" + +int main(int argc, char* argv[]) +{ + UicOnly uicOnly; + return 0; +} diff --git a/Tests/QtAutogen/UicOnly/uiA.ui b/Tests/QtAutogen/UicOnly/uiA.ui new file mode 100644 index 000000000..4c5762e82 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiA.ui @@ -0,0 +1,24 @@ + + + UiA + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicOnly/uiB.ui b/Tests/QtAutogen/UicOnly/uiB.ui new file mode 100644 index 000000000..6ca77dec3 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiB.ui @@ -0,0 +1,24 @@ + + + UiB + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicOnly/uiC.ui b/Tests/QtAutogen/UicOnly/uiC.ui new file mode 100644 index 000000000..6802550cb --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiC.ui @@ -0,0 +1,24 @@ + + + UiC + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicOnly/uiD.ui b/Tests/QtAutogen/UicOnly/uiD.ui new file mode 100644 index 000000000..aad79cf7f --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiD.ui @@ -0,0 +1,24 @@ + + + UiD + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + diff --git a/Tests/QtAutogen/UicSkipSource/CMakeLists.txt b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt new file mode 100644 index 000000000..dc3b7d4eb --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(UicSkipSource) +include("../AutogenGuiTest.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 000000000..c4a7ce95b --- /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 000000000..d2a55a6f1 --- /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 000000000..3669f0e5b --- /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 000000000..f591a42ba --- /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 000000000..286469598 --- /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 000000000..8c1c3241c --- /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 000000000..7c381938c --- /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 000000000..a7be52bce --- /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 000000000..4e500a44d --- /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 000000000..fc7cb8219 --- /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 000000000..01f08d2ef --- /dev/null +++ b/Tests/QtAutogen/UicSkipSource/uigen2.ui @@ -0,0 +1,24 @@ + + + UiGen2 + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + -- cgit v1.2.3