Sfoglia il codice sorgente

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.
Joerg Bornemann 4 anni fa
parent
commit
2999c40dd9

+ 26 - 0
Tests/QtAutogen/RerunMocBasic/CMakeLists.txt

@@ -118,3 +118,29 @@ message(STATUS "Changing nothing for no MOC re-run")
 rebuild(3)
 rebuild(3)
 acquire_timestamp(After)
 acquire_timestamp(After)
 require_change_not()
 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()

+ 6 - 0
Tests/QtAutogen/RerunMocBasic/MocBasic/test1c.h.in

@@ -0,0 +1,6 @@
+#include <QObject>
+class Test1
+{
+public:
+  void onTst1() {}
+};