From 2999c40dd911a59b438bd5f400521ab5007d83d8 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 23 Dec 2020 14:35:51 +0100 Subject: Extend QtAutogen/RerunMoc Test that removing / adding a Q_OBJECT macro doesn't break incremental builds. This was initially done to test the fix for #21620, but the test passes without the fix. The reason is that test1.h is included by main.cpp, which contains a Q_OBJECT macro, meaning that test1.h is in AutoMoc's dependencies transitively. --- Tests/QtAutogen/RerunMocBasic/CMakeLists.txt | 26 ++++++++++++++++++++++ Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in | 6 +++++ 2 files changed, 32 insertions(+) create mode 100644 Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt index a4179b7..72c99d5 100644 --- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt +++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt @@ -118,3 +118,29 @@ message(STATUS "Changing nothing for no MOC re-run") rebuild(3) acquire_timestamp(After) require_change_not() + + +# - Ensure that the timestamp will change +# - Remove Q_OBJECT from header +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Remove Q_OBJECT from header file for a MOC re-run") +configure_file("${mocBasicSrcDir}/test1c.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +sleep() +rebuild(4) +acquire_timestamp(After) +require_change() + + +# - Ensure that the timestamp will change +# - Add Q_OBJECT to header again +# - Rebuild +acquire_timestamp(Before) +sleep() +message(STATUS "Add Q_OBJECT to header file for a MOC re-run") +configure_file("${mocBasicSrcDir}/test1a.h.in" "${mocBasicBinDir}/test1.h" COPYONLY) +sleep() +rebuild(5) +acquire_timestamp(After) +require_change() diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in new file mode 100644 index 0000000..d0b9868 --- /dev/null +++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in @@ -0,0 +1,6 @@ +#include +class Test1 +{ +public: + void onTst1() {} +}; -- cgit v0.12